如何从Capistrano运行抽佣任务? [英] How do I run a rake task from Capistrano?

查看:52
本文介绍了如何从Capistrano运行抽佣任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一个deploy.rb,可以将我的应用程序部署到生产服务器上。

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

我的应用程序包含一个自定义的rake任务(lib / tasks目录中的.rake文件)。

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

我想创建一个上限任务,该任务将远程运行该rake任务。

I'd like to create a cap task that will remotely run that rake task.

推荐答案

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

通过Google找到它- http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano /

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

RAILS_ENV = production 是个陷阱-我当时没想到首先,不知道为什么任务没有做任何事情。

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.

这篇关于如何从Capistrano运行抽佣任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