Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
with:
ruby-version: 3.3
bundler-cache: true
env:
BENCHMARK: true
- name: Run benchmarks
run: |
bundle exec rake partial_benchmark
Expand Down Expand Up @@ -51,6 +53,12 @@ jobs:
- ruby_version: "3.3"
rails_version: "7.2"
mode: "capture_patch_enabled"
- ruby_version: "3.3"
rails_version: "8.0"
mode: "capture_patch_disabled"
- ruby_version: "3.3"
rails_version: "8.0"
mode: "capture_patch_enabled"
- ruby_version: "head"
rails_version: "main"
mode: "capture_patch_disabled"
Expand Down
10 changes: 10 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
appraise "rails-6.1" do
gem "rails", "~> 6.1"
gem "tailwindcss-rails", "~> 2.0"
gem "sprockets-rails", "~> 3.4.2"

# Required for Ruby 3.1.0
gem "net-smtp", require: false
Expand All @@ -15,17 +16,26 @@ appraise "rails-7.0" do
gem "rails", "~> 7.0"
gem "tailwindcss-rails", "~> 2.0"
gem "turbo-rails", "~> 1"
gem "sprockets-rails", "~> 3.4.2"
end

appraise "rails-7.1" do
gem "rails", "~> 7.1"
gem "tailwindcss-rails", "~> 2.0"
gem "turbo-rails", "~> 1"
gem "sprockets-rails", "~> 3.4.2"
end

appraise "rails-7.2" do
gem "rails", "~> 7.2"
gem "tailwindcss-rails", "~> 2.0"
gem "sprockets-rails", "~> 3.4.2"
end

appraise "rails-8.0" do
gem "rails", "~> 8.0"
gem "tailwindcss-rails", "~> 2.0"
gem "propshaft", "~> 1.1.0"
end

appraise "rails-main" do
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@ GEM
temple (~> 0.10.0)
tilt (>= 2.1.0)
smart_properties (1.17.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
standard (1.41.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
Expand Down Expand Up @@ -364,7 +357,6 @@ DEPENDENCIES
simplecov (~> 0.22.0)
simplecov-console (~> 0.9.1)
slim (~> 5.1)
sprockets-rails (~> 3.4.2)
standard (~> 1)
turbo-rails (~> 1)
view_component!
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ nav_order: 5

*Joel Hawksley*

* Add rails 8 support

*Reegan Viljoen

## 3.20.0

* Allow rendering `with_collection` to accept an optional `spacer_component` to be rendered between each item.
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ gem "net-smtp", require: false
gem "net-imap", require: false
gem "net-pop", require: false
gem "turbo-rails", "~> 1"
gem "sprockets-rails", "~> 3.4.2"

gemspec path: "../"
1 change: 1 addition & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ source "https://rubygems.org"
gem "rails", "~> 7.0"
gem "tailwindcss-rails", "~> 2.0"
gem "turbo-rails", "~> 1"
gem "sprockets-rails", "~> 3.4.2"

gemspec path: "../"
1 change: 1 addition & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ source "https://rubygems.org"
gem "rails", "~> 7.1"
gem "tailwindcss-rails", "~> 2.0"
gem "turbo-rails", "~> 1"
gem "sprockets-rails", "~> 3.4.2"

gemspec path: "../"
2 changes: 2 additions & 0 deletions gemfiles/rails_7.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ gem "debug"

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

gem "sprockets-rails", "~> 3.4.2"

group :test do
gem "cuprite", "~> 0.15"
gem "puma", "~> 6"
Expand Down
9 changes: 9 additions & 0 deletions gemfiles/rails_8.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 8.0"
gem "tailwindcss-rails", "~> 2.0"
gem "turbo-rails", "~> 1"

gemspec path: "../"
3 changes: 2 additions & 1 deletion test/sandbox/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
require "sprockets/railtie" if Rails.version.to_f <= 7.2 || !ENV["BENCHMARK"].present?
# require "propshaft/railtie" if Rails.version.to_f >= 7.2

require "turbo-rails"

Expand Down
2 changes: 1 addition & 1 deletion test/sandbox/config/initializers/assets.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

Rails.application.config.assets.precompile += %w[admin.css]
if Rails.version.to_f <= 7.2 then Rails.application.config.assets.precompile += %w[admin.css] end
Copy link
Contributor

@camertron camertron Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to change? EDIT: do we still need admin.css? I don't know what it's used for.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but propshaft auto includes it

29 changes: 20 additions & 9 deletions test/sandbox/test/rendering_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ def test_render_inline_allocations
ViewComponent::CompileCache.cache.delete(MyComponent)
MyComponent.ensure_compiled

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
render_inline(MyComponent.new)
if Rails.version.to_f >= 8.0
assert_allocations("3.4.0" => 109, "3.3.6" => 124, "3.3.0" => 127, "3.2.6" => 114, "3.1.6" => 114, "3.0.7" => 123) do
render_inline(MyComponent.new)
end
else
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
render_inline(MyComponent.new)
end
end

assert_selector("div", text: "hello,world!")
Expand Down Expand Up @@ -330,16 +336,21 @@ def test_renders_component_without_format

def test_renders_component_with_asset_url
component = AssetComponent.new
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
if Rails.version.to_f <= 7.2
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)

component.config.asset_host = nil
assert_match(%r{/assets/application-\w+.css}, render_inline(component).text)
# cant do this in Rails 8 https://github.com/rails/propshaft/pull/59
component.config.asset_host = nil
assert_match(%r{/assets/application-\w+.css}, render_inline(component).text)

component.config.asset_host = "http://assets.example.com"
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
component.config.asset_host = "http://assets.example.com"
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)

component.config.asset_host = "assets.example.com"
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
component.config.asset_host = "assets.example.com"
assert_match(%r{http://assets.example.com/assets/application-\w+.css}, render_inline(component).text)
else
assert_match(%r{http://assets.example.com/application.css}, render_inline(component).text)
end
end

def test_template_changes_are_not_reflected_if_cache_is_not_cleared
Expand Down
1 change: 0 additions & 1 deletion view_component.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "simplecov", "~> 0.22.0"
spec.add_development_dependency "simplecov-console", "~> 0.9.1"
spec.add_development_dependency "slim", "~> 5.1"
spec.add_development_dependency "sprockets-rails", "~> 3.4.2"
spec.add_development_dependency "turbo-rails", "~> 1"
spec.add_development_dependency "warning"
spec.add_development_dependency "yard", "~> 0.9.34"
Expand Down