railties 7.0.0.rc3 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4faffb109d7c8de979dd145a095fb9ab2cecd14b0c04ba22a59bd993bbc876fc
4
- data.tar.gz: a707973415707a90df0bef3b4d7ceee7394e567c1dcd7e502df793147fe82f60
3
+ metadata.gz: 5cb58ddc9e6fbbf28a0fb9c625cecec9cd282d59ccd697cf37cd1f78f7d25811
4
+ data.tar.gz: b6304f9dfa982671da582fb01c63f310b76d3d043aca2826ff5c54acecc7f90c
5
5
  SHA512:
6
- metadata.gz: c05ecaa835e442827306d60819e5325fb49453764e8c3cdfeb9dd8e83356fd22e7ec7b8225daa7ab1b0e660a6381f9f76f62aec853b68c7591950952ab544342
7
- data.tar.gz: 483f9b60ee65a85d338b34fcdd9847845c9a86b76bf28c6ca967fa9e16ea8e01d505f7093647e4c6d2cda8f22e1d7e5cfc171ceb06feed88e5900ff5dd2326ea
6
+ metadata.gz: febb1c2b1fc87226219dc2cf5870c236b801624c9a4d8c62b0853a1e3e033fbfec76e5b418de34774e069aa0b60d8b2c687c68ab729cc7165806974f16373b40
7
+ data.tar.gz: a6305f03e1ed58b3afd6a9647b6fb43a48007c08370db1e066c15e135ce159c9adc7ac84c318033264e1c18cafdf2d9446d3e08341e4922c46fb7c7b83a81ff7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Rails 7.0.0 (December 15, 2021) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 7.0.0.rc3 (December 14, 2021) ##
2
7
 
3
8
  * Allow localhost with a port by default in development
@@ -6,6 +11,10 @@
6
11
 
7
12
  ## Rails 7.0.0.rc2 (December 14, 2021) ##
8
13
 
14
+ * No changes
15
+
16
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
17
+
9
18
  * Remove deprecated `config` in `dbconsole`.
10
19
 
11
20
  *Rafael Mendonça França*
@@ -33,8 +33,12 @@ module Rails
33
33
  @filter_parameters = []
34
34
  @filter_redirect = []
35
35
  @helpers_paths = []
36
- @hosts = Rails.env.development? ? ActionDispatch::HostAuthorization::ALLOWED_HOSTS_IN_DEVELOPMENT : []
37
- @hosts.concat(ENV["RAILS_DEVELOPMENT_HOSTS"].to_s.split(",").map(&:strip)) if Rails.env.development?
36
+ if Rails.env.development?
37
+ @hosts = ActionDispatch::HostAuthorization::ALLOWED_HOSTS_IN_DEVELOPMENT +
38
+ ENV["RAILS_DEVELOPMENT_HOSTS"].to_s.split(",").map(&:strip)
39
+ else
40
+ @hosts = []
41
+ end
38
42
  @host_authorization = {}
39
43
  @public_file_server = ActiveSupport::OrderedOptions.new
40
44
  @public_file_server.enabled = true
@@ -84,6 +88,7 @@ module Rails
84
88
  if respond_to?(:action_controller)
85
89
  action_controller.per_form_csrf_tokens = true
86
90
  action_controller.forgery_protection_origin_check = true
91
+ action_controller.urlsafe_csrf_tokens = false
87
92
  end
88
93
 
89
94
  ActiveSupport.to_time_preserves_timezone = true
@@ -169,7 +174,7 @@ module Rails
169
174
  end
170
175
 
171
176
  if respond_to?(:action_controller)
172
- action_controller.urlsafe_csrf_tokens = true
177
+ action_controller.delete(:urlsafe_csrf_tokens)
173
178
  end
174
179
 
175
180
  if respond_to?(:action_view)
@@ -236,6 +241,7 @@ module Rails
236
241
  " -frames:v 1 -f image2"
237
242
 
238
243
  active_storage.variant_processor = :vips
244
+ active_storage.multiple_file_field_include_hidden = true
239
245
  end
240
246
 
241
247
  if respond_to?(:active_record)
@@ -10,7 +10,7 @@ module Rails
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "rc3"
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -100,7 +100,8 @@ module Rails
100
100
  desc: "Show this help message and quit"
101
101
  end
102
102
 
103
- def initialize(*)
103
+ def initialize(positional_argv, option_argv, *)
104
+ @argv = [*positional_argv, *option_argv]
104
105
  @gem_filter = lambda { |gem| true }
105
106
  super
106
107
  end
@@ -172,10 +173,10 @@ module Rails
172
173
  return [] if options[:skip_asset_pipeline]
173
174
 
174
175
  if options[:asset_pipeline] == "sprockets"
175
- GemfileEntry.version "sprockets-rails", ">= 3.4.1",
176
+ GemfileEntry.floats "sprockets-rails",
176
177
  "The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]"
177
178
  elsif options[:asset_pipeline] == "propshaft"
178
- GemfileEntry.version "propshaft", ">= 0.4.1", "The modern asset pipeline for Rails [https://github.com/rails/propshaft/]"
179
+ GemfileEntry.floats "propshaft", "The modern asset pipeline for Rails [https://github.com/rails/propshaft]"
179
180
  else
180
181
  []
181
182
  end
@@ -255,6 +256,10 @@ module Rails
255
256
  new(name, version, comment)
256
257
  end
257
258
 
259
+ def self.floats(name, comment = nil)
260
+ new(name, nil, comment)
261
+ end
262
+
258
263
  def self.path(name, path, comment = nil)
259
264
  new(name, nil, comment, path: path)
260
265
  end
@@ -268,26 +273,30 @@ module Rails
268
273
  version
269
274
  end
270
275
  end
276
+
277
+ def to_s
278
+ [ ("# #{comment}\n" if comment),
279
+ ("# " if commented_out), "gem \"#{name}\"", (", \"#{version}\"" if version),
280
+ *options.map { |key, val| ", #{key}: #{val.inspect}" }
281
+ ].compact.join
282
+ end
283
+ end
284
+
285
+ def rails_prerelease?
286
+ options.dev? || options.edge? || options.main?
271
287
  end
272
288
 
273
289
  def rails_gemfile_entry
274
290
  if options.dev?
275
- [
276
- GemfileEntry.path("rails", Rails::Generators::RAILS_DEV_PATH, "Use local checkout of Rails")
277
- ]
291
+ GemfileEntry.path("rails", Rails::Generators::RAILS_DEV_PATH, "Use local checkout of Rails")
278
292
  elsif options.edge?
279
293
  edge_branch = Rails.gem_version.prerelease? ? "main" : [*Rails.gem_version.segments.first(2), "stable"].join("-")
280
- [
281
- GemfileEntry.github("rails", "rails/rails", edge_branch, "Use specific branch of Rails")
282
- ]
294
+ GemfileEntry.github("rails", "rails/rails", edge_branch, "Use specific branch of Rails")
283
295
  elsif options.main?
284
- [
285
- GemfileEntry.github("rails", "rails/rails", "main", "Use main development branch of Rails")
286
- ]
296
+ GemfileEntry.github("rails", "rails/rails", "main", "Use main development branch of Rails")
287
297
  else
