ScotterC
ScotterC

Reputation: 1064

Load Capistrano's environment in rails console

What's the best way to load the Capistrano environment within the rails console?

I'd like to access the variables and methods capistrano is using in deploys such as latest_release, source etc.

Ruby debug isn't efficient when trying to hack out complicated capistrano tasks.

Upvotes: 2

Views: 381

Answers (1)

tadman
tadman

Reputation: 211670

Within the Rails console is probably not practical as the two environments would likely come into conflict. In an interactive console isn't hard, though. You could add a Capistrano task that simply spins up one:

task :console do
  require 'irb'
  $config = self
  ARGV.clear
  IRB.start
end

This exposes the current configuration object as the global $config. Although using a global variable is a bit ugly, I couldn't find a way to switch the default context of IRB from the main object.

Upvotes: 4

Related Questions