Permalink
Browse files

Merge pull request #2583 from guilleiguaran/railsrc

Read extra args for 'rails new' from ~/.railsrc
  • Loading branch information...
2 parents ec53b80 + 101fb42 commit 5af5e7789587e911ee81778ee84b05cbc9550bc5 @josevalim josevalim committed Oct 2, 2011
Showing with 14 additions and 0 deletions.
  1. +8 −0 railties/lib/rails/commands/application.rb
  2. +6 −0 railties/lib/rails/generators/rails/app/USAGE
@@ -9,6 +9,14 @@
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")
@@ -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

0 comments on commit 5af5e77

Please sign in to comment.