schema_dev 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec4c4b34d4c065f5027f7b4edf76af56b328d10194ba6e4b6ec13d6b0ffdc4bf
4
- data.tar.gz: dc39ed695a1fa9df914cbaa0aa4163d4bade79237e80ab306238bee5605755d2
3
+ metadata.gz: 50cc2bddf7346d81775cd66fdec8d2dfff9755110a28808c1b344c884e9804d0
4
+ data.tar.gz: e0df8587750447828fd2fddf9ed634b878dfb4b3c2422bef056936ddd74abd2f
5
5
  SHA512:
6
- metadata.gz: af15e3126328563021a8662d2a0c9180f6978a6095de9471ac2627bfbb0cf64ba47773f48f3c3c4fe21f1871511b0c249c83a9f87801651b1fef7fd367647bf3
7
- data.tar.gz: 4f2d82816b77a658f41d5afb34f8f9f4401a58a739f1b1fc05ddc1a3b5d8ef304613363f30a2d3ed14da17cf15fb991d5febf5bb5c3ae4b0ad28cc568977058c
6
+ metadata.gz: 883156b6f5408b599766606a33cfca654b7406d5e61f02694fc5629d3481eb8f2a08c2a3be4d59bf520cf85f213368234f68d3c1a5f2594bf66bbd5869526a76
7
+ data.tar.gz: fc0712880c7aff4f22814ba109abdbddf052897b1d769aff604d8bb5d2708e1b75f89fbe00f7a4280943dbcaa2de387b213d4698a05a2e1269fc6607d4736fa7
@@ -7,7 +7,7 @@ on:
7
7
  pull_request:
8
8
 
9
9
  concurrency:
10
- group: ${{ github.head_ref }}
10
+ group: "ci-${{ github.ref }}"
11
11
  cancel-in-progress: true
12
12
 
13
13
  jobs:
@@ -16,14 +16,26 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby-version: ['2.5', '2.6', '2.7', '3.0']
19
+ ruby: ['2.5', '2.6', '2.7', '3.0', '3.1']
20
+ activesupport: ['5.2', '6.0', '6.1', '7.0']
21
+ exclude:
22
+ - ruby: '2.5'
23
+ activesupport: '7.0'
24
+ - ruby: '2.6'
25
+ activesupport: '7.0'
26
+ - ruby: '3.0'
27
+ activesupport: '5.2'
28
+ - ruby: '3.1'
29
+ activesupport: '5.2'
30
+ env:
31
+ BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/Gemfile.activesupport-${{ matrix.activesupport }}"
20
32
  steps:
21
33
  - uses: actions/checkout@v2
22
34
 
23
35
  - name: Set up Ruby
24
36
  uses: ruby/setup-ruby@v1
25
37
  with:
26
- ruby-version: ${{ matrix.ruby-version }}
38
+ ruby-version: ${{ matrix.ruby }}
27
39
  bundler-cache: true
28
40
 
29
41
  - name: 'Run bundle update'
@@ -36,7 +48,7 @@ jobs:
36
48
  uses: coverallsapp/github-action@master
37
49
  with:
38
50
  github-token: ${{ secrets.GITHUB_TOKEN }}
39
- flag-name: run-${{ matrix.ruby-version }}
51
+ flag-name: run-${{ matrix.ruby }}-${{ matrix.activesupport }}
40
52
  parallel: true
41
53
  finish:
42
54
  needs: 'test'
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
3
  /Gemfile.lock
