schema_dev 4.1.1 → 4.2.beta.5

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: '069541cc90199caf6edba1204d1fac74c7f95a917fae588bfc2b619cccf74c68'
4
- data.tar.gz: 9386c5b2336b795263a14f9d716efe02e756d27f68e1f6ae3c09d3caf31d6ae9
3
+ metadata.gz: 0df7ac647427e66a0e968bacc402b4e194789192f6a7f816b7d590b5c872a0b3
4
+ data.tar.gz: 4a4aedbf0d720816c33066d69ea7edc37eb4060e9ad511fe00b004741ca8641a
5
5
  SHA512:
6
- metadata.gz: fdb76d00701923057eef2e2c7fc1c49f53ace6e6a80c57808e1c24bc30e30ebfa4c72fb5e298d44e45cd922fc86ba7ff39b184dc0333126296738c0f39fd2486
7
- data.tar.gz: 24bb533311da24ea06279941a9ac4634f54f98ee663b8198de023203881713d6b13d0d9f8441fe782e013c48b353cdfbe951118890df12a51abffd7539b4ee60
6
+ metadata.gz: 6d743ea859930dd2b02ae3d5be9ef2e7b7bd31b63033f711f33f11315798a075afa4b46136f49b6b40279a45216ee77d41a49e5f923b29cb63707c390353ae58
7
+ data.tar.gz: 29e621ebfac4125d87073c4da2406b507bafbf9215e03e5191bcd8c7d3e6d8225c41774de8471646ef1db8bb44c35ceab340e57a048d654e30833e26de9bdc08
@@ -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
@@ -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?
@@ -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.1'
4
+ VERSION = '4.2.beta.5'
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
@@ -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
  {
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.1
4
+ version: 4.2.beta.5
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-12 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
@@ -263,9 +272,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
263
272
  version: 2.5.0
264
273
  required_rubygems_version: !ruby/object:Gem::Requirement
265
274
  requirements:
266
- - - ">="
275
+ - - ">"
267
276
  - !ruby/object:Gem::Version
268
- version: '0'
277
+ version: 1.3.1
269
278
  requirements: []
270
279
  rubygems_version: 3.0.8
271
280
  signing_key: