database_validations 2.0.0 → 2.1.1

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: db1e6ff10f0fdc62b44c930403abe235abb7453197648ec2a0b02cb2230cd8da
4
+ data.tar.gz: 71d5ed3189a8f8a3d0eb9b407e8ca18419632cb2764da5c880f5bebff7e995f7
5
5
  SHA512:
6
- metadata.gz: a734d277d173977b8c30c3f6952f9458af89bf6eec3e79da3b218c222c8c575f94d163054bfcaf4d9c23b9cf6af2666a3b6794a22c7c013b61518605f57e2663
7
- data.tar.gz: 3fba9fd273ca3640fd19854401e42c2c091794dfb763cee8cdaa0c9e80260723cdad9fe66cf9ef0824a476e49766f6d6648309d942d8ad99744963bf0b0d58d9
6
+ metadata.gz: 6c1182c71cebae1d74f81ab204dcf3dd99890b0c88b3596acefd146e7f392e6bf713072d031b12d7c203d76d54c182bf12f17ab6aacbdea1dd3c708e6c420eaa
7
+ data.tar.gz: b197cf9d7159bec4ab76aa277c79fc5870107935d8f4798fb857fcd0589917f1ca29c86025759d3e9b10366a901c72e605dadd46dc96f3847cf0fe4e3852f09e
@@ -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.1'.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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
@@ -176,6 +176,9 @@ executables: []
176
176
  extensions: []
177
177
  extra_rdoc_files: []
178
178
  files:
179
+ - config/database.yml
180
+ - config/database_config.rb
181
+ - config/rubocop-default.yml
179
182
  - lib/database_validations.rb
180
183
  - lib/database_validations/lib/adapters.rb
181
184
  - lib/database_validations/lib/adapters/base_adapter.rb
@@ -203,10 +206,14 @@ files:
203
206
  - lib/database_validations/rubocop/cops.rb
204
207
  - lib/database_validations/tasks/database_validations.rake
205
208
  - lib/database_validations/version.rb
209
+ - lib/rubocop-database_validations.rb
210
+ - lib/rubocop/database_validations.rb
211
+ - lib/rubocop/database_validations/plugin.rb
206
212
  homepage: https://github.com/toptal/database_validations
207
213
  licenses:
208
214
  - MIT
209
- metadata: {}
215
+ metadata:
216
+ default_lint_roller_plugin: RuboCop::DatabaseValidations::Plugin
210
217
  rdoc_options: []
211
218
  require_paths:
212
219
  - lib