class Phantom::Process
Attributes
command[RW]
memory_usage[RW]
pid[RW]
port[RW]
Public Class Methods
from_string(str)
click to toggle source
# File lib/phantom/process.rb, line 11 def from_string(str) args = parse_string(str) new(*args) end
new(pid = nil, memory_usage = nil, command = nil, port = nil)
click to toggle source
# File lib/phantom/process.rb, line 30 def initialize(pid = nil, memory_usage = nil, command = nil, port = nil) @pid = pid @memory_usage = memory_usage @command = command @port = port end
Private Class Methods
parse_string(str)
click to toggle source
# File lib/phantom/process.rb, line 18 def parse_string(str) parts = str.split pid = parts[0].to_i memory_usage = parts[1].to_i command = parts[2..-1].join(" ") port = parts.last.to_i [pid, memory_usage, command, port] end
Public Instance Methods
inspect()
click to toggle source
# File lib/phantom/process.rb, line 51 def inspect "pid: #{pid}, port: #{port}, memory_usage: #{memory_usage}, command: #{command}" end
kill()
click to toggle source
# File lib/phantom/process.rb, line 37 def kill $logger.info "killing #{self}" Utils::Shell.execute "kill #{pid}" end
start()
click to toggle source
# File lib/phantom/process.rb, line 42 def start $logger.info "starting phantomjs on port #{port}" Utils::Shell.execute start_command end
to_s()
click to toggle source
# File lib/phantom/process.rb, line 47 def to_s inspect end
Private Instance Methods
start_command()
click to toggle source
# File lib/phantom/process.rb, line 56 def start_command "cd #{Cfg.rails_root} && #{Cfg.phantom_command} #{port} >>#{Cfg.phantom_log_path} 2>&1 &" end