From 28f3dae8cd5bf975121090cb58262b8344a3917c Mon Sep 17 00:00:00 2001 From: Xu Cheng <xucheng@me.com> Date: Mon, 7 Mar 2016 18:04:25 +0800 Subject: [PATCH] rename CoreFormulaRepository to CoreTap Core tap will be separated from core code in the near future. It makes sense to rename it to CoreTap. --- Library/Homebrew/bottles.rb | 4 +- Library/Homebrew/cmd/audit.rb | 2 +- Library/Homebrew/cmd/install.rb | 1 - Library/Homebrew/cmd/pull.rb | 7 +- Library/Homebrew/cmd/readall.rb | 3 +- Library/Homebrew/cmd/tap-info.rb | 2 +- Library/Homebrew/cmd/tap-pin.rb | 2 +- Library/Homebrew/cmd/tap-unpin.rb | 2 +- Library/Homebrew/cmd/tap.rb | 1 - Library/Homebrew/cmd/test-bot.rb | 11 ++- Library/Homebrew/cmd/untap.rb | 2 +- Library/Homebrew/cmd/update-report.rb | 4 +- Library/Homebrew/core_formula_repository.rb | 86 ------------------ Library/Homebrew/formula.rb | 19 ++-- Library/Homebrew/formulary.rb | 7 +- Library/Homebrew/tap.rb | 90 ++++++++++++++++++- Library/Homebrew/test/test_formulary.rb | 6 +- .../Homebrew/test/test_integration_cmds.rb | 41 +++++---- Library/Homebrew/test/test_tap.rb | 10 +-- Library/Homebrew/test/test_update_report.rb | 2 +- 20 files changed, 146 insertions(+), 156 deletions(-) delete mode 100644 Library/Homebrew/core_formula_repository.rb diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 07e96e2104..b18fde4770 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -47,7 +47,7 @@ def bottle_resolve_formula_names(bottle_file) name = receipt_file_path.split("/").first tap = Tab.from_file_content(receipt_file, "#{bottle_file}/#{receipt_file_path}").tap - if tap.nil? || tap.core_formula_repository? + if tap.nil? || tap.core_tap? full_name = name else full_name = "#{tap}/#{name}" @@ -66,7 +66,7 @@ class Bintray end def self.repository(tap = nil) - if tap.nil? || tap.core_formula_repository? + if tap.nil? || tap.core_tap? "bottles" else "bottles-#{tap.repo}" diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index a3643e7a64..9eec5590f5 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -247,7 +247,7 @@ class FormulaAuditor return end - if oldname = CoreFormulaRepository.instance.formula_renames[name] + if oldname = CoreTap.instance.formula_renames[name] problem "'#{name}' is reserved as the old name of #{oldname}" return end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index c2ef9a3344..6745e92b00 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -3,7 +3,6 @@ require "diagnostic" require "cmd/search" require "formula_installer" require "tap" -require "core_formula_repository" require "hardware" module Homebrew diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb index 45c3bf76bd..ae762ca51c 100644 --- a/Library/Homebrew/cmd/pull.rb +++ b/Library/Homebrew/cmd/pull.rb @@ -23,7 +23,6 @@ require "utils" require "utils/json" require "formula" require "tap" -require "core_formula_repository" module Homebrew def pull @@ -41,11 +40,11 @@ module Homebrew if arg.to_i > 0 issue = arg url = "https://github.com/Homebrew/homebrew/pull/#{arg}" - tap = CoreFormulaRepository.instance + tap = CoreTap.instance elsif (testing_match = arg.match %r{brew.sh/job/Homebrew.*Testing/(\d+)/}) _, testing_job = *testing_match url = "https://github.com/Homebrew/homebrew/compare/master...BrewTestBot:testing-#{testing_job}" - tap = CoreFormulaRepository.instance + tap = CoreTap.instance odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle") elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX) _, user, repo, issue = *api_match @@ -167,7 +166,7 @@ module Homebrew url else bottle_branch = "pull-bottle-#{issue}" - if tap.core_formula_repository? + if tap.core_tap? "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}" else "https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}" diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 7775c29238..f006838eac 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -5,7 +5,6 @@ require "formula" require "tap" -require "core_formula_repository" require "thread" module Homebrew @@ -39,7 +38,7 @@ module Homebrew if ARGV.named.empty? formulae = Formula.files alias_dirs = Tap.map(&:alias_dir) - alias_dirs.unshift CoreFormulaRepository.instance.alias_dir + alias_dirs.unshift CoreTap.instance.alias_dir else tap = Tap.fetch(ARGV.named.first) raise TapUnavailableError, tap.name unless tap.installed? diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index 8139b49433..3d1a0c83d1 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -10,7 +10,7 @@ module Homebrew end end - raise "Homebrew/homebrew is not allowed" if taps.any?(&:core_formula_repository?) + raise "Homebrew/homebrew is not allowed" if taps.any?(&:core_tap?) if ARGV.json == "v1" print_tap_json(taps) diff --git a/Library/Homebrew/cmd/tap-pin.rb b/Library/Homebrew/cmd/tap-pin.rb index e906c700d4..7625f2642c 100644 --- a/Library/Homebrew/cmd/tap-pin.rb +++ b/Library/Homebrew/cmd/tap-pin.rb @@ -4,7 +4,7 @@ module Homebrew def tap_pin ARGV.named.each do |name| tap = Tap.fetch(name) - raise "Homebrew/homebrew is not allowed" if tap.core_formula_repository? + raise "Homebrew/homebrew is not allowed" if tap.core_tap? tap.pin ohai "Pinned #{tap.name}" end diff --git a/Library/Homebrew/cmd/tap-unpin.rb b/Library/Homebrew/cmd/tap-unpin.rb index e36a68ed03..5bf3bb1788 100644 --- a/Library/Homebrew/cmd/tap-unpin.rb +++ b/Library/Homebrew/cmd/tap-unpin.rb @@ -4,7 +4,7 @@ module Homebrew def tap_unpin ARGV.named.each do |name| tap = Tap.fetch(name) - raise "Homebrew/homebrew is not allowed" if tap.core_formula_repository? + raise "Homebrew/homebrew is not allowed" if tap.core_tap? tap.unpin ohai "Unpinned #{tap.name}" end diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index a755e5559d..99efc7aab5 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -1,5 +1,4 @@ require "tap" -require "core_formula_repository" module Homebrew def tap diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index 80c98dfa6e..b6fc301bdf 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -31,7 +31,6 @@ require "rexml/document" require "rexml/xmldecl" require "rexml/cdata" require "tap" -require "core_formula_repository" module Homebrew BYTES_IN_1_MEGABYTE = 1024*1024 @@ -62,7 +61,7 @@ module Homebrew end end - CoreFormulaRepository.instance + CoreTap.instance end class Step @@ -209,7 +208,7 @@ module Homebrew @added_formulae = [] @modified_formula = [] @steps = [] - @tap = options.fetch(:tap, CoreFormulaRepository.instance) + @tap = options.fetch(:tap, CoreTap.instance) @repository = @tap.path @skip_homebrew = options.fetch(:skip_homebrew, false) @@ -609,7 +608,7 @@ module Homebrew @category = __method__ return if @skip_homebrew test "brew", "tests" - if @tap.core_formula_repository? + if @tap.core_tap? tests_args = ["--no-compat"] readall_args = ["--aliases"] if RUBY_VERSION.split(".").first.to_i >= 2 @@ -767,7 +766,7 @@ module Homebrew safe_system "brew", "update" if pr - pull_pr = if tap.core_formula_repository? + pull_pr = if tap.core_tap? pr else "https://github.com/#{tap.user}/homebrew-#{tap.repo}/pull/#{pr}" @@ -779,7 +778,7 @@ module Homebrew bottle_args << "--keep-old" if ARGV.include? "--keep-old" system "brew", "bottle", *bottle_args - remote_repo = tap.core_formula_repository? ? "homebrew" : "homebrew-#{tap.repo}" + remote_repo = tap.core_tap? ? "homebrew" : "homebrew-#{tap.repo}" remote = "git@github.com:BrewTestBot/#{remote_repo}.git" tag = pr ? "pr-#{pr}" : "testing-#{number}" safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}" diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index 8f14258f31..52e1e9a18c 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -6,7 +6,7 @@ module Homebrew ARGV.named.each do |tapname| tap = Tap.fetch(tapname) - raise "Homebrew/homebrew is not allowed" if tap.core_formula_repository? + raise "Homebrew/homebrew is not allowed" if tap.core_tap? tap.uninstall end end diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 79eac4382f..d85b35cec0 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -12,7 +12,7 @@ module Homebrew hub = ReporterHub.new begin - master_reporter = Reporter.new(CoreFormulaRepository.instance) + master_reporter = Reporter.new(CoreTap.instance) rescue Reporter::ReporterRevisionUnsetError => e raise e if ARGV.homebrew_developer? odie "update-report should not be called directly!" @@ -125,7 +125,7 @@ class Reporter new_name = tap.formula_renames[old_name] next unless new_name - if tap.core_formula_repository? + if tap.core_tap? new_full_name = new_name else new_full_name = "#{tap}/#{new_name}" diff --git a/Library/Homebrew/core_formula_repository.rb b/Library/Homebrew/core_formula_repository.rb deleted file mode 100644 index 27b9db75cc..0000000000 --- a/Library/Homebrew/core_formula_repository.rb +++ /dev/null @@ -1,86 +0,0 @@ -require "tap" -require "tap_migrations" -require "formula_renames" - -# A specialized {Tap} class to mimic the core formula file system, which shares many -# similarities with normal {Tap}. -# TODO Separate core formulae with core codes. See discussion below for future plan: -# https://github.com/Homebrew/homebrew/pull/46735#discussion_r46820565 -class CoreFormulaRepository < Tap - # @private - def initialize - @user = "Homebrew" - @repo = "homebrew" - @name = "Homebrew/homebrew" - @path = HOMEBREW_REPOSITORY - end - - def self.instance - @instance ||= CoreFormulaRepository.new - end - - # @private - def uninstall - raise "Tap#uninstall is not available for CoreFormulaRepository" - end - - # @private - def pin - raise "Tap#pin is not available for CoreFormulaRepository" - end - - # @private - def unpin - raise "Tap#unpin is not available for CoreFormulaRepository" - end - - # @private - def pinned? - false - end - - # @private - def command_files - [] - end - - # @private - def custom_remote? - remote != "https://github.com/#{user}/#{repo}.git" - end - - # @private - def core_formula_repository? - true - end - - # @private - def formula_dir - HOMEBREW_LIBRARY/"Formula" - end - - # @private - def alias_dir - HOMEBREW_LIBRARY/"Aliases" - end - - # @private - def formula_renames - FORMULA_RENAMES - end - - # @private - def tap_migrations - TAP_MIGRATIONS - end - - # @private - def formula_file_to_name(file) - file.basename(".rb").to_s - end - - # @private - def alias_file_to_name(file) - file.basename.to_s - end -end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index c3d319d8f0..c2363fcde2 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -10,7 +10,6 @@ require "software_spec" require "install_renamed" require "pkg_version" require "tap" -require "core_formula_repository" require "keg" require "migrator" @@ -142,7 +141,7 @@ class Formula @revision = self.class.revision || 0 if path == Formulary.core_path(name) - @tap = CoreFormulaRepository.instance + @tap = CoreTap.instance @full_name = name elsif path.to_s =~ HOMEBREW_TAP_PATH_REGEX @tap = Tap.fetch($1, $2) @@ -1062,13 +1061,13 @@ class Formula # an array of all core {Formula} names # @private def self.core_names - CoreFormulaRepository.instance.formula_names + CoreTap.instance.formula_names end # an array of all core {Formula} files # @private def self.core_files - CoreFormulaRepository.instance.formula_files + CoreTap.instance.formula_files end # an array of all tap {Formula} names @@ -1141,13 +1140,13 @@ class Formula # an array of all alias files of core {Formula} # @private def self.core_alias_files - CoreFormulaRepository.instance.alias_files + CoreTap.instance.alias_files end # an array of all core aliases # @private def self.core_aliases - CoreFormulaRepository.instance.aliases + CoreTap.instance.aliases end # an array of all tap aliases @@ -1171,13 +1170,13 @@ class Formula # a table mapping core alias to formula name # @private def self.core_alias_table - CoreFormulaRepository.instance.alias_table + CoreTap.instance.alias_table end # a table mapping core formula name to aliases # @private def self.core_alias_reverse_table - CoreFormulaRepository.instance.alias_reverse_table + CoreTap.instance.alias_reverse_table end def self.[](name) @@ -1187,13 +1186,13 @@ class Formula # True if this formula is provided by Homebrew itself # @private def core_formula? - tap && tap.core_formula_repository? + tap && tap.core_tap? end # True if this formula is provided by external Tap # @private def tap? - tap && !tap.core_formula_repository? + tap && !tap.core_tap? end # @private diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index a2f1ad7a13..da70aed2f9 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -1,6 +1,5 @@ require "digest/md5" require "tap" -require "core_formula_repository" # The Formulary is responsible for creating instances of Formula. # It is not meant to be used directy from formulae. @@ -278,7 +277,7 @@ class Formulary return FormulaLoader.new(ref, formula_with_that_name) end - possible_alias = CoreFormulaRepository.instance.alias_dir/ref + possible_alias = CoreTap.instance.alias_dir/ref if possible_alias.file? return AliasLoader.new(possible_alias) end @@ -292,7 +291,7 @@ class Formulary return FormulaLoader.new(name, path) end - if newref = CoreFormulaRepository.instance.formula_renames[ref] + if newref = CoreTap.instance.formula_renames[ref] formula_with_that_oldname = core_path(newref) if formula_with_that_oldname.file? return FormulaLoader.new(newref, formula_with_that_oldname) @@ -321,7 +320,7 @@ class Formulary end def self.core_path(name) - CoreFormulaRepository.instance.formula_dir/"#{name.downcase}.rb" + CoreTap.instance.formula_dir/"#{name.downcase}.rb" end def self.tap_paths(name, taps = Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/"]) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 8958e3b11d..5883c779ca 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -1,4 +1,6 @@ require "extend/string" +require "tap_migrations" +require "formula_renames" # a {Tap} is used to extend the formulae provided by Homebrew core. # Usually, it's synced with a remote git repository. And it's likely @@ -31,8 +33,7 @@ class Tap repo = repo.strip_prefix "homebrew-" if user == "Homebrew" && repo == "homebrew" - require "core_formula_repository" - return CoreFormulaRepository.instance + return CoreTap.instance end cache_key = "#{user}/#{repo}".downcase @@ -159,7 +160,7 @@ class Tap end # @private - def core_formula_repository? + def core_tap? false end @@ -444,3 +445,86 @@ class Tap "#{name}/#{file.basename}" end end + +# A specialized {Tap} class to mimic the core formula file system, which shares many +# similarities with normal {Tap}. +# TODO Separate core formulae with core codes. See discussion below for future plan: +# https://github.com/Homebrew/homebrew/pull/46735#discussion_r46820565 +class CoreTap < Tap + # @private + def initialize + @user = "Homebrew" + @repo = "homebrew" + @name = "Homebrew/homebrew" + @path = HOMEBREW_REPOSITORY + end + + def self.instance + @instance ||= CoreTap.new + end + + # @private + def uninstall + raise "Tap#uninstall is not available for CoreTap" + end + + # @private + def pin + raise "Tap#pin is not available for CoreTap" + end + + # @private + def unpin + raise "Tap#unpin is not available for CoreTap" + end + + # @private + def pinned? + false + end + + # @private + def command_files + [] + end + + # @private + def custom_remote? + remote != "https://github.com/#{user}/#{repo}.git" + end + + # @private + def core_tap? + true + end + + # @private + def formula_dir + HOMEBREW_LIBRARY/"Formula" + end + + # @private + def alias_dir + HOMEBREW_LIBRARY/"Aliases" + end + + # @private + def formula_renames + FORMULA_RENAMES + end + + # @private + def tap_migrations + TAP_MIGRATIONS + end + + # @private + def formula_file_to_name(file) + file.basename(".rb").to_s + end + + # @private + def alias_file_to_name(file) + file.basename.to_s + end +end diff --git a/Library/Homebrew/test/test_formulary.rb b/Library/Homebrew/test/test_formulary.rb index f41bcde3ac..48f155fcb9 100644 --- a/Library/Homebrew/test/test_formulary.rb +++ b/Library/Homebrew/test/test_formulary.rb @@ -16,7 +16,7 @@ end class FormularyFactoryTest < Homebrew::TestCase def setup @name = "testball_bottle" - @path = CoreFormulaRepository.new.formula_dir/"#{@name}.rb" + @path = CoreTap.new.formula_dir/"#{@name}.rb" @bottle_dir = Pathname.new("#{File.expand_path("..", __FILE__)}/bottles") @bottle = @bottle_dir/"testball_bottle-0.1.#{bottle_tag}.bottle.tar.gz" @path.write <<-EOS.undent @@ -72,7 +72,7 @@ class FormularyFactoryTest < Homebrew::TestCase end def test_factory_from_alias - alias_dir = CoreFormulaRepository.instance.alias_dir + alias_dir = CoreTap.instance.alias_dir alias_dir.mkpath FileUtils.ln_s @path, alias_dir/"foo" assert_kind_of Formula, Formulary.factory("foo") @@ -144,7 +144,7 @@ end class FormularyTapPriorityTest < Homebrew::TestCase def setup @name = "foo" - @core_path = CoreFormulaRepository.new.formula_dir/"#{@name}.rb" + @core_path = CoreTap.new.formula_dir/"#{@name}.rb" @tap = Tap.new "homebrew", "foo" @tap_path = @tap.path/"#{@name}.rb" code = <<-EOS.undent diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 530c9aa13b..52606da080 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -1,6 +1,5 @@ require "bundler" require "testing_env" -require "core_formula_repository" require "fileutils" require "pathname" @@ -146,7 +145,7 @@ class IntegrationCommandTests < Homebrew::TestCase cmd("install", "--build-bottle", testball) assert_match "Formula not from core or any taps", cmd_fail("bottle", "--no-revision", testball) - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "https://example.com/testball-0.1.tar.gz" @@ -181,7 +180,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_readall - repo = CoreFormulaRepository.new + repo = CoreTap.new formula_file = repo.formula_dir/"foo.rb" formula_file.write <<-EOS.undent class Foo < Formula @@ -228,7 +227,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_missing - repo = CoreFormulaRepository.new + repo = CoreTap.new foo_file = repo.formula_dir/"foo.rb" foo_file.write <<-EOS.undent class Foo < Formula @@ -271,7 +270,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_cat - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" content = <<-EOS.undent class Testball < Formula url "https://example.com/testball-0.1.tar.gz" @@ -285,7 +284,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_desc - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula desc "Some test" @@ -300,7 +299,7 @@ class IntegrationCommandTests < Homebrew::TestCase def test_edit (HOMEBREW_REPOSITORY/".git").mkpath - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "https://example.com/testball-0.1.tar.gz" @@ -321,7 +320,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_info - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "https://example.com/testball-0.1.tar.gz" @@ -345,7 +344,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_unpack - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" @@ -363,7 +362,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_options - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" @@ -379,7 +378,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_outdated - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" @@ -394,7 +393,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_upgrade - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" @@ -422,7 +421,7 @@ class IntegrationCommandTests < Homebrew::TestCase apps_dir = Pathname.new(home).join("Applications") apps_dir.mkpath - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "https://example.com/testball-0.1.tar.gz" @@ -444,7 +443,7 @@ class IntegrationCommandTests < Homebrew::TestCase apps_dir = Pathname.new(home).join("Applications") apps_dir.mkpath - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "https://example.com/testball-0.1.tar.gz" @@ -465,7 +464,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_pin_unpin - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" @@ -494,7 +493,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_reinstall - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" @@ -545,7 +544,7 @@ class IntegrationCommandTests < Homebrew::TestCase url = "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" cmd("create", url, {"HOMEBREW_EDITOR" => "/bin/cat"}) - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" assert formula_file.exist?, "The formula source should have been created" assert_match %(sha256 "#{TESTBALL_SHA256}"), formula_file.read ensure @@ -554,7 +553,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_fetch - formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file.write <<-EOS.undent class Testball < Formula url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" @@ -571,7 +570,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_deps - formula_dir = CoreFormulaRepository.new.formula_dir + formula_dir = CoreTap.new.formula_dir formula_file1 = formula_dir/"testball1.rb" formula_file2 = formula_dir/"testball2.rb" formula_file3 = formula_dir/"testball3.rb" @@ -604,7 +603,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_uses - formula_dir = CoreFormulaRepository.new.formula_dir + formula_dir = CoreTap.new.formula_dir formula_file1 = formula_dir/"testball1.rb" formula_file2 = formula_dir/"testball2.rb" formula_file3 = formula_dir/"testball3.rb" @@ -648,7 +647,7 @@ class IntegrationCommandTests < Homebrew::TestCase end def test_leaves - formula_dir = CoreFormulaRepository.new.formula_dir + formula_dir = CoreTap.new.formula_dir formula_file1 = formula_dir/"testball1.rb" formula_file2 = formula_dir/"testball2.rb" formula_file1.write <<-EOS.undent diff --git a/Library/Homebrew/test/test_tap.rb b/Library/Homebrew/test/test_tap.rb index 6438e0808c..56c87de832 100644 --- a/Library/Homebrew/test/test_tap.rb +++ b/Library/Homebrew/test/test_tap.rb @@ -59,7 +59,7 @@ class TapTest < Homebrew::TestCase end def test_fetch - assert_kind_of CoreFormulaRepository, Tap.fetch("Homebrew", "homebrew") + assert_kind_of CoreTap, Tap.fetch("Homebrew", "homebrew") tap = Tap.fetch("Homebrew", "foo") assert_kind_of Tap, tap assert_equal "homebrew/foo", tap.name @@ -78,7 +78,7 @@ class TapTest < Homebrew::TestCase assert_equal @path, @tap.path assert_predicate @tap, :installed? assert_predicate @tap, :official? - refute_predicate @tap, :core_formula_repository? + refute_predicate @tap, :core_tap? end def test_issues_url @@ -204,11 +204,11 @@ class TapTest < Homebrew::TestCase end end -class CoreFormulaRepositoryTest < Homebrew::TestCase +class CoreTapTest < Homebrew::TestCase include FileUtils def setup - @repo = CoreFormulaRepository.new + @repo = CoreTap.new end def test_attributes @@ -219,7 +219,7 @@ class CoreFormulaRepositoryTest < Homebrew::TestCase assert_predicate @repo, :installed? refute_predicate @repo, :pinned? assert_predicate @repo, :official? - assert_predicate @repo, :core_formula_repository? + assert_predicate @repo, :core_tap? end def test_forbidden_operations diff --git a/Library/Homebrew/test/test_update_report.rb b/Library/Homebrew/test/test_update_report.rb index 1c96ba1055..cf6804b10a 100644 --- a/Library/Homebrew/test/test_update_report.rb +++ b/Library/Homebrew/test/test_update_report.rb @@ -24,7 +24,7 @@ class ReportTests < Homebrew::TestCase end def setup - @tap = CoreFormulaRepository.new + @tap = CoreTap.new @reporter = ReporterMock.new(@tap, "12345678", "abcdef12") @hub = ReporterHub.new end -- GitLab