Steve Upstill
Steve Upstill

Reputation: 442

Why doesn't the Heroku client CLI work under Capistrano?

I have a Capistrano deployment that needs to get the database URL (using the deploying machine, not the target) by calling Heroku toolbelt with Ruby backticks, viz heroku pgbackups:url --app strong-galaxy-5765. I have done this under Capistrano 2 for months, but now, after upgrading to Ruby 2.2 and Cap 3, calling the heroku command using Ruby backticks within the Capistrano task produces a blank string. And it's not just this particular command: even 'heroku --version' returns nothing.

Data points: * standard shell commands are back-tickable and produce appropriate output * The behavior is identical if I give an absolute path to the 'heroku' command. * whoami reveals that the user under the Capistrano task is me. * all heroku commands that I've tried in a generic Ruby script with backticks work fine. * Everything worked fine until I switched to Capistrano 3 and Ruby 2.2

So there must be something about the Capistrano environment, and I'm climbing the walls trying to figure out what it would be. One possible clue: I get the following error output from my Capistrano task when running the 'heroku' command:

/Users/upstill/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.12/lib/bundler/definition.rb:380:in validate_ruby!': Your Ruby version is 1.9.3, but your Gemfile specified 2.2.0 (Bundler::RubyVersionMismatch) from /Users/upstill/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.12/lib/bundler.rb:118:insetup' from /Users/upstill/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.12/lib/bundler/setup.rb:17:in <top (required)>' from /usr/local/heroku/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' from /usr/local/heroku/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' INFO 'heroku pgbackups:url --app strong-galaxy-5765' => (pid 46786 exit 1)

Note: my Ruby environment is 2.2.0, as shown by ALL OF my Gemfile, :rbenv_ruby in the Cap deploy.rb file, rvm, rbenv and 'ruby -v'. Everything else Capistrano does uses the 2.2 environment. But 'heroku --version' reveals that IT is built for 1.9.3. I would love to build it for 2.2, but running the installer again in the new environment did nothing to change the Ruby spec.

Okay, so this is my dead end. Any help would be desperately appreciated.

Thanks, Steve

Upvotes: 0

Views: 103

Answers (1)

Jeff Dickey
Jeff Dickey

Reputation: 5034

install the toolbelt via homebrew instead

$ brew install heroku

Upvotes: 0

Related Questions