database_validations 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2725c19065bc2a34ba2c1eddc54ab4f7127caf234a9e11be5a08c31388f4d3df
4
- data.tar.gz: 6797dde1e63a4701eaa5e8c1c743c57feeae914352407e43c1185d092de1f8b8
3
+ metadata.gz: cb8e88ed5b20821f4c5ebd14e90ea1505689ea2d68619608b832c18ece68a50c
4
+ data.tar.gz: 4b658e6f4d179735bd6fc73002e9790ed18bb4134119a00403fe51bba3d4bba6
5
5
  SHA512:
6
- metadata.gz: a734d277d173977b8c30c3f6952f9458af89bf6eec3e79da3b218c222c8c575f94d163054bfcaf4d9c23b9cf6af2666a3b6794a22c7c013b61518605f57e2663
7
- data.tar.gz: 3fba9fd273ca3640fd19854401e42c2c091794dfb763cee8cdaa0c9e80260723cdad9fe66cf9ef0824a476e49766f6d6648309d942d8ad99744963bf0b0d58d9
6
+ metadata.gz: 7053335a8acdf7dbf0f64a9c8e4bdfecaa6300a285158911af5d436f59265c05d36f118347c4e36b9016e6c4284ff54b0f680c30bbaba80ec4649ef2922da742
7
+ data.tar.gz: 4887ce0d4ab98df0498b7df3531bc8ecdc49c85b8af3bb22606f2bc1df3b3c9de871216abe9ef16ca9c1cb6c33b3382c7a2da63bf13464e0c852ff0e1e891b0c
@@ -0,0 +1,17 @@
1
+ postgresql:
2
+ adapter: postgresql
3
+ database: database_validations_test
4
+ host: <%= ENV['DB_HOST'] || '127.0.0.1' %>
5
+ username: <%= ENV['DB_USER'] || 'database_validations' %>
6
+ password: <%= ENV['DB_PASSWORD'] || 'database_validations' %>
7
+
8
+ mysql:
9
+ adapter: mysql2
10
+ database: database_validations_test
11
+ host: <%= ENV['DB_HOST'] || '127.0.0.1' %>
12
+ username: <%= ENV['DB_USER'] || 'root' %>
13
+ password: <%= ENV['DB_PASSWORD'] || 'database_validations' %>
14
+
15
+ sqlite:
16
+ adapter: sqlite3
17
+ database: ':memory:'
@@ -0,0 +1,12 @@
1
+ require 'erb'
2
+ require 'yaml'
3
+
4
+ module DatabaseConfig
5
+ def self.load(symbolize_keys: false)
6
+ yaml_path = File.expand_path('database.yml', __dir__)
7
+ yaml_content = ERB.new(File.read(yaml_path)).result
8
+ configs = YAML.safe_load(yaml_content)
9
+ configs = configs.transform_values { |v| v.transform_keys(&:to_sym) } if symbolize_keys
10
+ configs
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ DatabaseValidations/BelongsTo:
2
+ Enabled: true
3
+
4
+ DatabaseValidations/UniquenessOf:
5
+ Enabled: true
@@ -1,3 +1,3 @@
1
1
  module DatabaseValidations
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
@@ -0,0 +1,29 @@
1
+ require 'lint_roller'
2
+ require 'database_validations/version'
3
+
4
+ module RuboCop
5
+ module DatabaseValidations
6
+ class Plugin < LintRoller::Plugin
7
+ def about
8
+ LintRoller::About.new(
9
+ name: 'rubocop-database_validations',
10
+ version: ::DatabaseValidations::VERSION,
11
+ homepage: 'https://github.com/toptal/database_validations',
12
+ description: 'RuboCop cops for database_validations gem.'
13
+ )
14
+ end
15
+
16
+ def supported?(context)
17
+ context.engine == :rubocop
18
+ end
19
+
20
+ def rules(_context)
21
+ LintRoller::Rules.new(
22
+ type: :path,
23
+ config_format: :rubocop,
24
+ value: File.join(__dir__, '..', '..', '..', 'config', 'rubocop-default.yml')
25
+ )
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,2 @@
1
+ require_relative '../../lib/database_validations/rubocop/cop/belongs_to'
2
+ require_relative '../../lib/database_validations/rubocop/cop/uniqueness_of'
@@ -0,0 +1,4 @@
1
+ require 'rubocop'
2
+
3
+ require_relative 'rubocop/database_validations'
4
+ require_relative 'rubocop/database_validations/plugin'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: 7.2.0
26
+ - !ruby/object:Gem::Dependency
27
+ name: lint_roller
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: benchmark-ips
28
42
  requirement: !ruby/object:Gem::Requirement
@@ -176,6 +190,9 @@ executables: []
176
190
  extensions: []
177
191
  extra_rdoc_files: []
178
192
  files:
193
+ - config/database.yml
194
+ - config/database_config.rb
195
+ - config/rubocop-default.yml
179
196
  - lib/database_validations.rb
180
197
  - lib/database_validations/lib/adapters.rb
181
198
  - lib/database_validations/lib/adapters/base_adapter.rb
@@ -203,10 +220,14 @@ files:
203
220
  - lib/database_validations/rubocop/cops.rb
204
221
  - lib/database_validations/tasks/database_validations.rake
205
222
  - lib/database_validations/version.rb
223
+ - lib/rubocop-database_validations.rb
224
+ - lib/rubocop/database_validations.rb
225
+ - lib/rubocop/database_validations/plugin.rb
206
226
  homepage: https://github.com/toptal/database_validations
207
227
  licenses:
208
228
  - MIT
209
- metadata: {}
229
+ metadata:
230
+ default_lint_roller_plugin: RuboCop::DatabaseValidations::Plugin
210
231
  rdoc_options: []
211
232
  require_paths:
212
233
  - lib