Skip to content

Commit

Permalink
avoid object creation if there is no rc file
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 30, 2013
1 parent f7ae6e1 commit b0645ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/rails/app/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,14 @@ def railsrc(argv)
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)
return argv unless File.exists?(railsrc)
extra_args = read_rc_file railsrc
argv.take(1) + extra_args + argv.drop(1)
end
Expand Down

0 comments on commit b0645ea

Please sign in to comment.