Module: Bj::Runner::ClassMethods
- Defined in:
- lib/bj/runner.rb
Instance Method Summary collapse
- #background ⇒ Object
- #command ⇒ Object
- #key ⇒ Object
- #log ⇒ Object
- #logdir ⇒ Object
- #ping ⇒ Object
- #run(options = {}, &block) ⇒ Object
- #start(options = {}) ⇒ Object
- #tickle ⇒ Object
Instance Method Details
#background ⇒ Object
70 71 72 |
# File 'lib/bj/runner.rb', line 70 def background @background ||= Hash.new end |
#command ⇒ Object
74 75 76 |
# File 'lib/bj/runner.rb', line 74 def command "#{ Bj.ruby } #{ Bj.script } run --forever --redirect=#{ log } --rails_env=#{ Bj.rails_env } --ppid=#{ Process.pid }" end |
#log ⇒ Object
78 79 80 |
# File 'lib/bj/runner.rb', line 78 def log File.join logdir, "bj.#{ Bj.hostname }.#{ Bj.rails_env }.log" end |
#logdir ⇒ Object
82 83 84 |
# File 'lib/bj/runner.rb', line 82 def logdir File.join File.(Bj.rails_root), 'log' end |
#ping ⇒ Object
55 56 57 58 |
# File 'lib/bj/runner.rb', line 55 def ping pid = Bj.config[Runner.key] pid ? Util.ping(pid) : nil end |
#run(options = {}, &block) ⇒ Object
86 87 88 |
# File 'lib/bj/runner.rb', line 86 def run = {}, &block new(, &block).run end |
#start(options = {}) ⇒ Object
64 65 66 67 68 |
# File 'lib/bj/runner.rb', line 64 def start = {} . background.delete Bj.rails_env if [:force] background[Bj.rails_env] ||= Background.for(command) end |
#tickle ⇒ Object
51 52 53 |
# File 'lib/bj/runner.rb', line 51 def tickle ping or start end |