Skip to content

Commit 92e5f3d

Browse files
authored
Merge pull request #17 from PenguinParadigm/update-ci
Support Rails 7 + 8
2 parents 2c0c097 + 6218341 commit 92e5f3d

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

.github/workflows/ruby.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
ruby: [2.7, '3.0']
14+
ruby: [3.4]
15+
rails: ['~> 7', '~> 8']
16+
env:
17+
RAILS_VERSION: ${{ matrix.rails }}
1518
steps:
16-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
1720
- name: Set up Ruby
1821
uses: ruby/setup-ruby@v1
1922
with:
2023
ruby-version: ${{ matrix.ruby }}
21-
- uses: actions/cache@v2
24+
- uses: actions/cache@v4
2225
with:
2326
path: vendor/bundle
2427
key: ${{ runner.os }}-gems-202103-${{ hashFiles('**/Gemfile.lock') }}
@@ -27,6 +30,6 @@ jobs:
2730
- name: Bundle install
2831
run: bundle config path vendor/bundle
2932
- name: Install dependencies
30-
run: bin/setup
33+
run: bundle install
3134
- name: Run tests
3235
run: bundle exec rake

Gemfile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ gemspec
1616
# engine_cart: 1.2.0
1717
# engine_cart stanza: 0.10.0
1818
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
19-
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
19+
file = File.expand_path('Gemfile',
20+
ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app',
21+
File.dirname(__FILE__)))
2022
if File.exist?(file)
2123
begin
2224
eval_gemfile file
@@ -35,16 +37,5 @@ else
3537
gem 'rails', ENV['RAILS_VERSION']
3638
end
3739
end
38-
39-
case ENV['RAILS_VERSION']
40-
when /^5.[12]/
41-
gem 'sass-rails', '~> 5.1'
42-
when /^4.2/
43-
gem 'responders', '~> 2.0'
44-
gem 'sass-rails', '>= 5.0'
45-
gem 'coffee-rails', '~> 4.1.0'
46-
when /^4.[01]/
47-
gem 'sass-rails', '< 5.0'
48-
end
4940
end
5041
# END ENGINE_CART BLOCK

annotot.gemspec

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$:.push File.expand_path('../lib', __FILE__)
1+
$:.push File.expand_path('lib', __dir__)
22

33
# Maintain your gem's version:
44
require 'annotot/version'
@@ -16,11 +16,10 @@ Gem::Specification.new do |s|
1616

1717
s.files = Dir['{app,config,db,lib}/**/*', 'LICENSE', 'Rakefile', 'README.md']
1818

19-
s.add_dependency 'rails', '>= 5.1', '< 8'
19+
s.add_dependency 'rails', '>= 7.0', '< 9'
2020

2121
s.add_development_dependency 'engine_cart'
2222
s.add_development_dependency 'factory_bot_rails'
2323
s.add_development_dependency 'rails-controller-testing'
2424
s.add_development_dependency 'rspec-rails'
25-
s.add_development_dependency 'sqlite3'
2625
end

app/models/annotot/annotation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Annotation < ApplicationRecord
33
validates :uuid, presence: true, uniqueness: true
44
validates :canvas, presence: true
55

6-
serialize :data, JSON
6+
serialize :data, coder: JSON
77

88
##
99
# Used to differentiate between a numeric id and a uuid. Rails will trim a

lib/annotot/engine.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
module Annotot
22
class Engine < ::Rails::Engine
33
isolate_namespace Annotot
4+
5+
config.before_configuration do
6+
# see https://github.com/fxn/zeitwerk#for_gem
7+
# Blacklight puts a generator into LOCAL APP lib/generators, so tell
8+
# zeitwerk to ignore the whole directory? If we're using a recent
9+
# enough version of Rails to have zeitwerk config
10+
#
11+
# See: https://github.com/cbeer/engine_cart/issues/117
12+
if Rails.try(:autoloaders).try(:main).respond_to?(:ignore)
13+
Rails.autoloaders.main.ignore(Rails.root.join('lib/generators'))
14+
end
15+
end
416
end
517
end

0 commit comments

Comments
 (0)