god.rb revision 234a52ce997ea67bbf347044e7c4e9c0f5317b34
3199N/A# https://makandracards.com/makandra/1431-resque-+-god-+-capistrano
3199N/Anamespace :god do
3199N/A def god_is_running
3199N/A !capture("#{god_command} status >/dev/null 2>/dev/null || echo 'not running'").start_with?('not running')
3199N/A end
3199N/A
3199N/A def god_command
3199N/A "cd #{current_path}; bundle exec god"
3199N/A end
3199N/A
3199N/A desc "Start god"
3199N/A task :start do
3199N/A run "#{god_command} -c config/god/app.rb", :env => environment = { :RAILS_ENV => rails_env }
3199N/A end
3199N/A
3199N/A desc "Stop god"
3199N/A task :stop do
3199N/A if god_is_running
3199N/A run "#{god_command} terminate"
3199N/A end
3199N/A end
3199N/A
6033N/A desc "Test if god is running"
3199N/A task :status do
4070N/A puts god_is_running ? "God is running" : "God is NOT running"
3199N/A end
3199N/Aend
3199N/A
6033N/Abefore "deploy:update", "god:stop"
6033N/Aafter "deploy:update", "god:start"