mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Use --
for bottles.
This commit is contained in:
parent
54a9f687df
commit
d33241bc11
@ -391,7 +391,7 @@ module Homebrew
|
||||
"rebuild" => bottle.rebuild,
|
||||
"tags" => {
|
||||
tag => {
|
||||
"filename" => filename.to_s,
|
||||
"filename" => filename.bintray,
|
||||
"sha256" => sha256,
|
||||
},
|
||||
},
|
||||
@ -402,7 +402,7 @@ module Homebrew
|
||||
},
|
||||
},
|
||||
}
|
||||
File.open("#{filename.prefix}.bottle.json", "w") do |file|
|
||||
File.open(filename.json, "w") do |file|
|
||||
file.write JSON.generate json
|
||||
end
|
||||
end
|
||||
|
@ -1617,7 +1617,7 @@ class Formula
|
||||
bottle_spec.collector.keys.each do |os|
|
||||
checksum = bottle_spec.collector[os]
|
||||
bottle_info["files"][os] = {
|
||||
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild)}",
|
||||
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}",
|
||||
checksum.hash_type.to_s => checksum.hexdigest,
|
||||
}
|
||||
end
|
||||
|
@ -259,17 +259,21 @@ class Bottle
|
||||
end
|
||||
|
||||
def to_s
|
||||
prefix + suffix
|
||||
"#{name}--#{version}#{extname}"
|
||||
end
|
||||
alias to_str to_s
|
||||
|
||||
def prefix
|
||||
"#{name}-#{version}.#{tag}"
|
||||
def json
|
||||
"#{name}--#{version}.#{tag}.bottle.json"
|
||||
end
|
||||
|
||||
def suffix
|
||||
def bintray
|
||||
"#{name}-#{version}#{extname}"
|
||||
end
|
||||
|
||||
def extname
|
||||
s = rebuild.positive? ? ".#{rebuild}" : ""
|
||||
".bottle#{s}.tar.gz"
|
||||
".#{tag}.bottle#{s}.tar.gz"
|
||||
end
|
||||
end
|
||||
|
||||
@ -290,7 +294,7 @@ class Bottle
|
||||
checksum, tag = spec.checksum_for(Utils::Bottles.tag)
|
||||
|
||||
filename = Filename.create(formula, tag, spec.rebuild)
|
||||
@resource.url(build_url(spec.root_url, filename),
|
||||
@resource.url(build_url(spec.root_url, filename.bintray),
|
||||
select_download_strategy(spec.root_url_specs))
|
||||
@resource.version = formula.pkg_version
|
||||
@resource.checksum = checksum
|
||||
|
@ -2,36 +2,53 @@ require "formula"
|
||||
require "software_spec"
|
||||
|
||||
describe Bottle::Filename do
|
||||
specify "#prefix" do
|
||||
expect(described_class.new("foo", "1.0", :tag, 0).prefix)
|
||||
.to eq("foo-1.0.tag")
|
||||
subject { described_class.new(name, version, tag, rebuild) }
|
||||
|
||||
let(:name) { "foo" }
|
||||
let(:version) { "1.0" }
|
||||
let(:tag) { :tag }
|
||||
let(:rebuild) { 0 }
|
||||
|
||||
describe "#extname" do
|
||||
its(:extname) { is_expected.to eq ".tag.bottle.tar.gz" }
|
||||
|
||||
context "when rebuild is 0" do
|
||||
its(:extname) { is_expected.to eq ".tag.bottle.tar.gz" }
|
||||
end
|
||||
|
||||
specify "#suffix" do
|
||||
expect(described_class.new("foo", "1.0", :tag, 0).suffix)
|
||||
.to eq(".bottle.tar.gz")
|
||||
|
||||
expect(described_class.new("foo", "1.0", :tag, 1).suffix)
|
||||
.to eq(".bottle.1.tar.gz")
|
||||
context "when rebuild is 1" do
|
||||
let(:rebuild) { 1 }
|
||||
its(:extname) { is_expected.to eq ".tag.bottle.1.tar.gz" }
|
||||
end
|
||||
end
|
||||
|
||||
specify "#to_s and #to_str" do
|
||||
expected = "foo-1.0.tag.bottle.tar.gz"
|
||||
|
||||
expect(described_class.new("foo", "1.0", :tag, 0).to_s)
|
||||
.to eq(expected)
|
||||
|
||||
expect(described_class.new("foo", "1.0", :tag, 0).to_str)
|
||||
.to eq(expected)
|
||||
describe "#to_s and #to_str" do
|
||||
its(:to_s) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" }
|
||||
its(:to_str) { is_expected.to eq "foo--1.0.tag.bottle.tar.gz" }
|
||||
end
|
||||
|
||||
specify "::create" do
|
||||
f = formula do
|
||||
describe "#bintray" do
|
||||
its(:bintray) { is_expected.to eq "foo-1.0.tag.bottle.tar.gz" }
|
||||
end
|
||||
|
||||
describe "#json" do
|
||||
its(:json) { is_expected.to eq "foo--1.0.tag.bottle.json" }
|
||||
|
||||
context "when rebuild is 1" do
|
||||
its(:json) { is_expected.to eq "foo--1.0.tag.bottle.json" }
|
||||
end
|
||||
end
|
||||
|
||||
describe "::create" do
|
||||
subject { described_class.create(f, :tag, 0) }
|
||||
|
||||
let(:f) {
|
||||
formula do
|
||||
url "https://example.com/foo.tar.gz"
|
||||
version "1.0"
|
||||
end
|
||||
}
|
||||
|
||||
expect(described_class.create(f, :tag, 0).to_s)
|
||||
.to eq("formula_name-1.0.tag.bottle.tar.gz")
|
||||
its(:to_s) { is_expected.to eq "formula_name--1.0.tag.bottle.tar.gz" }
|
||||
end
|
||||
end
|
||||
|
@ -21,11 +21,11 @@ describe "brew bottle", :integration_test do
|
||||
end
|
||||
|
||||
expect { brew "bottle", "--no-rebuild", "testball" }
|
||||
.to output(/testball-0\.1.*\.bottle\.tar\.gz/).to_stdout
|
||||
.to output(/testball--0\.1.*\.bottle\.tar\.gz/).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
ensure
|
||||
FileUtils.rm_f Dir.glob("testball-0.1*.bottle.tar.gz")
|
||||
FileUtils.rm_f Dir.glob("testball--0.1*.bottle.tar.gz")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user