Capistrano: creating your own tasks

When I create a task within capistrano.rb I can call it using rake.

When I create a task and put it in deploy.rb I can call it. Neither
with or without the remote: namespace.

Anyone have any insight into why it does not work?

John K.

On Mar 21, 2006, at 4:52 PM, John K. wrote:

When I create a task within capistrano.rb I can call it using rake.

When I create a task and put it in deploy.rb I can call it.
Neither with or without the remote: namespace.

Anyone have any insight into why it does not work?

Above, you say “I can call it”. Do you mean “can’t”?

First, you need to be sure and keep “rake tasks” and “cap tasks”
separate. Rake cannot execute capistrano tasks directly. Capistrano
cannot invoke rake tasks directly.

If you have a capistrano task, it needs to go in deploy.rb. If you
want to be able to invoke it via rake, you then need to add a wrapper
for it in lib/tasks/capistrano.rake.

Try this. In config/deploy.rb, add the following:

task :test_task do
puts “IT’S ALIVE!!!”
end

Then, type:

cap test_task

Do you see the “IT’S ALIVE” message?

  • Jamis

Again Jamis, thanks a lot. I now have a perfectly customized task to
upload my website. Sweet! :slight_smile:

On 22-Mar-06, at 12:23 AM, Jamis B. wrote:

task :test_task do


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

John K.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs