diff options
author | Xavier Noria <fxn@hashref.com> | 2014-01-12 21:25:16 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2014-01-12 22:14:44 +0100 |
commit | 20a795f64d8a4f540004d7361f6a02e81eba79bb (patch) | |
tree | 0ce0533d0418f1788411f470dea18a1aeee14906 /railties/lib/rails/generators | |
parent | 75c271198ac2c94c58b46389383aef2df1afc572 (diff) | |
download | rails-20a795f64d8a4f540004d7361f6a02e81eba79bb.tar.gz rails-20a795f64d8a4f540004d7361f6a02e81eba79bb.tar.bz2 rails-20a795f64d8a4f540004d7361f6a02e81eba79bb.zip |
fixes the Gemfile generator templates
The templates were written as if for a given gem you could either pass a version
or options, but not both. But you may want to specify a version and also a group
or whether the gem has to be required, for example.
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 6 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/Gemfile | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index 68bd62d4b1..6d017e187d 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -6,12 +6,10 @@ source 'https://rubygems.org' # <%= gem.comment %> <% end -%> -<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<% if gem.version -%> -, '<%= gem.version %>' -<% elsif gem.options.any? -%> +<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%> +<% if gem.options.any? -%> ,<%= gem.padding(max_width) %><%= gem.options.map { |k,v| "#{k}: #{v.inspect}" }.join(', ') %> -<% else %> <% end -%> <% end -%> diff --git a/railties/lib/rails/generators/rails/plugin/templates/Gemfile b/railties/lib/rails/generators/rails/plugin/templates/Gemfile index 88ec4e6354..f0a832f783 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/Gemfile +++ b/railties/lib/rails/generators/rails/plugin/templates/Gemfile @@ -29,12 +29,10 @@ end # <%= gem.comment %> <% end -%> -<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<% if gem.version -%> -, '<%= gem.version %>' -<% elsif gem.options.any? -%> +<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%> +<% if gem.options.any? -%> ,<%= gem.padding(max_width) %><%= gem.options.map { |k,v| "#{k}: #{v.inspect}" }.join(', ') %> -<% else %> <% end -%> <% end -%> |