Skip to content

Commit

Permalink
Merge pull request #9147 from amparo-luna/custom_rc
Browse files Browse the repository at this point in the history
Add --rc option to support the load of a custom rc file
  • Loading branch information
guilleiguaran committed Feb 2, 2013
2 parents 3e1f231 + 5f1dc8e commit 9cb386d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions railties/CHANGELOG.md
@@ -1,5 +1,9 @@
## Rails 4.0.0 (unreleased) ## ## Rails 4.0.0 (unreleased) ##


* Add --rc option to support the load of a custom rc file during the generation of a new app.

*Amparo Luna*

* Add --no-rc option to skip the loading of railsrc file during the generation of a new app. * Add --no-rc option to skip the loading of railsrc file during the generation of a new app.


*Amparo Luna* *Amparo Luna*
Expand Down
8 changes: 7 additions & 1 deletion railties/lib/rails/commands/application.rb
Expand Up @@ -10,7 +10,13 @@
else else
ARGV.shift ARGV.shift
unless ARGV.delete("--no-rc") unless ARGV.delete("--no-rc")
railsrc = File.join(File.expand_path("~"), ".railsrc") customrc = ARGV.index('--rc')
railsrc = if customrc
ARGV.delete_at(customrc)
ARGV.delete_at(customrc)
else
File.join(File.expand_path("~"), '.railsrc')
end
if File.exist?(railsrc) if File.exist?(railsrc)
extra_args_string = File.read(railsrc) extra_args_string = File.read(railsrc)
extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten
Expand Down

0 comments on commit 9cb386d

Please sign in to comment.