Module: Homebrew::Bundle::CaskInstaller Private
- Defined in:
- bundle/cask_installer.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Class Method Summary collapse
- .cask_installed?(cask) ⇒ Boolean private
- .cask_installed_and_up_to_date?(cask, no_upgrade: false) ⇒ Boolean private
- .cask_upgradable?(cask) ⇒ Boolean private
- .install(name, preinstall: true, no_upgrade: false, verbose: false, force: false, **options) ⇒ Object private
- .installed_casks ⇒ Object private
- .outdated_casks ⇒ Object private
- .preinstall(name, no_upgrade: false, verbose: false, **options) ⇒ Object private
- .reset! ⇒ Object private
Class Method Details
.cask_installed?(cask) ⇒ Boolean
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.
90 91 92 |
# File 'bundle/cask_installer.rb', line 90 def self.cask_installed?(cask) installed_casks.include? cask end |
.cask_installed_and_up_to_date?(cask, no_upgrade: false) ⇒ Boolean
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.
83 84 85 86 87 88 |
# File 'bundle/cask_installer.rb', line 83 def self.cask_installed_and_up_to_date?(cask, no_upgrade: false) return false unless cask_installed?(cask) return true if no_upgrade !cask_upgradable?(cask) end |
.cask_upgradable?(cask) ⇒ Boolean
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.
94 95 96 |
# File 'bundle/cask_installer.rb', line 94 def self.cask_upgradable?(cask) outdated_casks.include? cask end |
.install(name, preinstall: true, no_upgrade: false, verbose: false, force: false, **options) ⇒ 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.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'bundle/cask_installer.rb', line 30 def self.install(name, preinstall: true, no_upgrade: false, verbose: false, force: false, **) return true unless preinstall full_name = .fetch(:full_name, name) install_result = if installed_casks.include?(name) && upgrading?(no_upgrade, name, ) status = "#{[:greedy] ? "may not be" : "not"} up-to-date" puts "Upgrading #{name} cask. It is installed but #{status}." if verbose Bundle.brew("upgrade", "--cask", full_name, verbose:) else args = .fetch(:args, []).filter_map do |k, v| case v when TrueClass "--#{k}" when FalseClass nil else "--#{k}=#{v}" end end args << "--force" if force args << "--adopt" unless args.include?("--force") args.uniq! with_args = " with #{args.join(" ")}" if args.present? puts "Installing #{name} cask#{with_args}. It is not currently installed." if verbose if Bundle.brew("install", "--cask", full_name, *args, verbose:) installed_casks << name true else false end end result = install_result if cask_installed?(name) postinstall_result = postinstall_change_state!(name:, options:, verbose:) result &&= postinstall_result end result end |
.installed_casks ⇒ 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.
98 99 100 101 |
# File 'bundle/cask_installer.rb', line 98 def self.installed_casks require "bundle/cask_dumper" @installed_casks ||= Homebrew::Bundle::CaskDumper.cask_names end |
.outdated_casks ⇒ 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.
103 104 105 106 |
# File 'bundle/cask_installer.rb', line 103 def self.outdated_casks require "bundle/cask_dumper" @outdated_casks ||= Homebrew::Bundle::CaskDumper.outdated_cask_names end |
.preinstall(name, no_upgrade: false, verbose: false, **options) ⇒ 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.
21 22 23 24 25 26 27 28 |
# File 'bundle/cask_installer.rb', line 21 def self.preinstall(name, no_upgrade: false, verbose: false, **) if installed_casks.include?(name) && !upgrading?(no_upgrade, name, ) puts "Skipping install of #{name} cask. It is already installed." if verbose return false end true end |
.reset! ⇒ 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.
7 8 9 10 |
# File 'bundle/cask_installer.rb', line 7 def self.reset! @installed_casks = nil @outdated_casks = nil end |