From 44e6ec6df8cfcda17a964e5169450a19e74fd087 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 1 Dec 2014 22:05:13 -0800 Subject: [PATCH] pushes/atlas: support custom server address --- plugins/pushes/atlas/config.rb | 8 ++++++++ plugins/pushes/atlas/push.rb | 1 + test/unit/plugins/pushes/atlas/push_test.rb | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/plugins/pushes/atlas/config.rb b/plugins/pushes/atlas/config.rb index 71b40e299..9941da455 100644 --- a/plugins/pushes/atlas/config.rb +++ b/plugins/pushes/atlas/config.rb @@ -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 diff --git a/plugins/pushes/atlas/push.rb b/plugins/pushes/atlas/push.rb index 0dc90f725..0b13f1bb3 100644 --- a/plugins/pushes/atlas/push.rb +++ b/plugins/pushes/atlas/push.rb @@ -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) diff --git a/test/unit/plugins/pushes/atlas/push_test.rb b/test/unit/plugins/pushes/atlas/push_test.rb index 2073e5789..b93231bb1 100644 --- a/test/unit/plugins/pushes/atlas/push_test.rb +++ b/test/unit/plugins/pushes/atlas/push_test.rb @@ -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