cmd/destroy.rb in tap-gen-0.2.0 vs cmd/destroy.rb in tap-gen-0.3.0
- old
+ new
@@ -4,18 +4,24 @@
# best way to figure out what a generator does is to use --help. For example:
#
# % tap generate root --help
#
-require 'tap/generator/exe'
-require 'tap/generator/destroy'
+require 'tap/generator/base'
-env = Tap::Env.instance
-env.extend Tap::Generator::Exe
+app = Tap::App.instance
-env.run(Tap::Generator::Destroy, ARGV) do
+if ARGV.empty? || ARGV == ['--help']
+ constants = app.env.constants
+ generators = constants.summarize do |constant|
+ constant.types['generator']
+ end
+
puts Lazydoc.usage(__FILE__)
puts
- puts "generators:"
- puts env.manifest('generator').summarize
+ puts generators
exit(1)
end
+
+generator = app.build('class' => ARGV.shift, 'spec' => ARGV)
+generator.signal(:set).call([Tap::Generator::Destroy])
+generator.call(*ARGV)