Skip to content

Commit

Permalink
fix the class name
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 27, 2013
1 parent 9385752 commit 61c65a0
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions railties/lib/rails/generators/app_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def set_default_accessors!

def database_gemfile_entry
return [] if options[:skip_active_record]
gem = GemfileGem.version gem_for_database, nil,
gem = GemfileEntry.version gem_for_database, nil,
"Use #{options[:database]} as the database for Active Record"
return [gem]
end
Expand All @@ -135,7 +135,7 @@ def comment_if(value)
options[value] ? '# ' : ''
end

class GemfileGem < Struct.new(:name, :comment, :version, :options, :commented_out)
class GemfileEntry < Struct.new(:name, :comment, :version, :options, :commented_out)

This comment has been minimized.

Copy link
@frodsan

frodsan Oct 27, 2013

Contributor

Is this part of the public API? (#nodoc it?)

This comment has been minimized.

Copy link
@rafaelfranca

rafaelfranca Oct 27, 2013

Member

I think it will part of public API since users will be able to use the methods to filter the gems they want

This comment has been minimized.

Copy link
@frodsan

frodsan Oct 28, 2013

Contributor

cool 👍

def initialize(name, comment, version, options = {}, commented_out = false)
super
end
Expand Down Expand Up @@ -164,17 +164,17 @@ def padding(max_width)
def rails_gemfile_entry
if options.dev?
[
GemfileGem.path('rails', Rails::Generators::RAILS_DEV_PATH),
GemfileGem.github('arel', 'rails/arel'),
GemfileEntry.path('rails', Rails::Generators::RAILS_DEV_PATH),
GemfileEntry.github('arel', 'rails/arel'),
]
elsif options.edge?
[
GemfileGem.path('rails', 'rails/rails'),
GemfileGem.path('arel', 'rails/arel'),
GemfileEntry.path('rails', 'rails/rails'),
GemfileEntry.path('arel', 'rails/arel'),
]
else
[
GemfileGem.new('rails', "Bundle edge Rails instead: gem 'rails', github: 'rails/rails'", Rails::VERSION::STRING)
GemfileEntry.new('rails', "Bundle edge Rails instead: gem 'rails', github: 'rails/rails'", Rails::VERSION::STRING)
]
end
end
Expand Down Expand Up @@ -211,17 +211,17 @@ def assets_gemfile_entry

gems = []
gemfile = if options.dev? || options.edge?
gems << GemfileGem.github('sprockets-rails', 'rails/sprockets-rails',
gems << GemfileEntry.github('sprockets-rails', 'rails/sprockets-rails',
'Use edge version of sprockets-rails')
gems << GemfileGem.github('sass-rails', 'rails/sass-rails',
gems << GemfileEntry.github('sass-rails', 'rails/sass-rails',
'Use SCSS for stylesheets')
else
gems << GemfileGem.version('sass-rails',
gems << GemfileEntry.version('sass-rails',
'~> 4.0.0.rc1',
'Use SCSS for stylesheets')
end

gems << GemfileGem.version('uglifier',
gems << GemfileEntry.version('uglifier',
'>= 1.3.0',
'Use Uglifier as compressor for JavaScript assets')

Expand All @@ -236,9 +236,9 @@ def assets_gemfile_entry
def coffee_gemfile_entry
comment = 'Use CoffeeScript for .js.coffee assets and views'
if options.dev? || options.edge?
GemfileGem.github 'coffee-rails', 'rails/coffee-rails', comment
GemfileEntry.github 'coffee-rails', 'rails/coffee-rails', comment
else
GemfileGem.version 'coffee-rails', '~> 4.0.0', comment
GemfileEntry.version 'coffee-rails', '~> 4.0.0', comment
end
end

Expand All @@ -247,20 +247,20 @@ def javascript_gemfile_entry
[]
else
gems = [coffee_gemfile_entry, javascript_runtime_gemfile_entry]
gems << GemfileGem.version("#{options[:javascript]}-rails", nil,
gems << GemfileEntry.version("#{options[:javascript]}-rails", nil,
"Use #{options[:javascript]} as the JavaScript library")

gems << GemfileGem.version("turbolinks", nil,
gems << GemfileEntry.version("turbolinks", nil,
"Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks")
end
end

def javascript_runtime_gemfile_entry
comment = 'See https://github.com/sstephenson/execjs#readme for more supported runtimes'
runtime = if defined?(JRUBY_VERSION)
GemfileGem.version 'therubyrhino', comment, nil
GemfileEntry.version 'therubyrhino', comment, nil

This comment has been minimized.

Copy link
@rubys

rubys Nov 1, 2013

Contributor

The order of the parameters appears to be wrong, perhaps the class itself could be made more consistent?

class GemfileEntry < Struct.new(:name, :comment, :version, :options, :commented_out)
def initialize(name, comment, version, options = {}, commented_out = false)
def self.version(name, version, comment = nil)

This comment has been minimized.

Copy link
@rafaelfranca

rafaelfranca Nov 1, 2013

Member

Fixed at fe21c85

else
GemfileGem.new 'therubyracer', comment, nil, { :platforms => :ruby }, true
GemfileEntry.new 'therubyracer', comment, nil, { :platforms => :ruby }, true
end
end

Expand Down

0 comments on commit 61c65a0

Please sign in to comment.