Skip to content

Commit 559d7ed

Browse files
Merge branch 'main' into rv_add_component_caching
2 parents 31b0702 + e21b61d commit 559d7ed

14 files changed

+59
-20
lines changed

Diff for: .github/workflows/ci.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
benchmark:
1111
runs-on: ubuntu-latest
12+
env:
13+
BUNDLE_GEMFILE: gemfiles/rails_8.0.gemfile
1214
steps:
1315
- uses: actions/[email protected]
1416
- name: Setup Ruby
@@ -18,8 +20,8 @@ jobs:
1820
bundler-cache: true
1921
- name: Run benchmarks
2022
run: |
21-
bundle exec rake partial_benchmark
22-
bundle exec rake translatable_benchmark
23+
bundle exec appraisal rails-8.0 rake partial_benchmark
24+
bundle exec appraisal rails-8.0 rake translatable_benchmark
2325
test:
2426
name: test (${{ matrix.rails_version }}, ${{ matrix.ruby_version }}, ${{ matrix.mode }})
2527
runs-on: ubuntu-latest
@@ -51,6 +53,12 @@ jobs:
5153
- ruby_version: "3.3"
5254
rails_version: "7.2"
5355
mode: "capture_patch_enabled"
56+
- ruby_version: "3.3"
57+
rails_version: "8.0"
58+
mode: "capture_patch_disabled"
59+
- ruby_version: "3.3"
60+
rails_version: "8.0"
61+
mode: "capture_patch_enabled"
5462
- ruby_version: "head"
5563
rails_version: "main"
5664
mode: "capture_patch_disabled"

Diff for: Appraisals

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
appraise "rails-6.1" do
44
gem "rails", "~> 6.1"
55
gem "tailwindcss-rails", "~> 2.0"
6+
gem "sprockets-rails", "~> 3.4.2"
67

78
# Required for Ruby 3.1.0
89
gem "net-smtp", require: false
@@ -15,17 +16,26 @@ appraise "rails-7.0" do
1516
gem "rails", "~> 7.0"
1617
gem "tailwindcss-rails", "~> 2.0"
1718
gem "turbo-rails", "~> 1"
19+
gem "sprockets-rails", "~> 3.4.2"
1820
end
1921

2022
appraise "rails-7.1" do
2123
gem "rails", "~> 7.1"
2224
gem "tailwindcss-rails", "~> 2.0"
2325
gem "turbo-rails", "~> 1"
26+
gem "sprockets-rails", "~> 3.4.2"
2427
end
2528

2629
appraise "rails-7.2" do
2730
gem "rails", "~> 7.2"
2831
gem "tailwindcss-rails", "~> 2.0"
32+
gem "sprockets-rails", "~> 3.4.2"
33+
end
34+
35+
appraise "rails-8.0" do
36+
gem "rails", "~> 8.0"
37+
gem "tailwindcss-rails", "~> 2.0"
38+
gem "propshaft", "~> 1.1.0"
2939
end
3040

3141
appraise "rails-main" do

Diff for: Gemfile.lock

-8
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,6 @@ GEM
284284
temple (~> 0.10.0)
285285
tilt (>= 2.1.0)
286286
smart_properties (1.17.0)
287-
sprockets (4.2.1)
288-
concurrent-ruby (~> 1.0)
289-
rack (>= 2.2.4, < 4)
290-
sprockets-rails (3.4.2)
291-
actionpack (>= 5.2)
292-
activesupport (>= 5.2)
293-
sprockets (>= 3.0.0)
294287
standard (1.41.1)
295288
language_server-protocol (~> 3.17.0.2)
296289
lint_roller (~> 1.0)
@@ -364,7 +357,6 @@ DEPENDENCIES
364357
simplecov (~> 0.22.0)
365358
simplecov-console (~> 0.9.1)
366359
slim (~> 5.1)
367-
sprockets-rails (~> 3.4.2)
368360
standard (~> 1)
369361
turbo-rails (~> 1)
370362
view_component!

Diff for: docs/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ nav_order: 5
2222

2323
*Joel Hawksley*
2424

25+
* Add rails 8 support to CI.
26+
27+
*Reegan Viljoen*
28+
2529
## 3.20.0
2630

2731
* Allow rendering `with_collection` to accept an optional `spacer_component` to be rendered between each item.

Diff for: gemfiles/rails_6.1.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ gem "net-smtp", require: false
88
gem "net-imap", require: false
99
gem "net-pop", require: false
1010
gem "turbo-rails", "~> 1"
11+
gem "sprockets-rails", "~> 3.4.2"
1112

1213
gemspec path: "../"

Diff for: gemfiles/rails_7.0.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ source "https://rubygems.org"
55
gem "rails", "~> 7.0"
66
gem "tailwindcss-rails", "~> 2.0"
77
gem "turbo-rails", "~> 1"
8+
gem "sprockets-rails", "~> 3.4.2"
89

910
gemspec path: "../"

Diff for: gemfiles/rails_7.1.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ source "https://rubygems.org"
55
gem "rails", "~> 7.1"
66
gem "tailwindcss-rails", "~> 2.0"
77
gem "turbo-rails", "~> 1"
8+
gem "sprockets-rails", "~> 3.4.2"
89

910
gemspec path: "../"

Diff for: gemfiles/rails_7.2.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ gem "debug"
1212

1313
gem "tailwindcss-rails", "~> 2.0"
1414

15+
gem "sprockets-rails", "~> 3.4.2"
16+
1517
group :test do
1618
gem "cuprite", "~> 0.15"
1719
gem "puma", "~> 6"

Diff for: gemfiles/rails_8.0.gemfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 8.0"
6+
gem "tailwindcss-rails", "~> 2.0"
7+
gem "turbo-rails", "~> 1"
8+
gem "propshaft", "~> 1.1.0"
9+
10+
gemspec path: "../"

Diff for: gemfiles/rails_main.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ source "https://rubygems.org"
55
gem "rails", github: "rails/rails", branch: "main"
66
gem "tailwindcss-rails", "~> 2.0"
77
gem "turbo-rails", "~> 1"
8+
gem "propshaft", "~> 1.1.0"
89

910
gemspec path: "../"

Diff for: test/sandbox/config/application.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
require "action_controller/railtie"
88
require "action_mailer/railtie"
99
require "action_view/railtie"
10-
require "sprockets/railtie"
10+
require "sprockets/railtie" if Rails.version.to_f < 8.0
11+
require "propshaft" if Rails.version.to_f >= 8.0
1112

1213
require "turbo-rails"
1314

Diff for: test/sandbox/config/initializers/assets.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# frozen_string_literal: true
22

3-
Rails.application.config.assets.precompile += %w[admin.css]
3+
Rails.application.config.assets.precompile += %w[admin.css] if Rails.version.to_f <= 7.2

Diff for: test/sandbox/test/rendering_test.rb

+16-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ def test_render_inline_allocations
1515
ViewComponent::CompileCache.cache.delete(MyComponent)
1616
MyComponent.ensure_compiled
1717

18-
assert_allocations("3.4.0" => 109, "3.3.6" => 115, "3.3.0" => 127, "3.2.6" => 114, "3.1.6" => 114, "3.0.7" => 123) do
18+
allocations = (Rails.version.to_f >= 8.0) ?
19+
{"3.4.0" => 109, "3.3.6" => 124, "3.3.0" => 127, "3.2.6" => 114, "3.1.6" => 114, "3.0.7" => 123} :
20+
{"3.4.0" => 109, "3.3.6" => 115, "3.3.0" => 127, "3.2.6" => 114, "3.1.6" => 114, "3.0.7" => 123}
21+
22+
assert_allocations(**allocations) do
1923
render_inline(MyComponent.new)
2024
end
2125

@@ -332,14 +336,19 @@ def test_renders_component_with_asset_url
332336
component = AssetComponent.new
333337
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
334338

335-
component.config.asset_host = nil
336-
assert_match(%r{/assets/application-\w+.css}, render_inline(component).text)
339+
if Rails.version.to_f < 8.0
337340

338-
component.config.asset_host = "http://assets.example.com"
339-
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
341+
# Propshaft doesn't allow setting custom hosts so this only works in Rails < 8
342+
# TODO: Revisit this comment for v4 to see if we need to make any deprecations
343+
component.config.asset_host = nil
344+
assert_match(%r{/assets/application-\w+.css}, render_inline(component).text)
340345

341-
component.config.asset_host = "assets.example.com"
342-
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
346+
component.config.asset_host = "http://assets.example.com"
347+
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
348+
349+
component.config.asset_host = "assets.example.com"
350+
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
351+
end
343352
end
344353

345354
def test_template_changes_are_not_reflected_if_cache_is_not_cleared

Diff for: view_component.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ Gem::Specification.new do |spec|
5555
spec.add_development_dependency "simplecov", "~> 0.22.0"
5656
spec.add_development_dependency "simplecov-console", "~> 0.9.1"
5757
spec.add_development_dependency "slim", "~> 5.1"
58-
spec.add_development_dependency "sprockets-rails", "~> 3.4.2"
5958
spec.add_development_dependency "turbo-rails", "~> 1"
6059
spec.add_development_dependency "warning"
6160
spec.add_development_dependency "yard", "~> 0.9.34"

0 commit comments

Comments
 (0)