bottle_spec: more cleanup
This commit is contained in:
parent
da0d7eff9b
commit
2fc17772f7
@ -76,85 +76,65 @@ describe Homebrew do
|
|||||||
subject(:homebrew) { described_class }
|
subject(:homebrew) { described_class }
|
||||||
|
|
||||||
let(:hello_hash_big_sur) {
|
let(:hello_hash_big_sur) {
|
||||||
JSON.parse(
|
JSON.parse stub_hash(
|
||||||
stub_hash(
|
"name": "hello",
|
||||||
{
|
"version": "1.0",
|
||||||
"name": "hello",
|
"path": "/home/hello.rb",
|
||||||
"version": "1.0",
|
"cellar": "any_skip_relocation",
|
||||||
"path": "/home/hello.rb",
|
"os": "big_sur",
|
||||||
"cellar": "any_skip_relocation",
|
"filename": "hello-1.0.big_sur.bottle.tar.gz",
|
||||||
"os": "big_sur",
|
"local_filename": "hello--1.0.big_sur.bottle.tar.gz",
|
||||||
"filename": "hello-1.0.big_sur.bottle.tar.gz",
|
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
||||||
"local_filename": "hello--1.0.big_sur.bottle.tar.gz",
|
|
||||||
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
let(:hello_hash_catalina) {
|
let(:hello_hash_catalina) {
|
||||||
JSON.parse(
|
JSON.parse stub_hash(
|
||||||
stub_hash(
|
"name": "hello",
|
||||||
{
|
"version": "1.0",
|
||||||
"name": "hello",
|
"path": "/home/hello.rb",
|
||||||
"version": "1.0",
|
"cellar": "any_skip_relocation",
|
||||||
"path": "/home/hello.rb",
|
"os": "catalina",
|
||||||
"cellar": "any_skip_relocation",
|
"filename": "hello-1.0.catalina.bottle.tar.gz",
|
||||||
"os": "catalina",
|
"local_filename": "hello--1.0.catalina.bottle.tar.gz",
|
||||||
"filename": "hello-1.0.catalina.bottle.tar.gz",
|
"sha256": "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
|
||||||
"local_filename": "hello--1.0.catalina.bottle.tar.gz",
|
|
||||||
"sha256": "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
let(:unzip_hash_big_sur) {
|
let(:unzip_hash_big_sur) {
|
||||||
JSON.parse(
|
JSON.parse stub_hash(
|
||||||
stub_hash(
|
"name": "unzip",
|
||||||
{
|
"version": "2.0",
|
||||||
"name": "unzip",
|
"path": "/home/unzip.rb",
|
||||||
"version": "2.0",
|
"cellar": "any_skip_relocation",
|
||||||
"path": "/home/unzip.rb",
|
"os": "big_sur",
|
||||||
"cellar": "any_skip_relocation",
|
"filename": "unzip-2.0.big_sur.bottle.tar.gz",
|
||||||
"os": "big_sur",
|
"local_filename": "unzip--2.0.big_sur.bottle.tar.gz",
|
||||||
"filename": "unzip-2.0.big_sur.bottle.tar.gz",
|
"sha256": "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
|
||||||
"local_filename": "unzip--2.0.big_sur.bottle.tar.gz",
|
|
||||||
"sha256": "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
let(:unzip_hash_catalina) {
|
let(:unzip_hash_catalina) {
|
||||||
JSON.parse(
|
JSON.parse stub_hash(
|
||||||
stub_hash(
|
"name": "unzip",
|
||||||
{
|
"version": "2.0",
|
||||||
"name": "unzip",
|
"path": "/home/unzip.rb",
|
||||||
"version": "2.0",
|
"cellar": "any",
|
||||||
"path": "/home/unzip.rb",
|
"os": "catalina",
|
||||||
"cellar": "any",
|
"filename": "unzip-2.0.catalina.bottle.tar.gz",
|
||||||
"os": "catalina",
|
"local_filename": "unzip--2.0.catalina.bottle.tar.gz",
|
||||||
"filename": "unzip-2.0.catalina.bottle.tar.gz",
|
"sha256": "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
|
||||||
"local_filename": "unzip--2.0.catalina.bottle.tar.gz",
|
|
||||||
"sha256": "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
specify "::parse_json_files" do
|
specify "::parse_json_files" do
|
||||||
Tempfile.open("hello--1.0.big_sur.bottle.json") do |f|
|
Tempfile.open("hello--1.0.big_sur.bottle.json") do |f|
|
||||||
f.write(
|
f.write stub_hash(
|
||||||
stub_hash(
|
"name": "hello",
|
||||||
{
|
"version": "1.0",
|
||||||
"name": "hello",
|
"path": "/home/hello.rb",
|
||||||
"version": "1.0",
|
"cellar": "any_skip_relocation",
|
||||||
"path": "/home/hello.rb",
|
"os": "big_sur",
|
||||||
"cellar": "any_skip_relocation",
|
"filename": "hello-1.0.big_sur.bottle.tar.gz",
|
||||||
"os": "big_sur",
|
"local_filename": "hello--1.0.big_sur.bottle.tar.gz",
|
||||||
"filename": "hello-1.0.big_sur.bottle.tar.gz",
|
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
||||||
"local_filename": "hello--1.0.big_sur.bottle.tar.gz",
|
|
||||||
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
f.close
|
f.close
|
||||||
expect(
|
expect(
|
||||||
@ -206,7 +186,7 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Pathname("testball-1.0.big_sur.bottle.json").write stub_hash(
|
Pathname("#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json").write stub_hash(
|
||||||
"name": "testball",
|
"name": "testball",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"path": "#{core_tap.path}/Formula/testball.rb",
|
"path": "#{core_tap.path}/Formula/testball.rb",
|
||||||
@ -217,7 +197,7 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
||||||
)
|
)
|
||||||
|
|
||||||
Pathname("testball-1.0.catalina.bottle.json").write stub_hash(
|
Pathname("#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json").write stub_hash(
|
||||||
"name": "testball",
|
"name": "testball",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"path": "#{core_tap.path}/Formula/testball.rb",
|
"path": "#{core_tap.path}/Formula/testball.rb",
|
||||||
@ -230,8 +210,8 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
FileUtils.rm_f "testball-1.0.catalina.bottle.json"
|
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
||||||
FileUtils.rm_f "testball-1.0.big_sur.bottle.json"
|
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adds the bottle block to a formula that has none" do
|
it "adds the bottle block to a formula that has none" do
|
||||||
@ -246,59 +226,55 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
brew "bottle",
|
brew "bottle",
|
||||||
"--merge",
|
"--merge",
|
||||||
"--write",
|
"--write",
|
||||||
"testball-1.0.big_sur.bottle.json",
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
||||||
"testball-1.0.catalina.bottle.json"
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
||||||
}.to output(
|
}.to output(<<~EOS).to_stdout
|
||||||
<<~EOS,
|
==> testball
|
||||||
==> testball
|
bottle do
|
||||||
bottle do
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
cellar :any_skip_relocation
|
||||||
cellar :any_skip_relocation
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
||||||
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
||||||
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
||||||
end
|
|
||||||
EOS
|
|
||||||
).to_stdout
|
|
||||||
|
|
||||||
expect((core_tap.path/"Formula/testball.rb").read).to eq(
|
|
||||||
<<~EOS,
|
|
||||||
class Testball < Formula
|
|
||||||
desc "Some test"
|
|
||||||
homepage "https://brew.sh/testball"
|
|
||||||
url "file://#{tarball}"
|
|
||||||
sha256 "#{tarball.sha256}"
|
|
||||||
|
|
||||||
bottle do
|
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
||||||
cellar :any_skip_relocation
|
|
||||||
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
||||||
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
||||||
end
|
|
||||||
|
|
||||||
option "with-foo", "Build with foo"
|
|
||||||
|
|
||||||
def install
|
|
||||||
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
|
||||||
prefix.install Dir["*"]
|
|
||||||
(buildpath/"test.c").write \
|
|
||||||
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
|
||||||
bin.mkpath
|
|
||||||
system ENV.cc, "test.c", "-o", bin/"test"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# something here
|
|
||||||
|
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
)
|
|
||||||
|
expect((core_tap.path/"Formula/testball.rb").read).to eq <<~EOS
|
||||||
|
class Testball < Formula
|
||||||
|
desc "Some test"
|
||||||
|
homepage "https://brew.sh/testball"
|
||||||
|
url "file://#{tarball}"
|
||||||
|
sha256 "#{tarball.sha256}"
|
||||||
|
|
||||||
|
bottle do
|
||||||
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
|
cellar :any_skip_relocation
|
||||||
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
||||||
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
||||||
|
end
|
||||||
|
|
||||||
|
option "with-foo", "Build with foo"
|
||||||
|
|
||||||
|
def install
|
||||||
|
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
||||||
|
prefix.install Dir["*"]
|
||||||
|
(buildpath/"test.c").write \
|
||||||
|
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
||||||
|
bin.mkpath
|
||||||
|
system ENV.cc, "test.c", "-o", bin/"test"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# something here
|
||||||
|
|
||||||
|
end
|
||||||
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
it "replaces the bottle block in a formula that already has a bottle block" do
|
it "replaces the bottle block in a formula that already has a bottle block" do
|
||||||
core_tap.path.cd do
|
core_tap.path.cd do
|
||||||
system "git", "init"
|
system "git", "init"
|
||||||
bottle_block = <<~EOS
|
setup_test_formula "testball", bottle_block: <<~EOS
|
||||||
|
|
||||||
bottle do
|
bottle do
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
@ -307,7 +283,6 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
sha256 "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" => :catalina
|
sha256 "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" => :catalina
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
setup_test_formula("testball", "", bottle_block)
|
|
||||||
system "git", "add", "--all"
|
system "git", "add", "--all"
|
||||||
system "git", "commit", "-m", "testball 0.1"
|
system "git", "commit", "-m", "testball 0.1"
|
||||||
end
|
end
|
||||||
@ -316,53 +291,49 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
brew "bottle",
|
brew "bottle",
|
||||||
"--merge",
|
"--merge",
|
||||||
"--write",
|
"--write",
|
||||||
"testball-1.0.big_sur.bottle.json",
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
||||||
"testball-1.0.catalina.bottle.json"
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
||||||
}.to output(
|
}.to output(<<~EOS).to_stdout
|
||||||
<<~EOS,
|
==> testball
|
||||||
==> testball
|
bottle do
|
||||||
bottle do
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
cellar :any_skip_relocation
|
||||||
cellar :any_skip_relocation
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
||||||
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
||||||
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
||||||
end
|
|
||||||
EOS
|
|
||||||
).to_stdout
|
|
||||||
|
|
||||||
expect((core_tap.path/"Formula/testball.rb").read).to eq(
|
|
||||||
<<~EOS,
|
|
||||||
class Testball < Formula
|
|
||||||
desc "Some test"
|
|
||||||
homepage "https://brew.sh/testball"
|
|
||||||
url "file://#{tarball}"
|
|
||||||
sha256 "#{tarball.sha256}"
|
|
||||||
|
|
||||||
option "with-foo", "Build with foo"
|
|
||||||
|
|
||||||
bottle do
|
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
||||||
cellar :any_skip_relocation
|
|
||||||
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
||||||
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
||||||
end
|
|
||||||
|
|
||||||
def install
|
|
||||||
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
|
||||||
prefix.install Dir["*"]
|
|
||||||
(buildpath/"test.c").write \
|
|
||||||
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
|
||||||
bin.mkpath
|
|
||||||
system ENV.cc, "test.c", "-o", bin/"test"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# something here
|
|
||||||
|
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
)
|
|
||||||
|
expect((core_tap.path/"Formula/testball.rb").read).to eq <<~EOS
|
||||||
|
class Testball < Formula
|
||||||
|
desc "Some test"
|
||||||
|
homepage "https://brew.sh/testball"
|
||||||
|
url "file://#{tarball}"
|
||||||
|
sha256 "#{tarball.sha256}"
|
||||||
|
|
||||||
|
option "with-foo", "Build with foo"
|
||||||
|
|
||||||
|
bottle do
|
||||||
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
|
cellar :any_skip_relocation
|
||||||
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
||||||
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
||||||
|
end
|
||||||
|
|
||||||
|
def install
|
||||||
|
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
||||||
|
prefix.install Dir["*"]
|
||||||
|
(buildpath/"test.c").write \
|
||||||
|
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
||||||
|
bin.mkpath
|
||||||
|
system ENV.cc, "test.c", "-o", bin/"test"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# something here
|
||||||
|
|
||||||
|
end
|
||||||
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
it "fails to add the bottle block to a formula that has no bottle block when using --keep-old" do
|
it "fails to add the bottle block to a formula that has no bottle block when using --keep-old" do
|
||||||
@ -378,15 +349,15 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
"--merge",
|
"--merge",
|
||||||
"--write",
|
"--write",
|
||||||
"--keep-old",
|
"--keep-old",
|
||||||
"testball-1.0.big_sur.bottle.json",
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
||||||
"testball-1.0.catalina.bottle.json"
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
||||||
}.to output("Error: --keep-old was passed but there was no existing bottle block!\n").to_stderr
|
}.to output("Error: --keep-old was passed but there was no existing bottle block!\n").to_stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
it "updates the bottle block in a formula that already has a bottle block when using --keep-old" do
|
it "updates the bottle block in a formula that already has a bottle block when using --keep-old" do
|
||||||
core_tap.path.cd do
|
core_tap.path.cd do
|
||||||
system "git", "init"
|
system "git", "init"
|
||||||
bottle_block = <<~EOS
|
setup_test_formula "testball", bottle_block: <<~EOS
|
||||||
|
|
||||||
bottle do
|
bottle do
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
@ -394,7 +365,6 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
setup_test_formula("testball", "", bottle_block)
|
|
||||||
system "git", "add", "--all"
|
system "git", "add", "--all"
|
||||||
system "git", "commit", "-m", "testball 0.1"
|
system "git", "commit", "-m", "testball 0.1"
|
||||||
end
|
end
|
||||||
@ -404,54 +374,50 @@ describe "brew bottle --merge", :integration_test, :needs_linux do
|
|||||||
"--merge",
|
"--merge",
|
||||||
"--write",
|
"--write",
|
||||||
"--keep-old",
|
"--keep-old",
|
||||||
"testball-1.0.big_sur.bottle.json",
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
||||||
"testball-1.0.catalina.bottle.json"
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
||||||
}.to output(
|
}.to output(<<~EOS).to_stdout
|
||||||
<<~EOS,
|
==> testball
|
||||||
==> testball
|
bottle do
|
||||||
bottle do
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
cellar :any_skip_relocation
|
||||||
cellar :any_skip_relocation
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
||||||
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
||||||
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
||||||
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
|
||||||
end
|
|
||||||
EOS
|
|
||||||
).to_stdout
|
|
||||||
|
|
||||||
expect((core_tap.path/"Formula/testball.rb").read).to eq(
|
|
||||||
<<~EOS,
|
|
||||||
class Testball < Formula
|
|
||||||
desc "Some test"
|
|
||||||
homepage "https://brew.sh/testball"
|
|
||||||
url "file://#{tarball}"
|
|
||||||
sha256 "#{tarball.sha256}"
|
|
||||||
|
|
||||||
option "with-foo", "Build with foo"
|
|
||||||
|
|
||||||
bottle do
|
|
||||||
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
||||||
cellar :any_skip_relocation
|
|
||||||
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
||||||
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
||||||
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
|
||||||
end
|
|
||||||
|
|
||||||
def install
|
|
||||||
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
|
||||||
prefix.install Dir["*"]
|
|
||||||
(buildpath/"test.c").write \
|
|
||||||
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
|
||||||
bin.mkpath
|
|
||||||
system ENV.cc, "test.c", "-o", bin/"test"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# something here
|
|
||||||
|
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
)
|
|
||||||
|
expect((core_tap.path/"Formula/testball.rb").read).to eq <<~EOS
|
||||||
|
class Testball < Formula
|
||||||
|
desc "Some test"
|
||||||
|
homepage "https://brew.sh/testball"
|
||||||
|
url "file://#{tarball}"
|
||||||
|
sha256 "#{tarball.sha256}"
|
||||||
|
|
||||||
|
option "with-foo", "Build with foo"
|
||||||
|
|
||||||
|
bottle do
|
||||||
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
||||||
|
cellar :any_skip_relocation
|
||||||
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
||||||
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
||||||
|
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
||||||
|
end
|
||||||
|
|
||||||
|
def install
|
||||||
|
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
||||||
|
prefix.install Dir["*"]
|
||||||
|
(buildpath/"test.c").write \
|
||||||
|
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
||||||
|
bin.mkpath
|
||||||
|
system ENV.cc, "test.c", "-o", bin/"test"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# something here
|
||||||
|
|
||||||
|
end
|
||||||
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -123,7 +123,7 @@ RSpec.shared_context "integration test" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_test_formula(name, content = nil, bottle_block = nil)
|
def setup_test_formula(name, content = nil, bottle_block: nil)
|
||||||
case name
|
case name
|
||||||
when /^testball/
|
when /^testball/
|
||||||
tarball = if OS.linux?
|
tarball = if OS.linux?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user