diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2450ae..036226c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ jobs: strategy: fail-fast: false matrix: - gemfile: [rails_6_1, rails_7_0, rails_master] + gemfile: [rails_6_1, rails_7_0, rails_7_1, rails_master] # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' ruby: [2.7, '3.0', 3.1] runs-on: ubuntu-latest diff --git a/Appraisals b/Appraisals index 5ec34c1..4895cf4 100644 --- a/Appraisals +++ b/Appraisals @@ -7,6 +7,10 @@ appraise "rails-7-0" do gem "rails", "~> 7.0.0" end +appraise "rails-7-1" do + gem "rails", "~> 7.1.0" +end + appraise "rails-master" do gem "rails", git: "https://github.com/rails/rails.git", branch: :main end diff --git a/Gemfile.lock b/Gemfile.lock index e177a01..15ab80f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,86 +2,106 @@ PATH remote: . specs: rbexy (2.0.0.rc2) - actionview (>= 6, < 7.1) - activesupport (>= 6, < 7.1) + actionview (>= 6, < 7.2) + activesupport (>= 6, < 7.2) GEM remote: https://rubygems.org/ specs: - actioncable (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) + actioncable (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + zeitwerk (~> 2.6) + actionmailbox (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) mail (>= 2.7.1) - actionmailer (6.1.3) - actionpack (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activesupport (= 6.1.3) + net-imap + net-pop + net-smtp + actionmailer (7.1.1) + actionpack (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activesupport (= 7.1.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.3) - actionview (= 6.1.3) - activesupport (= 6.1.3) - rack (~> 2.0, >= 2.0.9) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.1) + actionview (= 7.1.1) + activesupport (= 7.1.1) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.3) - actionpack (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.1) + actionpack (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.3) - activesupport (= 6.1.3) + actionview (7.1.1) + activesupport (= 7.1.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.3) - activesupport (= 6.1.3) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.1) + activesupport (= 7.1.1) globalid (>= 0.3.6) - activemodel (6.1.3) - activesupport (= 6.1.3) - activerecord (6.1.3) - activemodel (= 6.1.3) - activesupport (= 6.1.3) - activestorage (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activesupport (= 6.1.3) - marcel (~> 0.3.1) - mimemagic (~> 0.3.2) - activesupport (6.1.3) + activemodel (7.1.1) + activesupport (= 7.1.1) + activerecord (7.1.1) + activemodel (= 7.1.1) + activesupport (= 7.1.1) + timeout (>= 0.4.0) + activestorage (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activesupport (= 7.1.1) + marcel (~> 1.0) + activesupport (7.1.1) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - zeitwerk (~> 2.3) appraisal (2.4.1) bundler rake thor (>= 0.14.0) + base64 (0.1.1) + bigdecimal (3.1.4) builder (3.2.4) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.8) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) crass (1.0.6) - diff-lcs (1.4.4) - erubi (1.10.0) + date (3.3.3) + diff-lcs (1.5.0) + drb (2.1.1) + ruby2_keywords + erubi (1.12.0) ffi (1.15.0) formatador (0.2.5) - globalid (0.4.2) - activesupport (>= 4.2.0) + globalid (1.2.1) + activesupport (>= 6.1) guard (2.16.2) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) @@ -96,31 +116,44 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - i18n (1.8.9) + i18n (1.14.1) concurrent-ruby (~> 1.0) + io-console (0.6.0) + irb (1.8.3) + rdoc + reline (>= 0.3.8) listen (3.4.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.9.0) + loofah (2.21.4) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) lumberjack (1.2.8) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + net-imap + net-pop + net-smtp + marcel (1.0.2) memory_profiler (0.9.14) method_source (1.0.0) - mimemagic (0.3.10) - nokogiri (~> 1) - rake - mini_mime (1.0.2) - mini_portile2 (2.8.0) - minitest (5.14.4) + mini_mime (1.1.5) + mini_portile2 (2.8.4) + minitest (5.20.0) + mutex_m (0.1.2) nenv (0.3.0) - nio4r (2.5.7) - nokogiri (1.13.3) - mini_portile2 (~> 2.8.0) + net-imap (0.4.1) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.4.0) + net-protocol + nio4r (2.5.9) + nokogiri (1.15.4) + mini_portile2 (~> 2.8.2) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -131,82 +164,100 @@ GEM pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) + psych (5.1.1.1) + stringio puma (5.6.2) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.3) - actioncable (= 6.1.3) - actionmailbox (= 6.1.3) - actionmailer (= 6.1.3) - actionpack (= 6.1.3) - actiontext (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activemodel (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + racc (1.7.1) + rack (3.0.8) + rack-session (2.0.0) + rack (>= 3.0.0) + rack-test (2.1.0) + rack (>= 1.3) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + rails (7.1.1) + actioncable (= 7.1.1) + actionmailbox (= 7.1.1) + actionmailer (= 7.1.1) + actionpack (= 7.1.1) + actiontext (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activemodel (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) bundler (>= 1.15.0) - railties (= 6.1.3) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + railties (= 7.1.1) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) - method_source - rake (>= 0.8.7) - thor (~> 1.0) - rake (13.0.3) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) + irb + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.0.6) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.2) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rdoc (6.5.0) + psych (>= 4.0.0) + reline (0.3.9) + io-console (~> 0.5) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.12.0) rspec-html-matchers (0.9.3) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.9.1) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (4.0.1) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.9) - rspec-expectations (~> 3.9) - rspec-mocks (~> 3.9) - rspec-support (~> 3.9) - rspec-support (3.9.3) + rspec-support (~> 3.12.0) + rspec-rails (6.0.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) + ruby2_keywords (0.0.5) shellany (0.0.1) - sprockets (4.0.2) + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.2) - thor (1.1.0) - tzinfo (2.0.4) + stringio (3.0.8) + thor (1.3.0) + timeout (0.4.0) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - websocket-driver (0.7.3) + webrick (1.8.1) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.4.2) + zeitwerk (2.6.12) PLATFORMS ruby @@ -217,12 +268,12 @@ DEPENDENCIES memory_profiler (~> 0.9.14) pry-byebug puma - rails (>= 6, < 7.1) + rails (>= 6, < 7.2) rake rbexy! - rspec (~> 3.9) + rspec (~> 3.12) rspec-html-matchers (~> 0.9.3) - rspec-rails (~> 4.0, >= 4.0.1) + rspec-rails (~> 6.0, >= 6.0.3) sprockets-rails (>= 2, < 4) sqlite3 diff --git a/README.md b/README.md index b60f015..d5d7849 100644 --- a/README.md +++ b/README.md @@ -408,7 +408,7 @@ If you want to run against the supported versions of Rails, use Appraisal: ``` -docker-compose run rbexy appraisal bin/test +docker-compose run rbexy bundle exec appraisal bin/test ``` ## Debugging TemplatePath methods being called @@ -421,7 +421,7 @@ To list all methods being called, enable `RBEXY_TEMPLATE_PATH_DEBUG` and run tests: ``` -docker-compose run -e RBEXY_TEMPLATE_PATH_DEBUG=1 rbexy appraisal bin/test +docker-compose run -e RBEXY_TEMPLATE_PATH_DEBUG=1 rbexy bundle exec appraisal bin/test ``` ## Contributing diff --git a/gemfiles/rails_6_1.gemfile.lock b/gemfiles/rails_6_1.gemfile.lock index e2b9557..e4c2523 100644 --- a/gemfiles/rails_6_1.gemfile.lock +++ b/gemfiles/rails_6_1.gemfile.lock @@ -2,8 +2,8 @@ PATH remote: .. specs: rbexy (2.0.0.rc2) - actionview (>= 6, < 7.1) - activesupport (>= 6, < 7.1) + actionview (>= 6, < 7.2) + activesupport (>= 6, < 7.2) GEM remote: https://rubygems.org/ @@ -74,11 +74,11 @@ GEM builder (3.2.4) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.9) + concurrent-ruby (1.2.2) crass (1.0.6) diff-lcs (1.5.0) digest (3.1.0) - erubi (1.10.0) + erubi (1.12.0) ffi (1.15.5) formatador (1.1.0) globalid (1.0.0) @@ -97,15 +97,15 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - i18n (1.10.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) io-wait (0.2.1) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.14.0) + loofah (2.21.4) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) @@ -113,7 +113,7 @@ GEM memory_profiler (0.9.14) method_source (1.0.0) mini_mime (1.1.2) - minitest (5.15.0) + minitest (5.20.0) nenv (0.3.0) net-protocol (0.1.2) io-wait @@ -123,7 +123,7 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.13.3-x86_64-linux) + nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -136,10 +136,10 @@ GEM pry (~> 0.13.0) puma (5.6.2) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) + racc (1.7.1) + rack (2.2.8) + rack-test (2.1.0) + rack (>= 1.3) rails (6.1.4.6) actioncable (= 6.1.4.6) actionmailbox (= 6.1.4.6) @@ -155,11 +155,13 @@ GEM bundler (>= 1.15.0) railties (= 6.1.4.6) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) - loofah (~> 2.3) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) railties (6.1.4.6) actionpack (= 6.1.4.6) activesupport (= 6.1.4.6) @@ -170,30 +172,30 @@ GEM rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.11.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-rails (4.1.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-support (3.11.0) + rspec-support (~> 3.12.0) + rspec-rails (6.0.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) shellany (0.0.1) sprockets (4.0.3) concurrent-ruby (~> 1.0) @@ -203,14 +205,14 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.2) - thor (1.2.1) + thor (1.3.0) timeout (0.2.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.5.4) + zeitwerk (2.6.12) PLATFORMS x86_64-linux @@ -225,9 +227,9 @@ DEPENDENCIES rails (~> 6.1.4) rake rbexy! - rspec (~> 3.9) + rspec (~> 3.12) rspec-html-matchers (~> 0.9.3) - rspec-rails (~> 4.0, >= 4.0.1) + rspec-rails (~> 6.0, >= 6.0.3) sprockets-rails (>= 2, < 4) sqlite3 diff --git a/gemfiles/rails_7_0.gemfile.lock b/gemfiles/rails_7_0.gemfile.lock index 33b5f01..b71b33d 100644 --- a/gemfiles/rails_7_0.gemfile.lock +++ b/gemfiles/rails_7_0.gemfile.lock @@ -2,8 +2,8 @@ PATH remote: .. specs: rbexy (2.0.0.rc2) - actionview (>= 6, < 7.1) - activesupport (>= 6, < 7.1) + actionview (>= 6, < 7.2) + activesupport (>= 6, < 7.2) GEM remote: https://rubygems.org/ @@ -80,11 +80,11 @@ GEM builder (3.2.4) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.9) + concurrent-ruby (1.2.2) crass (1.0.6) diff-lcs (1.5.0) digest (3.1.0) - erubi (1.10.0) + erubi (1.12.0) ffi (1.15.5) formatador (1.1.0) globalid (1.0.0) @@ -103,15 +103,15 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - i18n (1.10.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) io-wait (0.2.1) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.14.0) + loofah (2.21.4) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) @@ -119,7 +119,7 @@ GEM memory_profiler (0.9.14) method_source (1.0.0) mini_mime (1.1.2) - minitest (5.15.0) + minitest (5.20.0) nenv (0.3.0) net-imap (0.2.3) digest @@ -137,7 +137,7 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.13.3-x86_64-linux) + nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -150,10 +150,10 @@ GEM pry (~> 0.13.0) puma (5.6.2) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) + racc (1.7.1) + rack (2.2.8) + rack-test (2.1.0) + rack (>= 1.3) rails (7.0.2.2) actioncable (= 7.0.2.2) actionmailbox (= 7.0.2.2) @@ -168,11 +168,13 @@ GEM activesupport (= 7.0.2.2) bundler (>= 1.15.0) railties (= 7.0.2.2) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) - loofah (~> 2.3) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) railties (7.0.2.2) actionpack (= 7.0.2.2) activesupport (= 7.0.2.2) @@ -184,30 +186,30 @@ GEM rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.11.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-rails (4.1.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-support (3.11.0) + rspec-support (~> 3.12.0) + rspec-rails (6.0.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) shellany (0.0.1) sprockets (4.0.3) concurrent-ruby (~> 1.0) @@ -218,14 +220,14 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.2) strscan (3.0.1) - thor (1.2.1) + thor (1.3.0) timeout (0.2.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.5.4) + zeitwerk (2.6.12) PLATFORMS x86_64-linux @@ -239,9 +241,9 @@ DEPENDENCIES rails (~> 7.0.0) rake rbexy! - rspec (~> 3.9) + rspec (~> 3.12) rspec-html-matchers (~> 0.9.3) - rspec-rails (~> 4.0, >= 4.0.1) + rspec-rails (~> 6.0, >= 6.0.3) sprockets-rails (>= 2, < 4) sqlite3 diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile new file mode 100644 index 0000000..35a0ba3 --- /dev/null +++ b/gemfiles/rails_7_1.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 7.1.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7_1.gemfile.lock b/gemfiles/rails_7_1.gemfile.lock new file mode 100644 index 0000000..894bccc --- /dev/null +++ b/gemfiles/rails_7_1.gemfile.lock @@ -0,0 +1,279 @@ +PATH + remote: .. + specs: + rbexy (2.0.0.rc2) + actionview (>= 6, < 7.2) + activesupport (>= 6, < 7.2) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.1.1) + actionpack (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activesupport (= 7.1.1) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.1) + actionview (= 7.1.1) + activesupport (= 7.1.1) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.1) + actionpack (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.1.1) + activesupport (= 7.1.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.1) + activesupport (= 7.1.1) + globalid (>= 0.3.6) + activemodel (7.1.1) + activesupport (= 7.1.1) + activerecord (7.1.1) + activemodel (= 7.1.1) + activesupport (= 7.1.1) + timeout (>= 0.4.0) + activestorage (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activesupport (= 7.1.1) + marcel (~> 1.0) + activesupport (7.1.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.1.1) + bigdecimal (3.1.4) + builder (3.2.4) + byebug (11.1.3) + coderay (1.1.3) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) + crass (1.0.6) + date (3.3.3) + diff-lcs (1.5.0) + drb (2.1.1) + ruby2_keywords + erubi (1.12.0) + ffi (1.16.3) + formatador (1.1.0) + globalid (1.2.1) + activesupport (>= 6.1) + guard (2.18.1) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + lumberjack (>= 1.0.12, < 2.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.13.0) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.7.3) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + io-console (0.6.0) + irb (1.8.3) + rdoc + reline (>= 0.3.8) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.21.4) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + lumberjack (1.2.9) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + memory_profiler (0.9.14) + method_source (1.0.0) + mini_mime (1.1.5) + minitest (5.20.0) + mutex_m (0.1.2) + nenv (0.3.0) + net-imap (0.4.1) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.4.0) + net-protocol + nio4r (2.5.9) + nokogiri (1.15.4-x86_64-linux) + racc (~> 1.4) + notiffany (0.1.3) + nenv (~> 0.1) + shellany (~> 0.0) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.10.1) + byebug (~> 11.0) + pry (>= 0.13, < 0.15) + psych (5.1.1.1) + stringio + puma (6.4.0) + nio4r (~> 2.0) + racc (1.7.1) + rack (3.0.8) + rack-session (2.0.0) + rack (>= 3.0.0) + rack-test (2.1.0) + rack (>= 1.3) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + rails (7.1.1) + actioncable (= 7.1.1) + actionmailbox (= 7.1.1) + actionmailer (= 7.1.1) + actionpack (= 7.1.1) + actiontext (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activemodel (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) + bundler (>= 1.15.0) + railties (= 7.1.1) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) + irb + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.0.6) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + rdoc (6.5.0) + psych (>= 4.0.0) + reline (0.3.9) + io-console (~> 0.5) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-html-matchers (0.9.4) + nokogiri (~> 1) + rspec (>= 3.0.0.a, < 4) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-rails (6.0.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) + ruby2_keywords (0.0.5) + shellany (0.0.1) + 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) + sqlite3 (1.6.7-x86_64-linux) + stringio (3.0.8) + thor (1.3.0) + timeout (0.4.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + webrick (1.8.1) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.12) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + appraisal (~> 2.2) + guard-rspec (~> 4.7, >= 4.7.3) + memory_profiler (~> 0.9.14) + pry-byebug + puma + rails (~> 7.1.0) + rake + rbexy! + rspec (~> 3.12) + rspec-html-matchers (~> 0.9.3) + rspec-rails (~> 6.0, >= 6.0.3) + sprockets-rails (>= 2, < 4) + sqlite3 + +BUNDLED WITH + 2.2.3 diff --git a/gemfiles/rails_master.gemfile.lock b/gemfiles/rails_master.gemfile.lock index 604a10e..1b5246a 100644 --- a/gemfiles/rails_master.gemfile.lock +++ b/gemfiles/rails_master.gemfile.lock @@ -94,8 +94,8 @@ PATH remote: .. specs: rbexy (2.0.0.rc2) - actionview (>= 6, < 7.1) - activesupport (>= 6, < 7.1) + actionview (>= 6, < 7.2) + activesupport (>= 6, < 7.2) GEM remote: https://rubygems.org/ @@ -107,11 +107,11 @@ GEM builder (3.2.4) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.9) + concurrent-ruby (1.2.2) crass (1.0.6) diff-lcs (1.5.0) digest (3.1.0) - erubi (1.10.0) + erubi (1.12.0) ffi (1.15.5) formatador (1.1.0) globalid (1.0.0) @@ -130,15 +130,15 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - i18n (1.10.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) io-wait (0.2.1) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.14.0) + loofah (2.21.4) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) @@ -146,7 +146,7 @@ GEM memory_profiler (0.9.14) method_source (1.0.0) mini_mime (1.1.2) - minitest (5.15.0) + minitest (5.20.0) nenv (0.3.0) net-imap (0.2.3) digest @@ -164,7 +164,7 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.13.3-x86_64-linux) + nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -177,43 +177,45 @@ GEM pry (~> 0.13.0) puma (5.6.2) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + racc (1.7.1) + rack (2.2.8) + rack-test (2.1.0) + rack (>= 1.3) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) - loofah (~> 2.3) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rake (13.0.6) rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.11.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-rails (4.1.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-support (3.11.0) + rspec-support (~> 3.12.0) + rspec-rails (6.0.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) shellany (0.0.1) sprockets (4.0.3) concurrent-ruby (~> 1.0) @@ -224,14 +226,14 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.2) strscan (3.0.1) - thor (1.2.1) + thor (1.3.0) timeout (0.2.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.5.4) + zeitwerk (2.6.12) PLATFORMS x86_64-linux @@ -245,9 +247,9 @@ DEPENDENCIES rails! rake rbexy! - rspec (~> 3.9) + rspec (~> 3.12) rspec-html-matchers (~> 0.9.3) - rspec-rails (~> 4.0, >= 4.0.1) + rspec-rails (~> 6.0, >= 6.0.3) sprockets-rails (>= 2, < 4) sqlite3 diff --git a/lib/rbexy/component.rb b/lib/rbexy/component.rb index 6702df0..cffefb3 100644 --- a/lib/rbexy/component.rb +++ b/lib/rbexy/component.rb @@ -87,6 +87,7 @@ def _render template.render(self, {}) rescue ActionView::Template::Error => error error.set_backtrace clean_template_backtrace(error.backtrace) + error.cause.set_backtrace clean_template_backtrace(error.cause.backtrace) raise error end diff --git a/lib/rbexy/configuration.rb b/lib/rbexy/configuration.rb index ffb4de6..6f167c7 100644 --- a/lib/rbexy/configuration.rb +++ b/lib/rbexy/configuration.rb @@ -21,7 +21,7 @@ def transforms def component_rendering_templates @component_rendering_templates ||= { - children: "{capture{%{children}}}", + children: "{capture{%{children};nil}}", component: "::%{component_class}.new(%{view_context},%{kwargs}).render_in%{children_block}" } end diff --git a/lib/rbexy/rails/component_template_resolver.rb b/lib/rbexy/rails/component_template_resolver.rb index 346a8eb..51d9f06 100644 --- a/lib/rbexy/rails/component_template_resolver.rb +++ b/lib/rbexy/rails/component_template_resolver.rb @@ -18,12 +18,12 @@ def _find_all(name, prefix, partial, details, key, locals) cache.compute_if_absent(ActionView::TemplatePath.virtual(name, prefix, partial)) do find_templates(name, prefix, partial, details, locals) - end + end.map { |t| t.bind_locals(locals) } end else # Rails 6 implements caching at the call-site (find_all) def _find_all(name, prefix, partial, details, key, locals) - find_templates(name, prefix, partial, details, locals) + find_templates(name, prefix, partial, details, locals).map { |t| t.bind_locals(locals) } end end @@ -50,14 +50,11 @@ def find_rbx_templates(templates_path, extensions, component_name, virtual_path) Dir["#{templates_path}.*{#{extensions}}"].map do |template_path| source = File.binread(template_path) extension = File.extname(template_path)[1..-1] - handler = ActionView::Template.handler_for_extension(extension) - ActionView::Template.new( - "#{source}#{component_class_cachebuster(component_name, extension)}", - template_path, - handler, - format: extension.to_sym, - locals: [], + build_template( + source: "#{source}#{component_class_cachebuster(component_name, extension)}", + template_path: template_path, + extension: extension.to_sym, virtual_path: virtual_path ) end @@ -68,17 +65,36 @@ def find_call_component_cachebuster_templates(templates_path, component_name, vi return [] unless component_class && component_class.call_component? [ - ActionView::Template.new( - cachebuster_digest_as_comment(component_class.component_file_location, :rbx), - "#{templates_path}.rbexycall", - ActionView::Template.handler_for_extension(:rbx), - format: :rbx, - locals: [], + build_template( + source: cachebuster_digest_as_comment(component_class.component_file_location, :rbx), + template_path: "#{templates_path}.rbexycall", + extension: :rbx, virtual_path: virtual_path ) ] end + if ActionView.version >= Gem::Version.new("7.0.0") + def build_template(source:, template_path:, extension:, virtual_path:) + ActionView::UnboundTemplate.new( + source, + template_path, + details: ActionView::TemplateDetails.new(nil, extension, extension, nil), + virtual_path: virtual_path + ) + end + else + def build_template(source:, template_path:, extension:, virtual_path:) + ActionView::UnboundTemplate.new( + source, + template_path, + ActionView::Template.handler_for_extension(extension), + format: extension.to_sym, + virtual_path: virtual_path + ) + end + end + def component_class_cachebuster(component_name, template_format) component_class = find_component_class(component_name) return unless component_class diff --git a/rbexy.gemspec b/rbexy.gemspec index 3be033c..81825c9 100644 --- a/rbexy.gemspec +++ b/rbexy.gemspec @@ -25,15 +25,15 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "activesupport", ">= 6", "< 7.1" - spec.add_dependency "actionview", ">= 6", "< 7.1" + spec.add_dependency "activesupport", ">= 6", "< 7.2" + spec.add_dependency "actionview", ">= 6", "< 7.2" spec.add_development_dependency "appraisal", "~> 2.2" - spec.add_development_dependency "rails", ">= 6", "< 7.1" + spec.add_development_dependency "rails", ">= 6", "< 7.2" spec.add_development_dependency "sprockets-rails", ">= 2", "< 4" - spec.add_development_dependency "rspec", "~> 3.9" + spec.add_development_dependency "rspec", "~> 3.12" spec.add_development_dependency "guard-rspec", "~> 4.7", ">= 4.7.3" - spec.add_development_dependency "rspec-rails", "~> 4.0", ">= 4.0.1" + spec.add_development_dependency "rspec-rails", "~> 6.0", ">= 6.0.3" spec.add_development_dependency "rspec-html-matchers", "~> 0.9.3" spec.add_development_dependency "rake" spec.add_development_dependency "pry-byebug" diff --git a/spec/dummy/app/components/with_children/empty_children_component.rb b/spec/dummy/app/components/with_children/empty_children_component.rb new file mode 100644 index 0000000..8332174 --- /dev/null +++ b/spec/dummy/app/components/with_children/empty_children_component.rb @@ -0,0 +1,2 @@ +class WithChildren::EmptyChildrenComponent < Rbexy::Component +end diff --git a/spec/dummy/app/components/with_children/empty_children_component.rbx b/spec/dummy/app/components/with_children/empty_children_component.rbx new file mode 100644 index 0000000..d8b2328 --- /dev/null +++ b/spec/dummy/app/components/with_children/empty_children_component.rbx @@ -0,0 +1,6 @@ + +

Text in a child

+
+ + + diff --git a/spec/dummy/app/components/with_children/parent_component.rbx b/spec/dummy/app/components/with_children/parent_component.rbx index 49eba2e..4cec9cf 100644 --- a/spec/dummy/app/components/with_children/parent_component.rbx +++ b/spec/dummy/app/components/with_children/parent_component.rbx @@ -1,2 +1,4 @@ -

Here come the children...

-{content} +
+

Here come the children...

+ {content} +
diff --git a/spec/integration/component_spec.rb b/spec/integration/component_spec.rb index 7d859ad..bc18285 100644 --- a/spec/integration/component_spec.rb +++ b/spec/integration/component_spec.rb @@ -45,6 +45,11 @@ expect(result).to have_tag("h1", text: "Text in a child") end + it "renders empty parent components when they have no children" do + result = WithChildren::EmptyChildrenComponent.new(view_context).render_in + expect(result.gsub(/\s{2,}/, "")).to eq '

Here come the children...

Text in a child

Here come the children...

' + end + it "allows the component to implement #call instead of a template" do class MyCallComponent < Rbexy::Component def call