Class: Homebrew::Cmd::Untap Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::Cmd::Untap
- Defined in:
- cmd/untap.rb,
sorbet/rbi/dsl/homebrew/cmd/untap.rbi
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.
Defined Under Namespace
Classes: Args
Instance Method Summary collapse
- #args ⇒ Homebrew::Cmd::Untap::Args private
-
#installed_casks_for(tap:) ⇒ Array<Cask::Cask>
private
All installed casks currently available in a tap by cask full name.
-
#installed_formulae_for(tap:) ⇒ Array<Formula>
private
All installed formulae currently available in a tap by formula full name.
- #run ⇒ void private
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::Cmd::Untap::Args
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 |
# File 'sorbet/rbi/dsl/homebrew/cmd/untap.rbi', line 10 def args; end |
#installed_casks_for(tap:) ⇒ Array<Cask::Cask>
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.
All installed casks currently available in a tap by cask full name.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'cmd/untap.rb', line 69 def installed_casks_for(tap:) tap.cask_tokens.filter_map do |cask_token| next unless installed_cask_tokens.include?(T.must(cask_token.split("/").last)) cask = begin Cask::CaskLoader.load(cask_token) rescue Cask::CaskUnavailableError # Don't blow up because of a single unavailable cask. next end cask if cask.installed? end end |
#installed_formulae_for(tap:) ⇒ Array<Formula>
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.
All installed formulae currently available in a tap by formula full name.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'cmd/untap.rb', line 50 def installed_formulae_for(tap:) tap.formula_names.filter_map do |formula_name| next unless installed_formulae_names.include?(T.must(formula_name.split("/").last)) formula = begin Formulary.factory(formula_name) rescue FormulaUnavailableError # Don't blow up because of a single unavailable formula. next end # Can't use Formula#any_version_installed? because it doesn't consider # taps correctly. formula if formula.installed_kegs.any? { |keg| keg.tab.tap == tap } end end |
#run ⇒ void
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.
This method returns an undefined value.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'cmd/untap.rb', line 20 def run args.named.to_installed_taps.each do |tap| odie "Untapping #{tap} is not allowed" if tap.core_tap? && Homebrew::EnvConfig.no_install_from_api? if Homebrew::EnvConfig.no_install_from_api? || (!tap.core_tap? && !tap.core_cask_tap?) installed_tap_formulae = installed_formulae_for(tap:) installed_tap_casks = installed_casks_for(tap:) if installed_tap_formulae.present? || installed_tap_casks.present? installed_names = (installed_tap_formulae + installed_tap_casks.map(&:token)).join("\n") if args.force? || Homebrew::EnvConfig.developer? opoo <<~EOS Untapping #{tap} even though it contains the following installed formulae or casks: #{installed_names} EOS else odie <<~EOS Refusing to untap #{tap} because it contains the following installed formulae or casks: #{installed_names} EOS end end end tap.uninstall manual: true end end |