Class: Cask::List
Class Method Summary collapse
- .format_versioned(cask) ⇒ Object
- .list_artifacts(cask) ⇒ Object
- .list_casks(*casks, one: false, full_name: false, versions: false) ⇒ Object
Class Method Details
.format_versioned(cask) ⇒ Object
44 45 46 |
# File 'cask/list.rb', line 44 def self.format_versioned(cask) "#{cask}#{cask.installed_version&.prepend(" ")}" end |
.list_artifacts(cask) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'cask/list.rb', line 30 def self.list_artifacts(cask) cask.artifacts.group_by(&:class).sort_by { |klass, _| klass.english_name }.each do |klass, artifacts| next if [Artifact::Uninstall, Artifact::Zap].include? klass ohai klass.english_name artifacts.each do |artifact| puts artifact.summarize_installed if artifact.respond_to?(:summarize_installed) next if artifact.respond_to?(:summarize_installed) puts artifact end end end |
.list_casks(*casks, one: false, full_name: false, versions: false) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'cask/list.rb', line 8 def self.list_casks(*casks, one: false, full_name: false, versions: false) output = if casks.any? casks.each do |cask| raise CaskNotInstalledError, cask unless cask.installed? end else Caskroom.casks end if one puts output.map(&:to_s) elsif full_name puts output.map(&:full_name).sort(&tap_and_name_comparison) elsif versions puts output.map { format_versioned(_1) } elsif !output.empty? && casks.any? output.map { list_artifacts(_1) } elsif !output.empty? puts Formatter.columns(output.map(&:to_s)) end end |