From ee710e12cfa3651f3276e7845e2cf5d2e64739aa Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Tue, 7 Jan 2025 21:52:26 +0100 Subject: [PATCH] Add full Ruby 3.4 compatibility Caller location with `label` is being decorated with `Shakapacker::Helper#` in Ruby 3.4 This commit changes `label` to `base_label` Close #535 Ref: - https://ruby-doc.org/core-2.7.0/Thread/Backtrace/Location.html#method-i-base_label --- .github/workflows/generator.yml | 8 +++++++- .github/workflows/ruby.yml | 10 ++++++++-- lib/shakapacker/helper.rb | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generator.yml b/.github/workflows/generator.yml index 51816eae2..25dd86d47 100644 --- a/.github/workflows/generator.yml +++ b/.github/workflows/generator.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] + ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4'] gemfile: - gemfiles/Gemfile-rails.6.0.x - gemfiles/Gemfile-rails.6.1.x @@ -41,6 +41,12 @@ jobs: gemfile: gemfiles/Gemfile-rails.6.0.x - ruby: '3.3' gemfile: gemfiles/Gemfile-rails.6.1.x + - ruby: '3.4' + gemfile: gemfiles/Gemfile-rails.6.0.x + - ruby: '3.4' + gemfile: gemfiles/Gemfile-rails.6.1.x + - ruby: '3.4' + gemfile: gemfiles/Gemfile-rails.7.0.x env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 273154dfb..fa9c2a694 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -23,7 +23,7 @@ jobs: run: rm -f Gemfile.lock - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.3' + ruby-version: '3.4' rubygems: latest bundler-cache: true @@ -36,7 +36,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] + ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4'] gemfile: - gemfiles/Gemfile-rails.6.0.x - gemfiles/Gemfile-rails.6.1.x @@ -59,6 +59,12 @@ jobs: gemfile: gemfiles/Gemfile-rails.6.0.x - ruby: '3.3' gemfile: gemfiles/Gemfile-rails.6.1.x + - ruby: '3.4' + gemfile: gemfiles/Gemfile-rails.6.0.x + - ruby: '3.4' + gemfile: gemfiles/Gemfile-rails.6.1.x + - ruby: '3.4' + gemfile: gemfiles/Gemfile-rails.7.0.x env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} diff --git a/lib/shakapacker/helper.rb b/lib/shakapacker/helper.rb index 4513b8d8a..dafa5f8cf 100644 --- a/lib/shakapacker/helper.rb +++ b/lib/shakapacker/helper.rb @@ -195,7 +195,7 @@ def prepend_javascript_pack_tag(*names, defer: true) def update_javascript_pack_tag_queue(defer:) if @javascript_pack_tag_loaded - raise "You can only call #{caller_locations(1..1).first.label} before javascript_pack_tag helper. " \ + raise "You can only call #{caller_locations(1..1).first.base_label} before javascript_pack_tag helper. " \ "Please refer to https://github.com/shakacode/shakapacker/blob/main/README.md#view-helper-append_javascript_pack_tag-prepend_javascript_pack_tag-and-append_stylesheet_pack_tag for the usage guide" end