gen-config: grooming

This commit is contained in:
Luka Vandervelden 2019-10-25 13:21:22 +02:00
parent add94be507
commit fe4bce0a44

View File

@ -7,7 +7,7 @@ def sanitize_path(path)
path.gsub /\/\/+/, "/"
end
module Configure
module GenConfig
def self.parse_options(unparsed : Array(String))
options = ARGV.map(&.split '=')
@ -32,10 +32,10 @@ module Configure
end
end
class Configure::Exception < Exception
class GenConfig::Exception < Exception
end
class Configure::Context
class GenConfig::Context
getter root : String
def initialize(@root)
@ -116,11 +116,11 @@ end
ARGV.shift
ARGV.shift
options = Configure.parse_options ARGV
options = GenConfig.parse_options ARGV
begin
Configure::Context.new("/").generate(template, target, options)
rescue e : Configure::Exception
GenConfig::Context.new("/").generate(template, target, options)
rescue e : GenConfig::Exception
STDERR.puts "Fatal error: #{e.message}"
exit 1
rescue e : Crinja::TypeError