vagrantup 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -1
- data/Gemfile +0 -14
- data/LICENSE +1 -1
- data/bin/vagrant +47 -20
- data/config/default.rb +6 -14
- data/lib/vagrant/action/box/destroy.rb +7 -3
- data/lib/vagrant/action/box/download.rb +8 -8
- data/lib/vagrant/action/box/package.rb +2 -2
- data/lib/vagrant/action/box/unpackage.rb +13 -7
- data/lib/vagrant/action/box/verify.rb +5 -5
- data/lib/vagrant/action/builder.rb +23 -19
- data/lib/vagrant/action/builtin.rb +117 -79
- data/lib/vagrant/action/env/set.rb +7 -4
- data/lib/vagrant/action/environment.rb +3 -41
- data/lib/vagrant/action/general/package.rb +14 -29
- data/lib/vagrant/action/general/validate.rb +2 -2
- data/lib/vagrant/action/runner.rb +53 -0
- data/lib/vagrant/action/vm/boot.rb +9 -9
- data/lib/vagrant/action/vm/check_accessible.rb +2 -2
- data/lib/vagrant/action/vm/check_box.rb +10 -12
- data/lib/vagrant/action/vm/check_guest_additions.rb +8 -8
- data/lib/vagrant/action/vm/check_port_collisions.rb +85 -0
- data/lib/vagrant/action/vm/clean_machine_folder.rb +4 -4
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +3 -11
- data/lib/vagrant/action/vm/clear_network_interfaces.rb +31 -0
- data/lib/vagrant/action/vm/clear_shared_folders.rb +2 -11
- data/lib/vagrant/action/vm/customize.rb +19 -9
- data/lib/vagrant/action/vm/destroy.rb +4 -4
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +2 -12
- data/lib/vagrant/action/vm/discard_state.rb +4 -4
- data/lib/vagrant/action/vm/export.rb +13 -8
- data/lib/vagrant/action/vm/forward_ports.rb +55 -102
- data/lib/vagrant/action/vm/halt.rb +9 -6
- data/lib/vagrant/action/vm/host_name.rb +4 -4
- data/lib/vagrant/action/vm/import.rb +19 -10
- data/lib/vagrant/action/vm/match_mac_address.rb +4 -9
- data/lib/vagrant/action/vm/network.rb +300 -94
- data/lib/vagrant/action/vm/nfs.rb +41 -26
- data/lib/vagrant/action/vm/package.rb +1 -1
- data/lib/vagrant/action/vm/package_vagrantfile.rb +5 -2
- data/lib/vagrant/action/vm/provision.rb +42 -13
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +2 -2
- data/lib/vagrant/action/vm/{clear_nfs_exports.rb → prune_nfs_exports.rb} +7 -7
- data/lib/vagrant/action/vm/resume.rb +4 -4
- data/lib/vagrant/action/vm/setup_package_files.rb +54 -0
- data/lib/vagrant/action/vm/share_folders.rb +63 -39
- data/lib/vagrant/action/vm/suspend.rb +4 -4
- data/lib/vagrant/action/warden.rb +13 -6
- data/lib/vagrant/action.rb +45 -123
- data/lib/vagrant/box.rb +9 -55
- data/lib/vagrant/box_collection.rb +22 -17
- data/lib/vagrant/cli.rb +62 -47
- data/lib/vagrant/command/base.rb +135 -90
- data/lib/vagrant/command/box.rb +46 -21
- data/lib/vagrant/command/box_add.rb +33 -0
- data/lib/vagrant/command/box_list.rb +25 -0
- data/lib/vagrant/command/box_remove.rb +23 -0
- data/lib/vagrant/command/box_repackage.rb +23 -0
- data/lib/vagrant/command/destroy.rb +16 -5
- data/lib/vagrant/command/halt.rb +25 -7
- data/lib/vagrant/command/init.rb +30 -7
- data/lib/vagrant/command/package.rb +49 -18
- data/lib/vagrant/command/provision.rb +22 -9
- data/lib/vagrant/command/reload.rb +18 -5
- data/lib/vagrant/command/resume.rb +18 -5
- data/lib/vagrant/command/ssh.rb +69 -31
- data/lib/vagrant/command/ssh_config.rb +37 -22
- data/lib/vagrant/command/status.rb +22 -20
- data/lib/vagrant/command/suspend.rb +18 -5
- data/lib/vagrant/command/up.rb +41 -8
- data/lib/vagrant/command.rb +18 -20
- data/lib/vagrant/communication/base.rb +56 -0
- data/lib/vagrant/communication/ssh.rb +200 -0
- data/lib/vagrant/communication.rb +7 -0
- data/lib/vagrant/config/base.rb +18 -26
- data/lib/vagrant/config/container.rb +37 -0
- data/lib/vagrant/config/error_recorder.rb +1 -1
- data/lib/vagrant/config/loader.rb +125 -0
- data/lib/vagrant/config/nfs.rb +1 -3
- data/lib/vagrant/config/package.rb +1 -3
- data/lib/vagrant/config/ssh.rb +31 -16
- data/lib/vagrant/config/top.rb +36 -25
- data/lib/vagrant/config/vagrant.rb +2 -5
- data/lib/vagrant/config/vm/provisioner.rb +16 -20
- data/lib/vagrant/config/vm/sub_vm.rb +1 -1
- data/lib/vagrant/config/vm.rb +115 -56
- data/lib/vagrant/config.rb +29 -103
- data/lib/vagrant/data_store.rb +23 -15
- data/lib/vagrant/downloaders/base.rb +7 -5
- data/lib/vagrant/downloaders/file.rb +4 -4
- data/lib/vagrant/downloaders/http.rb +4 -5
- data/lib/vagrant/driver/virtualbox.rb +121 -0
- data/lib/vagrant/driver/virtualbox_4_0.rb +411 -0
- data/lib/vagrant/driver/virtualbox_4_1.rb +411 -0
- data/lib/vagrant/driver/virtualbox_base.rb +284 -0
- data/lib/vagrant/driver.rb +7 -0
- data/lib/vagrant/environment.rb +221 -240
- data/lib/vagrant/errors.rb +74 -25
- data/lib/vagrant/guest/arch.rb +48 -0
- data/lib/vagrant/{systems → guest}/base.rb +30 -18
- data/lib/vagrant/guest/debian.rb +61 -0
- data/lib/vagrant/{systems → guest}/freebsd.rb +11 -18
- data/lib/vagrant/guest/gentoo.rb +32 -0
- data/lib/vagrant/{systems → guest}/linux/config.rb +2 -4
- data/lib/vagrant/guest/linux/error.rb +9 -0
- data/lib/vagrant/guest/linux.rb +78 -0
- data/lib/vagrant/guest/redhat.rb +66 -0
- data/lib/vagrant/guest/solaris.rb +114 -0
- data/lib/vagrant/{systems → guest}/suse.rb +2 -2
- data/lib/vagrant/guest/ubuntu.rb +23 -0
- data/lib/vagrant/guest.rb +16 -0
- data/lib/vagrant/hosts/arch.rb +7 -3
- data/lib/vagrant/hosts/base.rb +36 -46
- data/lib/vagrant/hosts/bsd.rb +53 -16
- data/lib/vagrant/hosts/fedora.rb +14 -0
- data/lib/vagrant/hosts/freebsd.rb +6 -36
- data/lib/vagrant/hosts/linux.rb +45 -20
- data/lib/vagrant/hosts/windows.rb +16 -0
- data/lib/vagrant/hosts.rb +23 -6
- data/lib/vagrant/provisioners/base.rb +11 -34
- data/lib/vagrant/provisioners/chef.rb +30 -26
- data/lib/vagrant/provisioners/chef_client.rb +37 -23
- data/lib/vagrant/provisioners/chef_solo.rb +61 -16
- data/lib/vagrant/provisioners/puppet.rb +70 -38
- data/lib/vagrant/provisioners/puppet_server.rb +12 -13
- data/lib/vagrant/provisioners/shell.rb +24 -24
- data/lib/vagrant/provisioners.rb +10 -7
- data/lib/vagrant/registry.rb +49 -0
- data/lib/vagrant/ssh.rb +82 -153
- data/lib/vagrant/ui.rb +118 -50
- data/lib/vagrant/util/busy.rb +1 -1
- data/lib/vagrant/util/file_mode.rb +12 -0
- data/lib/vagrant/util/network_ip.rb +28 -0
- data/lib/vagrant/util/platform.rb +1 -0
- data/lib/vagrant/util/subprocess.rb +227 -0
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +111 -97
- data/lib/vagrant.rb +132 -5
- data/tasks/acceptance.rake +3 -3
- data/tasks/test.rake +7 -2
- data/templates/commands/init/Vagrantfile.erb +11 -4
- data/templates/{ssh_config.erb → commands/ssh_config/config.erb} +0 -0
- data/templates/guests/arch/network_dhcp.erb +7 -0
- data/templates/guests/arch/network_static.erb +7 -0
- data/templates/guests/debian/network_dhcp.erb +6 -0
- data/templates/guests/debian/network_static.erb +7 -0
- data/templates/guests/gentoo/network_dhcp.erb +4 -0
- data/templates/guests/gentoo/network_static.erb +4 -0
- data/templates/guests/redhat/network_dhcp.erb +6 -0
- data/templates/guests/redhat/network_static.erb +7 -0
- data/templates/locales/en.yml +241 -122
- data/templates/{chef_server_client.erb → provisioners/chef_client/client.erb} +0 -0
- data/templates/{chef_solo_solo.erb → provisioners/chef_solo/solo.erb} +0 -0
- data/test/acceptance/base.rb +10 -10
- data/test/acceptance/box_test.rb +28 -6
- data/test/acceptance/destroy_test.rb +1 -1
- data/test/acceptance/halt_test.rb +4 -4
- data/test/acceptance/init_test.rb +3 -3
- data/test/acceptance/networking/host_only_test.rb +37 -0
- data/test/acceptance/networking/port_forward_test.rb +125 -0
- data/test/acceptance/package_test.rb +46 -0
- data/test/acceptance/provisioning/basic_test.rb +61 -0
- data/test/acceptance/provisioning/chef_solo_test.rb +37 -0
- data/test/acceptance/provisioning/shell_test.rb +53 -0
- data/test/acceptance/resume_test.rb +1 -1
- data/test/acceptance/skeletons/chef_solo_basic/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/skeletons/chef_solo_json/README.md +3 -0
- data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +6 -0
- data/test/acceptance/skeletons/provisioner_multi/README.md +3 -0
- data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +5 -0
- data/test/acceptance/ssh_test.rb +7 -2
- data/test/acceptance/support/config.rb +1 -1
- data/test/acceptance/support/isolated_environment.rb +41 -150
- data/test/acceptance/support/matchers/match_output.rb +1 -1
- data/test/acceptance/support/matchers/succeed.rb +14 -0
- data/test/acceptance/support/network_tests.rb +29 -0
- data/test/acceptance/support/output.rb +9 -1
- data/test/acceptance/support/shared/base_context.rb +16 -9
- data/test/acceptance/support/shared/command_examples.rb +4 -4
- data/test/acceptance/suspend_test.rb +1 -1
- data/test/acceptance/up_basic_test.rb +26 -7
- data/test/acceptance/up_with_box_url.rb +1 -1
- data/test/acceptance/vagrant_test.rb +1 -1
- data/test/acceptance/version_test.rb +0 -5
- data/test/support/isolated_environment.rb +46 -0
- data/test/{acceptance/support → support}/tempdir.rb +0 -0
- data/test/unit/base.rb +21 -0
- data/test/unit/support/isolated_environment.rb +39 -0
- data/test/unit/support/shared/base_context.rb +30 -0
- data/test/unit/vagrant/action/builder_test.rb +126 -177
- data/test/unit/vagrant/action/environment_test.rb +10 -21
- data/test/unit/vagrant/action/runner_test.rb +65 -0
- data/test/unit/vagrant/action/warden_test.rb +64 -97
- data/test/unit/vagrant/box_collection_test.rb +44 -33
- data/test/unit/vagrant/box_test.rb +25 -65
- data/test/unit/vagrant/command/base_test.rb +141 -14
- data/test/unit/vagrant/config/base_test.rb +16 -43
- data/test/unit/vagrant/config/loader_test.rb +79 -0
- data/test/unit/vagrant/config/top_test.rb +69 -0
- data/test/unit/vagrant/config/vm_test.rb +62 -47
- data/test/unit/vagrant/config_test.rb +16 -151
- data/test/unit/vagrant/data_store_test.rb +43 -61
- data/test/unit/vagrant/downloaders/base_test.rb +12 -22
- data/test/unit/vagrant/downloaders/file_test.rb +58 -31
- data/test/unit/vagrant/downloaders/http_test.rb +12 -86
- data/test/unit/vagrant/environment_test.rb +107 -536
- data/test/unit/vagrant/hosts_test.rb +36 -0
- data/test/unit/vagrant/registry_test.rb +56 -0
- data/test/unit/vagrant/util/file_checksum_test.rb +23 -0
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +23 -24
- data/test/unit/vagrant/util/network_ip_test.rb +17 -0
- data/test/unit/vagrant/util/retryable_test.rb +90 -34
- data/test/unit/vagrant_test.rb +27 -0
- data/test/{unit → unit_legacy}/locales/en.yml +0 -0
- data/test/{unit → unit_legacy}/test_helper.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/download_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/unpackage_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/box/verify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/env/set_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/general/validate_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/boot_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_accessible_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_box_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/check_guest_additions_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clean_machine_folder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_nfs_exports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/clear_shared_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/customize_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/discard_state_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/export_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/forward_ports_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/halt_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/host_name_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/import_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/match_mac_address_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/modify_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/network_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/nfs_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/package_vagrantfile_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provision_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/provisioner_cleanup_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/resume_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/share_folders_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action/vm/suspend_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/action_test.rb +0 -0
- data/test/unit_legacy/vagrant/box_collection_test.rb +45 -0
- data/test/unit_legacy/vagrant/box_test.rb +74 -0
- data/test/{unit → unit_legacy}/vagrant/cli_test.rb +0 -0
- data/test/unit_legacy/vagrant/command/base_test.rb +23 -0
- data/test/{unit → unit_legacy}/vagrant/command/group_base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/helpers_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/init_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/command/package_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/base_test.rb +52 -0
- data/test/{unit → unit_legacy}/vagrant/config/error_recorder_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vagrant_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/config/vm/provisioner_test.rb +0 -0
- data/test/unit_legacy/vagrant/config/vm_test.rb +47 -0
- data/test/unit_legacy/vagrant/config_test.rb +148 -0
- data/test/unit_legacy/vagrant/downloaders/http_test.rb +93 -0
- data/test/unit_legacy/vagrant/environment_test.rb +539 -0
- data/test/{unit → unit_legacy}/vagrant/errors_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/bsd_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/hosts/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/plugin_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_client_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_solo_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/chef_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_server_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/puppet_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/provisioners/shell_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh/session_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/ssh_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/base_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/systems/linux_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/busy_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/counter_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/platform_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/stacked_proc_runner_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/util/template_renderer_test.rb +0 -0
- data/test/{unit → unit_legacy}/vagrant/vm_test.rb +0 -0
- data/vagrant.gemspec +7 -9
- metadata +183 -179
- data/keys/vagrant.ppk +0 -26
- data/lib/vagrant/action/box.rb +0 -11
- data/lib/vagrant/action/env.rb +0 -7
- data/lib/vagrant/action/general.rb +0 -8
- data/lib/vagrant/action/vm/forward_ports_helpers.rb +0 -28
- data/lib/vagrant/action/vm/modify.rb +0 -37
- data/lib/vagrant/action/vm/nfs_helpers.rb +0 -11
- data/lib/vagrant/action/vm.rb +0 -34
- data/lib/vagrant/command/group_base.rb +0 -107
- data/lib/vagrant/command/helpers.rb +0 -33
- data/lib/vagrant/command/named_base.rb +0 -14
- data/lib/vagrant/command/upgrade_to_060.rb +0 -45
- data/lib/vagrant/command/version.rb +0 -13
- data/lib/vagrant/ssh/session.rb +0 -136
- data/lib/vagrant/systems/arch.rb +0 -34
- data/lib/vagrant/systems/debian.rb +0 -36
- data/lib/vagrant/systems/gentoo.rb +0 -27
- data/lib/vagrant/systems/linux/error.rb +0 -9
- data/lib/vagrant/systems/linux.rb +0 -82
- data/lib/vagrant/systems/redhat.rb +0 -48
- data/lib/vagrant/systems/solaris.rb +0 -113
- data/lib/vagrant/systems/ubuntu.rb +0 -17
- data/lib/vagrant/systems.rb +0 -13
- data/templates/network_entry_arch.erb +0 -9
- data/templates/network_entry_debian.erb +0 -8
- data/templates/network_entry_gentoo.erb +0 -5
- data/templates/network_entry_redhat.erb +0 -9
- data/test/unit/vagrant/ui_test.rb +0 -29
@@ -1,56 +1,71 @@
|
|
1
|
-
require "
|
1
|
+
require File.expand_path("../../../base", __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
@username = "mitchellh"
|
3
|
+
describe Vagrant::Config::VMConfig do
|
4
|
+
include_context "unit"
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
it "merges by appending forwarded ports" do
|
7
|
+
a = described_class.new
|
8
|
+
a.forward_port 80, 8080
|
9
|
+
|
10
|
+
b = described_class.new
|
11
|
+
b.forward_port 100, 1000
|
12
|
+
|
13
|
+
c = a.merge(b)
|
14
|
+
c.forwarded_ports.length.should == 2
|
15
|
+
c.forwarded_ports[0][:guestport].should == 80
|
16
|
+
c.forwarded_ports[0][:hostport].should == 8080
|
17
|
+
c.forwarded_ports[1][:guestport].should == 100
|
18
|
+
c.forwarded_ports[1][:hostport].should == 1000
|
10
19
|
end
|
11
20
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
assert @config.defined_vms[:name].options[:set]
|
25
|
-
end
|
26
|
-
|
27
|
-
should "not have multi-VMs by default" do
|
28
|
-
assert !@config.has_multi_vms?
|
29
|
-
end
|
30
|
-
|
31
|
-
should "have multi-VMs once one is specified" do
|
32
|
-
@config.define(:foo) {}
|
33
|
-
assert @config.has_multi_vms?
|
34
|
-
end
|
35
|
-
|
36
|
-
should "retain vm definition order" do
|
37
|
-
@config.define(:a) {}
|
38
|
-
@config.define(:b) {}
|
39
|
-
@config.define(:c) {}
|
40
|
-
|
41
|
-
assert_equal [:a, :b, :c], @config.defined_vm_keys
|
42
|
-
end
|
21
|
+
it "merges by merging shared folders" do
|
22
|
+
a = described_class.new
|
23
|
+
a.share_folder "a", "/guest", "/host"
|
24
|
+
a.share_folder "b", "/guest", "/host"
|
25
|
+
|
26
|
+
b = described_class.new
|
27
|
+
b.share_folder "c", "/guest", "/host"
|
28
|
+
|
29
|
+
c = a.merge(b)
|
30
|
+
c.shared_folders.has_key?("a").should be
|
31
|
+
c.shared_folders.has_key?("b").should be
|
32
|
+
c.shared_folders.has_key?("c").should be
|
43
33
|
end
|
44
34
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
35
|
+
it "merges by appending networks" do
|
36
|
+
a = described_class.new
|
37
|
+
a.network :hostonly, "33.33.33.10"
|
38
|
+
|
39
|
+
b = described_class.new
|
40
|
+
b.network :hostonly, "33.33.33.11"
|
41
|
+
|
42
|
+
c = a.merge(b)
|
43
|
+
c.networks.length.should == 2
|
44
|
+
c.networks[0].should == [:hostonly, ["33.33.33.10"]]
|
45
|
+
c.networks[1].should == [:hostonly, ["33.33.33.11"]]
|
46
|
+
end
|
47
|
+
|
48
|
+
it "merges by appending provisioners" do
|
49
|
+
a = described_class.new
|
50
|
+
a.provision :foo
|
51
|
+
|
52
|
+
b = described_class.new
|
53
|
+
b.provision :bar
|
54
|
+
|
55
|
+
c = a.merge(b)
|
56
|
+
c.provisioners.length.should == 2
|
57
|
+
c.provisioners[0].shortcut.should == :foo
|
58
|
+
c.provisioners[1].shortcut.should == :bar
|
59
|
+
end
|
60
|
+
|
61
|
+
it "merges by appending customizations" do
|
62
|
+
a = described_class.new
|
63
|
+
a.customize "a"
|
64
|
+
|
65
|
+
b = described_class.new
|
66
|
+
b.customize "b"
|
49
67
|
|
50
|
-
|
51
|
-
|
52
|
-
@config.customize(&proc)
|
53
|
-
assert @config.proc_stack.include?(proc)
|
54
|
-
end
|
68
|
+
c = a.merge(b)
|
69
|
+
c.customizations.should == ["a", "b"]
|
55
70
|
end
|
56
71
|
end
|
@@ -1,162 +1,27 @@
|
|
1
|
-
require "
|
1
|
+
require File.expand_path("../../base", __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
context "with the class" do
|
9
|
-
should "allow access to the last proc" do
|
10
|
-
foo = mock("object")
|
11
|
-
foo.expects(:call).once
|
12
|
-
|
13
|
-
@klass.run { |config| foo.call }
|
14
|
-
value = @klass.last_proc.first
|
15
|
-
assert value.is_a?(Proc)
|
16
|
-
value.call(nil)
|
17
|
-
|
18
|
-
assert @klass.last_proc.nil?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "with an instance" do
|
23
|
-
setup do
|
24
|
-
@instance = @klass.new
|
25
|
-
end
|
26
|
-
|
27
|
-
should "load the config files in the given order" do
|
28
|
-
names = %w{alpha beta gamma}
|
29
|
-
|
30
|
-
@instance.load_order = [:alpha, :beta]
|
31
|
-
|
32
|
-
names.each do |name|
|
33
|
-
vagrantfile(vagrant_box(name), "config.vm.box = '#{name}'")
|
34
|
-
@instance.set(name.to_sym, vagrant_box(name).join("Vagrantfile"))
|
35
|
-
end
|
36
|
-
|
37
|
-
config = @instance.load(nil)
|
38
|
-
assert_equal "beta", config.vm.box
|
39
|
-
end
|
40
|
-
|
41
|
-
should "load the config as procs" do
|
42
|
-
@instance.set(:proc, Proc.new { |config| config.vm.box = "proc" })
|
43
|
-
@instance.load_order = [:proc]
|
44
|
-
config = @instance.load(nil)
|
45
|
-
|
46
|
-
assert_equal "proc", config.vm.box
|
47
|
-
end
|
48
|
-
|
49
|
-
should "load an array of procs" do
|
50
|
-
@instance.set(:proc, [Proc.new { |config| config.vm.box = "proc" },
|
51
|
-
Proc.new { |config| config.vm.box = "proc2" }])
|
52
|
-
@instance.load_order = [:proc]
|
53
|
-
config = @instance.load(nil)
|
54
|
-
|
55
|
-
assert_equal "proc2", config.vm.box
|
56
|
-
end
|
57
|
-
|
58
|
-
should "not care if a file doesn't exist" do
|
59
|
-
@instance.load_order = [:foo]
|
60
|
-
assert_nothing_raised { @instance.set(:foo, "i/dont/exist") }
|
61
|
-
assert_nothing_raised { @instance.load(nil) }
|
62
|
-
end
|
63
|
-
|
64
|
-
should "not reload a file" do
|
65
|
-
foo_path = vagrant_box("foo").join("Vagrantfile")
|
66
|
-
|
67
|
-
vagrantfile(vagrant_box("foo"))
|
68
|
-
@instance.set(:foo, foo_path)
|
69
|
-
|
70
|
-
# Nothing should be raised in this case because the file isn't reloaded
|
71
|
-
vagrantfile(vagrant_box("foo"), "^%&8318")
|
72
|
-
assert_nothing_raised { @instance.set(:foo, foo_path) }
|
73
|
-
end
|
74
|
-
|
75
|
-
should "raise an exception if there is a syntax error in a file" do
|
76
|
-
vagrantfile(vagrant_box("foo"), "^%&8318")
|
77
|
-
|
78
|
-
assert_raises(Vagrant::Errors::VagrantfileSyntaxError) {
|
79
|
-
@instance.set(:foo, vagrant_box("foo").join("Vagrantfile"))
|
80
|
-
}
|
3
|
+
describe Vagrant::Config do
|
4
|
+
it "should not execute the proc on configuration" do
|
5
|
+
described_class.run do
|
6
|
+
raise Exception, "Failure."
|
81
7
|
end
|
82
8
|
end
|
83
9
|
|
84
|
-
|
85
|
-
|
86
|
-
@configures_list = {}
|
87
|
-
@klass::Top.stubs(:configures_list).returns(@configures_list)
|
88
|
-
end
|
89
|
-
|
90
|
-
context "adding configure keys" do
|
91
|
-
setup do
|
92
|
-
@key = "top_config_foo"
|
93
|
-
@config_klass = mock("klass")
|
94
|
-
end
|
10
|
+
it "should capture configuration procs" do
|
11
|
+
receiver = double()
|
95
12
|
|
96
|
-
|
97
|
-
|
98
|
-
|
13
|
+
procs = described_class.capture_configures do
|
14
|
+
described_class.run do
|
15
|
+
receiver.hello!
|
99
16
|
end
|
100
17
|
end
|
101
18
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
should "initialize each configurer and set it to its key" do
|
108
|
-
env = mock('env')
|
109
|
-
|
110
|
-
5.times do |i|
|
111
|
-
key = "key#{i}"
|
112
|
-
klass = mock("klass#{i}")
|
113
|
-
instance = mock("instance#{i}")
|
114
|
-
instance.expects(:top=).with() do |top|
|
115
|
-
assert top.is_a?(@klass::Top)
|
116
|
-
true
|
117
|
-
end
|
118
|
-
klass.expects(:new).returns(instance)
|
119
|
-
@configures_list[key] = klass
|
120
|
-
end
|
19
|
+
# Verify the structure of the result
|
20
|
+
procs.should be_kind_of(Array)
|
21
|
+
procs.length.should == 1
|
121
22
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
should "allow reading via methods" do
|
126
|
-
key = "my_foo_bar_key"
|
127
|
-
klass = mock("klass")
|
128
|
-
instance = mock("instance")
|
129
|
-
instance.stubs(:top=)
|
130
|
-
klass.expects(:new).returns(instance)
|
131
|
-
@klass::Top.configures(key, klass)
|
132
|
-
|
133
|
-
config = @klass::Top.new
|
134
|
-
assert_equal instance, config.send(key)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
context "validation" do
|
139
|
-
should "do nothing if no errors are added" do
|
140
|
-
valid_class = Class.new(@klass::Base)
|
141
|
-
@klass::Top.configures(:subconfig, valid_class)
|
142
|
-
instance = @klass::Top.new
|
143
|
-
assert_nothing_raised { instance.validate! }
|
144
|
-
end
|
145
|
-
|
146
|
-
should "raise an exception if there are errors" do
|
147
|
-
invalid_class = Class.new(@klass::Base) do
|
148
|
-
def validate(errors)
|
149
|
-
errors.add("vagrant.test.errors.test_key")
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
@klass::Top.configures(:subconfig, invalid_class)
|
154
|
-
instance = @klass::Top.new
|
155
|
-
|
156
|
-
assert_raises(Vagrant::Errors::ConfigValidationFailed) {
|
157
|
-
instance.validate!
|
158
|
-
}
|
159
|
-
end
|
160
|
-
end
|
23
|
+
# Verify that the proper proc was captured
|
24
|
+
receiver.should_receive(:hello!).once
|
25
|
+
procs[0].call
|
161
26
|
end
|
162
27
|
end
|
@@ -1,85 +1,67 @@
|
|
1
|
-
require "
|
2
|
-
require "test_helper"
|
1
|
+
require File.expand_path("../../base", __FILE__)
|
3
2
|
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@klass = Vagrant::DataStore
|
7
|
-
@initial_data = { "foo" => "bar" }
|
8
|
-
@db_file = File.join(tmp_path, "data_store_test")
|
9
|
-
File.open(@db_file, "w") { |f| f.write(@initial_data.to_json) }
|
3
|
+
require 'pathname'
|
10
4
|
|
11
|
-
|
12
|
-
|
5
|
+
describe Vagrant::DataStore do
|
6
|
+
include_context "unit"
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
let(:db_file) do
|
9
|
+
# We create a tempfile and force an explicit close/unlink
|
10
|
+
# but save the path so that we can re-use it multiple times
|
11
|
+
temp = Tempfile.new("vagrant")
|
12
|
+
result = Pathname.new(temp.path)
|
13
|
+
temp.close
|
14
|
+
temp.unlink
|
17
15
|
|
18
|
-
|
19
|
-
file = tmp_path.join("data_store_folder_test")
|
20
|
-
FileUtils.mkdir_p(file)
|
21
|
-
assert_raises (Vagrant::Errors::DotfileIsDirectory) {
|
22
|
-
@klass.new(file)
|
23
|
-
}
|
16
|
+
result
|
24
17
|
end
|
25
18
|
|
26
|
-
|
27
|
-
file = tmp_path.join("data_store_empty_test")
|
28
|
-
File.open(file, "w") { |f| f.write("") }
|
19
|
+
let(:instance) { described_class.new(db_file) }
|
29
20
|
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
it "initializes a new DB file" do
|
22
|
+
instance[:data] = true
|
23
|
+
instance.commit
|
24
|
+
instance[:data].should == true
|
33
25
|
|
34
|
-
|
35
|
-
|
26
|
+
test = described_class.new(db_file)
|
27
|
+
test[:data].should == true
|
36
28
|
end
|
37
29
|
|
38
|
-
|
39
|
-
|
30
|
+
it "initializes empty if the file contains invalid data" do
|
31
|
+
db_file.open("w+") { |f| f.write("NOPE!") }
|
32
|
+
described_class.new(db_file).should be_empty
|
40
33
|
end
|
41
34
|
|
42
|
-
|
43
|
-
|
35
|
+
it "initializes empty if the file doesn't exist" do
|
36
|
+
described_class.new("NOPENOPENOPENOPENPEPEPEPE").should be_empty
|
44
37
|
end
|
45
38
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
@instance = @klass.new(@db_file)
|
50
|
-
assert_equal "yay", @instance[:bar]["baz"]
|
51
|
-
end
|
39
|
+
it "raises an error if the path given is a directory" do
|
40
|
+
db_file.delete if db_file.exist?
|
41
|
+
db_file.mkdir
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
assert_equal "changed", @instance[:foo]
|
56
|
-
assert_equal @initial_data["foo"], @klass.new(@db_file)["foo"]
|
43
|
+
expect { described_class.new(db_file) }.
|
44
|
+
to raise_error(Vagrant::Errors::DotfileIsDirectory)
|
57
45
|
end
|
58
46
|
|
59
|
-
|
60
|
-
|
61
|
-
|
47
|
+
it "cleans nil and empties when committing" do
|
48
|
+
instance[:data] = { :bar => nil }
|
49
|
+
instance[:another] = {}
|
50
|
+
instance.commit
|
62
51
|
|
63
|
-
|
52
|
+
# The instance is now empty because the data was nil
|
53
|
+
instance.should be_empty
|
64
54
|
end
|
65
55
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
assert File.exist?(@db_file)
|
70
|
-
|
71
|
-
@instance.clear
|
72
|
-
assert @instance.empty?
|
73
|
-
@instance.commit
|
74
|
-
assert !File.exist?(@db_file)
|
75
|
-
end
|
56
|
+
it "deletes the data file if the store is empty when saving" do
|
57
|
+
instance[:data] = true
|
58
|
+
instance.commit
|
76
59
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
@instance.commit
|
60
|
+
another = described_class.new(db_file)
|
61
|
+
another[:data] = nil
|
62
|
+
another.commit
|
81
63
|
|
82
|
-
|
83
|
-
|
64
|
+
# The file should no longer exist
|
65
|
+
db_file.should_not be_exist
|
84
66
|
end
|
85
67
|
end
|
@@ -1,28 +1,18 @@
|
|
1
|
-
require "
|
1
|
+
require File.expand_path("../../../base", __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
3
|
+
describe Vagrant::Downloaders::Base do
|
4
|
+
let(:ui) { double("ui") }
|
5
|
+
let(:instance) { described_class.new(ui) }
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
@base = Vagrant::Downloaders::Base.new(@env)
|
12
|
-
end
|
7
|
+
it "should not match anything by default" do
|
8
|
+
described_class.match?("foo").should_not be
|
9
|
+
end
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
@base.prepare("source")
|
18
|
-
end
|
19
|
-
end
|
11
|
+
it "should implement `prepare`" do
|
12
|
+
instance.prepare("foo").should be_nil
|
13
|
+
end
|
20
14
|
|
21
|
-
|
22
|
-
|
23
|
-
assert @base.respond_to?(:download!)
|
24
|
-
@base.download!("source", "destination")
|
25
|
-
end
|
26
|
-
end
|
15
|
+
it "should implement `download!`" do
|
16
|
+
instance.download!("foo", "bar").should be_nil
|
27
17
|
end
|
28
18
|
end
|
@@ -1,48 +1,75 @@
|
|
1
|
-
require "
|
1
|
+
require File.expand_path("../../../base", __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
setup do
|
5
|
-
@downloader, @tempfile = vagrant_mock_downloader(Vagrant::Downloaders::File)
|
6
|
-
@uri = "foo.box"
|
7
|
-
end
|
3
|
+
require "tempfile"
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
describe Vagrant::Downloaders::File do
|
6
|
+
let(:ui) { double("ui") }
|
7
|
+
let(:instance) { described_class.new(ui) }
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
describe "matching" do
|
10
|
+
it "should match an existing file" do
|
11
|
+
described_class.match?(__FILE__).should be
|
16
12
|
end
|
17
|
-
end
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
clean_paths
|
14
|
+
it "should not match non-existent files" do
|
15
|
+
described_class.match?(File.join(__FILE__, "nowaywaywaywayayway")).should_not be
|
22
16
|
end
|
23
17
|
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
it "should match files where the path needs to be expanded" do
|
19
|
+
old_home = ENV["HOME"]
|
20
|
+
begin
|
21
|
+
# Create a temporary file
|
22
|
+
temp = Tempfile.new("vagrant")
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
# Set our home directory to be this directory so we can use
|
25
|
+
# "~" paths
|
26
|
+
ENV["HOME"] = File.dirname(temp.path)
|
27
|
+
|
28
|
+
# Test that we can find the temp file
|
29
|
+
described_class.match?("~/#{File.basename(temp.path)}").should be
|
30
|
+
ensure
|
31
|
+
ENV["HOME"] = old_home
|
32
32
|
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "preparing" do
|
37
|
+
it "should raise an exception if the file does not exist" do
|
38
|
+
path = File.join(__FILE__, "nopenopenope")
|
39
|
+
File.exist?(path).should_not be
|
40
|
+
|
41
|
+
expect { instance.prepare(path) }.to raise_error(Vagrant::Errors::DownloaderFileDoesntExist)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should raise an exception if the file is a directory" do
|
45
|
+
path = File.dirname(__FILE__)
|
46
|
+
File.should be_directory(path)
|
47
|
+
|
48
|
+
expect { instance.prepare(path) }.to raise_error(Vagrant::Errors::DownloaderFileDoesntExist)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should find files that use shell expansions" do
|
52
|
+
old_home = ENV["HOME"]
|
53
|
+
begin
|
54
|
+
# Create a temporary file
|
55
|
+
temp = Tempfile.new("vagrant")
|
56
|
+
|
57
|
+
# Set our home directory to be this directory so we can use
|
58
|
+
# "~" paths
|
59
|
+
ENV["HOME"] = File.dirname(temp.path)
|
33
60
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
61
|
+
# Test that we can find the temp file
|
62
|
+
expect { instance.prepare("~/#{File.basename(temp.path)}") }.
|
63
|
+
to_not raise_error
|
64
|
+
ensure
|
65
|
+
ENV["HOME"] = old_home
|
38
66
|
end
|
39
67
|
end
|
40
68
|
end
|
41
69
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
assert Vagrant::Downloaders::File.match?('foo')
|
70
|
+
describe "downloading" do
|
71
|
+
it "should copy the source to the destination" do
|
72
|
+
pending "setup paths"
|
46
73
|
end
|
47
74
|
end
|
48
75
|
end
|