diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 2ec4cb652f..d41e2d5221 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -55,7 +55,7 @@ module Hbc end def full_name - return token if tap == Hbc.default_tap + return token if tap == Tap.default_cask_tap qualified_token end diff --git a/Library/Homebrew/cask/lib/hbc/cask_loader.rb b/Library/Homebrew/cask/lib/hbc/cask_loader.rb index cf8f089df5..1c41a80691 100644 --- a/Library/Homebrew/cask/lib/hbc/cask_loader.rb +++ b/Library/Homebrew/cask/lib/hbc/cask_loader.rb @@ -207,7 +207,7 @@ module Hbc end def self.default_path(token) - Hbc.default_tap.cask_dir/"#{token.to_s.downcase}.rb" + Tap.default_cask_tap.cask_dir/"#{token.to_s.downcase}.rb" end def self.tap_paths(token) diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 6410af5aeb..57cec17469 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -163,7 +163,7 @@ module Hbc MacOS.full_version = ENV["MACOS_VERSION"] unless ENV["MACOS_VERSION"].nil? - Hbc.default_tap.install unless Hbc.default_tap.installed? + Tap.default_cask_tap.install unless Tap.default_cask_tap.installed? Hbc.init if self.class.should_init?(command) self.class.run_command(command, *args) rescue CaskError, ArgumentError, OptionParser::InvalidOption => e diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index f3d95f601d..e60103d290 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -83,13 +83,11 @@ module Hbc end def check_taps + default_tap = Tap.default_cask_tap + alt_taps = Tap.select { |t| t.cask_dir.exist? && t != default_tap } + ohai "Homebrew-Cask Taps:" - - default_tap = [Hbc.default_tap] - - alt_taps = Tap.select { |t| t.cask_dir.exist? && t != Hbc.default_tap } - - (default_tap + alt_taps).each do |tap| + [default_tap, *alt_taps].each do |tap| if tap.path.nil? || tap.path.to_s.empty? puts none_string else @@ -175,7 +173,7 @@ module Hbc end def self.alt_taps - Tap.select { |t| t.cask_dir.exist? && t != Hbc.default_tap } + Tap.select { |t| t.cask_dir.exist? && t != Tap.default_cask_tap } end def self.cask_count_for_tap(tap) diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb index cbfecb7993..9a910f8e8b 100644 --- a/Library/Homebrew/cask/lib/hbc/locations.rb +++ b/Library/Homebrew/cask/lib/hbc/locations.rb @@ -6,11 +6,6 @@ module Hbc end module ClassMethods - attr_writer :default_tap - - def default_tap - @default_tap ||= Tap.fetch("homebrew", "homebrew-cask") - end end end end diff --git a/Library/Homebrew/cask/lib/hbc/version.rb b/Library/Homebrew/cask/lib/hbc/version.rb index 9330999309..370d37be41 100644 --- a/Library/Homebrew/cask/lib/hbc/version.rb +++ b/Library/Homebrew/cask/lib/hbc/version.rb @@ -3,7 +3,7 @@ module Hbc @full_version ||= begin <<~EOS Homebrew-Cask #{HOMEBREW_VERSION} - #{Hbc.default_tap.full_name} #{Hbc.default_tap.version_string} + #{Tap.default_cask_tap.full_name} #{Tap.default_cask_tap.version_string} EOS end end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index fa167c5a89..a6f7c4044f 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -46,6 +46,10 @@ class Tap nil end + def self.default_cask_tap + @default_cask_tap ||= fetch("Homebrew", "cask") + end + extend Enumerable # The user name of this {Tap}. Usually, it's the Github username of diff --git a/Library/Homebrew/test/cask/cask_spec.rb b/Library/Homebrew/test/cask/cask_spec.rb index d97186f4dc..7c0c0c97d3 100644 --- a/Library/Homebrew/test/cask/cask_spec.rb +++ b/Library/Homebrew/test/cask/cask_spec.rb @@ -22,7 +22,7 @@ describe Hbc::Cask, :cask do end describe "load" do - let(:tap_path) { Hbc.default_tap.path } + let(:tap_path) { Tap.default_cask_tap.path } let(:file_dirname) { Pathname.new(__FILE__).dirname } let(:relative_tap_path) { tap_path.relative_path_from(file_dirname) } diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index 392f197256..62e682966b 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -25,7 +25,7 @@ RSpec.shared_context "Homebrew-Cask" do [Hbc::Config.global.binarydir, Hbc::Caskroom.path, Hbc::Cache.path].each(&:mkpath) - Hbc.default_tap.tap do |tap| + Tap.default_cask_tap.tap do |tap| FileUtils.mkdir_p tap.path.dirname FileUtils.ln_sf TEST_FIXTURE_DIR.join("cask"), tap.path end @@ -39,7 +39,7 @@ RSpec.shared_context "Homebrew-Cask" do ensure FileUtils.rm_rf HOMEBREW_CASK_DIRS.values FileUtils.rm_rf [Hbc::Config.global.binarydir, Hbc::Caskroom.path, Hbc::Cache.path] - Hbc.default_tap.path.unlink + Tap.default_cask_tap.path.unlink third_party_tap.path.unlink FileUtils.rm_rf third_party_tap.path.parent end