4
+ /gemfiles/*.lock
4
5
  /_yardoc/
5
6
  /coverage/
6
7
  /doc/
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in schema_dev.gemspec
6
6
  gemspec
7
7
 
8
- gem 'byebug'
8
+ gemfile_local = File.expand_path '../Gemfile.local', __FILE__
9
+ eval File.read(gemfile_local), binding, gemfile_local if File.exist? gemfile_local
data/README.md CHANGED
@@ -136,6 +136,8 @@ Which defines the rake task `create_databases` and also a task for github action
136
136
 
137
137
  Release notes for schema_dev versions:
138
138
 
139
+ * **4.2.0** - Add AR 7.0, and Ruby 3.1 support. Also add more shared rspec filters
140
+ * **4.1.1** - Fix github actions generated files for concurrency detection
139
141
  * **4.1.0** - Switch to GitHub actions instead of travis CI
140
142
  * **4.0.0** - Drop support for AR < 5.2 and add AR 6.0 and 6.1
141
143
  * **3.13.1** - Adjust travis.yml generation to work with mysql again
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 5.2.0.beta0", "< 5.3"
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 6.0", "< 6.1"
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 6.1", "< 6.2"
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 7.0", "< 7.1"
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gemspec path: File.expand_path('..', __FILE__)
3
+
4
+ File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
@@ -17,7 +17,11 @@ module SchemaDev
17
17
  end
18
18
 
19
19
  def self.read
20
- new(**YAML.safe_load(Pathname.new(CONFIG_FILE).read, [Symbol]).symbolize_keys)
20
+ if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1')
21
+ new(**YAML.safe_load(Pathname.new(CONFIG_FILE).read, permitted_classes: [Symbol], symbolize_names: true))
22
+ else
23
+ new(**YAML.safe_load(Pathname.new(CONFIG_FILE).read, [Symbol], symbolize_names: true))
24
+ end
21
25
  end
22
26
 
23
27
  def self.load
@@ -30,11 +34,21 @@ module SchemaDev
30
34
  @db = Array.wrap(db)
31
35
  @dbversions = (dbversions || {}).symbolize_keys
32
36
  @exclude = Array.wrap(exclude).map(&:symbolize_keys).map { |tuple| Tuple.new(**tuple.transform_values(&:to_s)) }
33
- if @activerecord.include?('5.2')
34
- ruby3 = ::Gem::Version.new('3.0')
37
+ @activerecord.each do |ar_version|
38
+ ar_check = ::Gem::Version.new(ar_version)
39
+
40
+ if ar_check < ::Gem::Version.new('6.0')
41
+ ruby3 = ::Gem::Version.new('3.0')
42
+
43
+ @ruby.select { |e| ::Gem::Version.new(e) >= ruby3 }.each do |v|
44
+ @exclude << Tuple.new(ruby: v, activerecord: ar_version)
45
+ end
46
+ elsif ar_check >= ::Gem::Version.new('7.0')
47
+ ruby27 = ::Gem::Version.new('2.7')
35
48
 
36
- @ruby.select { |e| ::Gem::Version.new(e) >= ruby3 }.each do |v|
37
- @exclude << Tuple.new(ruby: v, activerecord: '5.2')
49
+ @ruby.select { |e| ::Gem::Version.new(e) < ruby27 }.each do |v|
50
+ @exclude << Tuple.new(ruby: v, activerecord: ar_version)
51
+ end
38
52
  end
39
53
  end
40
54
  unless notify.nil?
@@ -27,7 +27,7 @@ module SchemaDev
27
27
  pull_request: nil,
28
28
  },
29
29
  concurrency: {
30
- group: '${{ github.head_ref }}',
30
+ group: 'ci-${{ github.ref }}',
31
31
  'cancel-in-progress': true,
32
32
  }
33
33
  }.freeze
@@ -14,12 +14,30 @@ module SchemaDev
14
14
  connect
15
15
  RSpec.configure do |config|
16
16
  config.include Helpers
17
- config.filter_run_excluding postgresql: :only unless Helpers.postgresql?
18
- config.filter_run_excluding postgresql: :skip if Helpers.postgresql?
17
+ config.filter_run_excluding postgresql: -> (v) {
18
+ if Helpers.postgresql?
19
+ case v
20
+ when String
21
+ version = ActiveRecord::Base.connection.select_value("SHOW server_version").match(/(\d+\.\d+)/)[1]
22
+ postgresql_version = Gem::Version.new(version)
23
+ test = Gem::Requirement.new(v)
24
+ !test.satisfied_by?(postgresql_version)
25
+ else
26
+ v == :skip
27
+ end
28
+ else
29
+ v == :only
30
+ end
31
+ }
19
32
  config.filter_run_excluding mysql: :only unless Helpers.mysql?
20
33
  config.filter_run_excluding mysql: :skip if Helpers.mysql?
21
34
  config.filter_run_excluding sqlite3: :only unless Helpers.sqlite3?
22
35
  config.filter_run_excluding sqlite3: :skip if Helpers.sqlite3?
36
+ config.filter_run_excluding rails: -> (v) {
37
+ rails_version = Gem::Version.new(ActiveRecord::VERSION::STRING)
38
+ test = Gem::Requirement.new(v)
39
+ !test.satisfied_by?(rails_version)
40
+ }
23
41
  end
24
42
  end
25
43
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SchemaDev
4
- VERSION = '4.1.0'
4
+ VERSION = '4.2.0'
5
5
  end
data/schema_dev.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
21
21
 
22
22
  gem.required_ruby_version = '>= 2.5.0'
23
23
 
24
- gem.add_dependency 'activesupport', '>= 5.2', '< 6.2'
24
+ gem.add_dependency 'activesupport', '>= 5.2', '< 7.1'
25
25
  gem.add_dependency 'faraday', '~> 1.0'
26
26
  gem.add_dependency 'simplecov'
27
27
  gem.add_dependency 'simplecov-lcov', '~> 0.8.0'
@@ -57,4 +57,17 @@ describe SchemaDev::Config do
57
57
  { ruby: '2.1.5', activerecord: '4.1', db: 'postgresql' },
58
58
  ]
59
59
  end
60
+
61
+ it 'excludes variations that are not possible' do
62
+ config = get_config(ruby: %w[2.6 2.7 3.0], activerecord: %w[5.2 6.0 7.0], db: %w[sqlite3])
63
+ expect(config.matrix).to contain_exactly(
64
+ { ruby: '2.6', activerecord: '5.2', db: 'sqlite3' },
65
+ { ruby: '2.6', activerecord: '6.0', db: 'sqlite3' },
66
+ { ruby: '2.7', activerecord: '5.2', db: 'sqlite3' },
67
+ { ruby: '2.7', activerecord: '6.0', db: 'sqlite3' },
68
+ { ruby: '2.7', activerecord: '7.0', db: 'sqlite3' },
69
+ { ruby: '3.0', activerecord: '6.0', db: 'sqlite3' },
70
+ { ruby: '3.0', activerecord: '7.0', db: 'sqlite3' },
71
+ )
72
+ end
60
73
  end
@@ -31,7 +31,7 @@ describe SchemaDev::GithubActions do
31
31
  - master
32
32
  pull_request:
33
33
  concurrency:
34
- group: "${{ github.head_ref }}"
34
+ group: ci-${{ github.ref }}
35
35
  cancel-in-progress: true
36
36
  jobs:
37
37
  test:
@@ -99,7 +99,7 @@ describe SchemaDev::GithubActions do
99
99
  - master
100
100
  pull_request:
101
101
  concurrency:
102
- group: "${{ github.head_ref }}"
102
+ group: ci-${{ github.ref }}
103
103
  cancel-in-progress: true
104
104
  jobs:
105
105
  test:
@@ -152,6 +152,78 @@ describe SchemaDev::GithubActions do
152
152
  end
153
153
  end
154
154
 
155
+ context 'when AR 7.0 is included with Ruby < 2.7' do
156
+ let(:config) do
157
+ {
158
+ ruby: [2.5, 2.7],
159
+ activerecord: [6.0, 7.0],
160
+ db: %w[sqlite3]
161
+ }
162
+ end
163
+
164
+ it 'automatically excludes Ruby < 2.7 for AR 7.0' do
165
+ is_expected.to eq described_class::HEADER + <<~YAML
166
+ ---
167
+ name: CI PR Builds
168
+ 'on':
169
+ push:
170
+ branches:
171
+ - master
172
+ pull_request:
173
+ concurrency:
174
+ group: ci-${{ github.ref }}
175
+ cancel-in-progress: true
176
+ jobs:
177
+ test:
178
+ runs-on: ubuntu-latest
179
+ strategy:
180
+ fail-fast: false
181
+ matrix:
182
+ ruby:
183
+ - '2.5'
184
+ - '2.7'
185
+ activerecord:
186
+ - '6.0'
187
+ - '7.0'
188
+ db:
189
+ - sqlite3
190
+ exclude:
191
+ - ruby: '2.5'
192
+ activerecord: '7.0'
193
+ env:
194
+ BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/activerecord-${{ matrix.activerecord }}/Gemfile.${{ matrix.db }}"
195
+ steps:
196
+ - uses: actions/checkout@v2
197
+ - name: Set up Ruby
198
+ uses: ruby/setup-ruby@v1
199
+ with:
200
+ ruby-version: "${{ matrix.ruby }}"
201
+ bundler-cache: true
202
+ - name: Run bundle update
203
+ run: bundle update
204
+ - name: Run tests
205
+ run: bundle exec rake spec
206
+ - name: Coveralls Parallel
207
+ if: "${{ !env.ACT }}"
208
+ uses: coverallsapp/github-action@master
209
+ with:
210
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
211
+ flag-name: run-${{ matrix.ruby }}-${{ matrix.activerecord }}-${{ matrix.db }}-${{ matrix.dbversion }}
212
+ parallel: true
213
+ finish:
214
+ needs: test
215
+ runs-on: ubuntu-latest
216
+ steps:
217
+ - name: Coveralls Finished
218
+ if: "${{ !env.ACT }}"
219
+ uses: coverallsapp/github-action@master
220
+ with:
221
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
222
+ parallel-finished: true
223
+ YAML
224
+ end
225
+ end
226
+
155
227
  context 'when notify is passed' do
156
228
  let(:config) do
157
229
  {
@@ -180,7 +252,7 @@ describe SchemaDev::GithubActions do
180
252
  - master
181
253
  pull_request:
182
254
  concurrency:
183
- group: "${{ github.head_ref }}"
255
+ group: ci-${{ github.ref }}
184
256
  cancel-in-progress: true
185
257
  jobs:
186
258
  test:
@@ -247,7 +319,7 @@ describe SchemaDev::GithubActions do
247
319
  - master
248
320
  pull_request:
249
321
  concurrency:
250
- group: "${{ github.head_ref }}"
322
+ group: ci-${{ github.ref }}
251
323
  cancel-in-progress: true
252
324
  jobs:
253
325
  test:
@@ -360,7 +432,7 @@ describe SchemaDev::GithubActions do
360
432
  - master
361
433
  pull_request:
362
434
  concurrency:
363
- group: "${{ github.head_ref }}"
435
+ group: ci-${{ github.ref }}
364
436
  cancel-in-progress: true
365
437
  jobs:
366
438
  test:
@@ -459,7 +531,7 @@ describe SchemaDev::GithubActions do
459
531
  - master
460
532
  pull_request:
461
533
  concurrency:
462
- group: "${{ github.head_ref }}"
534
+ group: ci-${{ github.ref }}
463
535
  cancel-in-progress: true
464
536
  jobs:
465
537
  test:
@@ -582,7 +654,7 @@ describe SchemaDev::GithubActions do
582
654
  - master
583
655
  pull_request:
584
656
  concurrency:
585
- group: "${{ github.head_ref }}"
657
+ group: ci-${{ github.ref }}
586
658
  cancel-in-progress: true
587
659
  jobs:
588
660
  test:
@@ -699,7 +771,7 @@ describe SchemaDev::GithubActions do
699
771
  - master
700
772
  pull_request:
701
773
  concurrency:
702
- group: "${{ github.head_ref }}"
774
+ group: ci-${{ github.ref }}
703
775
  cancel-in-progress: true
704
776
  jobs:
705
777
  test:
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'simplecov'
4
- SimpleCov.start
4
+ SimpleCov.start unless SimpleCov.running
5
5
 
6
6
  require 'rspec/given'
7
7
  require 'tempfile'
@@ -1,6 +1,6 @@
1
1
  require 'simplecov'
2
2
  require 'simplecov-gem-profile'
3
- SimpleCov.start "gem"
3
+ SimpleCov.start unless SimpleCov.running
4
4
 
5
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
6
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 7.0", "< 7.1"
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "mysql2"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcmysql-adapter'
10
+ end
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "pg"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcpostgresql-adapter'
10
+ end
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "sqlite3"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ronen barzel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-13 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.2'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.2'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faraday
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +193,11 @@ files:
193
193
  - README.md
194
194
  - Rakefile
195
195
  - bin/schema_dev
196
+ - gemfiles/Gemfile.activesupport-5.2
197
+ - gemfiles/Gemfile.activesupport-6.0
198
+ - gemfiles/Gemfile.activesupport-6.1
199
+ - gemfiles/Gemfile.activesupport-7.0
200
+ - gemfiles/Gemfile.base
196
201
  - lib/schema_dev.rb
197
202
  - lib/schema_dev/config.rb
198
203
  - lib/schema_dev/executor.rb
@@ -248,6 +253,10 @@ files:
248
253
  - templates/gemfiles/activerecord-6.1/Gemfile.mysql2.erb
249
254
  - templates/gemfiles/activerecord-6.1/Gemfile.postgresql.erb
250
255
  - templates/gemfiles/activerecord-6.1/Gemfile.sqlite3.erb
256
+ - templates/gemfiles/activerecord-7.0/Gemfile.base.erb
257
+ - templates/gemfiles/activerecord-7.0/Gemfile.mysql2.erb
258
+ - templates/gemfiles/activerecord-7.0/Gemfile.postgresql.erb
259
+ - templates/gemfiles/activerecord-7.0/Gemfile.sqlite3.erb
251
260
  homepage: https://github.com/SchemaPlus/schema_dev
252
261
  licenses:
253
262
  - MIT