Class: VagrantDNS::Command
- Inherits:
-
Object
- Object
- VagrantDNS::Command
- Defined in:
- lib/vagrant-dns/command.rb
Instance Method Summary collapse
-
#execute ⇒ Object
Runs the vbguest installer on the VMs that are represented by this environment.
Instance Method Details
#execute ⇒ Object
Runs the vbguest installer on the VMs that are represented by this environment.
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 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 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/vagrant-dns/command.rb', line 11 def execute = {} opts = OptionParser.new do |opts| opts. = "Usage: vagrant dns [vm-name] [-i|--install] [-u|--uninstall] [--with-sudo] [--pruge] [-s|--start] [-S|--stop] [-r|--restart] [--status] [-l|--list] [-o|--ontop]" opts.separator "" opts.on("--install", "-i", "Install DNS config for machine domain") do [:install] = true [:build_config] = true [:manage_installation] = true end opts.on("--uninstall", "-u", "Uninstall DNS config for machine domain") do [:uninstall] = true [:build_config] = false [:manage_installation] = true [:stop] = true end opts.on("--purge", "Uninstall DNS config and remove DNS configurations of all machines.") do [:purge] = true [:build_config] = false [:manage_installation] = true [:stop] = true end opts.on("--start", "-s", "Start the DNS service") do [:start] = true [:build_config] = true end opts.on("--stop", "-S", "Stop the DNS service") do [:stop] = true [:build_config] = false end opts.on("--restart", "-r", "Restart the DNS service") do [:restart] = true [:build_config] = true end opts.on("--status", "Show DNS service running status and PID.") do [:status] = true [:build_config] = false end opts.on("--list", "-l", "Show the current DNS service config. This works in conjunction with --start --stop --restart --status.") do [:show_config] = true [:build_config] = false end opts.on("--list-tlds", "-L", "Show the current TopLevelDomains registered. This works in conjunction with --start --stop --restart --status.") do [:show_tld_config] = true [:build_config] = false end opts.on("--with-sudo", "In conjunction with `--install`, `--uninstall`, `--purge`: Run using `sudo` instead of `osascript`. Useful for automated scripts running as sudoer.") do [:installer_opts] = { exec_style: :sudo } end opts.on("--ontop", "-o", "Start the DNS service on top. Debugging only, this blocks Vagrant!") do [:ontop] = true end end argv = (opts) return if !argv vms = argv unless argv.empty? build_config(vms, ) if [:build_config] manage_service(vms, ) manage_installation(vms, ) if [:manage_installation] show_config(vms, ) if [:show_config] || [:show_tld_config] end |