aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2013-05-21 21:04:29 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2013-12-01 20:47:15 +0530
commit4816fdd385b3187b1eaaa2ec4d0026324d631e45 (patch)
tree360cf21e86e68db259e214fc7153ffc52b038d5d /railties/lib/rails
parent18b462b3f9c99b3fcfcb7b83affa931d9c4020bf (diff)
downloadrails-4816fdd385b3187b1eaaa2ec4d0026324d631e45.tar.gz
rails-4816fdd385b3187b1eaaa2ec4d0026324d631e45.tar.bz2
rails-4816fdd385b3187b1eaaa2ec4d0026324d631e45.zip
Use .railsrc while creating new plugin if available
- Fixes #10700
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/commands/plugin.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/lib/rails/commands/plugin.rb b/railties/lib/rails/commands/plugin.rb
index 837fe0ec10..f7a0b99005 100644
--- a/railties/lib/rails/commands/plugin.rb
+++ b/railties/lib/rails/commands/plugin.rb
@@ -2,6 +2,20 @@ if ARGV.first != "new"
ARGV[0] = "--help"
else
ARGV.shift
+ unless ARGV.delete("--no-rc")
+ customrc = ARGV.index{ |x| x.include?("--rc=") }
+ railsrc = if customrc
+ File.expand_path(ARGV.delete_at(customrc).gsub(/--rc=/, ""))
+ 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
+ puts "Using #{extra_args.join(" ")} from #{railsrc}"
+ ARGV.insert(1, *extra_args)
+ end
+ end
end
require 'rails/generators'