database_consistency 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/database_consistency.rb +2 -0
- data/lib/database_consistency/checkers/base_checker.rb +2 -0
- data/lib/database_consistency/helper.rb +5 -0
- data/lib/database_consistency/rescue_error.rb +36 -0
- data/lib/database_consistency/version.rb +1 -1
- data/lib/database_consistency/writers/simple_writer.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5838553640c9936a64b3b4d57cf07a8f906ad2898a08cfa9e35dd335601c55fa
|
4
|
+
data.tar.gz: e7bcff327c307641b5841a569e89595f3df09dcc1291c1626ec4defb8f529143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e585ce47867455350dc2e23cb6316318272171ba2cf43ff24b3e83e80263bba515aafc66209d982ab7bc857831613850608cd3305ce4ceb37412450c5a27b084
|
7
|
+
data.tar.gz: 707be00b640e0f1c95ca7f6a192edb684513c6fd872ad0efbf58e869754dfc12d1e6471dc54bc81e7bce6c5174473f4529896cfcf7949b66c5a3593e6aef7884
|
data/lib/database_consistency.rb
CHANGED
@@ -5,6 +5,7 @@ require 'active_record'
|
|
5
5
|
require 'database_consistency/version'
|
6
6
|
require 'database_consistency/helper'
|
7
7
|
require 'database_consistency/configuration'
|
8
|
+
require 'database_consistency/rescue_error'
|
8
9
|
|
9
10
|
require 'database_consistency/writers/base_writer'
|
10
11
|
require 'database_consistency/writers/simple_writer'
|
@@ -29,6 +30,7 @@ require 'database_consistency/processors/columns_processor'
|
|
29
30
|
module DatabaseConsistency
|
30
31
|
class << self
|
31
32
|
def run
|
33
|
+
Helper.welcome_message!
|
32
34
|
Helper.load_environment!
|
33
35
|
|
34
36
|
configuration = Configuration.new
|
@@ -5,6 +5,11 @@ 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
|
+
|
8
13
|
# Returns list of models to check
|
9
14
|
def models
|
10
15
|
ActiveRecord::Base.descendants.delete_if(&:abstract_class?)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DatabaseConsistency
|
4
|
+
# The class writes error to the file
|
5
|
+
class RescueError
|
6
|
+
attr_reader :error
|
7
|
+
|
8
|
+
private_class_method :new
|
9
|
+
|
10
|
+
def self.call(error)
|
11
|
+
@singleton ||= new
|
12
|
+
@singleton.call(error)
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
puts 'Hey, some of checks fail with an error, please open an issue on github at https://github.com/djezzzl/database_consistency.'
|
17
|
+
puts "Attach the created file: #{filename}"
|
18
|
+
puts 'Thank you, for your contribution!'
|
19
|
+
puts '(c) Evgeniy Demin <lawliet.djez@gmail.com>'
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(error)
|
23
|
+
File.open(filename, 'a') do |file|
|
24
|
+
file.puts('<===begin===>')
|
25
|
+
file.puts(error.full_message)
|
26
|
+
file.puts('<===end===>')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def filename
|
33
|
+
"database_consistency_#{Time.now.strftime('%Y_%m_%d_%H_%M_%S')}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_consistency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/database_consistency/processors/base_processor.rb
|
154
154
|
- lib/database_consistency/processors/columns_processor.rb
|
155
155
|
- lib/database_consistency/processors/validators_processor.rb
|
156
|
+
- lib/database_consistency/rescue_error.rb
|
156
157
|
- lib/database_consistency/version.rb
|
157
158
|
- lib/database_consistency/writers/base_writer.rb
|
158
159
|
- lib/database_consistency/writers/simple_writer.rb
|