Skip to content
Browse files

add jbuilder web-console and sdoc to the GemEntry list

  • Loading branch information...
1 parent 61c65a0 commit 99cea666abf5ccc18485ed0adb8f816c82ed402a @tenderlove tenderlove committed Oct 27, 2013
View
37 railties/lib/rails/generators/app_base.rb
@@ -122,9 +122,8 @@ def set_default_accessors!
def database_gemfile_entry
return [] if options[:skip_active_record]
- gem = GemfileEntry.version gem_for_database, nil,
+ GemfileEntry.version gem_for_database, nil,
"Use #{options[:database]} as the database for Active Record"
- return [gem]
end
def include_all_railties?
@@ -163,19 +162,15 @@ def padding(max_width)
def rails_gemfile_entry
if options.dev?
- [
- GemfileEntry.path('rails', Rails::Generators::RAILS_DEV_PATH),
- GemfileEntry.github('arel', 'rails/arel'),
- ]
+ [GemfileEntry.path('rails', Rails::Generators::RAILS_DEV_PATH),
+ GemfileEntry.github('arel', 'rails/arel')]
elsif options.edge?
- [
- GemfileEntry.path('rails', 'rails/rails'),
- GemfileEntry.path('arel', 'rails/arel'),
- ]
+ [GemfileEntry.path('rails', 'rails/rails'),
+ GemfileEntry.path('arel', 'rails/arel')]
else
- [
- GemfileEntry.new('rails', "Bundle edge Rails instead: gem 'rails', github: 'rails/rails'", Rails::VERSION::STRING)
- ]
+ [GemfileEntry.version('rails',
+ Rails::VERSION::STRING,
+ "Bundle edge Rails instead: gem 'rails', github: 'rails/rails'")]
end
end
@@ -233,6 +228,21 @@ def assets_gemfile_entry
gems
end
+ def jbuilder_gemfile_entry
+ comment = 'Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder'
+ GemfileEntry.version('jbuilder', '~> 1.2', comment)
+ end
+
+ def webconsole_gemfile_entry
+ comment = 'Run `rails console` in the browser. Read more: https://github.com/rails/web-console'
+ GemfileEntry.new('web-console', comment, nil, group: :development)
+ end
+
+ def sdoc_gemfile_entry
+ comment = 'bundle exec rake doc:rails generates the API under doc/api.'
+ GemfileEntry.new('web-console', comment, nil, { :group => :doc, :require => false })
+ end
+
def coffee_gemfile_entry
comment = 'Use CoffeeScript for .js.coffee assets and views'
if options.dev? || options.edge?
@@ -252,6 +262,7 @@ def javascript_gemfile_entry
gems << GemfileEntry.version("turbolinks", nil,
"Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks")
+ gems
end
end
View
12 railties/lib/rails/generators/rails/app/app_generator.rb
@@ -163,10 +163,14 @@ def initialize(*args)
end
def gemfile_gems
- rails_gemfile_entry +
- database_gemfile_entry +
- assets_gemfile_entry +
- javascript_gemfile_entry
+ @gemfile_gems ||= [
+ 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!
View
13 railties/lib/rails/generators/rails/app/templates/Gemfile
@@ -10,22 +10,11 @@ gem '<%= gem.name %>'<% if gem.version -%>
, '<%= gem.version %>'
<% elsif gem.options.any? -%>
,<%= gem.padding(max_width) %><%= gem.options.map { |k,v|
- "#{k}: '#{v}'" }.join(', ') %>
+ "#{k}: #{v.inspect}" }.join(', ') %>
<% else %>
<% end -%>
<% end -%>
-# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
-gem 'jbuilder', '~> 1.2'
-
-# Run `rails console` in the browser. Read more: https://github.com/rails/web-console
-gem 'web-console', group: :development
-
-group :doc do
- # bundle exec rake doc:rails generates the API under doc/api.
- gem 'sdoc', require: false
-end
-
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

0 comments on commit 99cea66

Please sign in to comment.
Something went wrong with that request. Please try again.