Skip to content

Commit 0bf68fa

Browse files
committed
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 shakacode#535 Ref: - https://ruby-doc.org/core-2.7.0/Thread/Backtrace/Location.html#method-i-base_label
1 parent 17a976f commit 0bf68fa

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.github/workflows/generator.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
os: [ubuntu-latest]
21-
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
21+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
2222
gemfile:
2323
- gemfiles/Gemfile-rails.6.0.x
2424
- gemfiles/Gemfile-rails.6.1.x
@@ -48,6 +48,12 @@ jobs:
4848
gemfile: gemfiles/Gemfile-rails.6.0.x
4949
- ruby: '3.3'
5050
gemfile: gemfiles/Gemfile-rails.6.1.x
51+
- ruby: '3.4'
52+
gemfile: gemfiles/Gemfile-rails.6.0.x
53+
- ruby: '3.4'
54+
gemfile: gemfiles/Gemfile-rails.6.1.x
55+
- ruby: '3.4'
56+
gemfile: gemfiles/Gemfile-rails.7.0.x
5157

5258
env:
5359
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

.github/workflows/ruby.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: rm -f Gemfile.lock
2424
- uses: ruby/setup-ruby@v1
2525
with:
26-
ruby-version: '3.3'
26+
ruby-version: '3.4'
2727
bundler-cache: true
2828

2929
- name: Ruby rubocop
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
matrix:
3737
os: [ubuntu-latest]
38-
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
38+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
3939
gemfile:
4040
- gemfiles/Gemfile-rails.6.0.x
4141
- gemfiles/Gemfile-rails.6.1.x
@@ -65,6 +65,12 @@ jobs:
6565
gemfile: gemfiles/Gemfile-rails.6.0.x
6666
- ruby: '3.3'
6767
gemfile: gemfiles/Gemfile-rails.6.1.x
68+
- ruby: '3.4'
69+
gemfile: gemfiles/Gemfile-rails.6.0.x
70+
- ruby: '3.4'
71+
gemfile: gemfiles/Gemfile-rails.6.1.x
72+
- ruby: '3.4'
73+
gemfile: gemfiles/Gemfile-rails.7.0.x
6874

6975
env:
7076
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

lib/shakapacker/helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def prepend_javascript_pack_tag(*names, defer: true)
195195

196196
def update_javascript_pack_tag_queue(defer:)
197197
if @javascript_pack_tag_loaded
198-
raise "You can only call #{caller_locations(1..1).first.label} before javascript_pack_tag helper. " \
198+
raise "You can only call #{caller_locations(1..1).first.base_label} before javascript_pack_tag helper. " \
199199
"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"
200200
end
201201

0 commit comments

Comments
 (0)