Permalink
Browse files

Merge pull request #10712 from prathamesh-sonpatki/plugin-railsrc

Use .railsrc while creating new plugin if available. Fixes #10700
  • Loading branch information...
2 parents 18b462b + 4816fdd commit 20cf897d0e5c6945f7f533be875c34f436b5f056 @guilleiguaran guilleiguaran committed Dec 1, 2013
Showing with 19 additions and 0 deletions.
  1. +5 −0 railties/CHANGELOG.md
  2. +14 −0 railties/lib/rails/commands/plugin.rb
@@ -1,3 +1,8 @@
+* Uses .railsrc while creating new plugin if it is available.
+ Fixes #10700.
+
+ *Prathamesh Sonpatki*
+
* Remove turbolinks when generating a new application based on a template that skips it.
Example:
@@ -2,6 +2,20 @@
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'

0 comments on commit 20cf897

Please sign in to comment.