From ee139eb79dfcce8986e5f09bf3bf9d652c7765ea Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 23 Jan 2014 13:07:35 -0800 Subject: [PATCH] core: more output for box adding --- lib/vagrant/action/builtin/box_add.rb | 12 +++++++++++- templates/locales/en.yml | 6 ++++-- .../unit/vagrant/action/builtin/box_add_test.rb | 17 +++++++++++------ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/lib/vagrant/action/builtin/box_add.rb b/lib/vagrant/action/builtin/box_add.rb index 154673042..4403ed863 100644 --- a/lib/vagrant/action/builtin/box_add.rb +++ b/lib/vagrant/action/builtin/box_add.rb @@ -66,13 +66,23 @@ module Vagrant metadata_version.providers.first) end + env[:ui].output(I18n.t( + "vagrant.box_add_with_version", + name: metadata.name, + version: metadata_version.version, + provider: metadata_provider.name)) + # Now we have a URL, we have to download this URL. box_url = download(metadata_provider.url, env) # Add the box! - env[:box_collection].add( + box = env[:box_collection].add( box_url, metadata.name, metadata_version.version) + env[:ui].success(I18n.t( + "vagrant.box_added", + name: box.name, provider: box.provider)) + @app.call(env) end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 6744e2768..51bd723f0 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -4,6 +4,10 @@ en: Machine booted and ready! boot_waiting: |- Waiting for machine to boot. This may take a few minutes... + box_add_with_version: |- + Adding box '%{name}' (v%{version}) for '%{provider}' provider... + box_added: |- + Successfully added box '%{name}' for '%{provider}'! cfengine_bootstrapping: |- Bootstrapping CFEngine with policy server: %{policy_server}... cfengine_bootstrapping_policy_hub: |- @@ -1257,8 +1261,6 @@ en: add: adding: |- Extracting box... - added: |- - Successfully added box '%{name}' with provider '%{provider}'! checksumming: |- Calculating and comparing box checksum... destroy: diff --git a/test/unit/vagrant/action/builtin/box_add_test.rb b/test/unit/vagrant/action/builtin/box_add_test.rb index e9fcb53c5..88e44acdb 100644 --- a/test/unit/vagrant/action/builtin/box_add_test.rb +++ b/test/unit/vagrant/action/builtin/box_add_test.rb @@ -28,6 +28,11 @@ describe Vagrant::Action::Builtin::BoxAdd do end context "with box metadata" do + let(:box) do + box_dir = iso_env.box3("foo", "1.0", :virtualbox) + Vagrant::Box.new("foo", :virtualbox, "1.0", box_dir) + end + it "adds the latest version of a box with only one provider" do box_path = iso_env.box2_file(:virtualbox) tf = Tempfile.new("vagrant").tap do |f| @@ -59,7 +64,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(name).to eq("foo/bar") expect(version).to eq("0.7") true - end + end.and_return(box) app.should_receive(:call).with(env) @@ -102,7 +107,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(name).to eq("foo/bar") expect(version).to eq("0.7") true - end + end.and_return(box) app.should_receive(:call).with(env) @@ -148,7 +153,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(name).to eq("foo/bar") expect(version).to eq("0.7") true - end + end.and_return(box) app.should_receive(:call).with(env) @@ -185,7 +190,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(name).to eq("foo/bar") expect(version).to eq("0.5") true - end + end.and_return(box) app.should_receive(:call).with(env) @@ -227,7 +232,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(name).to eq("foo/bar") expect(version).to eq("0.5") true - end + end.and_return(box) app.should_receive(:call).with(env) @@ -272,7 +277,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(name).to eq("foo/bar") expect(version).to eq("0.7") true - end + end.and_return(box) app.should_receive(:call).with(env)