OSDN Git Service

Fix sidekiq task to use Rails
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>
Wed, 9 Jan 2013 22:56:47 +0000 (23:56 +0100)
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>
Wed, 9 Jan 2013 23:09:09 +0000 (00:09 +0100)
lib/tasks/sidekiq.rake

index 6bbcb3d..01da919 100644 (file)
@@ -6,18 +6,10 @@ namespace :sidekiq do
 
   desc "GITLAB | Start sidekiq"
   task :start do
-    run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,common,default -e #{rails_env} -P #{pidfile} >> #{root_path}/log/sidekiq.log 2>&1 &"
-  end
-
-  def root_path
-    @root_path ||= File.join(File.expand_path(File.dirname(__FILE__)), "../..")
+    run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
   end
 
   def pidfile
-    "#{root_path}/tmp/pids/sidekiq.pid"
-  end
-
-  def rails_env
-    ENV['RAILS_ENV'] || "production"
+    Rails.root.join("tmp", "pids", "sidekiq.pid")
   end
 end