ruby-on-rails-4capistrano3

Get a list of the set variables in Capistrano 3


I wonder if there is a simple way to get all the currently set variables in Capistrano 3?

So if I have:

set :user, "deploy"
set :application, "someapp"

I would like to get something like:

all_variables # => { user: "deploy", application: "someapp", ... }

Thanks


Solution

  • I was looking for the same thing and found Capistrano::Configuration.env.

    namespace :dump do
      task :env do
        pp Capistrano::Configuration.env
      end
    end
    

    This should allow you to view all :set variables by calling cap dump:env.

    Use fetch to get the values.

    Fetch mention in getting started guide

    Quick Edit: To get exactly what you're looking for try:

    all_variables = Capistrano::Configuration.env.instance_eval{ @config }