pushes/atlas: support custom server address

This commit is contained in:
Mitchell Hashimoto 2014-12-01 22:05:13 -08:00 committed by Seth Vargo
parent 998c5688e8
commit 44e6ec6df8
3 changed files with 17 additions and 0 deletions

View File

@ -41,10 +41,17 @@ module VagrantPlugins
# @return [String]
attr_accessor :uploader_path
# The address of the Atlas server to upload to. By default this will
# be the public Atlas server.
#
# @return [String]
attr_accessor :address
def initialize
@app = UNSET_VALUE
@dir = UNSET_VALUE
@vcs = UNSET_VALUE
@address = UNSET_VALUE
@includes = []
@excludes = []
@uploader_path = UNSET_VALUE
@ -58,6 +65,7 @@ module VagrantPlugins
end
def finalize!
@address = nil if @address == UNSET_VALUE
@app = nil if @app == UNSET_VALUE
@dir = "." if @dir == UNSET_VALUE
@uploader_path = nil if @uploader_path == UNSET_VALUE

View File

@ -26,6 +26,7 @@ module VagrantPlugins
cmd << "-vcs" if config.vcs
cmd += config.includes.map { |v| ["-include", v] }
cmd += config.excludes.map { |v| ["-exclude", v] }
cmd += ["-address", config.address] if config.address
cmd << config.app
cmd << File.expand_path(config.dir, env.root_path)
Vagrant::Util::SafeExec.exec(uploader, *cmd.flatten)

View File

@ -83,6 +83,14 @@ describe VagrantPlugins::AtlasPush::Push do
config.excludes = ["foo", "bar"]
subject.execute("foo")
end
it "sends custom server address" do
expect(Vagrant::Util::SafeExec).to receive(:exec).
with("foo", "-vcs", "-address", "foo", app, env.root_path.to_s)
config.address = "foo"
subject.execute("foo")
end
end
describe "#uploader_path" do