Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created January 23, 2014 14:29
Show Gist options
  • Save mashiro/8579330 to your computer and use it in GitHub Desktop.
Save mashiro/8579330 to your computer and use it in GitHub Desktop.
明示した変数だけ環境変数で上書きできる感じのやつ
# vim: ft=ruby
namespace 'load' do
task :defaults do
set :overridable_attributes, :branch
end
task :override do
attrs = Array(fetch(:overridable_attributes)).compact
attrs.each do |attr|
name = attr.to_s.upcase
set attr, ENV[name] if ENV[name]
end
end
end
Capistrano::DSL.stages.each do |stage|
after stage, 'load:override'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment