Class: Guard::Faye
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Faye
constructor
A new instance of Faye.
- #reload ⇒ Object
- #run_on_change(paths) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Faye
Returns a new instance of Faye.
10 11 12 13 14 15 |
# File 'lib/guard/faye.rb', line 10 def initialize(watchers = [], = {}) super @current_path = [:path] @faye_init = [:config] end |
Instance Method Details
#reload ⇒ Object
42 43 44 45 |
# File 'lib/guard/faye.rb', line 42 def reload stop start end |
#run_on_change(paths) ⇒ Object
47 48 49 |
# File 'lib/guard/faye.rb', line 47 def run_on_change(paths) reload end |
#start ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/guard/faye.rb', line 17 def start cmd = "cd #{@current_path} && bundle exec rackup #{@current_path}/#{@faye_init} -s thin -E test" result = '' Thread.new do result = %x[#{cmd}] end end |
#stop ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/guard/faye.rb', line 27 def stop parent_pids = [] Sys::ProcTable.ps.each do |ps| if ps.cmdline =~ /faye_test\.ru/i parent_pids << ps.pid Process.kill('KILL', ps.pid) end if parent_pids.include? ps.ppid Process.kill('KILL', ps.pid) end end end |