vagrant 1.0.7 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -43
- data/Gemfile +2 -1
- data/LICENSE.txt +22 -0
- data/README.md +3 -90
- data/Rakefile +1 -18
- data/bin/vagrant +2 -58
- data/message.txt +17 -0
- data/vagrant.gemspec +20 -69
- metadata +43 -655
- data/.yardopts +0 -1
- data/CHANGELOG.md +0 -723
- data/LICENSE +0 -21
- data/config/default.rb +0 -30
- data/contrib/README.md +0 -12
- data/contrib/emacs/vagrant.el +0 -8
- data/contrib/vim/vagrantfile.vim +0 -9
- data/keys/README.md +0 -17
- data/keys/vagrant +0 -27
- data/keys/vagrant.pub +0 -1
- data/lib/vagrant.rb +0 -197
- data/lib/vagrant/action.rb +0 -63
- data/lib/vagrant/action/box/destroy.rb +0 -25
- data/lib/vagrant/action/box/download.rb +0 -84
- data/lib/vagrant/action/box/package.rb +0 -19
- data/lib/vagrant/action/box/unpackage.rb +0 -61
- data/lib/vagrant/action/box/verify.rb +0 -23
- data/lib/vagrant/action/builder.rb +0 -128
- data/lib/vagrant/action/builtin.rb +0 -171
- data/lib/vagrant/action/env/set.rb +0 -21
- data/lib/vagrant/action/environment.rb +0 -12
- data/lib/vagrant/action/general/check_virtualbox.rb +0 -28
- data/lib/vagrant/action/general/package.rb +0 -101
- data/lib/vagrant/action/general/validate.rb +0 -18
- data/lib/vagrant/action/runner.rb +0 -53
- data/lib/vagrant/action/vm/boot.rb +0 -53
- data/lib/vagrant/action/vm/check_accessible.rb +0 -23
- data/lib/vagrant/action/vm/check_box.rb +0 -33
- data/lib/vagrant/action/vm/check_guest_additions.rb +0 -38
- data/lib/vagrant/action/vm/check_port_collisions.rb +0 -89
- data/lib/vagrant/action/vm/clean_machine_folder.rb +0 -43
- data/lib/vagrant/action/vm/clear_forwarded_ports.rb +0 -18
- data/lib/vagrant/action/vm/clear_network_interfaces.rb +0 -31
- data/lib/vagrant/action/vm/clear_shared_folders.rb +0 -18
- data/lib/vagrant/action/vm/customize.rb +0 -36
- data/lib/vagrant/action/vm/default_name.rb +0 -22
- data/lib/vagrant/action/vm/destroy.rb +0 -19
- data/lib/vagrant/action/vm/destroy_unused_network_interfaces.rb +0 -20
- data/lib/vagrant/action/vm/discard_state.rb +0 -22
- data/lib/vagrant/action/vm/export.rb +0 -57
- data/lib/vagrant/action/vm/forward_ports.rb +0 -92
- data/lib/vagrant/action/vm/halt.rb +0 -32
- data/lib/vagrant/action/vm/host_name.rb +0 -21
- data/lib/vagrant/action/vm/import.rb +0 -48
- data/lib/vagrant/action/vm/match_mac_address.rb +0 -21
- data/lib/vagrant/action/vm/network.rb +0 -403
- data/lib/vagrant/action/vm/nfs.rb +0 -196
- data/lib/vagrant/action/vm/package.rb +0 -23
- data/lib/vagrant/action/vm/package_vagrantfile.rb +0 -36
- data/lib/vagrant/action/vm/provision.rb +0 -61
- data/lib/vagrant/action/vm/provisioner_cleanup.rb +0 -26
- data/lib/vagrant/action/vm/prune_nfs_exports.rb +0 -20
- data/lib/vagrant/action/vm/resume.rb +0 -20
- data/lib/vagrant/action/vm/sane_defaults.rb +0 -78
- data/lib/vagrant/action/vm/setup_package_files.rb +0 -54
- data/lib/vagrant/action/vm/share_folders.rb +0 -114
- data/lib/vagrant/action/vm/suspend.rb +0 -20
- data/lib/vagrant/action/warden.rb +0 -92
- data/lib/vagrant/box.rb +0 -44
- data/lib/vagrant/box_collection.rb +0 -58
- data/lib/vagrant/cli.rb +0 -76
- data/lib/vagrant/command.rb +0 -24
- data/lib/vagrant/command/base.rb +0 -167
- data/lib/vagrant/command/box.rb +0 -58
- data/lib/vagrant/command/box_add.rb +0 -37
- data/lib/vagrant/command/box_list.rb +0 -28
- data/lib/vagrant/command/box_remove.rb +0 -27
- data/lib/vagrant/command/box_repackage.rb +0 -27
- data/lib/vagrant/command/destroy.rb +0 -64
- data/lib/vagrant/command/gem.rb +0 -39
- data/lib/vagrant/command/halt.rb +0 -39
- data/lib/vagrant/command/init.rb +0 -40
- data/lib/vagrant/command/package.rb +0 -75
- data/lib/vagrant/command/provision.rb +0 -40
- data/lib/vagrant/command/reload.rb +0 -39
- data/lib/vagrant/command/resume.rb +0 -33
- data/lib/vagrant/command/ssh.rb +0 -90
- data/lib/vagrant/command/ssh_config.rb +0 -51
- data/lib/vagrant/command/start_mixins.rb +0 -26
- data/lib/vagrant/command/status.rb +0 -36
- data/lib/vagrant/command/suspend.rb +0 -33
- data/lib/vagrant/command/up.rb +0 -40
- data/lib/vagrant/communication.rb +0 -7
- data/lib/vagrant/communication/base.rb +0 -56
- data/lib/vagrant/communication/ssh.rb +0 -230
- data/lib/vagrant/config.rb +0 -49
- data/lib/vagrant/config/base.rb +0 -82
- data/lib/vagrant/config/container.rb +0 -37
- data/lib/vagrant/config/error_recorder.rb +0 -19
- data/lib/vagrant/config/loader.rb +0 -127
- data/lib/vagrant/config/nfs.rb +0 -8
- data/lib/vagrant/config/package.rb +0 -7
- data/lib/vagrant/config/ssh.rb +0 -27
- data/lib/vagrant/config/top.rb +0 -72
- data/lib/vagrant/config/vagrant.rb +0 -14
- data/lib/vagrant/config/vm.rb +0 -168
- data/lib/vagrant/config/vm/provisioner.rb +0 -52
- data/lib/vagrant/config/vm/sub_vm.rb +0 -17
- data/lib/vagrant/data_store.rb +0 -92
- data/lib/vagrant/downloaders.rb +0 -7
- data/lib/vagrant/downloaders/base.rb +0 -25
- data/lib/vagrant/downloaders/file.rb +0 -22
- data/lib/vagrant/downloaders/http.rb +0 -97
- data/lib/vagrant/driver.rb +0 -8
- data/lib/vagrant/driver/virtualbox.rb +0 -134
- data/lib/vagrant/driver/virtualbox_4_0.rb +0 -459
- data/lib/vagrant/driver/virtualbox_4_1.rb +0 -459
- data/lib/vagrant/driver/virtualbox_4_2.rb +0 -606
- data/lib/vagrant/driver/virtualbox_base.rb +0 -326
- data/lib/vagrant/environment.rb +0 -522
- data/lib/vagrant/errors.rb +0 -445
- data/lib/vagrant/guest.rb +0 -18
- data/lib/vagrant/guest/arch.rb +0 -56
- data/lib/vagrant/guest/base.rb +0 -99
- data/lib/vagrant/guest/debian.rb +0 -64
- data/lib/vagrant/guest/fedora.rb +0 -66
- data/lib/vagrant/guest/freebsd.rb +0 -86
- data/lib/vagrant/guest/gentoo.rb +0 -46
- data/lib/vagrant/guest/linux.rb +0 -118
- data/lib/vagrant/guest/linux/config.rb +0 -19
- data/lib/vagrant/guest/linux/error.rb +0 -9
- data/lib/vagrant/guest/openbsd.rb +0 -20
- data/lib/vagrant/guest/redhat.rb +0 -67
- data/lib/vagrant/guest/solaris.rb +0 -118
- data/lib/vagrant/guest/suse.rb +0 -17
- data/lib/vagrant/guest/ubuntu.rb +0 -23
- data/lib/vagrant/hosts.rb +0 -37
- data/lib/vagrant/hosts/arch.rb +0 -55
- data/lib/vagrant/hosts/base.rb +0 -66
- data/lib/vagrant/hosts/bsd.rb +0 -97
- data/lib/vagrant/hosts/fedora.rb +0 -47
- data/lib/vagrant/hosts/freebsd.rb +0 -41
- data/lib/vagrant/hosts/gentoo.rb +0 -20
- data/lib/vagrant/hosts/linux.rb +0 -94
- data/lib/vagrant/hosts/opensuse.rb +0 -30
- data/lib/vagrant/hosts/windows.rb +0 -16
- data/lib/vagrant/plugin.rb +0 -81
- data/lib/vagrant/provisioners.rb +0 -12
- data/lib/vagrant/provisioners/base.rb +0 -44
- data/lib/vagrant/provisioners/chef.rb +0 -168
- data/lib/vagrant/provisioners/chef_client.rb +0 -132
- data/lib/vagrant/provisioners/chef_solo.rb +0 -234
- data/lib/vagrant/provisioners/puppet.rb +0 -176
- data/lib/vagrant/provisioners/puppet_server.rb +0 -78
- data/lib/vagrant/provisioners/shell.rb +0 -103
- data/lib/vagrant/registry.rb +0 -52
- data/lib/vagrant/ssh.rb +0 -126
- data/lib/vagrant/test_helpers.rb +0 -154
- data/lib/vagrant/ui.rb +0 -168
- data/lib/vagrant/util.rb +0 -12
- data/lib/vagrant/util/ansi_escape_code_remover.rb +0 -34
- data/lib/vagrant/util/busy.rb +0 -59
- data/lib/vagrant/util/counter.rb +0 -24
- data/lib/vagrant/util/file_checksum.rb +0 -38
- data/lib/vagrant/util/file_mode.rb +0 -12
- data/lib/vagrant/util/hash_with_indifferent_access.rb +0 -63
- data/lib/vagrant/util/is_port_open.rb +0 -38
- data/lib/vagrant/util/line_ending_helpers.rb +0 -14
- data/lib/vagrant/util/network_ip.rb +0 -28
- data/lib/vagrant/util/platform.rb +0 -68
- data/lib/vagrant/util/retryable.rb +0 -25
- data/lib/vagrant/util/safe_exec.rb +0 -36
- data/lib/vagrant/util/safe_puts.rb +0 -31
- data/lib/vagrant/util/stacked_proc_runner.rb +0 -35
- data/lib/vagrant/util/subprocess.rb +0 -247
- data/lib/vagrant/util/template_renderer.rb +0 -83
- data/lib/vagrant/version.rb +0 -6
- data/lib/vagrant/vm.rb +0 -195
- data/tasks/acceptance.rake +0 -113
- data/tasks/bundler.rake +0 -3
- data/tasks/test.rake +0 -20
- data/templates/commands/init/Vagrantfile.erb +0 -99
- data/templates/commands/ssh_config/config.erb +0 -15
- data/templates/config/validation_failed.erb +0 -7
- data/templates/guests/arch/network_dhcp.erb +0 -7
- data/templates/guests/arch/network_static.erb +0 -7
- data/templates/guests/debian/network_dhcp.erb +0 -6
- data/templates/guests/debian/network_static.erb +0 -7
- data/templates/guests/fedora/network_dhcp.erb +0 -6
- data/templates/guests/fedora/network_static.erb +0 -13
- data/templates/guests/freebsd/network_dhcp.erb +0 -3
- data/templates/guests/freebsd/network_static.erb +0 -3
- data/templates/guests/gentoo/network_dhcp.erb +0 -4
- data/templates/guests/gentoo/network_static.erb +0 -4
- data/templates/guests/redhat/network_dhcp.erb +0 -6
- data/templates/guests/redhat/network_static.erb +0 -7
- data/templates/locales/en.yml +0 -759
- data/templates/nfs/exports.erb +0 -5
- data/templates/nfs/exports_freebsd.erb +0 -5
- data/templates/nfs/exports_linux.erb +0 -5
- data/templates/package_Vagrantfile.erb +0 -11
- data/templates/provisioners/chef_client/client.erb +0 -32
- data/templates/provisioners/chef_solo/solo.erb +0 -25
- data/test/acceptance/base.rb +0 -48
- data/test/acceptance/box_test.rb +0 -99
- data/test/acceptance/destroy_test.rb +0 -37
- data/test/acceptance/halt_test.rb +0 -72
- data/test/acceptance/init_test.rb +0 -33
- data/test/acceptance/networking/host_only_test.rb +0 -37
- data/test/acceptance/networking/port_forward_test.rb +0 -125
- data/test/acceptance/package_test.rb +0 -46
- data/test/acceptance/provisioning/basic_test.rb +0 -61
- data/test/acceptance/provisioning/chef_solo_test.rb +0 -37
- data/test/acceptance/provisioning/shell_test.rb +0 -53
- data/test/acceptance/resume_test.rb +0 -17
- data/test/acceptance/shared_folders_test.rb +0 -84
- data/test/acceptance/skeletons/chef_solo_basic/README.md +0 -3
- data/test/acceptance/skeletons/chef_solo_basic/cookbooks/basic/recipes/default.rb +0 -5
- data/test/acceptance/skeletons/chef_solo_json/README.md +0 -3
- data/test/acceptance/skeletons/chef_solo_json/cookbooks/basic/recipes/default.rb +0 -6
- data/test/acceptance/skeletons/provisioner_multi/README.md +0 -3
- data/test/acceptance/skeletons/provisioner_multi/cookbooks/basic/recipes/default.rb +0 -5
- data/test/acceptance/ssh_test.rb +0 -46
- data/test/acceptance/support/config.rb +0 -42
- data/test/acceptance/support/isolated_environment.rb +0 -117
- data/test/acceptance/support/matchers/have_color.rb +0 -9
- data/test/acceptance/support/matchers/match_output.rb +0 -14
- data/test/acceptance/support/matchers/succeed.rb +0 -14
- data/test/acceptance/support/network_tests.rb +0 -29
- data/test/acceptance/support/output.rb +0 -95
- data/test/acceptance/support/shared/base_context.rb +0 -72
- data/test/acceptance/support/shared/command_examples.rb +0 -33
- data/test/acceptance/support/virtualbox.rb +0 -36
- data/test/acceptance/suspend_test.rb +0 -56
- data/test/acceptance/up_basic_test.rb +0 -33
- data/test/acceptance/up_with_box_url.rb +0 -40
- data/test/acceptance/vagrant_test.rb +0 -47
- data/test/acceptance/version_test.rb +0 -15
- data/test/buildbot/README.md +0 -72
- data/test/buildbot/buildbot_config/__init__.py +0 -0
- data/test/buildbot/buildbot_config/config/__init__.py +0 -0
- data/test/buildbot/buildbot_config/config/loader.py +0 -24
- data/test/buildbot/buildbot_config/config/master.py +0 -24
- data/test/buildbot/buildbot_config/config/slave.py +0 -22
- data/test/buildbot/buildbot_config/master/__init__.py +0 -6
- data/test/buildbot/buildbot_config/master/builders.py +0 -78
- data/test/buildbot/buildbot_config/master/buildsteps.py +0 -100
- data/test/buildbot/buildbot_config/master/change_sources.py +0 -8
- data/test/buildbot/buildbot_config/master/schedulers.py +0 -32
- data/test/buildbot/buildbot_config/master/slaves.py +0 -60
- data/test/buildbot/buildbot_config/master/status.py +0 -52
- data/test/buildbot/master/Makefile.sample +0 -28
- data/test/buildbot/master/buildbot.tac +0 -36
- data/test/buildbot/master/master.cfg +0 -67
- data/test/buildbot/master/public_html/bg_gradient.jpg +0 -0
- data/test/buildbot/master/public_html/default.css +0 -545
- data/test/buildbot/master/public_html/favicon.ico +0 -0
- data/test/buildbot/master/public_html/robots.txt +0 -10
- data/test/buildbot/master/public_html/static/css/bootstrap-1.4.0.min.css +0 -356
- data/test/buildbot/master/public_html/static/css/prettify.css +0 -97
- data/test/buildbot/master/public_html/static/css/syntax.css +0 -60
- data/test/buildbot/master/public_html/static/css/vagrant.base.css +0 -205
- data/test/buildbot/master/public_html/static/images/base_box_mac.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/getting-started/success.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/icons/error.png +0 -0
- data/test/buildbot/master/public_html/static/images/vagrant_chilling.png +0 -0
- data/test/buildbot/master/public_html/static/images/vagrant_holding.png +0 -0
- data/test/buildbot/master/public_html/static/images/vagrant_looking.png +0 -0
- data/test/buildbot/master/public_html/static/images/windows/alter_path.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/edit_path.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/environment_variables_button.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/port_and_ppk_path.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/ppk_selection.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/putty_first_screen.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/save_result.jpg +0 -0
- data/test/buildbot/master/public_html/static/images/windows/vbox_manage_default_location.jpg +0 -0
- data/test/buildbot/master/public_html/static/js/bootstrap-tabs.js +0 -80
- data/test/buildbot/master/public_html/static/js/jquery-1.7.min.js +0 -4
- data/test/buildbot/master/templates/authfail.html +0 -9
- data/test/buildbot/master/templates/build.html +0 -205
- data/test/buildbot/master/templates/builder.html +0 -118
- data/test/buildbot/master/templates/builders.html +0 -33
- data/test/buildbot/master/templates/buildslave.html +0 -72
- data/test/buildbot/master/templates/buildslaves.html +0 -70
- data/test/buildbot/master/templates/change.html +0 -15
- data/test/buildbot/master/templates/layouts/base.html +0 -58
- data/test/buildbot/master/templates/macros/box.html +0 -37
- data/test/buildbot/master/templates/macros/build_line.html +0 -50
- data/test/buildbot/master/templates/macros/change.html +0 -81
- data/test/buildbot/master/templates/macros/forms.html +0 -300
- data/test/buildbot/master/templates/root.html +0 -42
- data/test/buildbot/master/templates/waterfall.html +0 -53
- data/test/buildbot/requirements.txt +0 -4
- data/test/buildbot/scripts/deploy.sh +0 -38
- data/test/buildbot/scripts/setup.sh +0 -107
- data/test/buildbot/slave/buildbot.tac +0 -43
- data/test/buildbot/slave/info/admin +0 -1
- data/test/buildbot/slave/info/host +0 -1
- data/test/buildbot/tests/__init__.py +0 -0
- data/test/buildbot/tests/master/__init__.py +0 -0
- data/test/buildbot/tests/master/test_slaves.py +0 -41
- data/test/buildbot/vendor/choices-0.4.0.tar.gz +0 -0
- data/test/config/acceptance_boxes.yml +0 -7
- data/test/support/isolated_environment.rb +0 -46
- data/test/support/tempdir.rb +0 -34
- data/test/unit/base.rb +0 -21
- data/test/unit/support/isolated_environment.rb +0 -47
- data/test/unit/support/shared/base_context.rb +0 -30
- data/test/unit/vagrant/action/builder_test.rb +0 -156
- data/test/unit/vagrant/action/environment_test.rb +0 -16
- data/test/unit/vagrant/action/runner_test.rb +0 -65
- data/test/unit/vagrant/action/warden_test.rb +0 -92
- data/test/unit/vagrant/box_collection_test.rb +0 -56
- data/test/unit/vagrant/box_test.rb +0 -34
- data/test/unit/vagrant/command/base_test.rb +0 -150
- data/test/unit/vagrant/config/base_test.rb +0 -48
- data/test/unit/vagrant/config/loader_test.rb +0 -79
- data/test/unit/vagrant/config/ssh_test.rb +0 -17
- data/test/unit/vagrant/config/top_test.rb +0 -69
- data/test/unit/vagrant/config/vm_test.rb +0 -71
- data/test/unit/vagrant/config_test.rb +0 -27
- data/test/unit/vagrant/data_store_test.rb +0 -79
- data/test/unit/vagrant/downloaders/base_test.rb +0 -18
- data/test/unit/vagrant/downloaders/file_test.rb +0 -75
- data/test/unit/vagrant/downloaders/http_test.rb +0 -19
- data/test/unit/vagrant/environment_test.rb +0 -220
- data/test/unit/vagrant/hosts_test.rb +0 -36
- data/test/unit/vagrant/registry_test.rb +0 -74
- data/test/unit/vagrant/util/ansi_escape_code_remover_test.rb +0 -16
- data/test/unit/vagrant/util/file_checksum_test.rb +0 -23
- data/test/unit/vagrant/util/hash_with_indifferent_access_test.rb +0 -38
- data/test/unit/vagrant/util/is_port_open_test.rb +0 -53
- data/test/unit/vagrant/util/line_endings_helper_test.rb +0 -16
- data/test/unit/vagrant/util/network_ip_test.rb +0 -17
- data/test/unit/vagrant/util/retryable_test.rb +0 -106
- data/test/unit/vagrant_test.rb +0 -27
- data/test/unit_legacy/locales/en.yml +0 -8
- data/test/unit_legacy/test_helper.rb +0 -32
- data/test/unit_legacy/vagrant/action/box/destroy_test.rb +0 -18
- data/test/unit_legacy/vagrant/action/box/download_test.rb +0 -125
- data/test/unit_legacy/vagrant/action/box/package_test.rb +0 -25
- data/test/unit_legacy/vagrant/action/box/unpackage_test.rb +0 -84
- data/test/unit_legacy/vagrant/action/box/verify_test.rb +0 -30
- data/test/unit_legacy/vagrant/action/env/set_test.rb +0 -24
- data/test/unit_legacy/vagrant/action/general/package_test.rb +0 -268
- data/test/unit_legacy/vagrant/action/general/validate_test.rb +0 -31
- data/test/unit_legacy/vagrant/action/vm/boot_test.rb +0 -66
- data/test/unit_legacy/vagrant/action/vm/check_accessible_test.rb +0 -61
- data/test/unit_legacy/vagrant/action/vm/check_box_test.rb +0 -61
- data/test/unit_legacy/vagrant/action/vm/check_guest_additions_test.rb +0 -9
- data/test/unit_legacy/vagrant/action/vm/clean_machine_folder_test.rb +0 -84
- data/test/unit_legacy/vagrant/action/vm/clear_forwarded_ports_test.rb +0 -52
- data/test/unit_legacy/vagrant/action/vm/clear_nfs_exports_test.rb +0 -22
- data/test/unit_legacy/vagrant/action/vm/clear_shared_folders_test.rb +0 -40
- data/test/unit_legacy/vagrant/action/vm/customize_test.rb +0 -37
- data/test/unit_legacy/vagrant/action/vm/destroy_test.rb +0 -25
- data/test/unit_legacy/vagrant/action/vm/destroy_unused_network_interfaces_test.rb +0 -49
- data/test/unit_legacy/vagrant/action/vm/discard_state_test.rb +0 -45
- data/test/unit_legacy/vagrant/action/vm/export_test.rb +0 -107
- data/test/unit_legacy/vagrant/action/vm/forward_ports_helpers_test.rb +0 -77
- data/test/unit_legacy/vagrant/action/vm/forward_ports_test.rb +0 -197
- data/test/unit_legacy/vagrant/action/vm/halt_test.rb +0 -79
- data/test/unit_legacy/vagrant/action/vm/host_name_test.rb +0 -36
- data/test/unit_legacy/vagrant/action/vm/import_test.rb +0 -66
- data/test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb +0 -40
- data/test/unit_legacy/vagrant/action/vm/modify_test.rb +0 -38
- data/test/unit_legacy/vagrant/action/vm/network_test.rb +0 -286
- data/test/unit_legacy/vagrant/action/vm/nfs_helpers_test.rb +0 -26
- data/test/unit_legacy/vagrant/action/vm/nfs_test.rb +0 -260
- data/test/unit_legacy/vagrant/action/vm/package_test.rb +0 -25
- data/test/unit_legacy/vagrant/action/vm/package_vagrantfile_test.rb +0 -46
- data/test/unit_legacy/vagrant/action/vm/provision_test.rb +0 -65
- data/test/unit_legacy/vagrant/action/vm/provisioner_cleanup_test.rb +0 -56
- data/test/unit_legacy/vagrant/action/vm/resume_test.rb +0 -35
- data/test/unit_legacy/vagrant/action/vm/share_folders_test.rb +0 -144
- data/test/unit_legacy/vagrant/action/vm/suspend_test.rb +0 -35
- data/test/unit_legacy/vagrant/action_test.rb +0 -89
- data/test/unit_legacy/vagrant/box_collection_test.rb +0 -45
- data/test/unit_legacy/vagrant/box_test.rb +0 -74
- data/test/unit_legacy/vagrant/cli_test.rb +0 -35
- data/test/unit_legacy/vagrant/command/base_test.rb +0 -23
- data/test/unit_legacy/vagrant/command/group_base_test.rb +0 -15
- data/test/unit_legacy/vagrant/command/helpers_test.rb +0 -88
- data/test/unit_legacy/vagrant/command/init_test.rb +0 -10
- data/test/unit_legacy/vagrant/command/package_test.rb +0 -27
- data/test/unit_legacy/vagrant/config/base_test.rb +0 -52
- data/test/unit_legacy/vagrant/config/error_recorder_test.rb +0 -18
- data/test/unit_legacy/vagrant/config/ssh_test.rb +0 -12
- data/test/unit_legacy/vagrant/config/vagrant_test.rb +0 -35
- data/test/unit_legacy/vagrant/config/vm/provisioner_test.rb +0 -92
- data/test/unit_legacy/vagrant/config/vm_test.rb +0 -47
- data/test/unit_legacy/vagrant/config_test.rb +0 -148
- data/test/unit_legacy/vagrant/downloaders/http_test.rb +0 -93
- data/test/unit_legacy/vagrant/environment_test.rb +0 -539
- data/test/unit_legacy/vagrant/errors_test.rb +0 -42
- data/test/unit_legacy/vagrant/hosts/base_test.rb +0 -46
- data/test/unit_legacy/vagrant/hosts/bsd_test.rb +0 -53
- data/test/unit_legacy/vagrant/hosts/linux_test.rb +0 -54
- data/test/unit_legacy/vagrant/plugin_test.rb +0 -9
- data/test/unit_legacy/vagrant/provisioners/base_test.rb +0 -63
- data/test/unit_legacy/vagrant/provisioners/chef_client_test.rb +0 -190
- data/test/unit_legacy/vagrant/provisioners/chef_solo_test.rb +0 -115
- data/test/unit_legacy/vagrant/provisioners/chef_test.rb +0 -209
- data/test/unit_legacy/vagrant/provisioners/puppet_server_test.rb +0 -68
- data/test/unit_legacy/vagrant/provisioners/puppet_test.rb +0 -182
- data/test/unit_legacy/vagrant/provisioners/shell_test.rb +0 -79
- data/test/unit_legacy/vagrant/ssh/session_test.rb +0 -40
- data/test/unit_legacy/vagrant/ssh_test.rb +0 -304
- data/test/unit_legacy/vagrant/systems/base_test.rb +0 -18
- data/test/unit_legacy/vagrant/systems/linux_test.rb +0 -104
- data/test/unit_legacy/vagrant/util/busy_test.rb +0 -106
- data/test/unit_legacy/vagrant/util/counter_test.rb +0 -29
- data/test/unit_legacy/vagrant/util/platform_test.rb +0 -18
- data/test/unit_legacy/vagrant/util/stacked_proc_runner_test.rb +0 -43
- data/test/unit_legacy/vagrant/util/template_renderer_test.rb +0 -145
- data/test/unit_legacy/vagrant/vm_test.rb +0 -300
@@ -1,78 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Provisioners
|
3
|
-
class PuppetServerError < Vagrant::Errors::VagrantError
|
4
|
-
error_namespace("vagrant.provisioners.puppet_server")
|
5
|
-
end
|
6
|
-
|
7
|
-
class PuppetServer < Base
|
8
|
-
class Config < Vagrant::Config::Base
|
9
|
-
attr_accessor :puppet_server
|
10
|
-
attr_accessor :puppet_node
|
11
|
-
attr_accessor :options
|
12
|
-
attr_accessor :facter
|
13
|
-
|
14
|
-
def facter; @facter ||= {}; end
|
15
|
-
def puppet_server; @puppet_server || "puppet"; end
|
16
|
-
def options; @options ||= []; end
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.config_class
|
20
|
-
Config
|
21
|
-
end
|
22
|
-
|
23
|
-
def provision!
|
24
|
-
verify_binary("puppet")
|
25
|
-
run_puppet_agent
|
26
|
-
end
|
27
|
-
|
28
|
-
def verify_binary(binary)
|
29
|
-
env[:vm].channel.sudo("which #{binary}",
|
30
|
-
:error_class => PuppetServerError,
|
31
|
-
:error_key => :not_detected,
|
32
|
-
:binary => binary)
|
33
|
-
end
|
34
|
-
|
35
|
-
def run_puppet_agent
|
36
|
-
options = config.options
|
37
|
-
options = [options] if !options.is_a?(Array)
|
38
|
-
|
39
|
-
# Intelligently set the puppet node cert name based on certain
|
40
|
-
# external parameters.
|
41
|
-
cn = nil
|
42
|
-
if config.puppet_node
|
43
|
-
# If a node name is given, we use that directly for the certname
|
44
|
-
cn = config.puppet_node
|
45
|
-
elsif env[:vm].config.vm.host_name
|
46
|
-
# If a host name is given, we explicitly set the certname to
|
47
|
-
# nil so that the hostname becomes the cert name.
|
48
|
-
cn = nil
|
49
|
-
else
|
50
|
-
# Otherwise, we default to the name of the box.
|
51
|
-
cn = env[:vm].config.vm.box
|
52
|
-
end
|
53
|
-
|
54
|
-
# Add the certname option if there is one
|
55
|
-
options += ["--certname", cn] if cn
|
56
|
-
options = options.join(" ")
|
57
|
-
|
58
|
-
# Build up the custom facts if we have any
|
59
|
-
facter = ""
|
60
|
-
if !config.facter.empty?
|
61
|
-
facts = []
|
62
|
-
config.facter.each do |key, value|
|
63
|
-
facts << "FACTER_#{key}='#{value}'"
|
64
|
-
end
|
65
|
-
|
66
|
-
facter = "#{facts.join(" ")} "
|
67
|
-
end
|
68
|
-
|
69
|
-
command = "#{facter}puppet agent #{options} --server #{config.puppet_server} --detailed-exitcodes || [ $? -eq 2 ]"
|
70
|
-
|
71
|
-
env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
|
72
|
-
env[:vm].channel.sudo(command) do |type, data|
|
73
|
-
env[:ui].info(data.chomp, :prefix => false)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
|
3
|
-
module Vagrant
|
4
|
-
module Provisioners
|
5
|
-
class Shell < Base
|
6
|
-
class Config < Vagrant::Config::Base
|
7
|
-
attr_accessor :inline
|
8
|
-
attr_accessor :path
|
9
|
-
attr_accessor :upload_path
|
10
|
-
attr_accessor :args
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@upload_path = "/tmp/vagrant-shell"
|
14
|
-
end
|
15
|
-
|
16
|
-
def validate(env, errors)
|
17
|
-
# Validate that the parameters are properly set
|
18
|
-
if path && inline
|
19
|
-
errors.add(I18n.t("vagrant.provisioners.shell.path_and_inline_set"))
|
20
|
-
elsif !path && !inline
|
21
|
-
errors.add(I18n.t("vagrant.provisioners.shell.no_path_or_inline"))
|
22
|
-
end
|
23
|
-
|
24
|
-
# Validate the existence of a script to upload
|
25
|
-
if path
|
26
|
-
expanded_path = Pathname.new(path).expand_path(env.root_path)
|
27
|
-
if !expanded_path.file?
|
28
|
-
errors.add(I18n.t("vagrant.provisioners.shell.path_invalid",
|
29
|
-
:path => expanded_path))
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# There needs to be a path to upload the script to
|
34
|
-
if !upload_path
|
35
|
-
errors.add(I18n.t("vagrant.provisioners.shell.upload_path_not_set"))
|
36
|
-
end
|
37
|
-
|
38
|
-
# If there are args and its not a string, that is a problem
|
39
|
-
if args && !args.is_a?(String)
|
40
|
-
errors.add(I18n.t("vagrant.provisioners.shell.args_not_string"))
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.config_class
|
46
|
-
Config
|
47
|
-
end
|
48
|
-
|
49
|
-
# This method yields the path to a script to upload and execute
|
50
|
-
# on the remote server. This method will properly clean up the
|
51
|
-
# script file if needed.
|
52
|
-
def with_script_file
|
53
|
-
if config.path
|
54
|
-
# Just yield the path to that file...
|
55
|
-
yield Pathname.new(config.path).expand_path(env[:root_path])
|
56
|
-
return
|
57
|
-
end
|
58
|
-
|
59
|
-
# Otherwise we have an inline script, we need to Tempfile it,
|
60
|
-
# and handle it specially...
|
61
|
-
file = Tempfile.new('vagrant-shell')
|
62
|
-
|
63
|
-
# Unless you set binmode, on a Windows host the shell script will
|
64
|
-
# have CRLF line endings instead of LF line endings, causing havoc
|
65
|
-
# when the guest executes it
|
66
|
-
file.binmode
|
67
|
-
|
68
|
-
begin
|
69
|
-
file.write(config.inline)
|
70
|
-
file.fsync
|
71
|
-
file.close
|
72
|
-
yield file.path
|
73
|
-
ensure
|
74
|
-
file.close
|
75
|
-
file.unlink
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def provision!
|
80
|
-
args = ""
|
81
|
-
args = " #{config.args}" if config.args
|
82
|
-
command = "chmod +x #{config.upload_path} && #{config.upload_path}#{args}"
|
83
|
-
|
84
|
-
with_script_file do |path|
|
85
|
-
# Upload the script to the VM
|
86
|
-
env[:vm].channel.upload(path.to_s, config.upload_path)
|
87
|
-
|
88
|
-
# Execute it with sudo
|
89
|
-
env[:vm].channel.sudo(command) do |type, data|
|
90
|
-
if [:stderr, :stdout].include?(type)
|
91
|
-
# Output the data with the proper color based on the stream.
|
92
|
-
color = type == :stdout ? :green : :red
|
93
|
-
|
94
|
-
# Note: Be sure to chomp the data to avoid the newlines that the
|
95
|
-
# Chef outputs.
|
96
|
-
env[:ui].info(data.chomp, :color => color, :prefix => false)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
data/lib/vagrant/registry.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
# Register components in a single location that can be queried.
|
3
|
-
#
|
4
|
-
# This allows certain components (such as guest systems, configuration
|
5
|
-
# pieces, etc.) to be registered and queried.
|
6
|
-
class Registry
|
7
|
-
def initialize
|
8
|
-
@actions = {}
|
9
|
-
@results_cache = {}
|
10
|
-
end
|
11
|
-
|
12
|
-
# Register a callable by key.
|
13
|
-
#
|
14
|
-
# The callable should be given in a block which will be lazily evaluated
|
15
|
-
# when the action is needed.
|
16
|
-
#
|
17
|
-
# If an action by the given name already exists then it will be
|
18
|
-
# overwritten.
|
19
|
-
def register(key, value=nil, &block)
|
20
|
-
block = lambda { value } if value
|
21
|
-
@actions[key] = block
|
22
|
-
end
|
23
|
-
|
24
|
-
# Get an action by the given key.
|
25
|
-
#
|
26
|
-
# This will evaluate the block given to `register` and return the resulting
|
27
|
-
# action stack.
|
28
|
-
def get(key)
|
29
|
-
return nil if !@actions.has_key?(key)
|
30
|
-
return @results_cache[key] if @results_cache.has_key?(key)
|
31
|
-
@results_cache[key] = @actions[key].call
|
32
|
-
end
|
33
|
-
alias :[] :get
|
34
|
-
|
35
|
-
# Iterate over the keyspace.
|
36
|
-
def each(&block)
|
37
|
-
@actions.each do |key, _|
|
38
|
-
yield key, get(key)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Converts this registry to a hash
|
43
|
-
def to_hash
|
44
|
-
result = {}
|
45
|
-
self.each do |key, value|
|
46
|
-
result[key] = value
|
47
|
-
end
|
48
|
-
|
49
|
-
result
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
data/lib/vagrant/ssh.rb
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
require 'log4r'
|
2
|
-
|
3
|
-
require 'vagrant/util/file_mode'
|
4
|
-
require 'vagrant/util/platform'
|
5
|
-
require 'vagrant/util/safe_exec'
|
6
|
-
|
7
|
-
module Vagrant
|
8
|
-
# Manages SSH connection information as well as allows opening an
|
9
|
-
# SSH connection.
|
10
|
-
class SSH
|
11
|
-
include Util::SafeExec
|
12
|
-
|
13
|
-
def initialize(vm)
|
14
|
-
@vm = vm
|
15
|
-
@logger = Log4r::Logger.new("vagrant::ssh")
|
16
|
-
end
|
17
|
-
|
18
|
-
# Returns a hash of information necessary for accessing this
|
19
|
-
# virtual machine via SSH.
|
20
|
-
#
|
21
|
-
# @return [Hash]
|
22
|
-
def info
|
23
|
-
results = {
|
24
|
-
:host => @vm.config.ssh.host,
|
25
|
-
:port => @vm.config.ssh.port || @vm.driver.ssh_port(@vm.config.ssh.guest_port),
|
26
|
-
:username => @vm.config.ssh.username,
|
27
|
-
:forward_agent => @vm.config.ssh.forward_agent,
|
28
|
-
:forward_x11 => @vm.config.ssh.forward_x11
|
29
|
-
}
|
30
|
-
|
31
|
-
# This can happen if no port is set and for some reason Vagrant
|
32
|
-
# can't detect an SSH port.
|
33
|
-
raise Errors::SSHPortNotDetected if !results[:port]
|
34
|
-
|
35
|
-
# Determine the private key path, which is either set by the
|
36
|
-
# configuration or uses just the built-in insecure key.
|
37
|
-
pk_path = @vm.config.ssh.private_key_path || @vm.env.default_private_key_path
|
38
|
-
results[:private_key_path] = File.expand_path(pk_path, @vm.env.root_path)
|
39
|
-
|
40
|
-
# We need to check and fix the private key permissions
|
41
|
-
# to make sure that SSH gets a key with 0600 perms.
|
42
|
-
check_key_permissions(results[:private_key_path])
|
43
|
-
|
44
|
-
# Return the results
|
45
|
-
return results
|
46
|
-
end
|
47
|
-
|
48
|
-
# Connects to the environment's virtual machine, replacing the ruby
|
49
|
-
# process with an SSH process.
|
50
|
-
#
|
51
|
-
# @param [Hash] opts Options hash
|
52
|
-
# @options opts [Boolean] :plain_mode If True, doesn't authenticate with
|
53
|
-
# the machine, only connects, allowing the user to connect.
|
54
|
-
def exec(opts={})
|
55
|
-
# Get the SSH information and cache it here
|
56
|
-
ssh_info = info
|
57
|
-
|
58
|
-
if Util::Platform.windows?
|
59
|
-
raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
|
60
|
-
:port => ssh_info[:port],
|
61
|
-
:username => ssh_info[:username],
|
62
|
-
:key_path => ssh_info[:private_key_path]
|
63
|
-
end
|
64
|
-
|
65
|
-
raise Errors::SSHUnavailable if !Kernel.system("which ssh > /dev/null 2>&1")
|
66
|
-
|
67
|
-
# If plain mode is enabled then we don't do any authentication (we don't
|
68
|
-
# set a user or an identity file)
|
69
|
-
plain_mode = opts[:plain_mode]
|
70
|
-
|
71
|
-
options = {}
|
72
|
-
options[:host] = ssh_info[:host]
|
73
|
-
options[:port] = ssh_info[:port]
|
74
|
-
options[:username] = ssh_info[:username]
|
75
|
-
options[:private_key_path] = ssh_info[:private_key_path]
|
76
|
-
|
77
|
-
# Command line options
|
78
|
-
command_options = ["-p", options[:port].to_s, "-o", "UserKnownHostsFile=/dev/null",
|
79
|
-
"-o", "StrictHostKeyChecking=no", "-o", "LogLevel=ERROR"]
|
80
|
-
|
81
|
-
# Solaris/OpenSolaris/Illumos uses SunSSH which doesn't support the IdentitiesOnly option
|
82
|
-
command_options += ["-o", "IdentitiesOnly=yes"] unless Util::Platform.solaris?
|
83
|
-
|
84
|
-
command_options += ["-i", options[:private_key_path]] if !plain_mode
|
85
|
-
command_options += ["-o", "ForwardAgent=yes"] if ssh_info[:forward_agent]
|
86
|
-
|
87
|
-
# If there are extra options, then we append those
|
88
|
-
command_options.concat(opts[:extra_args]) if opts[:extra_args]
|
89
|
-
|
90
|
-
if ssh_info[:forward_x11]
|
91
|
-
# Both are required so that no warnings are shown regarding X11
|
92
|
-
command_options += ["-o", "ForwardX11=yes"]
|
93
|
-
command_options += ["-o", "ForwardX11Trusted=yes"]
|
94
|
-
end
|
95
|
-
|
96
|
-
host_string = options[:host]
|
97
|
-
host_string = "#{options[:username]}@#{host_string}" if !plain_mode
|
98
|
-
command_options << host_string
|
99
|
-
@logger.info("Invoking SSH: #{command_options.inspect}")
|
100
|
-
safe_exec("ssh", *command_options)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Checks the file permissions for a private key, resetting them
|
104
|
-
# if needed.
|
105
|
-
def check_key_permissions(key_path)
|
106
|
-
# Windows systems don't have this issue
|
107
|
-
return if Util::Platform.windows?
|
108
|
-
|
109
|
-
@logger.debug("Checking key permissions: #{key_path}")
|
110
|
-
stat = File.stat(key_path)
|
111
|
-
|
112
|
-
if stat.owned? && Util::FileMode.from_octal(stat.mode) != "600"
|
113
|
-
@logger.info("Attempting to correct key permissions to 0600")
|
114
|
-
File.chmod(0600, key_path)
|
115
|
-
|
116
|
-
if Util::FileMode.from_octal(stat.mode) != "600"
|
117
|
-
raise Errors::SSHKeyBadPermissions, :key_path => key_path
|
118
|
-
end
|
119
|
-
end
|
120
|
-
rescue Errno::EPERM
|
121
|
-
# This shouldn't happen since we verified we own the file, but
|
122
|
-
# it is possible in theory, so we raise an error.
|
123
|
-
raise Errors::SSHKeyBadPermissions, :key_path => key_path
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
data/lib/vagrant/test_helpers.rb
DELETED
@@ -1,154 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
# Test helpers provided by Vagrant to allow for plugin developers
|
3
|
-
# to write automated tests for their code. This module simply provides
|
4
|
-
# methods which can be included into any test framework (`test/unit`,
|
5
|
-
# RSpec, Shoulda, etc.)
|
6
|
-
module TestHelpers
|
7
|
-
#------------------------------------------------------------
|
8
|
-
# Environment creation helpers
|
9
|
-
#------------------------------------------------------------
|
10
|
-
# Creates a "vagrant_app" directory in the test tmp folder
|
11
|
-
# which can be used for creating test Vagrant environments.
|
12
|
-
# Returns the root directory of the app. This typically doesn't need
|
13
|
-
# to be called directly unless you're setting up a custom application.
|
14
|
-
# See the examples for common use cases.
|
15
|
-
def vagrant_app(*path)
|
16
|
-
root = tmp_path.join("vagrant_app")
|
17
|
-
FileUtils.rm_rf(root)
|
18
|
-
FileUtils.mkdir_p(root)
|
19
|
-
root.join(*path)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Creates a Vagrantfile with the given contents in the given
|
23
|
-
# app directory. If no app directory is specified, then a default
|
24
|
-
# Vagrant app is used.
|
25
|
-
def vagrantfile(*args)
|
26
|
-
path = args.shift.join("Vagrantfile") if Pathname === args.first
|
27
|
-
path ||= vagrant_app("Vagrantfile")
|
28
|
-
|
29
|
-
# Create this box so that it exists
|
30
|
-
vagrant_box("base")
|
31
|
-
|
32
|
-
str = args.shift || ""
|
33
|
-
File.open(path.to_s, "w") do |f|
|
34
|
-
f.puts "ENV['VAGRANT_HOME'] = '#{home_path}'"
|
35
|
-
f.puts "Vagrant::Config.run do |config|"
|
36
|
-
f.puts "config.vm.base_mac = 'foo' if !config.vm.base_mac"
|
37
|
-
f.puts "config.vm.box = 'base'"
|
38
|
-
f.puts str
|
39
|
-
f.puts "end"
|
40
|
-
end
|
41
|
-
|
42
|
-
path.parent
|
43
|
-
end
|
44
|
-
|
45
|
-
# Creates and _loads_ a Vagrant environment at the given path.
|
46
|
-
# If no path is given, then a default {#vagrantfile} is used.
|
47
|
-
def vagrant_env(*args)
|
48
|
-
path = args.shift if Pathname === args.first
|
49
|
-
path ||= vagrantfile
|
50
|
-
Vagrant::Environment.new(:cwd => path).load!
|
51
|
-
end
|
52
|
-
|
53
|
-
# Creates the folder to contain a vagrant box. This allows for
|
54
|
-
# "fake" boxes to be made with the specified name.
|
55
|
-
#
|
56
|
-
# @param [String] name
|
57
|
-
# @return [Pathname]
|
58
|
-
def vagrant_box(name)
|
59
|
-
result = boxes_path.join(name)
|
60
|
-
FileUtils.mkdir_p(result)
|
61
|
-
result
|
62
|
-
end
|
63
|
-
|
64
|
-
# Returns an instantiated downloader with a mocked tempfile
|
65
|
-
# which can be passed into it.
|
66
|
-
#
|
67
|
-
# @param [Class] klass The downloader class
|
68
|
-
# @return [Array] Returns an array of `downloader` `tempfile`
|
69
|
-
def vagrant_mock_downloader(klass)
|
70
|
-
tempfile = mock("tempfile")
|
71
|
-
tempfile.stubs(:write)
|
72
|
-
|
73
|
-
_, env = action_env
|
74
|
-
[klass.new(env), tempfile]
|
75
|
-
end
|
76
|
-
|
77
|
-
# Returns a blank app (callable) and action environment with the
|
78
|
-
# given vagrant environment. This allows for testing of middlewares.
|
79
|
-
def action_env(v_env = nil)
|
80
|
-
v_env ||= vagrant_env
|
81
|
-
# duplicate the Vagrant::Environment ui and get the default vm object
|
82
|
-
# for the new action environment from the first pair in the vms list
|
83
|
-
opts = {:ui => v_env.ui.dup, :vm => v_env.vms.first.last}
|
84
|
-
app = lambda { |env| }
|
85
|
-
env = Vagrant::Action::Environment.new(opts)
|
86
|
-
env["vagrant.test"] = true
|
87
|
-
[app, env]
|
88
|
-
end
|
89
|
-
|
90
|
-
# Utility method for capturing output streams.
|
91
|
-
# @example Evaluate the output
|
92
|
-
# output = capture(:stdout){ env.cli("foo") }
|
93
|
-
# assert_equal "bar", output
|
94
|
-
# @example Silence the output
|
95
|
-
# silence(:stdout){ env.cli("init") }
|
96
|
-
# @param [:stdout, :stderr] stream The stream to capture
|
97
|
-
# @yieldreturn String
|
98
|
-
# @see https://github.com/wycats/thor/blob/master/spec/spec_helper.rb
|
99
|
-
def capture(stream)
|
100
|
-
begin
|
101
|
-
stream = stream.to_s
|
102
|
-
eval "$#{stream} = StringIO.new"
|
103
|
-
yield
|
104
|
-
result = eval("$#{stream}").string
|
105
|
-
ensure
|
106
|
-
eval("$#{stream} = #{stream.upcase}")
|
107
|
-
end
|
108
|
-
|
109
|
-
result
|
110
|
-
end
|
111
|
-
alias :silence :capture
|
112
|
-
|
113
|
-
#------------------------------------------------------------
|
114
|
-
# Path helpers
|
115
|
-
#------------------------------------------------------------
|
116
|
-
# Path to the tmp directory for the tests.
|
117
|
-
#
|
118
|
-
# @return [Pathname]
|
119
|
-
def tmp_path
|
120
|
-
result = Vagrant.source_root.join("test", "tmp")
|
121
|
-
FileUtils.mkdir_p(result)
|
122
|
-
result
|
123
|
-
end
|
124
|
-
|
125
|
-
# Path to the "home" directory for the tests
|
126
|
-
#
|
127
|
-
# @return [Pathname]
|
128
|
-
def home_path
|
129
|
-
result = tmp_path.join("home")
|
130
|
-
FileUtils.mkdir_p(result)
|
131
|
-
result
|
132
|
-
end
|
133
|
-
|
134
|
-
# Path to the boxes directory in the home directory
|
135
|
-
#
|
136
|
-
# @return [Pathname]
|
137
|
-
def boxes_path
|
138
|
-
result = home_path.join("boxes")
|
139
|
-
FileUtils.mkdir_p(result)
|
140
|
-
result
|
141
|
-
end
|
142
|
-
|
143
|
-
# Cleans all the test temp paths, which includes the boxes path,
|
144
|
-
# home path, etc. This allows for cleaning between tests.
|
145
|
-
def clean_paths
|
146
|
-
FileUtils.rm_rf(tmp_path)
|
147
|
-
|
148
|
-
# Call these methods only to rebuild the directories
|
149
|
-
tmp_path
|
150
|
-
home_path
|
151
|
-
boxes_path
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|