How do I run a rake task from Capistrano?

前端 未结 16 2149
忘了有多久
忘了有多久 2020-11-28 02:18

I already have a deploy.rb that can deploy my app on my production server.

My app contains a custom rake task (a .rake file in the lib/tasks directory).

I\

16条回答
  •  悲哀的现实
    2020-11-28 02:46

    run("cd #{deploy_to}/current && /usr/bin/env rake `` RAILS_ENV=production")
    

    Found it with Google -- http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/

    The RAILS_ENV=production was a gotcha -- I didn't think of it at first and couldn't figure out why the task wasn't doing anything.

提交回复
热议问题