From 5f1dc8e3b74d4f4deb0617be6190a32256f4fe18 Mon Sep 17 00:00:00 2001 From: Amparo Luna Date: Fri, 1 Feb 2013 14:59:29 -0500 Subject: Add --rc option to support the load of a custom rc file --- railties/CHANGELOG.md | 4 ++++ railties/lib/rails/commands/application.rb | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 0a9c4a4984..f86baee4c3 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,5 +1,9 @@ ## 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. *Amparo Luna* diff --git a/railties/lib/rails/commands/application.rb b/railties/lib/rails/commands/application.rb index 8c1b20571c..92c9f9deb9 100644 --- a/railties/lib/rails/commands/application.rb +++ b/railties/lib/rails/commands/application.rb @@ -10,7 +10,13 @@ if ARGV.first != "new" else ARGV.shift 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) extra_args_string = File.read(railsrc) extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten -- cgit v1.2.3