Skip to content

Instantly share code, notes, and snippets.

View jerome's full-sized avatar

Jérôme Lipowicz jerome

View GitHub Profile
# in app/workers/testing_worker.rb
class TestingWorker < Workling::Base
def this_is_a_test(options)
File.open(options[:id], "w") { |f| 1.upto(30) { f.write "."; f.flush; sleep(1) } }
end
end
# in any controller...
namespace :workling do
namespace :client do
desc "Starts workling client"
task :start, :roles => :app, :only => { :primary => true } do
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client stop'"
run "sudo -u #{app_user} bash -c 'cd #{current_path} && rm -f log/workling.output'"
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client start'"
end
desc "Stops workling client"
# in app/workers/testing_worker.rb
class TestingWorker < Workling::Base
def this_is_a_test(options)
File.open(options[:id], "w") { |f| 1.upto(30) { f.write "."; f.flush; sleep(1) } }
end
end
# in any controller...