Class: Cask::Info Private
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Class Method Summary collapse
-
.artifact_info(cask) ⇒ Object
private
-
.desc_info(cask) ⇒ Object
private
-
.get_info(cask) ⇒ Object
private
-
.info(cask) ⇒ Object
private
-
.installation_info(cask) ⇒ Object
private
-
.language_info(cask) ⇒ Object
private
-
.name_info(cask) ⇒ Object
private
-
.repo_info(cask) ⇒ Object
private
-
.title_info(cask) ⇒ Object
private
Class Method Details
.artifact_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
87 88 89 90 91 92 93 94 95 96 |
# File 'cask/info.rb', line 87 def self.artifact_info(cask) artifact_output = ohai_title("Artifacts").dup cask.artifacts.each do |artifact| next unless artifact.respond_to?(:install_phase) next unless DSL::ORDINARY_ARTIFACT_CLASSES.include?(artifact.class) artifact_output << "\n" << artifact.to_s end artifact_output.freeze end |
.desc_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
59 60 61 62 63 64 |
# File 'cask/info.rb', line 59 def self.desc_info(cask) <<~EOS #{ohai_title("Description")} #{cask.desc.nil? ? Formatter.error("None") : cask.desc} EOS end |
.get_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'cask/info.rb', line 10 def self.get_info(cask) require "cask/installer" output = +"#{title_info(cask)}\n" output << "#{Formatter.url(cask.homepage)}\n" if cask.homepage output << installation_info(cask) repo = repo_info(cask) output << "#{repo}\n" if repo output << name_info(cask) output << desc_info(cask) language = language_info(cask) output << language if language output << "#{artifact_info(cask)}\n" caveats = Installer.caveats(cask) output << caveats if caveats output end |
.info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
28 29 30 31 |
# File 'cask/info.rb', line 28 def self.info(cask) puts get_info(cask) ::Utils::Analytics.cask_output(cask, args: Homebrew::CLI::Args.new) end |
.installation_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'cask/info.rb', line 39 def self.installation_info(cask) return "Not installed\n" unless cask.installed? versioned_staged_path = cask.caskroom_path.join(cask.installed_version) path_details = if versioned_staged_path.exist? versioned_staged_path.abv else Formatter.error("does not exist") end "#{versioned_staged_path} (#{path_details})\n" end |
.language_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
66 67 68 69 70 71 72 73 |
# File 'cask/info.rb', line 66 def self.language_info(cask) return if cask.languages.empty? <<~EOS #{ohai_title("Languages")} #{cask.languages.join(", ")} EOS end |
.name_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
52 53 54 55 56 57 |
# File 'cask/info.rb', line 52 def self.name_info(cask) <<~EOS #{ohai_title((cask.name.size > 1) ? "Names" : "Name")} #{cask.name.empty? ? Formatter.error("None") : cask.name.join("\n")} EOS end |
.repo_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'cask/info.rb', line 75 def self.repo_info(cask) return if cask.tap.nil? url = if cask.tap.custom_remote? && !cask.tap.remote.nil? cask.tap.remote else "#{cask.tap.default_remote}/blob/HEAD/#{cask.tap.relative_cask_path(cask.token)}" end "From: #{Formatter.url(url)}" end |
.title_info(cask) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
33 34 35 36 37 |
# File 'cask/info.rb', line 33 def self.title_info(cask) title = "#{oh1_title(cask.token)}: #{cask.version}" title += " (auto_updates)" if cask.auto_updates title end |