2

gem が正しくビルドされるdeploy.rbように、構成パラメーターを追加しようとしています。pg

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

出力では、追加された診断コードは、空でない 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

--globalViceを使用しても同じ結果が得られます--localglobal/localフラグを削除すると、別のエラーが発生します。

** [out :: my_server.com] Invalid scope --gemfile=/apps/my_app/releases/20121008194937/Gemfile given. Please use --local or --global.

状況を混乱させるグローバル構成またはコンテキストがあるようです。bundle configを表示するにはどうすればよいGemfileですか? これを行うより良い方法はありますか?

4

1 に答える 1

10

コマンドで--gemfile使用されるフラグとは対照的に、フラグは Gemfileの名前のみを識別します。bundle installbundle config

# 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.

最初にそのディレクトリにcdすることで問題を修正しました:

run "cd #{fetch(:latest_release)} && bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config"

詳細: http://gembundler.com/man/bundle-install.1.html & http://gembundler.com/man/bundle-config.1.html

于 2012-10-08T22:50:06.250 に答える