Created
December 9, 2013 01:50
-
-
Save nanliu/7866322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simplify github module convention | |
def github(name, options = nil) | |
options ||= {} | |
options[:user] ||= 'puppetlabs' | |
options[:version] ||= :master | |
options[:protocol] ||= 'git' | |
options[:prefix] ||= case options[:user] | |
when 'puppetlabs' | |
'puppetlabs' | |
when 'VMop', 'vmware' | |
'vmware' | |
else | |
'puppet' | |
end | |
options[:repo] ||= case options[:protocol] | |
when 'git' | |
"#{options[:protocol]}@github.com:#{options[:user]}/#{options[:prefix]}-#{name}.git" | |
when 'https' | |
"#{options[:protocol]}://github.com/#{options[:user]}/#{options[:prefix]}-#{name}.git" | |
else | |
raise Error, "Invalid github repo protocol." | |
end | |
if options[:version] == :master | |
# puts name, options[:repo] | |
mod name, :git => options[:repo] | |
else | |
# puts name, options[:repo], options[:version] | |
mod name, :git => options[:repo] , :ref => options[:version] | |
end | |
end | |
# Puppet Labs modules | |
github 'stdlib', :version => '3.2.0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment