database_consistency 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/database_consistency +10 -0
- data/lib/database_consistency/helper.rb +0 -10
- data/lib/database_consistency/version.rb +1 -1
- data/lib/database_consistency.rb +0 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86e5667ae277f41bb7a4e1125b7058680e236bee30b10bd43a56ae3c1b608c2a
|
4
|
+
data.tar.gz: b72491a32de3e10f9ac92f1b711ec5c412776be44bb8f54502420be21ed2299d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40cde48b836130ccfe120ea2826260a794bc35edcca1ec24622b2f92066597d679a6132dc64904311cc655e0756eab82bb1fd92f6c6f4e821a3f27c3d4185b7e
|
7
|
+
data.tar.gz: 8ed3b4f6e41c29f9d37323b6c8ecc79dc7d34cfe6eaa5c80982ec51d9fb61b58e520c1a809a0e63c1ef3a13627b5ff8fd1c99f3d38f6625bf7b7d9fec9ac2caf
|
data/bin/database_consistency
CHANGED
@@ -6,6 +6,7 @@ unless File.realpath(base_dir).start_with?(Dir.pwd)
|
|
6
6
|
puts "\nWarning! You are going out of current directory, ruby version may be wrong and some gems may be missing.\n"
|
7
7
|
end
|
8
8
|
|
9
|
+
# Load Rails project
|
9
10
|
begin
|
10
11
|
require File.join(base_dir, 'config', 'boot')
|
11
12
|
require File.join(base_dir, 'config', 'environment')
|
@@ -14,8 +15,17 @@ rescue LoadError
|
|
14
15
|
raise
|
15
16
|
end
|
16
17
|
|
18
|
+
# Load Rails models
|
19
|
+
Rails.application.eager_load! if defined?(Rails)
|
20
|
+
|
21
|
+
# Require the gem
|
17
22
|
$LOAD_PATH.unshift(File.expand_path('lib', __dir__))
|
18
23
|
require 'database_consistency'
|
19
24
|
|
25
|
+
# Welcome message
|
26
|
+
puts 'Thank you for using the gem. Any contribution is welcome https://github.com/djezzzl/database_consistency!'
|
27
|
+
puts "(c) Evgeniy Demin <lawliet.djez@gmail.com>\n\n"
|
28
|
+
|
29
|
+
# Process checks
|
20
30
|
result = DatabaseConsistency.run
|
21
31
|
exit result
|
@@ -5,11 +5,6 @@ module DatabaseConsistency
|
|
5
5
|
module Helper
|
6
6
|
module_function
|
7
7
|
|
8
|
-
def welcome_message!
|
9
|
-
puts 'Thank you for using the gem. Any contribution is welcome https://github.com/djezzzl/database_consistency!'
|
10
|
-
puts '(c) Evgeniy Demin <lawliet.djez@gmail.com>'
|
11
|
-
end
|
12
|
-
|
13
8
|
# Returns list of models to check
|
14
9
|
def models
|
15
10
|
ActiveRecord::Base.descendants.delete_if(&:abstract_class?)
|
@@ -22,11 +17,6 @@ module DatabaseConsistency
|
|
22
17
|
end
|
23
18
|
end
|
24
19
|
|
25
|
-
# Loads all models
|
26
|
-
def load_environment!
|
27
|
-
Rails.application.eager_load! if defined?(Rails)
|
28
|
-
end
|
29
|
-
|
30
20
|
# @return [Boolean]
|
31
21
|
def check_inclusion?(array, element)
|
32
22
|
array.include?(element.to_s) || array.include?(element.to_sym)
|
data/lib/database_consistency.rb
CHANGED
@@ -30,9 +30,6 @@ require 'database_consistency/processors/columns_processor'
|
|
30
30
|
module DatabaseConsistency
|
31
31
|
class << self
|
32
32
|
def run
|
33
|
-
Helper.welcome_message!
|
34
|
-
Helper.load_environment!
|
35
|
-
|
36
33
|
configuration = Configuration.new
|
37
34
|
reports = Processors.reports(configuration)
|
38
35
|
|