formula: fix alias loading
This commit is contained in:
parent
7c15dce285
commit
9b4f29e47c
@ -1417,7 +1417,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def current_installed_alias_target
|
def current_installed_alias_target
|
||||||
Formulary.factory(installed_alias_path) if installed_alias_path
|
Formulary.factory(installed_alias_name) if installed_alias_path
|
||||||
end
|
end
|
||||||
|
|
||||||
# Has the target of the alias used to install this formula changed?
|
# Has the target of the alias used to install this formula changed?
|
||||||
|
|||||||
@ -1194,6 +1194,7 @@ describe Formula do
|
|||||||
|
|
||||||
let(:tab) { Tab.empty }
|
let(:tab) { Tab.empty }
|
||||||
let(:alias_path) { "#{CoreTap.instance.alias_dir}/bar" }
|
let(:alias_path) { "#{CoreTap.instance.alias_dir}/bar" }
|
||||||
|
let(:alias_name) { "bar" }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(described_class).to receive(:installed).and_return([f])
|
allow(described_class).to receive(:installed).and_return([f])
|
||||||
@ -1215,7 +1216,7 @@ describe Formula do
|
|||||||
|
|
||||||
specify "alias changes when not changed" do
|
specify "alias changes when not changed" do
|
||||||
tab.source["path"] = alias_path
|
tab.source["path"] = alias_path
|
||||||
stub_formula_loader(f, alias_path)
|
stub_formula_loader(f, alias_name)
|
||||||
|
|
||||||
CoreTap.instance.alias_dir.mkpath
|
CoreTap.instance.alias_dir.mkpath
|
||||||
FileUtils.ln_sf f.path, alias_path
|
FileUtils.ln_sf f.path, alias_path
|
||||||
@ -1230,7 +1231,7 @@ describe Formula do
|
|||||||
|
|
||||||
specify "alias changes when new alias target" do
|
specify "alias changes when new alias target" do
|
||||||
tab.source["path"] = alias_path
|
tab.source["path"] = alias_path
|
||||||
stub_formula_loader(new_formula, alias_path)
|
stub_formula_loader(new_formula, alias_name)
|
||||||
|
|
||||||
CoreTap.instance.alias_dir.mkpath
|
CoreTap.instance.alias_dir.mkpath
|
||||||
FileUtils.ln_sf new_formula.path, alias_path
|
FileUtils.ln_sf new_formula.path, alias_path
|
||||||
@ -1245,7 +1246,7 @@ describe Formula do
|
|||||||
|
|
||||||
specify "alias changes when old formulae installed" do
|
specify "alias changes when old formulae installed" do
|
||||||
tab.source["path"] = alias_path
|
tab.source["path"] = alias_path
|
||||||
stub_formula_loader(new_formula, alias_path)
|
stub_formula_loader(new_formula, alias_name)
|
||||||
|
|
||||||
CoreTap.instance.alias_dir.mkpath
|
CoreTap.instance.alias_dir.mkpath
|
||||||
FileUtils.ln_sf new_formula.path, alias_path
|
FileUtils.ln_sf new_formula.path, alias_path
|
||||||
@ -1286,6 +1287,7 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
|
|
||||||
let(:alias_path) { "#{f.tap.alias_dir}/bar" }
|
let(:alias_path) { "#{f.tap.alias_dir}/bar" }
|
||||||
|
let(:alias_name) { "bar" }
|
||||||
|
|
||||||
def setup_tab_for_prefix(prefix, options = {})
|
def setup_tab_for_prefix(prefix, options = {})
|
||||||
prefix.mkpath
|
prefix.mkpath
|
||||||
@ -1324,14 +1326,14 @@ describe Formula do
|
|||||||
example "outdated follow alias and alias unchanged" do
|
example "outdated follow alias and alias unchanged" do
|
||||||
f.follow_installed_alias = true
|
f.follow_installed_alias = true
|
||||||
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
||||||
stub_formula_loader(f, alias_path)
|
stub_formula_loader(f, alias_name)
|
||||||
expect(f.outdated_kegs).to be_empty
|
expect(f.outdated_kegs).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
example "outdated follow alias and alias changed and new target not installed" do
|
example "outdated follow alias and alias changed and new target not installed" do
|
||||||
f.follow_installed_alias = true
|
f.follow_installed_alias = true
|
||||||
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
||||||
stub_formula_loader(new_formula, alias_path)
|
stub_formula_loader(new_formula, alias_name)
|
||||||
|
|
||||||
CoreTap.instance.alias_dir.mkpath
|
CoreTap.instance.alias_dir.mkpath
|
||||||
FileUtils.ln_sf new_formula.path, alias_path
|
FileUtils.ln_sf new_formula.path, alias_path
|
||||||
@ -1342,7 +1344,7 @@ describe Formula do
|
|||||||
example "outdated follow alias and alias changed and new target installed" do
|
example "outdated follow alias and alias changed and new target installed" do
|
||||||
f.follow_installed_alias = true
|
f.follow_installed_alias = true
|
||||||
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
||||||
stub_formula_loader(new_formula, alias_path)
|
stub_formula_loader(new_formula, alias_name)
|
||||||
setup_tab_for_prefix(new_formula.prefix)
|
setup_tab_for_prefix(new_formula.prefix)
|
||||||
expect(f.outdated_kegs).to be_empty
|
expect(f.outdated_kegs).to be_empty
|
||||||
end
|
end
|
||||||
@ -1350,7 +1352,7 @@ describe Formula do
|
|||||||
example "outdated no follow alias and alias unchanged" do
|
example "outdated no follow alias and alias unchanged" do
|
||||||
f.follow_installed_alias = false
|
f.follow_installed_alias = false
|
||||||
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
|
||||||
stub_formula_loader(f, alias_path)
|
stub_formula_loader(f, alias_name)
|
||||||
expect(f.outdated_kegs).to be_empty
|
expect(f.outdated_kegs).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user