mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Changing 'rails new' --master to be --main
Renaming test containing flag Updating other test referencing master branch Add notice that --master is deprecated, but still working the same as --main Only set @main if it's nil Making warn wildcard I think a hidden aliaes would be just as good Improving description & fixing rubocop error Forgot comma Deprecation warning was kind of hard - so just doing alias for now rubocop -a
This commit is contained in:
parent
077c66d5d6
commit
83f2f9fd24
5 changed files with 15 additions and 7 deletions
|
@ -97,7 +97,7 @@ module Rails
|
|||
class_option :edge, type: :boolean, default: false,
|
||||
desc: "Set up the #{name} with Gemfile pointing to Rails repository"
|
||||
|
||||
class_option :master, type: :boolean, default: false,
|
||||
class_option :main, type: :boolean, default: false, aliases: "--master",
|
||||
desc: "Set up the #{name} with Gemfile pointing to Rails repository main branch"
|
||||
|
||||
class_option :rc, type: :string, default: nil,
|
||||
|
@ -279,7 +279,7 @@ module Rails
|
|||
[
|
||||
GemfileEntry.github("rails", "rails/rails", "main")
|
||||
]
|
||||
elsif options.master?
|
||||
elsif options.main?
|
||||
[
|
||||
GemfileEntry.github("rails", "rails/rails", "main")
|
||||
]
|
||||
|
|
|
@ -46,7 +46,7 @@ end
|
|||
group :development do
|
||||
<%- unless options.api? || options.skip_dev_gems? -%>
|
||||
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
||||
<%- if options.dev? || options.edge? || options.master? -%>
|
||||
<%- if options.dev? || options.edge? || options.main? -%>
|
||||
gem 'web-console', github: 'rails/web-console'
|
||||
<%- else -%>
|
||||
gem 'web-console', '>= 4.1.0'
|
||||
|
|
|
@ -20,5 +20,5 @@ Gem::Specification.new do |spec|
|
|||
|
||||
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
|
||||
|
||||
<%= '# ' if options.dev? || options.edge? || options.master? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
|
||||
<%= '# ' if options.dev? || options.edge? || options.main? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ source 'https://rubygems.org'
|
|||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||
|
||||
<% if options[:skip_gemspec] -%>
|
||||
<%= '# ' if options.dev? || options.edge? || options.master? -%>gem 'rails', '<%= Array(rails_version_specifier).join("', '") %>'
|
||||
<%= '# ' if options.dev? || options.edge? || options.main? -%>gem 'rails', '<%= Array(rails_version_specifier).join("', '") %>'
|
||||
<% else -%>
|
||||
# Specify your gem's dependencies in <%= name %>.gemspec.
|
||||
gemspec
|
||||
|
|
|
@ -809,8 +809,8 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_web_console_with_master_option
|
||||
run_generator [destination_root, "--master"]
|
||||
def test_web_console_with_main_option
|
||||
run_generator [destination_root, "--main"]
|
||||
|
||||
assert_file "Gemfile" do |content|
|
||||
assert_match(/gem 'web-console',\s+github: 'rails\/web-console'/, content)
|
||||
|
@ -868,6 +868,14 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
|||
assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']main["']$}
|
||||
end
|
||||
|
||||
def test_main_option
|
||||
generator([destination_root], main: true, skip_webpack_install: true)
|
||||
run_generator_instance
|
||||
|
||||
assert_equal 1, @bundle_commands.count("install")
|
||||
assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']main["']$}
|
||||
end
|
||||
|
||||
def test_spring
|
||||
jruby_skip "spring doesn't run on JRuby"
|
||||
|
||||
|
|
Loading…
Reference in a new issue