diff --git a/Library/Homebrew/test/build_environment_spec.rb b/Library/Homebrew/test/build_environment_spec.rb index b073335a7e..51ae23af7e 100644 --- a/Library/Homebrew/test/build_environment_spec.rb +++ b/Library/Homebrew/test/build_environment_spec.rb @@ -30,11 +30,16 @@ describe BuildEnvironment do end describe BuildEnvironment::DSL do - subject(:build_environment_dsl) { double.extend(described_class) } + let(:build_environment_dsl) do + klass = described_class + Class.new do + extend(klass) + end + end context "with a single argument" do - before do - build_environment_dsl.instance_eval do + subject do + Class.new(build_environment_dsl) do env :std end end diff --git a/Library/Homebrew/test/cleaner_spec.rb b/Library/Homebrew/test/cleaner_spec.rb index a9c3d1f667..9e2c76e5f1 100644 --- a/Library/Homebrew/test/cleaner_spec.rb +++ b/Library/Homebrew/test/cleaner_spec.rb @@ -7,15 +7,15 @@ require "formula" describe Cleaner do include FileUtils - subject(:cleaner) { described_class.new(f) } - - let(:f) { formula("cleaner_test") { url "foo-1.0" } } - - before do - f.prefix.mkpath - end - describe "#clean" do + subject(:cleaner) { described_class.new(f) } + + let(:f) { formula("cleaner_test") { url "foo-1.0" } } + + before do + f.prefix.mkpath + end + it "cleans files" do f.bin.mkpath f.lib.mkpath @@ -159,45 +159,54 @@ describe Cleaner do end describe "::skip_clean" do + def stub_formula_skip_clean(skip_paths) + formula("cleaner_test") do + url "foo-1.0" + + skip_clean skip_paths + end + end + it "adds paths that should be skipped" do - f.class.skip_clean "bin" + f = stub_formula_skip_clean("bin") f.bin.mkpath - cleaner.clean + described_class.new(f).clean expect(f.bin).to be_a_directory end it "also skips empty sub-directories under the added paths" do - f.class.skip_clean "bin" + f = stub_formula_skip_clean("bin") subdir = f.bin/"subdir" subdir.mkpath - cleaner.clean + described_class.new(f).clean expect(f.bin).to be_a_directory expect(subdir).to be_a_directory end it "allows skipping broken symlinks" do - f.class.skip_clean "symlink" + f = stub_formula_skip_clean("symlink") + f.prefix.mkpath symlink = f.prefix/"symlink" ln_s "target", symlink - cleaner.clean + described_class.new(f).clean expect(symlink).to be_a_symlink end it "allows skipping symlinks pointing to an empty directory" do - f.class.skip_clean "c" + f = stub_formula_skip_clean("c") dir = f.prefix/"b" symlink = f.prefix/"c" dir.mkpath ln_s dir.basename, symlink - cleaner.clean + described_class.new(f).clean expect(dir).not_to exist expect(symlink).to be_a_symlink @@ -205,14 +214,14 @@ describe Cleaner do end it "allows skipping symlinks whose target was pruned before" do - f.class.skip_clean "a" + f = stub_formula_skip_clean("a") dir = f.prefix/"b" symlink = f.prefix/"a" dir.mkpath ln_s dir.basename, symlink - cleaner.clean + described_class.new(f).clean expect(dir).not_to exist expect(symlink).to be_a_symlink @@ -220,37 +229,40 @@ describe Cleaner do end it "allows skipping '.la' files" do + f = stub_formula_skip_clean(:la) + file = f.lib/"foo.la" - f.class.skip_clean :la f.lib.mkpath touch file - cleaner.clean + described_class.new(f).clean expect(file).to exist end it "allows skipping sub-directories" do + f = stub_formula_skip_clean("lib/subdir") + dir = f.lib/"subdir" - f.class.skip_clean "lib/subdir" dir.mkpath - cleaner.clean + described_class.new(f).clean expect(dir).to be_a_directory end it "allows skipping paths relative to prefix" do + f = stub_formula_skip_clean("bin/a") + dir1 = f.bin/"a" dir2 = f.lib/"bin/a" - f.class.skip_clean "bin/a" dir1.mkpath dir2.mkpath - cleaner.clean + described_class.new(f).clean expect(dir1).to exist expect(dir2).not_to exist diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 71f997c3df..71ad626a6f 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -832,15 +832,15 @@ describe Formula do specify "service complicated" do f = formula do url "https://brew.sh/test-1.0.tbz" - end - f.class.service do - run [opt_bin/"beanstalkd"] - run_type :immediate - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + service do + run [opt_bin/"beanstalkd"] + run_type :immediate + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end expect(f.service).not_to be_nil end diff --git a/Library/Homebrew/test/livecheck/livecheck_spec.rb b/Library/Homebrew/test/livecheck/livecheck_spec.rb index 9b68e3f94b..02ba9f58eb 100644 --- a/Library/Homebrew/test/livecheck/livecheck_spec.rb +++ b/Library/Homebrew/test/livecheck/livecheck_spec.rb @@ -98,11 +98,15 @@ describe Homebrew::Livecheck do describe "::livecheck_url_to_string" do let(:f_livecheck_url) do + homepage_url_s = homepage_url + stable_url_s = stable_url + head_url_s = head_url + formula("test_livecheck_url") do desc "Test Livecheck URL formula" - homepage "https://brew.sh" - url "https://brew.sh/test-0.0.1.tgz" - head "https://github.com/Homebrew/brew.git" + homepage homepage_url_s + url stable_url_s + head head_url_s end end @@ -120,25 +124,15 @@ describe Homebrew::Livecheck do end it "returns a URL string when given a livecheck_url string" do - f_livecheck_url.livecheck.url(livecheck_url) expect(livecheck.livecheck_url_to_string(livecheck_url, f_livecheck_url)).to eq(livecheck_url) end it "returns a URL symbol when given a valid livecheck_url symbol" do - f_livecheck_url.livecheck.url(:head) - expect(livecheck.livecheck_url_to_string(head_url, f_livecheck_url)).to eq(head_url) - - f_livecheck_url.livecheck.url(:homepage) - expect(livecheck.livecheck_url_to_string(homepage_url, f_livecheck_url)).to eq(homepage_url) - - c_livecheck_url.livecheck.url(:homepage) - expect(livecheck.livecheck_url_to_string(homepage_url, c_livecheck_url)).to eq(homepage_url) - - f_livecheck_url.livecheck.url(:stable) - expect(livecheck.livecheck_url_to_string(stable_url, f_livecheck_url)).to eq(stable_url) - - c_livecheck_url.livecheck.url(:url) - expect(livecheck.livecheck_url_to_string(cask_url, c_livecheck_url)).to eq(cask_url) + expect(livecheck.livecheck_url_to_string(:head, f_livecheck_url)).to eq(head_url) + expect(livecheck.livecheck_url_to_string(:homepage, f_livecheck_url)).to eq(homepage_url) + expect(livecheck.livecheck_url_to_string(:homepage, c_livecheck_url)).to eq(homepage_url) + expect(livecheck.livecheck_url_to_string(:stable, f_livecheck_url)).to eq(stable_url) + expect(livecheck.livecheck_url_to_string(:url, c_livecheck_url)).to eq(cask_url) end it "returns nil when not given a string or valid symbol" do diff --git a/Library/Homebrew/test/service_spec.rb b/Library/Homebrew/test/service_spec.rb index e35f0f4cb9..e3fab49f3a 100644 --- a/Library/Homebrew/test/service_spec.rb +++ b/Library/Homebrew/test/service_spec.rb @@ -5,26 +5,28 @@ require "formula" require "service" describe Homebrew::Service do - let(:klass) do - Class.new(Formula) do + let(:name) { "formula_name" } + + def stub_formula(&block) + formula(name) do url "https://brew.sh/test-1.0.tbz" + + instance_eval(&block) if block end end - let(:name) { "formula_name" } - let(:path) { Formulary.core_path(name) } - let(:spec) { :stable } - let(:f) { klass.new(name, path, spec) } describe "#std_service_path_env" do it "returns valid std_service_path_env" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate - environment_variables PATH: std_service_path_env - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + environment_variables PATH: std_service_path_env + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end path = f.service.std_service_path_env @@ -34,9 +36,11 @@ describe Homebrew::Service do describe "#process_type" do it "throws for unexpected type" do - f.class.service do - run opt_bin/"beanstalkd" - process_type :cow + f = stub_formula do + service do + run opt_bin/"beanstalkd" + process_type :cow + end end expect { @@ -47,9 +51,11 @@ describe Homebrew::Service do describe "#keep_alive" do it "throws for unexpected keys" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive test: "key" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive test: "key" + end end expect { @@ -60,9 +66,11 @@ describe Homebrew::Service do describe "#run_type" do it "throws for unexpected type" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :cow + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cow + end end expect { @@ -73,9 +81,11 @@ describe Homebrew::Service do describe "#sockets" do it "throws for missing type" do - f.class.service do - run opt_bin/"beanstalkd" - sockets "127.0.0.1:80" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + sockets "127.0.0.1:80" + end end expect { @@ -84,9 +94,11 @@ describe Homebrew::Service do end it "throws for missing host" do - f.class.service do - run opt_bin/"beanstalkd" - sockets "tcp://:80" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + sockets "tcp://:80" + end end expect { @@ -95,9 +107,11 @@ describe Homebrew::Service do end it "throws for missing port" do - f.class.service do - run opt_bin/"beanstalkd" - sockets "tcp://127.0.0.1" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + sockets "tcp://127.0.0.1" + end end expect { @@ -108,14 +122,16 @@ describe Homebrew::Service do describe "#manual_command" do it "returns valid manual_command" do - f.class.service do - run "#{HOMEBREW_PREFIX}/bin/beanstalkd" - run_type :immediate - environment_variables PATH: std_service_path_env, ETC_DIR: etc/"beanstalkd" - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + f = stub_formula do + service do + run "#{HOMEBREW_PREFIX}/bin/beanstalkd" + run_type :immediate + environment_variables PATH: std_service_path_env, ETC_DIR: etc/"beanstalkd" + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end path = f.service.manual_command @@ -123,14 +139,16 @@ describe Homebrew::Service do end it "returns valid manual_command without variables" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate - environment_variables PATH: std_service_path_env - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + environment_variables PATH: std_service_path_env + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end path = f.service.manual_command @@ -140,21 +158,23 @@ describe Homebrew::Service do describe "#to_plist" do it "returns valid plist" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate - environment_variables PATH: std_service_path_env, FOO: "BAR", ETC_DIR: etc/"beanstalkd" - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - input_path var/"in/beanstalkd" - root_dir var - working_dir var - keep_alive true - launch_only_once true - process_type :interactive - restart_delay 30 - interval 5 - macos_legacy_timers true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + environment_variables PATH: std_service_path_env, FOO: "BAR", ETC_DIR: etc/"beanstalkd" + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + input_path var/"in/beanstalkd" + root_dir var + working_dir var + keep_alive true + launch_only_once true + process_type :interactive + restart_delay 30 + interval 5 + macos_legacy_timers true + end end plist = f.service.to_plist @@ -216,9 +236,11 @@ describe Homebrew::Service do end it "returns valid plist with socket" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - sockets "tcp://127.0.0.1:80" + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + sockets "tcp://127.0.0.1:80" + end end plist = f.service.to_plist @@ -265,9 +287,11 @@ describe Homebrew::Service do end it "returns valid partial plist" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + end end plist = f.service.to_plist @@ -299,10 +323,12 @@ describe Homebrew::Service do end it "returns valid interval plist" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :interval - interval 5 + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :interval + interval 5 + end end plist = f.service.to_plist @@ -336,10 +362,12 @@ describe Homebrew::Service do end it "returns valid cron plist" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :cron - cron "@daily" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cron + cron "@daily" + end end plist = f.service.to_plist @@ -378,9 +406,11 @@ describe Homebrew::Service do end it "returns valid keepalive-exit plist" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive successful_exit: false + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive successful_exit: false + end end plist = f.service.to_plist @@ -417,9 +447,11 @@ describe Homebrew::Service do end it "returns valid keepalive-crashed plist" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive crashed: true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive crashed: true + end end plist = f.service.to_plist @@ -456,9 +488,11 @@ describe Homebrew::Service do end it "returns valid keepalive-path plist" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive path: opt_pkgshare/"test-path" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive path: opt_pkgshare/"test-path" + end end plist = f.service.to_plist @@ -497,19 +531,21 @@ describe Homebrew::Service do describe "#to_systemd_unit" do it "returns valid unit" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate - environment_variables PATH: std_service_path_env, FOO: "BAR" - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - input_path var/"in/beanstalkd" - root_dir var - working_dir var - keep_alive true - process_type :interactive - restart_delay 30 - macos_legacy_timers true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + environment_variables PATH: std_service_path_env, FOO: "BAR" + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + input_path var/"in/beanstalkd" + root_dir var + working_dir var + keep_alive true + process_type :interactive + restart_delay 30 + macos_legacy_timers true + end end unit = f.service.to_systemd_unit @@ -538,10 +574,12 @@ describe Homebrew::Service do end it "returns valid partial oneshot unit" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate - launch_only_once true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + launch_only_once true + end end unit = f.service.to_systemd_unit @@ -562,10 +600,12 @@ describe Homebrew::Service do describe "#to_systemd_timer" do it "returns valid timer" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :interval - interval 5 + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :interval + interval 5 + end end unit = f.service.to_systemd_timer @@ -584,9 +624,11 @@ describe Homebrew::Service do end it "returns valid partial timer" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + end end unit = f.service.to_systemd_timer @@ -604,10 +646,12 @@ describe Homebrew::Service do end it "throws on incomplete cron" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :cron - cron "1 2 3 4" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cron + cron "1 2 3 4" + end end expect { @@ -627,10 +671,12 @@ describe Homebrew::Service do } styles.each do |cron, calendar| - f.class.service do - run opt_bin/"beanstalkd" - run_type :cron - cron cron.to_s + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cron + cron cron.to_s + end end unit = f.service.to_systemd_timer @@ -653,18 +699,22 @@ describe Homebrew::Service do describe "#timed?" do it "returns false for immediate" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + end end expect(f.service.timed?).to be(false) end it "returns true for interval" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :interval + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :interval + end end expect(f.service.timed?).to be(true) @@ -673,35 +723,43 @@ describe Homebrew::Service do describe "#keep_alive?" do it "returns true when keep_alive set to hash" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - keep_alive crashed: true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + keep_alive crashed: true + end end expect(f.service.keep_alive?).to be(true) end it "returns true when keep_alive set to true" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - keep_alive true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + keep_alive true + end end expect(f.service.keep_alive?).to be(true) end it "returns false when keep_alive not set" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + end end expect(f.service.keep_alive?).to be(false) end it "returns false when keep_alive set to false" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - keep_alive false + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + keep_alive false + end end expect(f.service.keep_alive?).to be(false) @@ -710,9 +768,11 @@ describe Homebrew::Service do describe "#command" do it "returns @run data" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + end end command = f.service.command diff --git a/Library/Homebrew/test/support/fixtures/failball.rb b/Library/Homebrew/test/support/fixtures/failball.rb index 1b396a721e..4995d94f55 100644 --- a/Library/Homebrew/test/support/fixtures/failball.rb +++ b/Library/Homebrew/test/support/fixtures/failball.rb @@ -4,13 +4,22 @@ class Failball < Formula def initialize(name = "failball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec" diff --git a/Library/Homebrew/test/support/fixtures/testball.rb b/Library/Homebrew/test/support/fixtures/testball.rb index 1a99de2914..a2f23923a0 100644 --- a/Library/Homebrew/test/support/fixtures/testball.rb +++ b/Library/Homebrew/test/support/fixtures/testball.rb @@ -4,13 +4,22 @@ class Testball < Formula def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec" diff --git a/Library/Homebrew/test/support/fixtures/testball_bottle.rb b/Library/Homebrew/test/support/fixtures/testball_bottle.rb index d6b777996a..33d4093ef9 100644 --- a/Library/Homebrew/test/support/fixtures/testball_bottle.rb +++ b/Library/Homebrew/test/support/fixtures/testball_bottle.rb @@ -4,18 +4,29 @@ class TestballBottle < Formula def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - stable.bottle do - root_url "file://#{TEST_FIXTURE_DIR}/bottles" - sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" - end - cxxstdlib_check :skip - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + + bottle do + root_url "file://#{TEST_FIXTURE_DIR}/bottles" + sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" + end + + cxxstdlib_check :skip + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec" diff --git a/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb b/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb index 58bd8edfeb..85ea087b19 100644 --- a/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb +++ b/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb @@ -4,19 +4,29 @@ class TestballBottleCellar < Formula def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - hexdigest = "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" - stable.bottle do - root_url "file://#{TEST_FIXTURE_DIR}/bottles" - sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => hexdigest - end - cxxstdlib_check :skip - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + + bottle do + root_url "file://#{TEST_FIXTURE_DIR}/bottles" + sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" + end + + cxxstdlib_check :skip + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec"