diff options
author | José Valim <jose.valim@gmail.com> | 2011-10-02 02:13:30 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-10-02 02:13:30 -0700 |
commit | 5af5e7789587e911ee81778ee84b05cbc9550bc5 (patch) | |
tree | 9ee7fdb83a08704289431a5f19e16cacb4fc023d /railties | |
parent | ec53b802dab9b676dcc9b53e542bcd840983b7a2 (diff) | |
parent | 101fb42106db4e7e8221a3fec252e51dd84e0bb4 (diff) | |
download | rails-5af5e7789587e911ee81778ee84b05cbc9550bc5.tar.gz rails-5af5e7789587e911ee81778ee84b05cbc9550bc5.tar.bz2 rails-5af5e7789587e911ee81778ee84b05cbc9550bc5.zip |
Merge pull request #2583 from guilleiguaran/railsrc
Read extra args for 'rails new' from ~/.railsrc
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/commands/application.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/USAGE | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/railties/lib/rails/commands/application.rb b/railties/lib/rails/commands/application.rb index 1cf23a8b92..60d1aed73a 100644 --- a/railties/lib/rails/commands/application.rb +++ b/railties/lib/rails/commands/application.rb @@ -9,6 +9,14 @@ if ARGV.first != "new" ARGV[0] = "--help" else ARGV.shift + railsrc = File.join(File.expand_path("~"), ".railsrc") + if File.exist?(railsrc) + extra_args_string = File.open(railsrc).read + extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten + puts "Using #{extra_args.join(" ")} from #{railsrc}" + ARGV << extra_args + ARGV.flatten! + end end require 'rubygems' if ARGV.include?("--dev") diff --git a/railties/lib/rails/generators/rails/app/USAGE b/railties/lib/rails/generators/rails/app/USAGE index 9e7a78d132..691095f33f 100644 --- a/railties/lib/rails/generators/rails/app/USAGE +++ b/railties/lib/rails/generators/rails/app/USAGE @@ -2,6 +2,12 @@ Description: The 'rails new' command creates a new Rails application with a default directory structure and configuration at the path you specify. + You can specify extra command-line arguments to be used every time + 'rails new' runs in the .railsrc configuration file in your home directory. + + Note that the arguments specified in the .railsrc file don't affect the + defaults values shown above in this help message. + Example: rails new ~/Code/Ruby/weblog |