class Explorer::CLI::Process
Public Instance Methods
add(label, cmd)
click to toggle source
# File lib/explorer/cli/process.rb, line 20 def add(label, cmd) Celluloid.logger = nil # Silence celluloid ipc = IPCClient.new ipc.cmd_add(label, cmd, options[:dir]) puts Rainbow("Added #{label}").color(:green).bright rescue Errno::ENOENT puts Rainbow('Explore is not running').color(:red).bright end
list()
click to toggle source
# File lib/explorer/cli/process.rb, line 64 def list Celluloid.logger = nil # Silence celluloid ipc = IPCClient.new list = ipc.cmd_list data = list.map do |p| color = if p['state'] == 'stopped' 'red' else 'green' end { label: "[#{color}]#{p['label']}[/]", command: "[#{color}]#{p['cmd']}[/]", 'working directory' => "[#{color}]#{p['dir']}[/]", 'PID' => "[#{color}]#{p['pid']}[/]", 'exit code' => "[#{color}]#{p['status']}[/]", 'status' => "[#{color}]#{p['state']}[/]", } end Formatador.display_compact_table(data, [:label, :command, 'PID', 'exit code', 'status', 'working directory']) rescue Errno::ENOENT puts Rainbow('Explore is not running').color(:red).bright end
remove(label)
click to toggle source
# File lib/explorer/cli/process.rb, line 53 def remove(label) Celluloid.logger = nil # Silence celluloid ipc = IPCClient.new ipc.cmd_remove(label) puts Rainbow("Removed #{label}").color(:green).bright rescue Errno::ENOENT puts Rainbow('Explore is not running').color(:red).bright end
start(label)
click to toggle source
# File lib/explorer/cli/process.rb, line 31 def start(label) Celluloid.logger = nil # Silence celluloid ipc = IPCClient.new ipc.cmd_start(label) puts Rainbow("Started #{label}").color(:green).bright rescue Errno::ENOENT puts Rainbow('Explore is not running').color(:red).bright end
stop(label)
click to toggle source
# File lib/explorer/cli/process.rb, line 42 def stop(label) Celluloid.logger = nil # Silence celluloid ipc = IPCClient.new ipc.cmd_stop(label) puts Rainbow("Stopped #{label}").color(:green).bright rescue Errno::ENOENT puts Rainbow('Explore is not running').color(:red).bright end
tail()
click to toggle source
# File lib/explorer/cli/process.rb, line 8 def tail Celluloid.logger = nil # Silence celluloid ipc = IPCClient.new trap(:INT) { Thread.new { ipc.shutdown }.join } ipc.tail rescue Errno::ENOENT puts Rainbow('Explore is not running').color(:red).bright end