Skip to content

Commit

Permalink
Use RAILS_ROOT in preload task
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Aug 19, 2011
1 parent 7e4e0ef commit cb371b4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/resque/tasks.rb
Expand Up @@ -5,7 +5,7 @@
task :setup

desc "Start a Resque worker"
task :work => :setup do
task :work => [ :preload, :setup ] do
require 'resque'

queues = (ENV['QUEUES'] || ENV['QUEUE']).to_s.split(',')
Expand Down Expand Up @@ -39,11 +39,13 @@

threads.each { |thread| thread.join }
end
end

# Preload app files
task :environment do
Dir['app/**/*.rb'].each do |file|
require file
# Preload app files if this is Rails
task :preload do
if defined? RAILS_ROOT
Dir["#{RAILS_ROOT}/app/**/*.rb"].each do |file|
require file
end
end
end
end

0 comments on commit cb371b4

Please sign in to comment.