core: more output for box adding

This commit is contained in:
Mitchell Hashimoto 2014-01-23 13:07:35 -08:00
parent 5b075fa34e
commit ee139eb79d
3 changed files with 26 additions and 9 deletions

View File

@ -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

View File

@ -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:

View File

@ -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)