lib/tap/generator/exe.rb in tap-gen-0.1.3 vs lib/tap/generator/exe.rb in tap-gen-0.2.0

- old
+ new

@@ -10,17 +10,23 @@ if argv.empty? || argv == ['--help'] yield end name = argv.shift - env, const = eeek('generator', name) + env, const = seek('generator', name, false) unless const raise "unknown generator: #{name}" end - generator = const.constantize.parse(argv) - generator.template_dir = env.class_path(:templates, generator) {|dir| File.directory?(dir) } + generator = const.constantize.parse!(argv) + + # do not reassign dir unless a template directory + # is found, otherwise you get an error + if template_dir = env.class_path(:templates, generator) {|dir| File.directory?(dir) } + generator.template_dir = template_dir + end + generator.extend(mod).process(*argv) end end end end \ No newline at end of file