68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/dopstick/cli.rb', line 68
def new(path = nil)
interrupt_with_help(:new) if options[:help] || path.to_s.strip.empty?
unless Generator.registered.include?(options[:type])
interrupt_with_error(
"--type must be one of #{Generator.registered.keys.inspect}"
)
end
package_name, namespace = expand_gem_name_and_namespace(path)
generator_module = Generator.registered[options[:type]]
generator_class = generator_module.const_get(:Generator)
options_class = generator_module.const_get(:Options)
generator = generator_class.new
generator.destination_root = File.expand_path(path)
generator.options = options_class.new(
dup_options.merge(
package_name: package_name,
namespace: namespace,
entry_path: namespace.underscore("/")
)
)
generator.invoke_all
end
|