From b99a6fadca8111902101f985a352c685ad789557 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 27 Dec 2024 12:46:14 +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 --- .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 d833f7071..4645fb541 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 @@ -48,6 +48,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 7bf80762d..11de99a25 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' bundler-cache: true - name: Ruby rubocop @@ -35,7 +35,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 @@ -65,6 +65,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