0

Capistranoを使用してSlicehostにRailsアプリをデプロイしています。デプロイのプロセスの一部には、gemの再構築とインストールが含まれます。

git scmを介してサーバーにコードをデプロイすることは正常に機能しますが、何らかの理由で私が試してみると...

run 'gem build /my/app/folder/my.gemspec'

... deploy.rbの別のタスクでは、すべてがブームになります。gemspec内のファイルがファイルではないという奇妙なエラーが表示されます...

ERROR:  While executing gem ... (Gem::InvalidSpecificationException)
[ ... , "public/images/admin/navigation_shadow.png", "public/images/admin/new_layout.png", "public/images/admin/buttons_background.png", "public/images/admin/expand.png", "public/images/admin/status_spinner
** [out :: MY.IP.ADD.RESS ] .gif", "public/images/admin/draft_page.png", "public/images/admin/vertical_tan_gradient.png", "public/images/admin/status_top_right.png", "public/images/admin/snippet.png", "public/images/admin/spacer.gif", "public/images/admin/status_bottom_right.png", "public/images/admin/spinner.gif", "CONTRIBUTORS", "script", "script/server", "script/breakpointer", "script/generate", "script/dbconsole", "script/about", "script/spec", "script/runner", "script/process", "script/process/reaper", "script/process/inspector", "script/process/spinner", "script/process/spawner", "script/version", "script/plugin", "script/console", "script/autospec", "script/destroy", "script/cucumber", "script/spec_server", "script/performance", "script/performance/profiler", "s ** [out :: MY.IP.ADD.RESS ] cript/performance/request", "script/performance/benchmarker", "script/extension", "LICENSE", "CHANGELOG", ".gitignore", "bin", "my.gemspec", "config", "config/database.mysql.yml", "config/environments", "config/environments/test.rb", "config/environments/production.rb", "config/environments/development.rb", "config/database.yml" ] are not files

ボックスにSSHで接続して手動で実行した場合と、実行した場合に同じコマンドが完全に機能するため、これは奇妙なことです。

sh -c 'gem build /my/app/folder/my.gemspec'

これは、capistranoがリモートコマンドライン呼び出しをラップする方法です。手動で実行する場合も正常に機能します。

別のrubyファイルでKernel.system()呼び出しをラップして、deploy.rbから呼び出しようとしても、同じ問題が発生します。クレイジー。

それは何かと関係があるのだろうか

** [out :: MY.IP.A.DRES]

明らかにランダムな間隔で出力に追加される文字列。

4

1 に答える 1

0

「正常に動作する」が完全に真実ではない可能性があります.STDERRを出力しないと確信していますか?

out :: IP addr は少し奇妙で、正常ではありません。PATH が適切に設定されているかどうかも考慮する必要があります。これが PTY と TTY の違いです。

これを行う最も簡単な方法は次のとおりです (ただし、完全ではありません)。

run('echo $PATH')

ssh my.server.addr 'sh -c \'echo $PATH\''

(後者は Cap が実際に行っていることです。)

次のことも試してみてください。

run("cd /my/app/folder/ && gem build my.gemspec")

^ これらのいずれかが機能します。

于 2009-12-01T06:59:57.210 に答える