Class: Rails::Generators::AppPreparer

Inherits:
Object
  • Object
show all
Defined in:
railties/lib/rails/generators/rails/app/app_generator.rb

Overview

This class handles preparation of the arguments before the AppGenerator is called. The class provides version or help information if they were requested, and also constructs the railsrc file (used for extra configuration options).

This class should be called before the AppGenerator is required and started since it configures and mutates ARGV correctly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = ARGV) ⇒ AppPreparer

Returns a new instance of AppPreparer.



314
315
316
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 314

def initialize(argv = ARGV)
  @argv = argv
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv



312
313
314
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 312

def argv
  @argv
end

Instance Method Details

#prepare!Object



318
319
320
321
322
323
324
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 318

def prepare!
  handle_version_request!(argv.first)
  unless handle_invalid_command!(argv.first)
    argv.shift
    handle_rails_rc!
  end
end