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
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 }
This works well
vars = Capistrano::Configuration
.env
.instance_eval { @variables }
.trusted_keys
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With