dekiru 0.6.0 → 0.7.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: c0f03d8577117755bdd83832d5385e841f9b9062ed9280ff113126678fe246b4
4
- data.tar.gz: 6b1b4051c93f6fbacdf95feb0d5f89daafaf4b86ee8c871d8d35dd4c86e9aea7
3
+ metadata.gz: 69be6523ac8efcf2cfd2d1ffe1f076af877e66cf71a49ee8bd657764d6bed300
4
+ data.tar.gz: 2084793dd23ab85c1ad750f86957f99c914ff479e1fc0715e0bd8c16a2808032
5
5
  SHA512:
6
- metadata.gz: 15bd327a6571a4d56c7f0ea1fb3931c517496b02003f709a7185e052abb42fc66e5555eec0ba8fa3824cc4f64b4ab3e234517d5615f8287e97e6c6b30aa21a53
7
- data.tar.gz: adc18f216af47e11d68daaeb86304a6e0d00351a019bdc516ce14afa89b6e69338248c6c7a29aef7c610cf1ab69945dae7653e107c662f50f57ae9a80f2c6c9f
6
+ metadata.gz: 7c1f0b0d3d2035149fdc21d07402a586bfe354920622ecbdf083cc48210be8c0811a1fe436d453e6f1475c64982c2dbb20af7893e49924a41c1028cb125e411e
7
+ data.tar.gz: d1abc1daa96ca6c3c3ecf936bb46101387926bca31cd628e0286ee508d627b83e140b67ac4883f064422b054b6b71457e431366cf664eeb06ab23c8b94b792ef
@@ -14,7 +14,7 @@ jobs:
14
14
  strategy:
15
15
  fail-fast: false
16
16
  matrix:
17
- ruby: ["3.0", "3.1", "3.2"]
17
+ ruby: ["3.1", "3.2", "3.3"]
18
18
  steps:
19
19
  - uses: actions/checkout@v4
20
20
 
data/dekiru.gemspec CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ["lib"]
20
20
  gem.version = Dekiru::VERSION
21
21
 
22
- gem.required_ruby_version = '>= 3.0.0'
22
+ gem.required_ruby_version = '>= 3.1.0'
23
23
 
24
- gem.add_dependency 'rails', '>= 6.1'
24
+ gem.add_dependency 'rails', '>= 7.0'
25
25
  gem.add_dependency 'ruby-progressbar'
26
26
  gem.add_development_dependency 'rake'
27
27
  gem.add_development_dependency 'rspec'
@@ -2,13 +2,13 @@ namespace :db do
2
2
  namespace :migrate do
3
3
  desc 'Check migrate conflict'
4
4
  task check_conflict: :environment do
5
- migrations_status =
6
- if ActiveRecord::Base.connection.respond_to?(:migration_context)
7
- ActiveRecord::Base.connection.migration_context.current_version.zero? ? [] : ActiveRecord::Base.connection.migration_context.migrations_status
8
- else
9
- paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths
10
- ActiveRecord::Migrator.migrations_status(paths)
11
- end
5
+ migration_context =
6
+ if ActiveRecord::Base.connection_pool.respond_to?(:migration_context)
7
+ ActiveRecord::Base.connection_pool.migration_context
8
+ else
9
+ ActiveRecord::Base.connection.migration_context
10
+ end
11
+ migrations_status = migration_context.current_version.zero? ? [] : migration_context.migrations_status
12
12
 
13
13
  if migrations_status.map(&:third).any? { |name| name.include?('NO FILE') }
14
14
  abort 'Migration conflict!'
@@ -1,3 +1,3 @@
1
1
  module Dekiru
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
data/lib/dekiru.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'dekiru/version'
2
2
  require 'dekiru/railtie' if defined?(::Rails)
3
3
  require 'dekiru/helper'
4
- require 'dekiru/validators/existence'
5
4
  require 'dekiru/data_migration_operator'
6
5
  require 'dekiru/mail_security_interceptor'
7
6
  require 'dekiru/camelize_hash'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dekiru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akihiro Matsumura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-19 00:00:00.000000000 Z
