test: avoid improper, late usage of formula DSL
This commit is contained in:
parent
88a8def34c
commit
15280ba107
@ -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
|
||||
|
@ -7,6 +7,7 @@ require "formula"
|
||||
describe Cleaner do
|
||||
include FileUtils
|
||||
|
||||
describe "#clean" do
|
||||
subject(:cleaner) { described_class.new(f) }
|
||||
|
||||
let(:f) { formula("cleaner_test") { url "foo-1.0" } }
|
||||
@ -15,7 +16,6 @@ describe Cleaner do
|
||||
f.prefix.mkpath
|
||||
end
|
||||
|
||||
describe "#clean" do
|
||||
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
|
||||
|
@ -832,9 +832,8 @@ describe Formula do
|
||||
specify "service complicated" do
|
||||
f = formula do
|
||||
url "https://brew.sh/test-1.0.tbz"
|
||||
end
|
||||
|
||||
f.class.service do
|
||||
service do
|
||||
run [opt_bin/"beanstalkd"]
|
||||
run_type :immediate
|
||||
error_log_path var/"log/beanstalkd.error.log"
|
||||
@ -842,6 +841,7 @@ describe Formula do
|
||||
working_dir var
|
||||
keep_alive true
|
||||
end
|
||||
end
|
||||
expect(f.service).not_to be_nil
|
||||
end
|
||||
|
||||
|
@ -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
|
||||
|
@ -5,19 +5,20 @@ require "formula"
|
||||
require "service"
|
||||
|
||||
describe Homebrew::Service do
|
||||
let(:klass) do
|
||||
Class.new(Formula) do
|
||||
url "https://brew.sh/test-1.0.tbz"
|
||||
end
|
||||
end
|
||||
let(:name) { "formula_name" }
|
||||
let(:path) { Formulary.core_path(name) }
|
||||
let(:spec) { :stable }
|
||||
let(:f) { klass.new(name, path, spec) }
|
||||
|
||||
def stub_formula(&block)
|
||||
formula(name) do
|
||||
url "https://brew.sh/test-1.0.tbz"
|
||||
|
||||
instance_eval(&block) if block
|
||||
end
|
||||
end
|
||||
|
||||
describe "#std_service_path_env" do
|
||||
it "returns valid std_service_path_env" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :immediate
|
||||
environment_variables PATH: std_service_path_env
|
||||
@ -26,6 +27,7 @@ describe Homebrew::Service do
|
||||
working_dir var
|
||||
keep_alive true
|
||||
end
|
||||
end
|
||||
|
||||
path = f.service.std_service_path_env
|
||||
expect(path).to eq("#{HOMEBREW_PREFIX}/bin:#{HOMEBREW_PREFIX}/sbin:/usr/bin:/bin:/usr/sbin:/sbin")
|
||||
@ -34,10 +36,12 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#process_type" do
|
||||
it "throws for unexpected type" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
process_type :cow
|
||||
end
|
||||
end
|
||||
|
||||
expect {
|
||||
f.service.manual_command
|
||||
@ -47,10 +51,12 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#keep_alive" do
|
||||
it "throws for unexpected keys" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
keep_alive test: "key"
|
||||
end
|
||||
end
|
||||
|
||||
expect {
|
||||
f.service.manual_command
|
||||
@ -60,10 +66,12 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#run_type" do
|
||||
it "throws for unexpected type" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :cow
|
||||
end
|
||||
end
|
||||
|
||||
expect {
|
||||
f.service.manual_command
|
||||
@ -73,10 +81,12 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#sockets" do
|
||||
it "throws for missing type" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
sockets "127.0.0.1:80"
|
||||
end
|
||||
end
|
||||
|
||||
expect {
|
||||
f.service.manual_command
|
||||
@ -84,10 +94,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "throws for missing host" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
sockets "tcp://:80"
|
||||
end
|
||||
end
|
||||
|
||||
expect {
|
||||
f.service.manual_command
|
||||
@ -95,10 +107,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "throws for missing port" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
sockets "tcp://127.0.0.1"
|
||||
end
|
||||
end
|
||||
|
||||
expect {
|
||||
f.service.manual_command
|
||||
@ -108,7 +122,8 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#manual_command" do
|
||||
it "returns valid manual_command" do
|
||||
f.class.service do
|
||||
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"
|
||||
@ -117,13 +132,15 @@ describe Homebrew::Service do
|
||||
working_dir var
|
||||
keep_alive true
|
||||
end
|
||||
end
|
||||
|
||||
path = f.service.manual_command
|
||||
expect(path).to eq("ETC_DIR=\"#{HOMEBREW_PREFIX}/etc/beanstalkd\" #{HOMEBREW_PREFIX}/bin/beanstalkd")
|
||||
end
|
||||
|
||||
it "returns valid manual_command without variables" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :immediate
|
||||
environment_variables PATH: std_service_path_env
|
||||
@ -132,6 +149,7 @@ describe Homebrew::Service do
|
||||
working_dir var
|
||||
keep_alive true
|
||||
end
|
||||
end
|
||||
|
||||
path = f.service.manual_command
|
||||
expect(path).to eq("#{HOMEBREW_PREFIX}/opt/formula_name/bin/beanstalkd")
|
||||
@ -140,7 +158,8 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#to_plist" do
|
||||
it "returns valid plist" do
|
||||
f.class.service do
|
||||
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"
|
||||
@ -156,6 +175,7 @@ describe Homebrew::Service do
|
||||
interval 5
|
||||
macos_legacy_timers true
|
||||
end
|
||||
end
|
||||
|
||||
plist = f.service.to_plist
|
||||
plist_expect = <<~EOS
|
||||
@ -216,10 +236,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid plist with socket" do
|
||||
f.class.service do
|
||||
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
|
||||
plist_expect = <<~EOS
|
||||
@ -265,10 +287,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid partial plist" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :immediate
|
||||
end
|
||||
end
|
||||
|
||||
plist = f.service.to_plist
|
||||
plist_expect = <<~EOS
|
||||
@ -299,11 +323,13 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid interval plist" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :interval
|
||||
interval 5
|
||||
end
|
||||
end
|
||||
|
||||
plist = f.service.to_plist
|
||||
plist_expect = <<~EOS
|
||||
@ -336,11 +362,13 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid cron plist" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :cron
|
||||
cron "@daily"
|
||||
end
|
||||
end
|
||||
|
||||
plist = f.service.to_plist
|
||||
plist_expect = <<~EOS
|
||||
@ -378,10 +406,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid keepalive-exit plist" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
keep_alive successful_exit: false
|
||||
end
|
||||
end
|
||||
|
||||
plist = f.service.to_plist
|
||||
plist_expect = <<~EOS
|
||||
@ -417,10 +447,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid keepalive-crashed plist" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
keep_alive crashed: true
|
||||
end
|
||||
end
|
||||
|
||||
plist = f.service.to_plist
|
||||
plist_expect = <<~EOS
|
||||
@ -456,10 +488,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid keepalive-path plist" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
keep_alive path: opt_pkgshare/"test-path"
|
||||
end
|
||||
end
|
||||
|
||||
plist = f.service.to_plist
|
||||
plist_expect = <<~EOS
|
||||
@ -497,7 +531,8 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#to_systemd_unit" do
|
||||
it "returns valid unit" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run [opt_bin/"beanstalkd", "test"]
|
||||
run_type :immediate
|
||||
environment_variables PATH: std_service_path_env, FOO: "BAR"
|
||||
@ -511,6 +546,7 @@ describe Homebrew::Service do
|
||||
restart_delay 30
|
||||
macos_legacy_timers true
|
||||
end
|
||||
end
|
||||
|
||||
unit = f.service.to_systemd_unit
|
||||
std_path = "#{HOMEBREW_PREFIX}/bin:#{HOMEBREW_PREFIX}/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
|
||||
@ -538,11 +574,13 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid partial oneshot unit" do
|
||||
f.class.service do
|
||||
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
|
||||
unit_expect = <<~EOS
|
||||
@ -562,11 +600,13 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#to_systemd_timer" do
|
||||
it "returns valid timer" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run [opt_bin/"beanstalkd", "test"]
|
||||
run_type :interval
|
||||
interval 5
|
||||
end
|
||||
end
|
||||
|
||||
unit = f.service.to_systemd_timer
|
||||
unit_expect = <<~EOS
|
||||
@ -584,10 +624,12 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "returns valid partial timer" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :immediate
|
||||
end
|
||||
end
|
||||
|
||||
unit = f.service.to_systemd_timer
|
||||
unit_expect = <<~EOS
|
||||
@ -604,11 +646,13 @@ describe Homebrew::Service do
|
||||
end
|
||||
|
||||
it "throws on incomplete cron" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run opt_bin/"beanstalkd"
|
||||
run_type :cron
|
||||
cron "1 2 3 4"
|
||||
end
|
||||
end
|
||||
|
||||
expect {
|
||||
f.service.to_systemd_timer
|
||||
@ -627,11 +671,13 @@ describe Homebrew::Service do
|
||||
}
|
||||
|
||||
styles.each do |cron, calendar|
|
||||
f.class.service do
|
||||
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
|
||||
unit_expect = <<~EOS
|
||||
@ -653,19 +699,23 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#timed?" do
|
||||
it "returns false for immediate" do
|
||||
f.class.service do
|
||||
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
|
||||
f = stub_formula do
|
||||
service do
|
||||
run [opt_bin/"beanstalkd", "test"]
|
||||
run_type :interval
|
||||
end
|
||||
end
|
||||
|
||||
expect(f.service.timed?).to be(true)
|
||||
end
|
||||
@ -673,36 +723,44 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#keep_alive?" do
|
||||
it "returns true when keep_alive set to hash" do
|
||||
f.class.service do
|
||||
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
|
||||
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
|
||||
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
|
||||
f = stub_formula do
|
||||
service do
|
||||
run [opt_bin/"beanstalkd", "test"]
|
||||
keep_alive false
|
||||
end
|
||||
end
|
||||
|
||||
expect(f.service.keep_alive?).to be(false)
|
||||
end
|
||||
@ -710,10 +768,12 @@ describe Homebrew::Service do
|
||||
|
||||
describe "#command" do
|
||||
it "returns @run data" do
|
||||
f.class.service do
|
||||
f = stub_formula do
|
||||
service do
|
||||
run [opt_bin/"beanstalkd", "test"]
|
||||
run_type :immediate
|
||||
end
|
||||
end
|
||||
|
||||
command = f.service.command
|
||||
expect(command).to eq(["#{HOMEBREW_PREFIX}/opt/#{name}/bin/beanstalkd", "test"])
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -4,16 +4,27 @@
|
||||
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
|
||||
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
|
||||
end.freeze
|
||||
private_constant :DSL_PROC
|
||||
|
||||
DSL_PROC.call
|
||||
|
||||
def self.inherited(other)
|
||||
super
|
||||
other.instance_eval(&DSL_PROC)
|
||||
end
|
||||
|
||||
def install
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user