views:

60

answers:

1

I'm deploying a rails app on Slicehost using Capistrano. Part of the process of deployment involves rebuilding a gem and installing it.

Deploying the code to the server via git scm works fine, but for some reason when I try and do a...

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

... in a separate task in deploy.rb, it all goes bboom. I get a wierd error telling me that the files in the gemspec aren't files...

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

Which is weird because the same command works perfectly when i ssh into the box and do it manually, and when i do....

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

which is how capistrano wraps remote command line calls, that works fine too when i do it manually.

Even tried wrapping in a Kernel.system() call in another ruby file and calling that from deploy.rb, but still get the same problem. Crazy.

Wonder if its something to do with the

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

string thats being added into the output at apparently random intervals.

A: 

It's possible that "it works fine" isn't entirely true, are you sure it doesn't output STDERR ?

The out :: IP addr thing is a little strange, and not normal; you should also consider whether or not your PATH is set properly, this is the difference between a PTY and a TTY.

The easisest way to do this (but, not perfect) is:

run('echo $PATH')

versus

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

(the latter is what Cap, actually does.)

You may also want to try:

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

^ one of these will work for you.

Beaks