pushes/atlas: Look for the uploader bin in the embedded dir
This commit is contained in:
parent
202326875f
commit
998c5688e8
|
@ -43,10 +43,12 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
if Vagrant.in_installer?
|
if Vagrant.in_installer?
|
||||||
# TODO: look up uploader in embedded dir
|
path = File.join(
|
||||||
else
|
Vagrant.installer_embedded_dir, "bin", UPLOADER_BIN)
|
||||||
return Vagrant::Util::Which.which(UPLOADER_BIN)
|
return path if File.file?(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return Vagrant::Util::Which.which(UPLOADER_BIN)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,8 @@ require Vagrant.source_root.join("plugins/pushes/atlas/push")
|
||||||
describe VagrantPlugins::AtlasPush::Push do
|
describe VagrantPlugins::AtlasPush::Push do
|
||||||
include_context "unit"
|
include_context "unit"
|
||||||
|
|
||||||
|
let(:bin) { VagrantPlugins::AtlasPush::Push::UPLOADER_BIN }
|
||||||
|
|
||||||
let(:env) do
|
let(:env) do
|
||||||
double("env",
|
double("env",
|
||||||
root_path: File.expand_path("..", __FILE__)
|
root_path: File.expand_path("..", __FILE__)
|
||||||
|
@ -99,6 +101,32 @@ describe VagrantPlugins::AtlasPush::Push do
|
||||||
expect(subject.uploader_path).to eq("bar")
|
expect(subject.uploader_path).to eq("bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should look up the uploader in the embedded dir if installer" do
|
||||||
|
dir = temporary_dir
|
||||||
|
|
||||||
|
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||||
|
allow(Vagrant).to receive(:installer_embedded_dir).and_return(dir.to_s)
|
||||||
|
|
||||||
|
bin_path = dir.join("bin", bin)
|
||||||
|
bin_path.dirname.mkpath
|
||||||
|
bin_path.open("w+") { |f| f.write("hi") }
|
||||||
|
|
||||||
|
expect(subject.uploader_path).to eq(bin_path.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should look up the uploader in the PATH if not in the installer" do
|
||||||
|
dir = temporary_dir
|
||||||
|
|
||||||
|
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||||
|
allow(Vagrant).to receive(:installer_embedded_dir).and_return(dir.to_s)
|
||||||
|
|
||||||
|
expect(Vagrant::Util::Which).to receive(:which).
|
||||||
|
with(described_class.const_get(:UPLOADER_BIN)).
|
||||||
|
and_return("bar")
|
||||||
|
|
||||||
|
expect(subject.uploader_path).to eq("bar")
|
||||||
|
end
|
||||||
|
|
||||||
it "should return nil if its not found anywhere" do
|
it "should return nil if its not found anywhere" do
|
||||||
allow(Vagrant).to receive(:in_installer?).and_return(false)
|
allow(Vagrant).to receive(:in_installer?).and_return(false)
|
||||||
allow(Vagrant::Util::Which).to receive(:which).and_return(nil)
|
allow(Vagrant::Util::Which).to receive(:which).and_return(nil)
|
||||||
|
|
Loading…
Reference in New Issue