Skip to content

Commit

Permalink
add the database gem
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 27, 2013
1 parent f77e211 commit 469eafa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 3 additions & 5 deletions railties/lib/rails/generators/app_base.rb
Expand Up @@ -121,11 +121,9 @@ def set_default_accessors!
end end


def database_gemfile_entry def database_gemfile_entry
options[:skip_active_record] ? "" : return [] if options[:skip_active_record]
<<-GEMFILE.strip_heredoc gem = GemfileGem.new gem_for_database, "Use #{options[:database]} as the database for Active Record"
# Use #{options[:database]} as the database for Active Record return [gem]
gem '#{gem_for_database}'
GEMFILE
end end


def include_all_railties? def include_all_railties?
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/rails/app/app_generator.rb
Expand Up @@ -163,7 +163,7 @@ def initialize(*args)
end end


def gemfile_gems def gemfile_gems
rails_gemfile_entry rails_gemfile_entry + database_gemfile_entry
end end


public_task :set_default_accessors! public_task :set_default_accessors!
Expand Down
7 changes: 4 additions & 3 deletions railties/lib/rails/generators/rails/app/templates/Gemfile
Expand Up @@ -2,7 +2,10 @@ source 'https://rubygems.org'


<% max_width = gemfile_gems.map { |g| g.name.length }.max -%> <% max_width = gemfile_gems.map { |g| g.name.length }.max -%>
<% gemfile_gems.each do |gem| -%> <% gemfile_gems.each do |gem| -%>
<%= gem.comment -%> <% if gem.comment -%>
# <%= gem.comment %>
<% end -%>
<% if gem.version -%> <% if gem.version -%>
gem '<%= gem.name %>',<%= gem.padding(max_width) %>'<%= gem.version %>' gem '<%= gem.name %>',<%= gem.padding(max_width) %>'<%= gem.version %>'
<% elsif gem.path -%> <% elsif gem.path -%>
Expand All @@ -14,8 +17,6 @@ gem '<%= gem.name %>'
<% end -%> <% end -%>
<% end -%> <% end -%>
<%= database_gemfile_entry -%>
<%= assets_gemfile_entry %> <%= assets_gemfile_entry %>
<%= javascript_gemfile_entry -%> <%= javascript_gemfile_entry -%>
Expand Down

0 comments on commit 469eafa

Please sign in to comment.