model_validator 1.1.0 → 1.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: ad05f1a13e54602959a5913973a2faed03b80203233285d48b692fd3310a6b81
4
- data.tar.gz: a5cf56f9d5d792f675c4ccc918b448772ad4af4d02bdd2647b2a697c0c15b6d6
3
+ metadata.gz: d39b8ed8b26347cd45b16cd9c446bc30a926c79f507c06c2e6d86b1df354aa90
4
+ data.tar.gz: a5fef5baa38f2e5ee415ff8bcc30b5f31c344d86fd02b50bad772b2b4c6a0968
5
5
  SHA512:
6
- metadata.gz: a629d909b30a1582bb07d9bf5b1884911cb1991c6749ba2fb5fbd75b625648536c1f6ce16c6dcf6d39192a19af0326b6d6c7e96b87e507fc86f76cd3d0d02347
7
- data.tar.gz: e0440d447f4c11cb7f9fa9a027963476181d1114f18ed9a3fa2e00e4822bd7fd22b8e11ad7f1e019cf57e57d5f45bf9e6a8bc9317b9c9a09fecdf7ea486a3548
6
+ metadata.gz: 3359f10c445f0bf9a7f6f186e3e8a96d087b92720bca005782f4edcc3b9a1ce0f2dbbc9d8dea938e9302a89b0f64db93d3494ed0683a5280cd34ac4daf0c2af5
7
+ data.tar.gz: db3cd3080195468d3e338775c52749418063156562944d2ac2e6ade738bda764b039c942caf9492ed0044333d53282a39d028e37f9e4d0952dad20ad0f31699b
data/Gemfile CHANGED
@@ -3,11 +3,3 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
-
7
- gem "coveralls", require: false
8
- gem "rake", "~> 13.0"
9
- gem "rspec", "~> 3.0"
10
- gem "rubocop", "~> 1.7"
11
- gem "rubocop-rake", "~> 0.5.1"
12
- gem "rubocop-rspec", "~> 2.2"
13
- gem "sqlite3", "~> 1.4"
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- model_validator (1.1.0)
5
- rails (~> 6.1)
4
+ model_validator (1.2.0)
5
+ rails (>= 4.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -79,12 +79,14 @@ GEM
79
79
  diff-lcs (1.4.4)
80
80
  docile (1.3.5)
81
81
  erubi (1.10.0)
82
+ factory_bot (6.1.0)
83
+ activesupport (>= 5.0.0)
82
84
  globalid (0.4.2)
83
85
  activesupport (>= 4.2.0)
84
86
  i18n (1.8.5)
85
87
  concurrent-ruby (~> 1.0)
86
88
  json (2.5.1)
87
- loofah (2.8.0)
89
+ loofah (2.9.0)
88
90
  crass (~> 1.0.2)
89
91
  nokogiri (>= 1.5.9)
90
92
  mail (2.7.1)
@@ -96,7 +98,7 @@ GEM
96
98
  mini_mime (1.0.2)
97
99
  mini_portile2 (2.4.0)
98
100
  minitest (5.14.2)
99
- nio4r (2.5.4)
101
+ nio4r (2.5.5)
100
102
  nokogiri (1.10.10)
101
103
  mini_portile2 (~> 2.4.0)
102
104
  parallel (1.20.1)
@@ -198,6 +200,7 @@ PLATFORMS
198
200
 
199
201
  DEPENDENCIES
200
202
  coveralls
203
+ factory_bot
201
204
  model_validator!
202
205
  rake (~> 13.0)
203
206
  rspec (~> 3.0)
data/Makefile CHANGED
@@ -12,3 +12,6 @@ lint: ## Check file format, smell code, conventions…
12
12
 
13
13
  lint-fix: ## Fix violations when possible
14
14
  bundle exec rubocop -a
15
+
16
+ install-locally: ## Install this gem locally
17
+ bundle exec rake install
data/README.md CHANGED
@@ -75,7 +75,7 @@ Then, run `make test` to run the tests (test coverage is available in `coverage/
75
75
 
76
76
  Then, run `make lint` to run linters ([rubocop](https://github.com/rubocop-hq/rubocop)).
77
77
 
78
- To install this gem onto your local machine, run `bundle exec rake install`.
78
+ To install this gem onto your local machine, run `make install-locally`.
79
79
 
80
80
  ### How to release new version?
81
81
 
@@ -57,7 +57,7 @@ module ModelValidator
57
57
  # This handler logs validation progression
58
58
  class LogHandler
59
59
  def on_new_class(model_class)
60
- Rails.logger.info "Checking #{model_class}..."
60
+ Rails.logger.info "Checking #{model_class.count} #{model_class}…"
61
61
  end
62
62
 
63
63
  def on_violation(model)
@@ -7,7 +7,7 @@ namespace :db do
7
7
  task validate: :environment do
8
8
  Rails.logger.info "Validate database (this will take some time)…"
9
9
  skipped_models = (ENV["MODEL_VALIDATOR_SKIPPED_MODELS"] || "").split(",")
10
- count = ModelValidator.validate_all(skipped_models: skipped_models)
11
- Rails.logger.info "Validation finished with #{count} violation(s)"
10
+ result = ModelValidator.validate_all(skipped_models: skipped_models)
11
+ Rails.logger.info "Validation finished with #{result.violations}/#{result.total} violation(s)"
12
12
  end
13
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ModelValidator
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "lib/model_validator/version"
4
4
 
5
- Gem::Specification.new do |spec|
5
+ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
6
6
  spec.name = "model_validator"
7
7
  spec.version = ModelValidator::VERSION
8
8
  spec.authors = ["Jibidus"]
@@ -30,7 +30,16 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency "rails", "~> 6.1"
33
+ spec.add_runtime_dependency "rails", ">= 4.0"
34
+
35
+ spec.add_development_dependency "coveralls"
36
+ spec.add_development_dependency "factory_bot"
37
+ spec.add_development_dependency "rake", "~> 13.0"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency "rubocop", "~> 1.7"
40
+ spec.add_development_dependency "rubocop-rake", "~> 0.5.1"
41
+ spec.add_development_dependency "rubocop-rspec", "~> 2.2"
42
+ spec.add_development_dependency "sqlite3", "~> 1.4"
34
43
 
35
44
  # For more information and examples about making a new gem, checkout our
36
45
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jibidus
@@ -14,16 +14,128 @@ dependencies:
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.1'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: factory_bot
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.5.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.5.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: sqlite3
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.4'
132
+ type: :development
133
+ prerelease: false
22
134
  version_requirements: !ruby/object:Gem::Requirement
23
135
  requirements:
24
136
  - - "~>"
25
137
  - !ruby/object:Gem::Version
26
- version: '6.1'
138
+ version: '1.4'
27
139
  description: |
28
140
  Find models in database which violate Active Record validation rules.
29
141
  Invalid models may raise unexpected error when updated.