288
- [GemfileEntry.version("rails",
289
- rails_version_specifier,
290
- %(Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"))]
298
+ GemfileEntry.version("rails", rails_version_specifier,
299
+ %(Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"))
291
300
  end
292
301
  end
293
302
 
@@ -306,17 +315,16 @@ module Rails
306
315
 
307
316
  def jbuilder_gemfile_entry
308
317
  return [] if options[:skip_jbuilder]
309
- comment = "Build JSON APIs with ease [https://github.com/rails/jbuilder]"
310
- GemfileEntry.new "jbuilder", "~> 2.11", comment, {}, options[:api]
318
+ GemfileEntry.new "jbuilder", nil, "Build JSON APIs with ease [https://github.com/rails/jbuilder]", {}, options[:api]
311
319
  end
312
320
 
313
321
  def javascript_gemfile_entry
314
322
  return [] if options[:skip_javascript]
315
323
 
316
324
  if adjusted_javascript_option == "importmap"
317
- GemfileEntry.version("importmap-rails", ">= 0.9.2", "Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]")
325
+ GemfileEntry.floats "importmap-rails", "Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]"
318
326
  else
319
- GemfileEntry.version "jsbundling-rails", ">= 0.2.2", "Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]"
327
+ GemfileEntry.floats "jsbundling-rails", "Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]"
320
328
  end
321
329
  end
322
330
 
@@ -324,10 +332,10 @@ module Rails
324
332
  return [] if options[:skip_javascript] || options[:skip_hotwire]
325
333
 
326
334
  turbo_rails_entry =
327
- GemfileEntry.version("turbo-rails", ">= 0.9.0", "Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]")
335
+ GemfileEntry.floats "turbo-rails", "Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]"
328
336
 
329
337
  stimulus_rails_entry =
330
- GemfileEntry.version("stimulus-rails", ">= 0.7.3", "Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]")
338
+ GemfileEntry.floats "stimulus-rails", "Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]"
331
339
 
332
340
  [ turbo_rails_entry, stimulus_rails_entry ]
333
341
  end
@@ -350,9 +358,9 @@ module Rails
350
358
  return [] unless options[:css]
351
359
 
352
360
  if !using_node? && options[:css] == "tailwind"
353
- GemfileEntry.version("tailwindcss-rails", ">= 0.5.3", "Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]")
361
+ GemfileEntry.floats "tailwindcss-rails", "Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]"
354
362
  else
355
- GemfileEntry.version("cssbundling-rails", ">= 0.2.7", "Bundle and process CSS [https://github.com/rails/cssbundling-rails]")
363
+ GemfileEntry.floats "cssbundling-rails", "Bundle and process CSS [https://github.com/rails/cssbundling-rails]"
356
364
  end
357
365
  end
358
366
 
@@ -410,6 +418,28 @@ module Rails
410
418
  !options[:skip_bootsnap] && !options[:dev] && !defined?(JRUBY_VERSION)
411
419
  end
412
420
 
421
+ def target_rails_prerelease(self_command = "new")
422
+ return unless rails_prerelease? && bundle_install?
423
+
424
+ if !File.exist?(File.expand_path("Gemfile", destination_root))
425
+ create_file("Gemfile", <<~GEMFILE)
426
+ source "https://rubygems.org"
427
+ git_source(:github) { |repo| "https://github.com/\#{repo}.git" }
428
+ #{rails_gemfile_entry}
429
+ GEMFILE
430
+
431
+ run_bundle
432
+
433
+ @argv[0] = destination_root
434
+ require "shellwords"
435
+ bundle_command("exec rails #{self_command} #{Shellwords.join(@argv)}")
436
+ exit
437
+ else
438
+ remove_file("Gemfile")
439
+ remove_file("Gemfile.lock")
440
+ end
441
+ end
442
+
413
443
  def run_bundle
414
444
  bundle_command("install", "BUNDLE_IGNORE_MESSAGES" => "1") if bundle_install?
415
445
  end
@@ -5,6 +5,6 @@
5
5
  <br>
6
6
 
7
7
  <div>
8
- <%%= link_to "Show this <%= human_name.downcase %>", @<%= singular_table_name %> %> |
9
- <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path %>
8
+ <%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %> %> |
9
+ <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>
10
10
  </div>
@@ -3,7 +3,12 @@
3
3
  <h1><%= human_name.pluralize %></h1>
4
4
 
5
5
  <div id="<%= plural_table_name %>">
6
- <%%= render @<%= plural_table_name %> %>
6
+ <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
7
+ <%%= render <%= singular_table_name %> %>
8
+ <p>
9
+ <%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %> %>
10
+ </p>
11
+ <%% end %>
7
12
  </div>
8
13
 
9
- <%%= link_to "New <%= human_name.downcase %>", new_<%= singular_route_name %>_path %>
14
+ <%%= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %> %>
@@ -5,5 +5,5 @@
5
5
  <br>
6
6
 
7
7
  <div>
8
- <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path %>
8
+ <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>
9
9
  </div>
@@ -14,7 +14,4 @@
14
14
  </p>
15
15
 
16
16
  <% end -%>
17
- <p>
18
- <%%= link_to "Show this <%= human_name.downcase %>", <%= singular_name %> %>
19
- </p>
20
17
  </div>
@@ -3,8 +3,8 @@
3
3
  <%%= render @<%= singular_table_name %> %>
4
4
 
5
5
  <div>
6
- <%%= link_to "Edit this <%= human_name.downcase %>", edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |
7
- <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path %>
6
+ <%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %> %> |
7
+ <%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>
8
8
 
9
- <%%= button_to "Destroy this <%= human_name.downcase %>", <%= singular_table_name %>_path(@<%= singular_table_name %>), method: :delete %>
9
+ <%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete %>
10
10
  </div>
@@ -94,20 +94,20 @@ module Rails
94
94
  singular_name == plural_name
95
95
  end
96
96
 
97
- def index_helper # :doc:
98
- uncountable? ? "#{plural_route_name}_index" : plural_route_name
97
+ def index_helper(type: nil) # :doc:
98
+ [plural_route_name, ("index" if uncountable?), type].compact.join("_")
99
99
  end
100
100
 
101
- def show_helper # :doc:
102
- "#{singular_route_name}_url(@#{singular_table_name})"
101
+ def show_helper(arg = "@#{singular_table_name}", type: :url) # :doc:
102
+ "#{singular_route_name}_#{type}(#{arg})"
103
103
  end
104
104
 
105
- def edit_helper # :doc:
106
- "edit_#{show_helper}"
105
+ def edit_helper(...) # :doc:
106
+ "edit_#{show_helper(...)}"
107
107
  end
108
108
 
109
- def new_helper # :doc:
110
- "new_#{singular_route_name}_url"
109
+ def new_helper(type: :url) # :doc:
110
+ "new_#{singular_route_name}_#{type}"
111
111
  end
112
112
 
113
113
  def singular_table_name # :doc:
@@ -147,8 +147,8 @@ module Rails
147
147
  model_resource_name(prefix: "@")
148
148
  end
149
149
 
150
- def model_resource_name(prefix: "") # :doc:
151
- resource_name = "#{prefix}#{singular_table_name}"
150
+ def model_resource_name(base_name = singular_table_name, prefix: "") # :doc:
151
+ resource_name = "#{prefix}#{base_name}"
152
152
  if options[:model_name]
153
153
  "[#{controller_class_path.map { |name| ":" + name }.join(", ")}, #{resource_name}]"
154
154
  else
@@ -303,6 +303,7 @@ module Rails
303
303
 
304
304
  public_task :set_default_accessors!
305
305
  public_task :create_root
306
+ public_task :target_rails_prerelease
306
307
 
307
308
  def create_root_files
308
309
  build(:readme)
@@ -2,14 +2,10 @@ source "https://rubygems.org"
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  ruby <%= "\"#{RUBY_VERSION}\"" -%>
5
- <% gemfile_entries.each do |gem| -%>
6
- <% if gem.comment %>
7
5
 
8
- # <%= gem.comment %>
6
+ <% gemfile_entries.each do |gemfile_entry| %>
7
+ <%= gemfile_entry %>
9
8
  <% end -%>
10
- <%= gem.commented_out ? "# " : "" %>gem "<%= gem.name %>"<%= %(, "#{gem.version}") if gem.version -%>
11
- <% if gem.options.any? -%>, <%= gem.options.map { |k,v| "#{k}: #{v.inspect}" }.join(", ") %><% end -%>
12
- <% end %>
13
9
  <% unless options.minimal? -%>
14
10
 
15
11
  # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
@@ -24,12 +20,12 @@ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
24
20
  <% if depend_on_bootsnap? -%>
25
21
 
26
22
  # Reduces boot times through caching; required in config/boot.rb
27
- gem "bootsnap", ">= 1.4.4", require: false
23
+ gem "bootsnap", require: false
28
24
  <% end -%>
29
25
  <% unless skip_sprockets? || options.minimal? -%>
30
26
 
31
27
  # Use Sass to process CSS
32
- # gem "sassc-rails", "~> 2.1"
28
+ # gem "sassc-rails"
33
29
  <% end -%>
34
30
  <% unless skip_active_storage? -%>
35
31
 
@@ -44,18 +40,18 @@ gem "bootsnap", ">= 1.4.4", require: false
44
40
  <% if RUBY_ENGINE == "ruby" -%>
45
41
 
46
42
  group :development, :test do
47
- # See https://edgeguides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
48
- gem "debug", ">= 1.0.0", platforms: %i[ mri mingw x64_mingw ]
43
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
44
+ gem "debug", platforms: %i[ mri mingw x64_mingw ]
49
45
  end
50
46
  <% end -%>
51
47
 
52
48
  group :development do
53
49
  <%- unless options.api? || options.skip_dev_gems? -%>
54
50
  # Use console on exceptions pages [https://github.com/rails/web-console]
55
- gem "web-console", ">= 4.1.0"
51
+ gem "web-console"
56
52
 
57
53
  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
58
- # gem "rack-mini-profiler", ">= 2.3.3"
54
+ # gem "rack-mini-profiler"
59
55
 
60
56
  <%- end -%>
61
57
  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
@@ -65,8 +61,8 @@ end
65
61
  <%- if depends_on_system_test? -%>
66
62
  group :test do
67
63
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
68
- gem "capybara", ">= 3.26"
69
- gem "selenium-webdriver", ">= 4.0.0"
64
+ gem "capybara"
65
+ gem "selenium-webdriver"
70
66
  gem "webdrivers"
71
67
  end
72
68
  <%- end -%>
@@ -104,35 +104,4 @@ Rails.application.configure do
104
104
  # Do not dump schema after migrations.
105
105
  config.active_record.dump_schema_after_migration = false
106
106
  <%- end -%>
107
-
108
- # Inserts middleware to perform automatic connection switching.
109
- # The `database_selector` hash is used to pass options to the DatabaseSelector
110
- # middleware. The `delay` is used to determine how long to wait after a write
111
- # to send a subsequent read to the primary.
112
- #
113
- # The `database_resolver` class is used by the middleware to determine which
114
- # database is appropriate to use based on the time delay.
115
- #
116
- # The `database_resolver_context` class is used by the middleware to set
117
- # timestamps for the last write to the primary. The resolver uses the context
118
- # class timestamps to determine how long to wait before reading from the
119
- # replica.
120
- #
121
- # By default Rails will store a last write timestamp in the session. The
122
- # DatabaseSelector middleware is designed as such you can define your own
123
- # strategy for connection switching and pass that into the middleware through
124
- # these configuration options.
125
- # config.active_record.database_selector = { delay: 2.seconds }
126
- # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
127
- # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
128
-
129
- # Inserts middleware to perform automatic shard swapping. The `shard_selector` hash
130
- # can be used to pass options to the `ShardSelector` middleware. The `lock` option is
131
- # used to determine whether shard swapping should be prohibited for the request.
132
- #
133
- # The `shard_resolver` option is used by the middleware to determine which shard
134
- # to switch to. The application must provide a mechanism for finding the shard name
135
- # in a proc. See guides for an example.
136
- # config.active_record.shard_selector = { lock: true }
137
- # config.active_record.shard_resolver = ->(request) { Tenant.find_by!(host: request.host).shard }
138
107
  end
@@ -9,10 +9,6 @@
9
9
  # Read the Guide for Upgrading Ruby on Rails for more info on each option.
10
10
  # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11
11
 
12
- # Raise an error when trying to use forgery protection without a working
13
- # session.
14
- # Rails.application.config.action_controller.silence_disabled_session_errors = false
15
-
16
12
  # `button_to` view helper will render `<button>` element, regardless of whether
17
13
  # or not the content is passed as the first argument or as a block.
18
14
  # Rails.application.config.action_view.button_to_generates_button_tag = true
@@ -94,10 +94,6 @@ module Rails
94
94
  def test
95
95
  template "test/test_helper.rb"
96
96
  template "test/%namespaced_name%_test.rb"
97
- append_file "Rakefile", <<~EOF
98
- #{rakefile_test_tasks}
99
- task default: :test
100
- EOF
101
97
 
102
98
  if engine?
103
99
  empty_directory_with_keep_file "test/fixtures/files"
@@ -235,6 +231,10 @@ module Rails
235
231
  public_task :set_default_accessors!
236
232
  public_task :create_root
237
233
 
234
+ def target_rails_prerelease
235
+ super("plugin new")
236
+ end
237
+
238
238
  def create_root_files
239
239
  build(:readme)
240
240
  build(:rakefile)
@@ -398,6 +398,10 @@ module Rails
398
398
  end
399
399
  end
400
400
 
401
+ def rails_version_specifier(gem_version = Rails.gem_version)
402
+ [">= #{gem_version}"]
403
+ end
404
+
401
405
  def valid_const?
402
406
  if /-\d/.match?(original_name)
403
407
  raise Error, "Invalid plugin name #{original_name}. Please give a name which does not contain a namespace starting with numeric characters."
@@ -418,18 +422,6 @@ module Rails
418
422
  defined?(::PluginBuilder) ? ::PluginBuilder : Rails::PluginBuilder
419
423
  end
420
424
 
421
- def rakefile_test_tasks
422
- <<-RUBY
423
- require "rake/testtask"
424
-
425
- Rake::TestTask.new(:test) do |t|
426
- t.libs << "test"
427
- t.pattern = "test/**/*_test.rb"
428
- t.verbose = false
429
- end
430
- RUBY
431
- end
432
-
433
425
  def dummy_path(path = nil)
434
426
  @dummy_path = path if path
435
427
  @dummy_path || options[:dummy_path]
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
24
24
  Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
25
25
  end
26
26
 
27
- <%= "# " if options.dev? || options.edge? || options.main? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
27
+ <%= "# " if rails_prerelease? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
28
28
  end
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  <% if options[:skip_gemspec] -%>
5
- <%= "# " if options.dev? || options.edge? || options.main? -%>gem "rails", "<%= Array(rails_version_specifier).join("', '") %>"
5
+ <%= "# " if rails_prerelease? -%>gem "rails", "<%= Array(rails_version_specifier).join("', '") %>"
6
6
  <% else -%>
7
7
  # Specify your gem's dependencies in <%= name %>.gemspec.
8
8
  gemspec
@@ -14,20 +14,11 @@ group :development do
14
14
  end
15
15
  <% end -%>
16
16
 
17
- <% if options.dev? || options.edge? -%>
18
- # Your gem is dependent on dev or edge Rails. Once you can lock this
17
+ <% if rails_prerelease? -%>
18
+ # Your gem is dependent on a prerelease version of Rails. Once you can lock this
19
19
  # dependency down to a specific version, move it to your gemspec.
20
- <% max_width = gemfile_entries.map { |g| g.name.length }.max -%>
21
- <% gemfile_entries.each do |gem| -%>
22
- <% if gem.comment -%>
23
-
24
- # <%= gem.comment %>
25
- <% end -%>
26
- <%= gem.commented_out ? "# " : "" %>gem "<%= gem.name %>"<%= %(, "#{gem.version}") if gem.version -%>
27
- <% if gem.options.any? -%>
28
- , <%= gem.options.map { |k,v|
29
- "#{k}: #{v.inspect}" }.join(", ") %>
30
- <% end -%>
20
+ <% gemfile_entries.each do |gemfile_entry| -%>
21
+ <%= gemfile_entry %>
31
22
  <% end -%>
32
23
 
33
24
  <% end -%>
@@ -10,11 +10,6 @@ ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __d
10
10
  <% end -%>
11
11
  require "rails/test_help"
12
12
 
13
- <% unless engine? -%>
14
- require "rails/test_unit/reporter"
15
- Rails::TestUnitReporter.executable = "bin/test"
16
- <% end -%>
17
-
18
13
  <% unless options[:skip_active_record] -%>
19
14
  # Load fixtures from the engine
20
15
  if ActiveSupport::TestCase.respond_to?(:fixture_path=)
@@ -11,7 +11,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe
11
11
  end
12
12
 
13
13
  test "should get index" do
14
- get <%= index_helper %>_url
14
+ get <%= index_helper(type: :url) %>
15
15
  assert_response :success
16
16
  end
17
17
 
@@ -22,10 +22,10 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe
22
22
 
23
23
  test "should create <%= singular_table_name %>" do
24
24
  assert_difference("<%= class_name %>.count") do
25
- post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }
25
+ post <%= index_helper(type: :url) %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }
26
26
  end
27
27
 
28
- assert_redirected_to <%= singular_table_name %>_url(<%= class_name %>.last)
28
+ assert_redirected_to <%= show_helper("#{class_name}.last") %>
29
29
  end
30
30
 
31
31
  test "should show <%= singular_table_name %>" do
@@ -40,7 +40,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe
40
40
 
41
41
  test "should update <%= singular_table_name %>" do
42
42
  patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }
43
- assert_redirected_to <%= singular_table_name %>_url(<%= "@#{singular_table_name}" %>)
43
+ assert_redirected_to <%= show_helper %>
44
44
  end
45
45
 
46
46
  test "should destroy <%= singular_table_name %>" do
@@ -48,7 +48,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe
48
48
  delete <%= show_helper %>
49
49
  end
50
50
 
51
- assert_redirected_to <%= index_helper %>_url
51
+ assert_redirected_to <%= index_helper(type: :url) %>
52
52
  end
53
53
  end
54
54
  <% end -%>
@@ -66,8 +66,8 @@ module Rails
66
66
  # printed by the generator.
67
67
  def run_generator(args = default_arguments, config = {})
68
68
  capture(:stdout) do
69
- args += ["--skip-bundle"] unless args.include? "--dev"
70
- args |= ["--skip-bootsnap"] unless args.include? "--no-skip-bootsnap"
69
+ args += ["--skip-bundle"] unless args.include?("--no-skip-bundle") || args.include?("--dev")
70
+ args |= ["--skip-bootsnap"] unless args.include?("--no-skip-bootsnap")
71
71
 
72
72
  generator_class.start(args, config.reverse_merge(destination_root: destination_root))
73
73
  end