Class: Rails::Generators::ARGVScrubber
- 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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ ARGVScrubber
constructor
A new instance of ARGVScrubber.
- #prepare! ⇒ Object
Constructor Details
#initialize(argv = ARGV) ⇒ ARGVScrubber
Returns a new instance of ARGVScrubber.
585 586 587 |
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 585 def initialize(argv = ARGV) @argv = argv end |
Class Method Details
.default_rc_file ⇒ Object
596 597 598 599 600 601 602 603 604 |
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 596 def self.default_rc_file xdg_config_home = ENV["XDG_CONFIG_HOME"].presence || "~/.config" xdg_railsrc = File.("rails/railsrc", xdg_config_home) if File.exist?(xdg_railsrc) xdg_railsrc else File.("~/.railsrc") end end |
Instance Method Details
#prepare! ⇒ Object
589 590 591 592 593 594 |
# File 'railties/lib/rails/generators/rails/app/app_generator.rb', line 589 def prepare! handle_version_request!(@argv.first) handle_invalid_command!(@argv.first, @argv) do handle_rails_rc!(@argv.drop(1)) end end |