Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #14100 from chancancode/rails_new_edge

`rails new --edge` should use the '4-1-stable' branch
  • Loading branch information...
commit e27b6fe941d2f9bf7fffab71d5282356a9ac083e 2 parents 51bd49b + 24e1fff
@chancancode chancancode authored
View
20 railties/lib/rails/generators/app_base.rb
@@ -178,8 +178,12 @@ def initialize(name, version, comment, options = {}, commented_out = false)
super
end
- def self.github(name, github, comment = nil)
- new(name, nil, comment, github: github)
+ def self.github(name, github, branch = nil, comment = nil)
+ if branch
+ new(name, nil, comment, github: github, branch: branch)
+ else
+ new(name, nil, comment, github: github)
+ end
end
def self.version(name, version, comment = nil)
@@ -198,10 +202,10 @@ 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.github('arel', 'rails/arel', '5-0-stable')]
elsif options.edge?
- [GemfileEntry.github('rails', 'rails/rails'),
- GemfileEntry.github('arel', 'rails/arel')]
+ [GemfileEntry.github('rails', 'rails/rails', '4-1-stable'),
+ GemfileEntry.github('arel', 'rails/arel', '5-0-stable')]
else
[GemfileEntry.version('rails',
Rails::VERSION::STRING,
@@ -241,9 +245,9 @@ def assets_gemfile_entry
gems = []
if options.dev? || options.edge?
- gems << GemfileEntry.github('sprockets-rails', 'rails/sprockets-rails',
+ gems << GemfileEntry.github('sprockets-rails', 'rails/sprockets-rails', nil,
'Use edge version of sprockets-rails')
- gems << GemfileEntry.github('sass-rails', 'rails/sass-rails',
+ gems << GemfileEntry.github('sass-rails', 'rails/sass-rails', nil,
'Use SCSS for stylesheets')
else
gems << GemfileEntry.version('sass-rails',
@@ -279,7 +283,7 @@ def sdoc_gemfile_entry
def coffee_gemfile_entry
comment = 'Use CoffeeScript for .js.coffee assets and views'
if options.dev? || options.edge?
- GemfileEntry.github 'coffee-rails', 'rails/coffee-rails', comment
+ GemfileEntry.github 'coffee-rails', 'rails/coffee-rails', nil, comment
else
GemfileEntry.version 'coffee-rails', '~> 4.0.0', comment
end
View
4 railties/test/generators/shared_generator_tests.rb
@@ -105,11 +105,13 @@ def test_dev_option
assert_generates_with_bundler dev: true
rails_path = File.expand_path('../../..', Rails.root)
assert_file 'Gemfile', /^gem\s+["']rails["'],\s+path:\s+["']#{Regexp.escape(rails_path)}["']$/
+ assert_file 'Gemfile', %r{^gem\s+["']arel["'],\s+github:\s+["']#{Regexp.escape("rails/arel")}["'],\s+branch:\s+["']#{Regexp.escape("5-0-stable")}["']$}
end
def test_edge_option
assert_generates_with_bundler edge: true
- assert_file 'Gemfile', %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["']$}
+ assert_file 'Gemfile', %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']#{Regexp.escape("4-1-stable")}["']$}
+ assert_file 'Gemfile', %r{^gem\s+["']arel["'],\s+github:\s+["']#{Regexp.escape("rails/arel")}["'],\s+branch:\s+["']#{Regexp.escape("5-0-stable")}["']$}
end
def test_skip_gemfile
Please sign in to comment.
Something went wrong with that request. Please try again.