# File lib/rubigen/scripts.rb, line 17 def run(args = [], runtime_options = {}) @stdout = runtime_options[:stdout] || $stdout begin parse!(args.dup, runtime_options) rescue OptionParser::InvalidOption => e # Don't cry, script. Generators want what you think is invalid. end # Generator name is the only required option. unless options[:generator] usage if args.empty? options[:generator] ||= args.shift end # Look up generator instance and invoke command on it. RubiGen::Base.instance(options[:generator], args, options).command(options[:command]).invoke! rescue => e stdout.puts e stdout.puts " #{e.backtrace.join("\n ")}\n" if options[:backtrace] raise SystemExit unless options[:no_exit] end