diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-30 16:37:33 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-30 16:37:33 -0700 |
commit | 19ca0952bbdcf744f12d2bedb267dff20618e149 (patch) | |
tree | 41a394c3eea0923f3f0b87157e8b6aba6cd97e4b /railties/lib/rails | |
parent | 36ea8e6a3bb75753dd64032d1a8ebff0ffcdca68 (diff) | |
download | rails-19ca0952bbdcf744f12d2bedb267dff20618e149.tar.gz rails-19ca0952bbdcf744f12d2bedb267dff20618e149.tar.bz2 rails-19ca0952bbdcf744f12d2bedb267dff20618e149.zip |
there is no reason for ARGV[0] to be nil
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index b6dbb11a34..718be02f30 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -362,15 +362,17 @@ module Rails end end + def read_rc_file(railsrc) + return [] unless File.exists?(railsrc) + extra_args_string = File.read(railsrc) + extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten + puts "Using #{extra_args.join(" ")} from #{railsrc}" + extra_args + end + def insert_railsrc_into_argv!(argv, railsrc) - if File.exist?(railsrc) - extra_args_string = File.read(railsrc) - extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten - puts "Using #{extra_args.join(" ")} from #{railsrc}" - [argv.first] + extra_args + argv.drop(1) - else - argv - end + extra_args = read_rc_file railsrc + argv.take(1) + extra_args + argv.drop(1) end end end |