Last active
August 29, 2015 14:19
-
-
Save werebus/b1ea94fd3e12ea794586 to your computer and use it in GitHub Desktop.
Getting knife configuration into chef-dk generator
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
#<chef_repo>/code_generator/libraries/config_defaults.rb | |
#Pull in all of the values defined in the `chefdk` context in knife.rb | |
Chef::Config[:chefdk].configuration.each do |config_key, value| | |
ChefDK::Generator.context.send("#{config_key}=", value) | |
end |
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
#<chef_repo>/.chef/knife.rb | |
require 'optparse' | |
# Other knife stuff | |
if config_contexts.include? :chefdk | |
chefdk.generator_cookbook File.join(current_dir, '..', 'code_generator') | |
chefdk.copyright_holder "UMass Transit Service" | |
chefdk.email '[email protected]' | |
chefdk.license 'mit' | |
OptionParser.new do |opts| | |
opts.on('-C', '--copyright HOLDER') do |c| | |
chefdk.copyright_holder c | |
end | |
opts.on('-m', '--email EMAIL') do |m| | |
chefdk.email m | |
end | |
opts.on('-I', '--license LICENSE') do |i| | |
chefdk.license i | |
end | |
end.parse! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment