Skip to content

Commit 99bc69a

Browse files
Merge branch 'main' into 42994-add-support-for-postgresql-certs-on-db-tasks
2 parents 4497abb + c0e17d4 commit 99bc69a

File tree

138 files changed

+2275
-2136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+2275
-2136
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Check out https://help.github.com/articles/ignoring-files for how to set that up.
33

44
.Gemfile
5-
.byebug_history
65
.ruby-version
76
/*/doc/
87
/*/test/tmp/

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ Style/DefWithParentheses:
143143
Style/MethodDefParentheses:
144144
Enabled: true
145145

146+
Style/ExplicitBlockArgument:
147+
Enabled: true
148+
146149
Style/FrozenStringLiteralComment:
147150
Enabled: true
148151
EnforcedStyle: always

Gemfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ gem "selenium-webdriver", ">= 4.0.0.alpha7"
1515
gem "rack-cache", "~> 1.2"
1616
gem "stimulus-rails"
1717
gem "turbo-rails"
18-
gem "webpacker", "~> 6.0.0.rc.5", require: ENV["SKIP_REQUIRE_WEBPACKER"] != "true"
18+
gem "jsbundling-rails"
19+
gem "cssbundling-rails"
1920
gem "importmap-rails"
21+
gem "tailwindcss-rails"
2022
# require: false so bcrypt is loaded only when has_secure_password is used.
2123
# This is to avoid Active Model (and by extension the entire framework)
2224
# being dependent on a binary library.
@@ -117,7 +119,7 @@ group :test do
117119

118120
platforms :mri do
119121
gem "stackprof"
120-
gem "byebug"
122+
gem "debug", ">= 1.0.0", require: false
121123
end
122124

123125
gem "benchmark-ips"

Gemfile.lock

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ PATH
8181
i18n (>= 1.6, < 2)
8282
minitest (>= 5.1)
8383
tzinfo (~> 2.0)
84-
zeitwerk (~> 2.5.0.beta2)
8584
rails (7.0.0.alpha)
8685
actioncable (= 7.0.0.alpha)
8786
actionmailbox (= 7.0.0.alpha)
@@ -103,6 +102,7 @@ PATH
103102
method_source
104103
rake (>= 0.13)
105104
thor (~> 1.0)
105+
zeitwerk (~> 2.5.0.beta3)
106106

107107
GEM
108108
remote: https://rubygems.org/
@@ -164,7 +164,6 @@ GEM
164164
bunny (2.18.0)
165165
amq-protocol (~> 2.3, >= 2.3.1)
166166
sorted_set (~> 1, >= 1.0.2)
167-
byebug (11.1.3)
168167
capybara (3.35.3)
169168
addressable
170169
mini_mime (>= 0.1.3)
@@ -184,10 +183,15 @@ GEM
184183
crack (0.4.5)
185184
rexml
186185
crass (1.0.6)
186+
cssbundling-rails (0.1.0)
187+
rails (>= 6.0.0)
187188
curses (1.4.2)
188189
daemons (1.4.0)
189190
dalli (2.7.11)
190191
dante (0.2.0)
192+
debug (1.0.0)
193+
irb
194+
reline (>= 0.2.7)
191195
declarative (0.0.20)
192196
delayed_job (4.1.9)
193197
activesupport (>= 3.0, < 6.2)
@@ -286,9 +290,14 @@ GEM
286290
image_processing (1.12.1)
287291
mini_magick (>= 4.9.5, < 5)
288292
ruby-vips (>= 2.0.17, < 3)
289-
importmap-rails (0.3.4)
293+
importmap-rails (0.5.1)
290294
rails (>= 6.0.0)
295+
io-console (0.5.9)
296+
irb (1.3.7)
297+
reline (>= 0.2.7)
291298
jmespath (1.4.0)
299+
jsbundling-rails (0.1.0)
300+
rails (>= 6.0.0)
292301
json (2.5.1)
293302
jwt (2.2.3)
294303
kindlerb (1.2.0)
@@ -354,8 +363,6 @@ GEM
354363
rack (>= 0.4)
355364
rack-protection (2.1.0)
356365
rack
357-
rack-proxy (0.7.0)
358-
rack
359366
rack-test (1.1.0)
360367
rack (>= 1.0, < 3)
361368
rails-dom-testing (2.0.3)
@@ -375,6 +382,8 @@ GEM
375382
redis-namespace (1.8.1)
376383
redis (>= 3.0.4)
377384
regexp_parser (2.1.1)
385+
reline (0.2.7)
386+
io-console (~> 0.5)
378387
representable (3.1.1)
379388
declarative (< 0.1.0)
380389
trailblazer-option (>= 0.1.1, < 0.2.0)
@@ -428,7 +437,6 @@ GEM
428437
childprocess (>= 0.5, < 5.0)
429438
rexml (~> 3.2)
430439
rubyzip (>= 1.2.2)
431-
semantic_range (3.0.0)
432440
sequel (5.45.0)
433441
serverengine (2.0.7)
434442
sigdump (~> 0.2.2)
@@ -467,10 +475,12 @@ GEM
467475
sprockets (>= 3.0.0)
468476
sqlite3 (1.4.2)
469477
stackprof (0.2.17)
470-
stimulus-rails (0.3.9)
478+
stimulus-rails (0.4.2)
471479
rails (>= 6.0.0)
472480
sucker_punch (3.0.1)
473481
concurrent-ruby (~> 1.0)
482+
tailwindcss-rails (0.4.3)
483+
rails (>= 6.0.0)
474484
terser (1.1.4)
475485
execjs (>= 0.3.0, < 3)
476486
thin (1.8.1)
@@ -480,7 +490,7 @@ GEM
480490
thor (1.1.0)
481491
tilt (2.0.10)
482492
trailblazer-option (0.1.1)
483-
turbo-rails (0.7.4)
493+
turbo-rails (0.7.11)
484494
rails (>= 6.0.0)
485495
tzinfo (2.0.4)
486496
concurrent-ruby (~> 1.0)
@@ -501,19 +511,14 @@ GEM
501511
addressable (>= 2.3.6)
502512
crack (>= 0.3.2)
503513
hashdiff (>= 0.4.0, < 2.0.0)
504-
webpacker (6.0.0.rc.5)
505-
activesupport (>= 5.2)
506-
rack-proxy (>= 0.6.1)
507-
railties (>= 5.2)
508-
semantic_range (>= 2.3.0)
509514
webrick (1.7.0)
510515
websocket (1.2.9)
511516
websocket-driver (0.7.5)
512517
websocket-extensions (>= 0.1.0)
513518
websocket-extensions (0.1.5)
514519
xpath (3.2.0)
515520
nokogiri (~> 1.8)
516-
zeitwerk (2.5.0.beta2)
521+
zeitwerk (2.5.0.beta3)
517522

518523
PLATFORMS
519524
ruby
@@ -533,16 +538,18 @@ DEPENDENCIES
533538
benchmark-ips
534539
blade
535540
bootsnap (>= 1.4.4)
536-
byebug
537541
capybara (>= 3.26)
538542
connection_pool
543+
cssbundling-rails
539544
dalli
545+
debug (>= 1.0.0)
540546
delayed_job
541547
delayed_job_active_record
542548
google-cloud-storage (~> 1.11)
543549
hiredis
544550
image_processing (~> 1.2)
545551
importmap-rails
552+
jsbundling-rails
546553
json (>= 2.0.0)
547554
kindlerb (~> 1.2.0)
548555
libxml-ruby
@@ -583,14 +590,14 @@ DEPENDENCIES
583590
stackprof
584591
stimulus-rails
585592
sucker_punch
593+
tailwindcss-rails
586594
terser (>= 1.1.4)
587595
turbo-rails
588596
tzinfo-data
589597
w3c_validators (~> 1.3.6)
590598
wdm (>= 0.1.0)
591599
webdrivers
592600
webmock
593-
webpacker (~> 6.0.0.rc.5)
594601
webrick
595602
websocket-client-simple!
596603

RELEASING_RAILS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ give them a heads up that Rails will be released soonish.
4949
This is only required for major and minor releases, bugfix releases aren't a
5050
big enough deal, and are supposed to be backward compatible.
5151

52-
Send an email just giving a heads up about the upcoming release to these
52+
Send a message just giving a heads up about the upcoming release to these
5353
lists:
5454

5555
5656
57-
* rubyonrails-core@googlegroups.com
57+
* [rubyonrails-core](https://discuss.rubyonrails.org/c/rubyonrails-core)
5858

5959
Implementors will love you and help you.
6060

@@ -135,8 +135,8 @@ Write a release announcement that includes the version, changes, and links to
135135
GitHub where people can find the specific commit list. Here are the mailing
136136
lists where you should announce:
137137

138-
* rubyonrails-core@googlegroups.com
139-
* rubyonrails-talk@googlegroups.com
138+
* [rubyonrails-core](https://discuss.rubyonrails.org/c/rubyonrails-core)
139+
* [rubyonrails-talk](https://discuss.rubyonrails.org/c/rubyonrails-talk)
140140
141141

142142
Use Markdown format for your announcement. Remember to ask people to report

actioncable/lib/action_cable/connection/tagged_logger_proxy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def add_tags(*tags)
1818
@tags = @tags.uniq
1919
end
2020

21-
def tag(logger)
21+
def tag(logger, &block)
2222
if logger.respond_to?(:tagged)
2323
current_tags = tags - logger.formatter.current_tags
24-
logger.tagged(*current_tags) { yield }
24+
logger.tagged(*current_tags, &block)
2525
else
2626
yield
2727
end

actioncable/lib/action_cable/server/worker.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ def stopping?
3636
@executor.shuttingdown?
3737
end
3838

39-
def work(connection)
39+
def work(connection, &block)
4040
self.connection = connection
4141

42-
run_callbacks :work do
43-
yield
44-
end
42+
run_callbacks :work, &block
4543
ensure
4644
self.connection = nil
4745
end

actioncable/lib/action_cable/server/worker/active_record_connection_management.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module ActiveRecordConnectionManagement
1212
end
1313
end
1414

15-
def with_database_connections
16-
connection.logger.tag(ActiveRecord::Base.logger) { yield }
15+
def with_database_connections(&block)
16+
connection.logger.tag(ActiveRecord::Base.logger, &block)
1717
end
1818
end
1919
end

actioncable/lib/rails/generators/channel/channel_generator.rb

Lines changed: 79 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,98 @@ class ChannelGenerator < NamedBase
1313

1414
hook_for :test_framework
1515

16-
def create_channel_file
17-
template "channel.rb", File.join("app/channels", class_path, "#{file_name}_channel.rb")
18-
19-
if options[:assets]
20-
if behavior == :invoke
21-
if defined?(Webpacker::Engine)
22-
template "javascript/index.js", "#{Webpacker.config.source_path}/channels/index.js"
23-
template "javascript/consumer.js", "#{Webpacker.config.source_path}/channels/consumer.js"
24-
else
25-
template "javascript/consumer.js", "app/javascript/channels/consumer.js"
26-
end
27-
end
16+
def create_channel_files
17+
create_shared_channel_files
18+
create_channel_file
2819

29-
if defined?(Webpacker::Engine)
30-
js_template "javascript/channel", File.join(Webpacker.config.source_path, "channels", class_path, "#{file_name}_channel")
31-
else
32-
channel_js_path = File.join("app/javascript/channels", class_path, "#{file_name}_channel")
33-
js_template "javascript/channel", channel_js_path
34-
gsub_file "#{channel_js_path}.js", /\.\/consumer/, "channels/consumer"
20+
if using_javascript?
21+
if first_setup_required?
22+
create_shared_channel_javascript_files
23+
import_channels_in_javascript_entrypoint
3524

36-
append_to_file "app/javascript/application.js", %(\nimport "channels/#{file_name}_channel"\n)
25+
if using_importmap?
26+
pin_javascript_dependencies
27+
elsif using_node?
28+
install_javascript_dependencies
29+
end
3730
end
38-
end
3931

40-
generate_application_cable_files
32+
create_channel_javascript_file
33+
import_channel_in_javascript_entrypoint
34+
end
4135
end
4236

4337
private
38+
def create_shared_channel_files
39+
return if behavior != :invoke
40+
41+
copy_file "#{__dir__}/templates/application_cable/channel.rb",
42+
"app/channels/application_cable/channel.rb"
43+
copy_file "#{__dir__}/templates/application_cable/connection.rb",
44+
"app/channels/application_cable/connection.rb"
45+
end
46+
47+
def create_channel_file
48+
template "channel.rb",
49+
File.join("app/channels", class_path, "#{file_name}_channel.rb")
50+
end
51+
52+
def create_shared_channel_javascript_files
53+
template "javascript/index.js", "app/javascript/channels/index.js"
54+
template "javascript/consumer.js", "app/javascript/channels/consumer.js"
55+
end
56+
57+
def create_channel_javascript_file
58+
channel_js_path = File.join("app/javascript/channels", class_path, "#{file_name}_channel")
59+
js_template "javascript/channel", channel_js_path
60+
gsub_file "#{channel_js_path}.js", /\.\/consumer/, "channels/consumer" unless using_node?
61+
end
62+
63+
def import_channels_in_javascript_entrypoint
64+
append_to_file "app/javascript/application.js",
65+
using_node? ? %(import "./channels"\n) : %(import "channels"\n)
66+
end
67+
68+
def import_channel_in_javascript_entrypoint
69+
append_to_file "app/javascript/channels/index.js",
70+
using_node? ? %(import "./#{file_name}_channel"\n) : %(import "channels/#{file_name}_channel"\n)
71+
end
72+
73+
def install_javascript_dependencies
74+
say "Installing JavaScript dependencies", :green
75+
run "yarn add @rails/actioncable"
76+
end
77+
78+
def pin_javascript_dependencies
79+
append_to_file "config/importmap.rb", <<-RUBY
80+
pin "@rails/actioncable", to: "actioncable.esm.js"
81+
pin_all_from "app/javascript/channels", under: "channels"
82+
RUBY
83+
end
84+
85+
4486
def file_name
4587
@_file_name ||= super.sub(/_channel\z/i, "")
4688
end
4789

48-
# FIXME: Change these files to symlinks once RubyGems 2.5.0 is required.
49-
def generate_application_cable_files
50-
return if behavior != :invoke
90+
def first_setup_required?
91+
!root.join("app/javascript/channels/index.js").exist?
92+
end
5193

52-
files = [
53-
"application_cable/channel.rb",
54-
"application_cable/connection.rb"
55-
]
94+
def using_javascript?
95+
@using_javascript ||= options[:assets] && root.join("app/javascript").exist?
96+
end
5697

57-
files.each do |name|
58-
path = File.join("app/channels/", name)
59-
template(name, path) if !File.exist?(path)
60-
end
98+
def using_node?
99+
@using_node ||= root.join("package.json").exist?
100+
end
101+
102+
def using_importmap?
103+
@using_importmap ||= root.join("config/importmap.rb").exist?
104+
end
105+
106+
def root
107+
@root ||= Pathname(destination_root)
61108
end
62109
end
63110
end

0 commit comments

Comments
 (0)