Pregunta

I really have no idea what im doing. I'm trying to get rake to work so I can run rake workers:start but without having to have the working directory be the same as the folder of the rake file.

for example if i'm in my app directory, the above command works fine, but if i run rake -f ~/Code/my-app/Rakefile workers:start it says "Cannot load such file -- ./database

I'm using Sinatra (rack), and ultimately my goal is to try and install god so I can create a resque worker in production

require File.dirname(__FILE__) + "/main"
require 'resque/tasks'

namespace :workers do

  desc "Launch single worker for processing jobs"
  task :start do
    ENV['QUEUE']   ||= '*'
    puts "=== Launching single worker on '#{ENV['QUEUE']}' queue(s) with PID #{Process.pid}"
    Rake::Task['resque:work'].invoke
  end

end
¿Fue útil?

Solución

rake -f ~/Code/my-app/Rakefile rake:workers:start
                                ^ shouldn't need this one.

Also you might want to cd to appropriate dir before running rake.

cd ~/Code/my-app && rake workers:start
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top