11
+ date: 2024-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.1'
19
+ version: '7.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '6.1'
26
+ version: '7.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-progressbar
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +139,6 @@ files:
139
139
  - lib/dekiru/railtie.rb
140
140
  - lib/dekiru/task_with_logger.rb
141
141
  - lib/dekiru/tasks/db.rake
142
- - lib/dekiru/validators/existence.rb
143
142
  - lib/dekiru/version.rb
144
143
  - lib/generators/maintenance_script/USAGE
145
144
  - lib/generators/maintenance_script/maintenance_script_generator.rb
@@ -147,7 +146,6 @@ files:
147
146
  - spec/dekiru/camelize_hash_spec.rb
148
147
  - spec/dekiru/data_migration_operator_spec.rb
149
148
  - spec/dekiru/mail_security_interceptor_spec.rb
150
- - spec/dekiru/validators/existence_spec.rb
151
149
  - spec/spec_helper.rb
152
150
  - spec/supports/action_mailer.rb
153
151
  - spec/supports/mock_active_record.rb
@@ -165,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
163
  requirements:
166
164
  - - ">="
167
165
  - !ruby/object:Gem::Version
168
- version: 3.0.0
166
+ version: 3.1.0
169
167
  required_rubygems_version: !ruby/object:Gem::Requirement
170
168
  requirements:
171
169
  - - ">="
@@ -180,7 +178,6 @@ test_files:
180
178
  - spec/dekiru/camelize_hash_spec.rb
181
179
  - spec/dekiru/data_migration_operator_spec.rb
182
180
  - spec/dekiru/mail_security_interceptor_spec.rb
183
- - spec/dekiru/validators/existence_spec.rb
184
181
  - spec/spec_helper.rb
185
182
  - spec/supports/action_mailer.rb
186
183
  - spec/supports/mock_active_record.rb
@@ -1,27 +0,0 @@
1
- # class Post < ActiveRecord::Base
2
- # belongs_to :company
3
- # belongs_to :user
4
- # validates :user_id, presence: true, existence: { in: -> { company.users } }
5
- # end
6
-
7
- module ActiveModel
8
- module Validations
9
- class ExistenceValidator < EachValidator
10
- def validate_each(record, attribute, value)
11
- ActiveSupport::Deprecation.warn('`ExistenceValidator` is deprecated and will be removed in v0.5. Please use `inclusion: { in: xx }` instead.')
12
-
13
- unless exists?(record, value)
14
- record.errors.add(attribute, :existence, **options.except(:in).merge!(value: value))
15
- end
16
- end
17
-
18
- def exists?(record, value)
19
- unless options[:in].respond_to?(:call)
20
- raise ArgumentError, '`in` option should be proc'
21
- end
22
- collection = record.instance_exec(&options[:in])
23
- collection.exists?(value)
24
- end
25
- end
26
- end
27
- end
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveModel::Validations::ExistenceValidator do
4
- let(:user_class) do
5
- Class.new do
6
- def self.exists?(id)
7
- %w[valid_id].member?(id)
8
- end
9
- end
10
- end
11
- let(:model_class) do
12
- _options = options
13
-
14
- Struct.new(:user_id, :users) do
15
- include ActiveModel::Validations
16
-
17
- def self.name
18
- 'DummyModel'
19
- end
20
-
21
- validates :user_id, existence: _options
22
- end
23
- end
24
-
25
- describe 'validate' do
26
- subject(:valid?) do
27
- model_class.new(user_id, user_class).valid?
28
- end
29
-
30
- context 'with exists id' do
31
- let(:user_id) { 'valid_id' }
32
- let(:options) { { in: -> { users } } }
33
-
34
- it { is_expected.to eq true }
35
- end
36
-
37
- context 'with exists not id' do
38
- let(:user_id) { 'invalid_id' }
39
- let(:options) { { in: -> { users } } }
40
-
41
- it { is_expected.to eq false }
42
- end
43
-
44
- context 'with invalid option' do
45
- let(:user_id) { 'valid_id' }
46
- let(:options) { { in: user_class } }
47
-
48
- it { expect { valid? }.to raise_error(ArgumentError) }
49
- end
50
- end
51
- end