Created
April 5, 2017 16:35
-
-
Save domcleal/5c1c9e892d175ac351d894204e7069db 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
fail("Usage: move_types_to_parameters.rb MANIFEST_PP CLASS_NAME") if ARGV.length != 2 | |
original_params = File.read(ARGV[0]).lines.map do |line| | |
$1 if line =~ /\A \$(\w+)\s+=.*,$/ | |
end.compact | |
require 'kafo_parsers/puppet_strings_module_parser' | |
hash = KafoParsers::PuppetStringsModuleParser.parse(ARGV.first) | |
original_params.each do |param| | |
type = hash[:types].fetch(param, 'Any') | |
puts " %s $%s = $::%s::params::%s," % [type, param, ARGV[1], param] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment