jor*_*npg 2 gem capistrano ruby-on-rails bundler
我正在尝试添加配置参数,deploy.rb
以便pg
gem正确构建:
before "bundle:install" do
run "ls -l #{fetch(:latest_release)}/Gemfile"
run "bundle config --local --gemfile=#{fetch(:latest_release)}/Gemfile build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config"
end
Run Code Online (Sandbox Code Playgroud)
在输出中,添加的诊断代码清楚地显示了非空Gemfile的存在:
* executing `bundle:install'
triggering before callbacks for `bundle:install'
* executing "ls -l /apps/my_app/releases/20121008195429/Gemfile"
servers: ["my_server.com"]
[my_server.com] executing command
** [out :: my_server.com] -rw-r--r-- 1 webapp webapp 1291 Oct 5 22:34 /apps/my_app/releases/20121008195429/Gemfile
command finished in 157ms
* executing "bundle config --local --gemfile=/apps/my_app/releases/20121008195429/Gemfile build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config"
servers: ["my_server.com"]
[my_server.com] executing command
** [out :: my_server.com] Could not locate Gemfile
Run Code Online (Sandbox Code Playgroud)
如果我使用--global
副词,我会得到相同的结果--local
.如果我删除global
/ local
flag,我会得到一个不同的错误:
** [out :: my_server.com] Invalid scope --gemfile=/apps/my_app/releases/20121008194937/Gemfile given. Please use --local or --global.
Run Code Online (Sandbox Code Playgroud)
似乎全局配置或上下文使情况混乱.我怎么能bundle config
看到我的Gemfile
?有一个更好的方法吗?
jor*_*npg 10
与命令中--gemfile
使用的标志相反bundle install
,标志bundle config
仅标识Gemfile 的名称:
# man bundle-config
...
gemfile (BUNDLE_GEMFILE)
The name of the file that bundler should use as the Gemfile. This location of this file
also sets the root of the project, which is used to resolve relative paths in the Gemfile,
among other things. By default, bundler will search up from the current working directory
until it finds a Gemfile.
Run Code Online (Sandbox Code Playgroud)
我首先通过cd到该目录修复了这个问题:
run "cd #{fetch(:latest_release)} && bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config"
Run Code Online (Sandbox Code Playgroud)
更多信息:http: //gembundler.com/man/bundle-install.1.html&http://gembundler.com/man/bundle-config.1.html
归档时间: |
|
查看次数: |
2095 次 |
最近记录: |