Class: CodeSync::Manager
- Inherits:
-
Object
- Object
- CodeSync::Manager
- Defined in:
- lib/code_sync/manager.rb
Instance Attribute Summary collapse
-
#client_manager ⇒ Object
Returns the value of attribute client_manager.
-
#options ⇒ Object
Returns the value of attribute options.
-
#process_map ⇒ Object
Returns the value of attribute process_map.
-
#processes ⇒ Object
Returns the value of attribute processes.
-
#server ⇒ Object
Returns the value of attribute server.
-
#sprockets ⇒ Object
Returns the value of attribute sprockets.
Class Method Summary collapse
-
.cleanup_stale_processes ⇒ Object
FIXME: You know this aint right.
- .start(options = {}) ⇒ Object
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object (protected)
234 235 236 |
# File 'lib/code_sync/manager.rb', line 234 def method_missing meth, *args, &block puts "Need to implement #{ meth }" end |
Instance Attribute Details
#client_manager ⇒ Object
Returns the value of attribute client_manager.
48 49 50 |
# File 'lib/code_sync/manager.rb', line 48 def client_manager @client_manager end |
#options ⇒ Object
Returns the value of attribute options.
48 49 50 |
# File 'lib/code_sync/manager.rb', line 48 def @options end |
#process_map ⇒ Object
Returns the value of attribute process_map.
48 49 50 |
# File 'lib/code_sync/manager.rb', line 48 def process_map @process_map end |
#processes ⇒ Object
Returns the value of attribute processes.
48 49 50 |
# File 'lib/code_sync/manager.rb', line 48 def processes @processes end |
#server ⇒ Object
Returns the value of attribute server.
48 49 50 |
# File 'lib/code_sync/manager.rb', line 48 def server @server end |
#sprockets ⇒ Object
Returns the value of attribute sprockets.
48 49 50 |
# File 'lib/code_sync/manager.rb', line 48 def sprockets @sprockets end |
Class Method Details
.cleanup_stale_processes ⇒ Object
FIXME: You know this aint right
38 39 40 41 42 43 44 45 46 |
# File 'lib/code_sync/manager.rb', line 38 def self.cleanup_stale_processes PTY.spawn("ps aux |grep 'codesyn[c]'") do |stdin,stdout,pid| stdin.each do |output| if pid = output.split[1] `kill -9 #{ pid }` end end end end |
.start(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/code_sync/manager.rb', line 13 def self.start ={} begin manager = new() cleanup_stale_processes if [:forked] pid = fork do manager.start end Process.detach(pid) else manager.start() end rescue puts "Error Manager. #{ $! }" ensure puts "Clesning up finally" cleanup_stale_processes end end |
Instance Method Details
#start(options = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/code_sync/manager.rb', line 50 def start ={} if already_running? puts "== Codesync is already running" return end $0 = "codesync process: manager" build_process_map trap("SIGINT") do exit_gracefully # :) end puts "== All CodeSync processes exited cleanly." end |