aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-08-31 16:00:18 +0930
committerGitHub <noreply@github.com>2017-08-31 16:00:18 +0930
commitaa1dc38dc285a2900d5059c924c3fa03ad6555ce (patch)
treebfd696f4d353c644776ac80cb4fc2ee89af37125 /railties/lib
parent7721f23e86782baa758c70dd81de80aa0857ca2c (diff)
parentbe49c302f30319cc460cd83ae0e89464dde11a37 (diff)
downloadrails-aa1dc38dc285a2900d5059c924c3fa03ad6555ce.tar.gz
rails-aa1dc38dc285a2900d5059c924c3fa03ad6555ce.tar.bz2
rails-aa1dc38dc285a2900d5059c924c3fa03ad6555ce.zip
Merge pull request #30323 from yhirano55/support_multiple_version_for_gem_method
Support multiple versions arguments for `gem` method of Generators
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/actions.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index c773e07eba..9800e5750a 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -13,17 +13,22 @@ module Rails
#
# gem "rspec", group: :test
# gem "technoweenie-restful-authentication", lib: "restful-authentication", source: "http://gems.github.com/"
- # gem "rails", "3.0", git: "git://github.com/rails/rails"
+ # gem "rails", "3.0", git: "https://github.com/rails/rails"
+ # gem "RedCloth", ">= 4.1.0", "< 4.2.0"
def gem(*args)
options = args.extract_options!
- name, version = args
+ name, *versions = args
# Set the message to be shown in logs. Uses the git repo if one is given,
# otherwise use name (version).
parts, message = [ quote(name) ], name.dup
- if version ||= options.delete(:version)
- parts << quote(version)
- message << " (#{version})"
+
+ if versions = versions.any? ? versions : options.delete(:version)
+ _versions = Array(versions)
+ _versions.each do |version|
+ parts << quote(version)
+ end
+ message << " (#{_versions.join(", ")})"
end
message = options[:git] if options[:git]