Module: Bj::Runner::ClassMethods
- Defined in:
- lib/bj/runner.rb
Instance Method Summary collapse
- #background ⇒ Object
- #background=(value) ⇒ Object
- #command ⇒ Object
- #key ⇒ Object
- #log ⇒ Object
- #logdir ⇒ Object
- #no_tickle_key ⇒ Object
- #ping ⇒ Object
- #run(options = {}, &block) ⇒ Object
- #start(options = {}) ⇒ Object
- #tickle ⇒ Object
Instance Method Details
#background ⇒ Object
86 87 88 |
# File 'lib/bj/runner.rb', line 86 def background @background ||= Hash.new end |
#background=(value) ⇒ Object
90 91 92 |
# File 'lib/bj/runner.rb', line 90 def background= value @background ||= value end |
#command ⇒ Object
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/bj/runner.rb', line 94 def command %W[ #{ Bj.ruby } #{ Bj.script } run --forever --redirect=#{ log } --ppid=#{ Process.pid } --rails_env=#{ Bj.rails_env } --rails_root=#{ Bj.rails_root } ].join(" ") end |
#log ⇒ Object
105 106 107 |
# File 'lib/bj/runner.rb', line 105 def log File.join logdir, "bj.#{ Bj.hostname }.#{ Bj.rails_env }.log" end |
#logdir ⇒ Object
109 110 111 |
# File 'lib/bj/runner.rb', line 109 def logdir File.join File.(Bj.rails_root), 'log' end |
#no_tickle_key ⇒ Object
76 77 78 |
# File 'lib/bj/runner.rb', line 76 def no_tickle_key "#{ Bj.rails_env }.no_tickle" end |
#ping ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/bj/runner.rb', line 60 def ping pid = Bj.config[Runner.key] return nil unless pid pid = Integer pid begin Process.kill Runner.signal, pid pid rescue Exception false end end |
#run(options = {}, &block) ⇒ Object
113 114 115 |
# File 'lib/bj/runner.rb', line 113 def run = {}, &block new(, &block).run end |
#start(options = {}) ⇒ Object
80 81 82 83 84 |
# File 'lib/bj/runner.rb', line 80 def start = {} . background.delete Bj.rails_env if [:force] background[Bj.rails_env] ||= Background.for(command) end |