diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-28 17:10:00 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-28 17:10:00 -0700 |
commit | f5ef5ed3d5f3d432715a2b187fe8f72f6d5acf6d (patch) | |
tree | b58c7d1c56308c5365174b8a7a4ad17e4b1b0ce4 /railties | |
parent | faa1b82bf2ae5d33bfa1ee5552878d5ca69607b0 (diff) | |
download | rails-f5ef5ed3d5f3d432715a2b187fe8f72f6d5acf6d.tar.gz rails-f5ef5ed3d5f3d432715a2b187fe8f72f6d5acf6d.tar.bz2 rails-f5ef5ed3d5f3d432715a2b187fe8f72f6d5acf6d.zip |
fix template Gemfiles
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 11 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 11 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/Gemfile | 15 |
3 files changed, 25 insertions, 12 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index c24d9fdffc..3731be38ae 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -83,6 +83,17 @@ module Rails protected + def gemfile_entries + @gemfile_entries ||= [ + rails_gemfile_entry, + database_gemfile_entry, + assets_gemfile_entry, + javascript_gemfile_entry, + jbuilder_gemfile_entry, + webconsole_gemfile_entry, + sdoc_gemfile_entry].flatten + end + def builder @builder ||= begin builder_class = get_builder_class diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 68efd17067..6927cc52dd 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -164,17 +164,6 @@ module Rails end end - def gemfile_entries - @gemfile_entries ||= [ - rails_gemfile_entry, - database_gemfile_entry, - assets_gemfile_entry, - javascript_gemfile_entry, - jbuilder_gemfile_entry, - webconsole_gemfile_entry, - sdoc_gemfile_entry].flatten - end - public_task :set_default_accessors! public_task :create_root diff --git a/railties/lib/rails/generators/rails/plugin/templates/Gemfile b/railties/lib/rails/generators/rails/plugin/templates/Gemfile index 3f2b78f2fd..d576784415 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/Gemfile +++ b/railties/lib/rails/generators/rails/plugin/templates/Gemfile @@ -23,7 +23,20 @@ end <% if options.dev? || options.edge? -%> # Your gem is dependent on dev or edge Rails. Once you can lock this # dependency down to a specific version, move it to your gemspec. -<%= rails_gemfile_entry -%> +<% max_width = gemfile_entries.map { |g| g.name.length }.max -%> +<% gemfile_entries.each do |gem| -%> +<% if gem.comment -%> + +# <%= gem.comment %> +<% end -%> +<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<% if gem.version -%> +, '<%= gem.version %>' +<% elsif gem.options.any? -%> +,<%= gem.padding(max_width) %><%= gem.options.map { |k,v| + "#{k}: #{v.inspect}" }.join(', ') %> +<% else %> +<% end -%> +<% end -%> <% end -%> # To use debugger |