Class: VagrantPlugins::HostManager::Command
- Inherits:
-
Object
- Object
- VagrantPlugins::HostManager::Command
- Defined in:
- lib/vagrant-hostmanager/command.rb
Class Method Summary collapse
-
.synopsis ⇒ Object
Show description when ‘vagrant list-commands` is triggered.
Instance Method Summary collapse
Class Method Details
.synopsis ⇒ Object
Show description when ‘vagrant list-commands` is triggered
6 7 8 |
# File 'lib/vagrant-hostmanager/command.rb', line 6 def self.synopsis "plugin: vagrant-hostmanager: manages the /etc/hosts file within a multi-machine environment" end |
Instance Method Details
#execute ⇒ Object
10 11 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 |
# File 'lib/vagrant-hostmanager/command.rb', line 10 def execute = {} opts = OptionParser.new do |o| o. = 'Usage: vagrant hostmanager [vm-name]' o.separator '' o.version = VagrantPlugins::HostManager::VERSION o.program_name = 'vagrant hostmanager' o.on('--provider provider', String, 'Update machines with the specific provider.') do |provider| [:provider] = provider.to_sym end end argv = (opts) [:provider] ||= @env.default_provider # update /etc/hosts file for specified guest machines with_target_vms(argv, ) do |machine| @env.action_runner.run(Action.update_guest, { :global_env => @env, :machine => machine, :provider => [:provider] }) end # update /etc/hosts file for host @env.action_runner.run(Action.update_host, { :global_env => @env, :provider => [:provider] }) end |