Capistrano中的require deploy.rb找不到文件 [英] require in capistrano deploy.rb cannot find file

查看:49
本文介绍了Capistrano中的require deploy.rb找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rails 3.0.5应用程序,我正在设置capistrano以使用配方。

I have a rails 3.0.5 app and I'm setting up capistrano to use a recipe.

在我的配置目录中,我有一个名为 database_capistrano的文件。 rb,并且在我的deploy.rb中,也在配置目录中,刚开始时有以下行:

in my config directory I have a file named "database_capistrano.rb" and in my deploy.rb, also in config directory, I have the following line, just in the beginning:


require 'database_capistrano'

但是我得到:


`require': no such file to load -- capistrano_database (LoadError)

也可以尝试:


require 'database_capistrano.rb'

并且不起作用...

在Rails 3.0.5中,如何在capistrano deploy.rb中包含文件?

How, in Rails 3.0.5, include files in capistrano deploy.rb??

推荐答案

好,我设法找出应该怎么做。

Ok, I manage to find out how this should be done.

只需将文件复制到新的子目录 deploy(仅供组织使用),并在我deploy.rb的开头添加:

Just copied the file to a new sub-directory "deploy", for organization only, and at the beginning of my deploy.rb, added:


$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'deploy')

然后在deploy.rb中使用:

Then, in deploy.rb, just used:


require 'database_capistrano'

这篇关于Capistrano中的require deploy.rb找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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