我正在使用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包装远程命令行调用的方式,当我手动执行时,也可以很好地工作。
甚至尝试将Kernel.system()调用包装在另一个ruby文件中,并从deploy.rb调用它,但仍然得到相同的问题。太疯狂了。
我想知道这是不是跟
** [out :: MY.IP.A.DRES]以明显随机的间隔添加到输出中的字符串。
发布于 2009-12-01 14:59:57
有可能“它工作得很好”并不完全正确,你确定它不会输出STDERR吗?
out ::IP addr有点奇怪,而且不正常;您还应该考虑您的路径是否设置正确,这就是PTY和TTY之间的区别。
要做到这一点,最简单的方法(但并不完美)是:
run('echo $PATH')对比
ssh my.server.addr 'sh -c \'echo $PATH\''(后者实际上就是Cap所做的。)
您可能还想尝试:
run("cd /my/app/folder/ && gem build my.gemspec")^其中一个将为您工作。
https://stackoverflow.com/questions/1821737
复制相似问题