Skip to content

Commit 192cc2d

Browse files
authored
Merge pull request #131 from rom-rb/fix-matrix
update build matrix to scope down to more recent / supported releases
2 parents 38bae62 + d1ee9cc commit 192cc2d

File tree

2 files changed

+13
-34
lines changed

2 files changed

+13
-34
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,13 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
ruby:
27+
- '3.1'
28+
- '3.0'
2729
- '2.7'
28-
- '2.6'
29-
- '2.5'
30-
- '2.4'
31-
- 'jruby-9.3'
3230
rails:
31+
- "7.0.0"
3332
- "6.1.0"
3433
- "6.0.0"
35-
- "5.2.0"
36-
- "5.1.0"
37-
- "5.0.0"
38-
- "4.2.0"
39-
exclude:
40-
- ruby: "2.4"
41-
rails: "6.0.0"
42-
- ruby: "2.4"
43-
rails: "6.1.0"
44-
- ruby: "2.7"
45-
rails: "4.2.0"
4634
env:
4735
APT_DEPS: libsqlite3-dev
4836
RAILS_VERSION: "${{matrix.rails}}"

lib/rom/rails/active_record/configuration.rb

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,20 @@ def initialize(env: ::Rails.env, root: ::Rails.root, configurations: ::ActiveRec
3737
#
3838
# @api private
3939
def call
40-
specs = { default: build(default_configuration.configuration_hash) }
40+
specs = {}
4141

42-
if rails6?
43-
configurations.configs_for(env_name: env).each do |config|
44-
specs[config.name.to_sym] = build(config.configuration_hash)
42+
configurations.configs_for(env_name: env).each do |config|
43+
if config.respond_to?(:configuration_hash)
44+
name, hash = [config.name, config.configuration_hash]
45+
else # Rails 6.0
46+
name, hash = [config.spec_name, config.config]
4547
end
46-
end
47-
48-
specs
49-
end
5048

51-
def default_configuration
52-
if rails6?
53-
configurations.configs_for(env_name: env).first
54-
else
55-
configurations.fetch(env)
49+
specs[:default] ||= hash
50+
specs[name.to_sym] = hash
5651
end
52+
53+
specs.transform_values { |hash| build hash.symbolize_keys }
5754
end
5855

5956
# Builds a configuration hash from a flat database config hash.
@@ -77,12 +74,6 @@ def build(config)
7774
uri = uri_builder.build(adapter, uri_options)
7875
{ uri: uri, options: other_options }
7976
end
80-
81-
private
82-
83-
def rails6?
84-
::ActiveRecord::VERSION::MAJOR >= 6
85-
end
8677
end
8778
end
8879
end

0 commit comments

Comments
 (0)