Class: VagrantPlugins::ListenServer::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-listen-server/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



4
5
6
# File 'lib/vagrant-listen-server/command.rb', line 4

def self.synopsis
  "Check the status of the vagrant-listen server"
end

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-listen-server/command.rb', line 8

def execute
  opts = OptionParser.new do |o|
    o.banner = 'Usage: vagrant listen [start|stop|status]'
  end

  command = @argv.shift
  argv = parse_options opts

  with_target_vms nil, single_target: true do |vm|
    # puts "ENV #{vm.env.inspect}"
    # puts "CONFIG #{vm.config.inspect}"
    # puts "LISTEN #{vm.config.listen_server.inspect}"

    case command
    when 'status' then Daemon.status vm.config.listen_server
    when 'stop' then Daemon.stop vm
    when 'start' then Daemon.start vm
    else
      puts 'Unknown command'
      exit 1
    end
  end

  0
end