Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chrisberkhout/305358 to your computer and use it in GitHub Desktop.
Save chrisberkhout/305358 to your computer and use it in GitHub Desktop.
Babushka: dynamic removal of a dep requirement, based on a condition evaluated after previous requires have been processed
# dynamic removal of a dep requirement,
# based on a condition evaluated after previous requires have been processed
dep 'site' do
requires \
'system',
'account',
'site dir',
'site options'
end
dep 'site options' do
requires 'rvm user'
setup {
define_var :install_rvm,
:message => "System ruby is \""+`ruby -v 2>&1`.chomp+"\" do you want to install your own in an RVM?",
:choices => ['yes', 'no'],
:default => 'no'
ask_for_var :install_rvm.to_s
definer.payload[:requires].delete 'rvm user' if var(:install_rvm)=='no'
}
end
dep 'rvm user' do
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment