Class: VagrantVbguest::Command
- Inherits:
-
Object
- Object
- VagrantVbguest::Command
- Includes:
- VagrantPlugins::CommandUp::StartMixins, Helpers::Rebootable
- Defined in:
- lib/vagrant-vbguest/command.rb
Class Method Summary collapse
-
.synopsis ⇒ Object
Show description when ‘vagrant list-commands` is triggered.
Instance Method Summary collapse
-
#execute ⇒ Object
Runs the vbguest installer on the VMs that are represented by this environment.
Methods included from Helpers::Rebootable
included, #reboot, #reboot!, #reboot?, #rebooted?
Methods included from Helpers::VmCompatible
#communicate, #driver, included
Class Method Details
.synopsis ⇒ Object
Show description when ‘vagrant list-commands` is triggered
77 78 79 |
# File 'lib/vagrant-vbguest/command.rb', line 77 def self.synopsis "plugin: vagrant-vbguest: install VirtualBox Guest Additions to the machine" end |
Instance Method Details
#execute ⇒ Object
Runs the vbguest installer on the VMs that are represented by this environment.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/vagrant-vbguest/command.rb', line 12 def execute = { :_method => :run, :_rebootable => true, :auto_reboot => false } opts = OptionParser.new do |opts| opts. = "Usage: vagrant vbguest [vm-name] "\ "[--do start|rebuild|install] "\ "[--status] "\ "[-f|--force] "\ "[-b|--auto-reboot] "\ "[-R|--no-remote] "\ "[--iso VBoxGuestAdditions.iso] "\ "[--no-cleanup]" opts.separator "" opts.on("--do COMMAND", [:start, :rebuild, :install], "Manually `start`, `rebuild` or `install` GuestAdditions.") do |command| [:_method] = command [:force] = true end opts.on("--status", "Print current GuestAdditions status and exit.") do [:_method] = :status [:_rebootable] = false end opts.on("-f", "--force", "Whether to force the installation. (Implied by --do start|rebuild|install)") do [:force] = true end opts.on("--auto-reboot", "-b", "Allow rebooting the VM after installation. (when GuestAdditions won't start)") do [:auto_reboot] = true end opts.on("--no-remote", "-R", "Do not attempt do download the iso file from a webserver") do [:no_remote] = true end opts.on("--iso file_or_uri", "Full path or URI to the VBoxGuestAdditions.iso") do |file_or_uri| [:iso_path] = file_or_uri end opts.on("--no-cleanup", "Do not run cleanup tasks after installation. (for debugging)") do [:no_cleanup] = true end (opts, ) end argv = (opts) return if !argv if argv.empty? with_target_vms(nil) { |vm| execute_on_vm(vm, ) } else argv.each do |vm_name| with_target_vms(vm_name) { |vm| execute_on_vm(vm, ) } end end end |