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