I'm having problems with a variable scope with a multi-stage capistrano-ext gem module. I currently have config/deploy/staging.rb .
set(:settings) { YAML.load_file("config/deploy.yml")['staging'] } set :repository, settings["repository"] set :deploy_to, settings["deploy_to"] set :branch, settings["branch"] set :domain, settings["domain"] set :user, settings["user"] role :app, domain role :web, domain role :db, domain, :primary => true
My config/deploy/production.rb file is similar. It does not seem very dry. Ideally, I would like everything to be in the deploy.rb file. If there was a variable with the current stage, everything would be really clean.
UPDATE: I found a solution.
I defined this function in deploy.rb :
def set_settings(params) params.each_pair do |k,v| set k.to_sym, v end if exists? :domain role :app, domain role :web, domain role :db, domain, :primary => true end end
Then my staging.rb file staging.rb just set_settings(YAML.load_file("config/deploy.yml")['staging'])
source share