instance method run

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

run(args = [], runtime_options = {})

Run the generator script. Takes an array of unparsed arguments and a hash of parsed arguments, takes the generator as an option or first remaining argument, and invokes the requested command.

Parameters

args opt = []
runtime_options opt = {}
Source
# File railties/lib/rails_generator/scripts.rb, line 17
        def run(args = [], runtime_options = {})
          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.
          Rails::Generator::Base.instance(options[:generator], args, options).command(options[:command]).invoke!
        rescue => e
          puts e
          puts "  #{e.backtrace.join("\n  ")}\n" if options[:backtrace]
          raise SystemExit
        end

Defined in railties/lib/rails_generator/scripts.rb line 17 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Generator::Scripts::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close