Created
October 22, 2012 23:24
-
-
Save thomasbiddle/3935444 to your computer and use it in GitHub Desktop.
Librarian-Puppet Rake Task for Templating the Puppetfile
This file contains hidden or 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
#!/usr/bin/ruby | |
require 'erb' | |
desc "Templates the Puppetfile to the specified environment" | |
task :template_puppetfile, [:env] do |t, args| | |
unless args[:env].nil? | |
@environment = args[:env] | |
read_file = 'Puppetfile.erb' | |
write_file = 'Puppetfile' | |
erb = ERB.new(File.read(read_file)) | |
File.open(write_file, 'w') { |file| file.write(erb.result) } | |
else | |
puts "An environment must be specified." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment