validb 1.2.1 → 2.0.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
  SHA1:
3
- metadata.gz: 5029c1e329cd8ca5e201dbf789a1fae902d8e0cd
4
- data.tar.gz: d6da89be0e3a798c594a90c2c8e4d4dbb635fa00
3
+ metadata.gz: 36c876f755ed39d03ffa2089430e120485a33ef3
4
+ data.tar.gz: aee472a56c2a3a13d83da6cd6affecfddb4754c7
5
5
  SHA512:
6
- metadata.gz: 9b00aa393b7fcec846bfa37f82d5610070cb6d6a50116ab7e949f411d5c4fc9a9ef924b56ea7cd01bf5397dc8c461caa7dd82d4a99a42485f16bc01c8a717d28
7
- data.tar.gz: b5f36565dc2ebce1dfac46f7289200b9f31ff83701cd3142ee68942e85e9cb303224b4e4e20d2915cd8e471478772bdde3231cf4e2a00cb9f2ff041c81250c23
6
+ metadata.gz: 091a64b809e1652481cd32b847f34643246ae1772b9657e34bb24e2b7e17b2fcc9e908f7b1c8438c6809633deda8f66f08671e8cb12c60274831e04d64c4341a
7
+ data.tar.gz: e0fecdeef959242ec3f02bdb3ebdabca9c86aabaf632ea558505055a6a61a7376ec5d89e0833de55ffb0820a13f27e3d06adaee21cdb94e08b20192ca5b889f6
data/.gitignore CHANGED
@@ -43,3 +43,4 @@ tramp
43
43
  .rbx
44
44
  b/
45
45
  vendor/*
46
+ validb.log
@@ -1,3 +1,7 @@
1
+ ## 2.0.0, released 2013-04-07
2
+ * Distribute validation jobs using sidekiq
3
+ * Remove console logger
4
+
1
5
  ## 1.2.1, released 2013-04-05
2
6
  * Revert printing 'x' on validation failure
3
7
 
data/README.md CHANGED
@@ -10,22 +10,15 @@
10
10
  Check your database for invalid models.
11
11
 
12
12
  ## Installation
13
- gem install validb
14
-
15
- ### Rails 3 In Gemfile
13
+ Add this line to your Gemfile
16
14
 
17
15
  gem 'validb'
18
16
 
19
- ## Usage
20
-
21
- ### All models, default logger
22
- rake validb:validate
17
+ And then:
23
18
 
24
- ### Specific models
25
- rake validb:validate models="Model,Model"
19
+ bundle
26
20
 
27
- ### Specific logger
28
- rake validb:validate logger="Validb::Logger::Console"
21
+ ## Usage
29
22
 
30
23
  ### Generate config file in config/validb.json
31
24
  rake validb:generate_config
@@ -43,5 +36,19 @@ Check your database for invalid models.
43
36
  "batch_size": 1000
44
37
  }
45
38
 
39
+ ### Launch sidekiq
40
+ sidekiq -L log/sidekiq.log
41
+
42
+ ### Validate all model records
43
+ rake validb:validate
44
+
45
+ ### Validate specific model records
46
+ rake validb:validate models="Blog,Comment"
47
+
48
+ ## Uses
49
+ [sidekiq](http://mperham.github.io/sidekiq)
50
+
51
+ [sidekiq_status](https://github.com/cryo28/sidekiq_status)
52
+
46
53
  ## License
47
54
  Released under the MIT License
@@ -2,23 +2,9 @@ namespace :validb do
2
2
  desc "Check DB for invalid records"
3
3
  task :validate => :environment do
4
4
  models = ENV["models"] || ""
5
- logger_class = ENV["logger"] || "Validb::Logger::FileSystem"
6
5
  filename = ENV["config"] || default_configuration_file
7
6
 
8
- # force all models to load so we can find them
9
- Rails.application.eager_load!
10
- ActiveRecord::Base.logger.level = 1
11
-
12
- params = Validb::Configuration.new(filename).params
13
- finder = Validb::Finder.new(params, models)
14
-
15
- logger = logger_class.constantize.new
16
- logger.prepare
17
-
18
- started_at = Time.now
19
- checker = Validb::Checker.new(params, logger)
20
- checker.check(finder.models)
21
- puts "\nFinished in #{Time.now-started_at} seconds"
7
+ Validb::Tasker.new(models, filename).run
22
8
  end
23
9
 
24
10
  desc "Generate config/validb.json"
@@ -13,9 +13,11 @@ module Validb
13
13
  autoload :Batcher, 'validb/batcher'
14
14
  autoload :RecordValidator, 'validb/record_validator'
15
15
  autoload :Parameters, 'validb/parameters'
16
+ autoload :FileSystemLoggerWorker, 'validb/file_system_logger_worker'
17
+ autoload :QueueMonitor, 'validb/queue_monitor'
18
+ autoload :Counter, 'validb/counter'
19
+ autoload :Tasker, 'validb/tasker'
16
20
  module Logger
17
- autoload :Base, 'validb/logger/base'
18
21
  autoload :FileSystem, 'validb/logger/file_system'
19
- autoload :Console, 'validb/logger/console'
20
22
  end
21
23
  end
@@ -1,14 +1,11 @@
1
1
  module Validb
2
2
  class Batcher
3
+ include SidekiqStatus::Worker
3
4
 
4
- def initialize(logger)
5
- @record_validator = RecordValidator.new(logger)
6
- end
7
-
8
- def validate(record_batch)
9
- $stdout.print "."
10
- record_batch.each do |record|
11
- @record_validator.validate(record)
5
+ def perform(model_name, model_ids)
6
+ model_name.constantize.find(model_ids).each do |record|
7
+ record_validator = Validb::RecordValidator.new
8
+ record_validator.validate(record)
12
9
  end
13
10
  end
14
11
  end
@@ -1,13 +1,10 @@
1
1
  module Validb
2
2
  class Checker
3
+ include SidekiqStatus::Worker
3
4
 
4
- def initialize(params, logger)
5
- @model_validator = Validb::ModelValidator.new(params, logger)
6
- end
7
-
8
- def check(models)
9
- models.each do |model|
10
- @model_validator.validate(model)
5
+ def perform(model_names, batch_size)
6
+ model_names.each do |model_name|
7
+ Validb::ModelValidator.perform_async(model_name, batch_size)
11
8
  end
12
9
  end
13
10
  end
@@ -0,0 +1,14 @@
1
+ module Validb
2
+ class Counter
3
+ def initialize(model_names)
4
+ @models = model_names.map(&:constantize)
5
+ end
6
+
7
+ def count
8
+ $stdout.puts("\nChecking models:")
9
+ @models.each do |model|
10
+ $stdout.puts("#{model}(#{model.table_name}) (#{model.count} records)")
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module Validb
2
+ class FileSystemLoggerWorker
3
+ include SidekiqStatus::Worker
4
+
5
+ def perform(message)
6
+ logger = Validb::Logger::FileSystem.new
7
+ logger.out(message)
8
+ end
9
+ end
10
+ end
@@ -7,7 +7,7 @@ module Validb
7
7
  end
8
8
 
9
9
  def models
10
- @model_filterer.filter(selected_models)
10
+ @model_filterer.filter(selected_models).map(&:name)
11
11
  end
12
12
 
13
13
  private
@@ -1,14 +1,15 @@
1
1
  module Validb
2
2
  module Logger
3
- class FileSystem < Base
3
+ class FileSystem
4
4
  def prepare
5
5
  File.delete(filename) if File.exists?(filename)
6
+ File.open(filename, "w") {}
6
7
  $stdout.puts("Writing output to #{filename}")
7
8
  end
8
9
 
9
- def out(record_hash)
10
+ def out(message)
10
11
  File.open(filename, "ab+") do |file|
11
- file.puts("#{record_hash[:model]}:#{record_hash[:id]} - #{record_hash[:error_messages]}")
12
+ file.puts(message)
12
13
  end
13
14
  end
14
15
 
@@ -1,15 +1,11 @@
1
1
  module Validb
2
2
  class ModelValidator
3
+ include SidekiqStatus::Worker
3
4
 
4
- def initialize(params, logger)
5
- @params = params
6
- @batcher = Validb::Batcher.new(logger)
7
- end
8
-
9
- def validate(model)
10
- $stdout.print "\nChecking #{model}(#{model.table_name}) (#{model.count} records)"
11
- model.find_in_batches(batch_size: @params.batch_size) do |record_batch|
12
- @batcher.validate(record_batch)
5
+ def perform(model_name, batch_size)
6
+ model_name.constantize.select(:id).find_in_batches(batch_size: batch_size) do |record_batch|
7
+ model_ids = record_batch.map(&:id)
8
+ Validb::Batcher.perform_async(model_name, model_ids)
13
9
  end
14
10
  end
15
11
  end
@@ -0,0 +1,30 @@
1
+ module Validb
2
+ class QueueMonitor
3
+
4
+ def monitor
5
+ saved_time = Time.now
6
+ $stdout.print "\nValidating database records"
7
+
8
+ wait_for_completion
9
+
10
+ $stdout.puts "\nComplete in #{Time.now - saved_time} seconds"
11
+ end
12
+
13
+ private
14
+
15
+ def wait_for_completion
16
+ while in_process_jobs?
17
+ sleep 1
18
+ $stdout.print "."
19
+ end
20
+ end
21
+
22
+ def in_process_jobs?
23
+ statuses.detect { |job| job.status != "complete" }
24
+ end
25
+
26
+ def statuses
27
+ SidekiqStatus::Container.statuses
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,5 @@
1
+ require 'sidekiq'
2
+ require 'sidekiq_status'
1
3
  require 'validb'
2
4
  require 'rails'
3
5
 
@@ -1,19 +1,10 @@
1
1
  module Validb
2
2
  class RecordValidator
3
3
 
4
- def initialize(logger)
5
- @logger = logger
6
- end
7
-
8
4
  def validate(record)
9
5
  if !record.valid?
10
- @logger.out(
11
- {
12
- model: record.class.name,
13
- id: record.id,
14
- error_messages: record.errors.full_messages.join(',')
15
- }
16
- )
6
+ message = "FAIL: #{record.class.name}:#{record.id} - #{record.errors.full_messages.join(',')}"
7
+ Validb::FileSystemLoggerWorker.perform_async(message)
17
8
  end
18
9
  end
19
10
  end
@@ -0,0 +1,46 @@
1
+ module Validb
2
+ class Tasker
3
+
4
+ def initialize(model_names, filename)
5
+ @model_names = model_names
6
+ @filename = filename
7
+ end
8
+
9
+ def run
10
+ load_models_and_prepare_logger
11
+ output_model_table_record_count
12
+ validate_database_records
13
+ end
14
+
15
+ private
16
+
17
+ def params
18
+ @params ||= Validb::Configuration.new(@filename).params
19
+ end
20
+
21
+ def finder
22
+ @finder ||= Validb::Finder.new(params, @model_names)
23
+ end
24
+
25
+ def load_models_and_prepare_logger
26
+ # force all models to load so we can find them
27
+ Rails.application.eager_load!
28
+ ActiveRecord::Base.logger.level = 1
29
+ Validb::Logger::FileSystem.new.prepare
30
+ end
31
+
32
+ def output_model_table_record_count
33
+ Validb::Counter.new(finder.models).count
34
+ end
35
+
36
+ def validate_database_records
37
+ Validb::Checker.perform_async(finder.models, params.batch_size)
38
+ monitor_job_progress
39
+ end
40
+
41
+ def monitor_job_progress
42
+ queue_monitor = Validb::QueueMonitor.new
43
+ queue_monitor.monitor
44
+ end
45
+ end
46
+ end
@@ -1,3 +1,3 @@
1
1
  module Validb
2
- VERSION = "1.2.1"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -1,10 +1,17 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../lib/validb')
2
2
 
3
3
  require "pry"
4
+ require "sidekiq"
5
+ require 'sidekiq/testing'
6
+ require 'sidekiq_status'
4
7
 
5
8
  RSpec.configure do |config|
6
9
  config.treat_symbols_as_metadata_keys_with_true_values = true
7
10
  config.run_all_when_everything_filtered = true
11
+
12
+ config.after(:all) do
13
+ SidekiqStatus::Container.delete
14
+ end
8
15
  end
9
16
 
10
17
  RSpec::Matchers::OperatorMatcher.register(ActiveRecord::Relation, '=~', RSpec::Matchers::BuiltIn::MatchArray)
@@ -1,22 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Validb::Batcher do
4
- describe "#initialize" do
5
- it "creates a batcher" do
6
- logger = double('logger')
7
- Validb::RecordValidator.should_receive(:new).with(logger)
8
- Validb::Batcher.new(logger)
9
- end
10
- end
11
-
12
- describe "#validate" do
13
- it "validates the batch of records" do
14
- record_batch = [Blog.new(title: "Title")]
15
- logger = double('logger')
16
- batcher = Validb::Batcher.new(logger)
4
+ describe "#perform" do
5
+ it "sends an invalid record logging event" do
6
+ record = Blog.new
7
+ record.save(validate: false)
8
+ batcher = Validb::Batcher.new
9
+ jid = Validb::Batcher.perform_async("Blog", [record.id])
17
10
 
18
- $stdout.should_receive(:print).with(".")
19
- batcher.validate(record_batch)
11
+ expect {
12
+ batcher.perform(jid)
13
+ }.to change(Validb::FileSystemLoggerWorker.jobs, :size).by(1)
20
14
  end
21
15
  end
22
16
  end
@@ -1,27 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Validb::Checker do
4
- describe "#initialize" do
5
- it "creates a checker" do
6
- logger = double('logger')
7
- params = double('params')
8
- Validb::ModelValidator.should_receive(:new).with(params, logger)
9
- Validb::Checker.new(params, logger)
10
- end
11
- end
12
-
13
- describe "#check" do
14
- it "validates the passed in models records" do
15
- logger = double('logger')
16
- params = double('params')
17
- model_validator = double('model_validator')
18
- Validb::ModelValidator.should_receive(:new).with(params, logger).and_return(model_validator)
19
- checker = Validb::Checker.new(params, logger)
20
-
21
- model_validator.should_receive(:validate).with(Blog)
22
- model_validator.should_receive(:validate).with(Post)
23
-
24
- checker.check([Blog, Post])
4
+ describe "#perform" do
5
+ it "generates validb model validator jobs" do
6
+ checker = Validb::Checker.new
7
+ jid = Validb::Batcher.perform_async(["Blog", "Post"], 100)
8
+
9
+ expect {
10
+ checker.perform(jid)
11
+ }.to change(Validb::ModelValidator.jobs, :size).by(2)
25
12
  end
26
13
  end
27
14
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Validb::Counter do
4
+ describe "#count" do
5
+ it "prints the model names, tables and record counts" do
6
+ counter = Validb::Counter.new(["Blog"])
7
+ $stdout.should_receive(:puts).with("\nChecking models:")
8
+ $stdout.should_receive(:puts).with("Blog(blogs) (1 records)")
9
+
10
+ counter.count
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Validb::FileSystemLoggerWorker do
4
+ describe "#perform" do
5
+ it "sends the message to the File System logger" do
6
+ Validb::Logger::FileSystem.any_instance.should_receive(:out).with("message")
7
+
8
+ logger = Validb::FileSystemLoggerWorker.new
9
+ jid = Validb::Batcher.perform_async("message")
10
+
11
+ logger.perform(jid)
12
+ end
13
+ end
14
+ end
@@ -17,7 +17,7 @@ describe Validb::Finder do
17
17
  it "returns all the models with tables" do
18
18
  params = Validb::Configuration.new("").params
19
19
  finder = Validb::Finder.new(params, "")
20
- finder.models.should == [Author, Blog, Comment, Post]
20
+ finder.models.should == ["Author", "Blog", "Comment", "Post"]
21
21
  end
22
22
  end
23
23
 
@@ -25,7 +25,7 @@ describe Validb::Finder do
25
25
  it "returns all the selected models with tables" do
26
26
  params = Validb::Configuration.new("").params
27
27
  finder = Validb::Finder.new(params, "Post, Blog")
28
- finder.models.should == [Blog, Post]
28
+ finder.models.should == ["Blog", "Post"]
29
29
  end
30
30
  end
31
31
 
@@ -33,7 +33,7 @@ describe Validb::Finder do
33
33
  it "returns all the valid models with tables" do
34
34
  params = Validb::Configuration.new("").params
35
35
  finder = Validb::Finder.new(params, "Post, Blog, Fake")
36
- finder.models.should == [Blog, Post]
36
+ finder.models.should == ["Blog", "Post"]
37
37
  end
38
38
  end
39
39
  end
@@ -30,12 +30,12 @@ describe Validb::Logger::FileSystem do
30
30
  describe "#out" do
31
31
  it "writes the hash output to a file and prints an X" do
32
32
  file = double('file')
33
+ message = "Blog:1 - Error message"
33
34
  File.should_receive(:open).with("validb.log", "ab+").and_yield(file)
34
- file.should_receive(:puts).with("Blog:1 - Error message")
35
+ file.should_receive(:puts).with(message)
35
36
 
36
- hash = { model: Blog, id: 1, error_messages: "Error message" }
37
37
  file_logger = Validb::Logger::FileSystem.new
38
- file_logger.out(hash)
38
+ file_logger.out(message)
39
39
  end
40
40
  end
41
41
  end
@@ -1,25 +1,30 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Validb::ModelValidator do
4
- describe "#initialize" do
5
- it "creates a model validator" do
6
- logger = double('logger')
7
- params = double('params')
8
- Validb::Batcher.should_receive(:new).with(logger)
9
- Validb::ModelValidator.new(params, logger)
4
+ describe "#perform" do
5
+ context "with available records" do
6
+ it "creates a batcher job" do
7
+ record = Blog.new(title: "title")
8
+ record.save
9
+ model_validator = Validb::ModelValidator.new
10
+ jid = Validb::ModelValidator.perform_async("Blog", 100)
11
+
12
+ expect {
13
+ model_validator.perform(jid)
14
+ }.to change(Validb::Batcher.jobs, :size).by(1)
15
+ end
10
16
  end
11
- end
12
17
 
13
- describe "#validate" do
14
- it "validates the records of the model" do
15
- model = Blog
16
- logger = double('logger')
17
- params = double('params', batch_size: 200)
18
- model_validator = Validb::ModelValidator.new(params, logger)
18
+ context "with no available records" do
19
+ it "does not create a batcher job" do
20
+ Blog.delete_all
21
+ model_validator = Validb::ModelValidator.new
22
+ jid = Validb::ModelValidator.perform_async("Blog", 100)
19
23
 
20
- $stdout.should_receive(:print).with("\nChecking Blog(blogs) (0 records)")
21
- model.should_receive(:find_in_batches).with(batch_size: 200)
22
- model_validator.validate(model)
24
+ expect {
25
+ model_validator.perform(jid)
26
+ }.not_to change(Validb::Batcher.jobs, :size)
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Validb::QueueMonitor do
4
+
5
+ describe "#monitor" do
6
+ it "prints progress information" do
7
+ $stdout.should_receive(:print).with("\nValidating database records")
8
+ $stdout.should_receive(:puts)
9
+
10
+ queue_monitor = Validb::QueueMonitor.new
11
+ queue_monitor.monitor
12
+ end
13
+ end
14
+ end
@@ -4,29 +4,24 @@ describe Validb::RecordValidator do
4
4
  describe "#validate" do
5
5
  context "with a valid record" do
6
6
  it "validates the passed in record" do
7
- logger = double(:logger)
8
- record_validator = Validb::RecordValidator.new(logger)
9
7
  record = Blog.new(title: "title")
8
+ record_validator = Validb::RecordValidator.new
10
9
 
11
- logger.should_not_receive(:out)
12
- record_validator.validate(record)
10
+ expect {
11
+ record_validator.validate(record)
12
+ }.not_to change(Validb::FileSystemLoggerWorker.jobs, :size)
13
13
  end
14
14
  end
15
15
 
16
16
  context "with an invalid record" do
17
17
  it "outputs the record information" do
18
- logger = double(:logger)
19
- record_validator = Validb::RecordValidator.new(logger)
18
+ record_validator = Validb::RecordValidator.new
20
19
  record = Blog.new
21
20
  record.save(validate: false)
22
21
 
23
- hash = {
24
- model: "Blog",
25
- id: record.id,
26
- error_messages: "Title can't be blank"
27
- }
28
- logger.should_receive(:out).with(hash)
29
- record_validator.validate(record)
22
+ expect {
23
+ record_validator.validate(record)
24
+ }.to change(Validb::FileSystemLoggerWorker.jobs, :size).by(1)
30
25
  end
31
26
  end
32
27
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Validb::Tasker do
4
+ describe "#run" do
5
+ it "runs the database validation" do
6
+ filename = File.expand_path(File.dirname(__FILE__) + '/../config/validb.json')
7
+ tasker = Validb::Tasker.new("", filename)
8
+
9
+ tasker.should_receive(:load_models_and_prepare_logger)
10
+ Validb::Counter.any_instance.should_receive(:count)
11
+ Validb::QueueMonitor.any_instance.should_receive(:monitor)
12
+
13
+ expect {
14
+ tasker.run
15
+ }.to change(Validb::Checker.jobs, :size).by(1)
16
+ end
17
+ end
18
+ end
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Validb do
4
4
  it "returns the version" do
5
- Validb::VERSION.should == "1.2.1"
5
+ Validb::VERSION.should == "2.0.0"
6
6
  end
7
7
  end
@@ -20,4 +20,6 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ['lib']
21
21
 
22
22
  s.add_dependency 'rails', '>=3'
23
+ s.add_dependency 'sidekiq'
24
+ s.add_dependency 'sidekiq_status'
23
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joey Geiger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-05 00:00:00.000000000 Z
11
+ date: 2013-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sidekiq
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: sidekiq_status
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: Check the contents of your database by validating the models.
28
56
  email: jgeiger@gmail.com
29
57
  executables: []
@@ -41,27 +69,32 @@ files:
41
69
  - lib/validb/batcher.rb
42
70
  - lib/validb/checker.rb
43
71
  - lib/validb/configuration.rb
72
+ - lib/validb/counter.rb
73
+ - lib/validb/file_system_logger_worker.rb
44
74
  - lib/validb/finder.rb
45
- - lib/validb/logger/base.rb
46
- - lib/validb/logger/console.rb
47
75
  - lib/validb/logger/file_system.rb
48
76
  - lib/validb/model_filterer.rb
49
77
  - lib/validb/model_validator.rb
50
78
  - lib/validb/parameters.rb
79
+ - lib/validb/queue_monitor.rb
51
80
  - lib/validb/railtie.rb
52
81
  - lib/validb/record_validator.rb
82
+ - lib/validb/tasker.rb
53
83
  - lib/validb/version.rb
54
84
  - spec/config/validb.json
55
85
  - spec/spec_helper.rb
56
86
  - spec/validb/batcher_spec.rb
57
87
  - spec/validb/checker_spec.rb
58
88
  - spec/validb/configuration_spec.rb
89
+ - spec/validb/counter_spec.rb
90
+ - spec/validb/file_system_logger_worker_spec.rb
59
91
  - spec/validb/finder_spec.rb
60
- - spec/validb/logger/console_spec.rb
61
92
  - spec/validb/logger/file_system_spec.rb
62
93
  - spec/validb/model_filterer_spec.rb
63
94
  - spec/validb/model_validator_spec.rb
95
+ - spec/validb/queue_monitor_spec.rb
64
96
  - spec/validb/record_validator_spec.rb
97
+ - spec/validb/tasker_spec.rb
65
98
  - spec/validb/version_spec.rb
66
99
  - validb.gemspec
67
100
  homepage: http://github.com/jgeiger/validb
@@ -1,11 +0,0 @@
1
- module Validb
2
- module Logger
3
- class Base
4
- def prepare
5
- end
6
-
7
- def out(record_hash)
8
- end
9
- end
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- module Validb
2
- module Logger
3
- class Console < Base
4
- def out(record_hash)
5
- $stdout.puts "\n#{record_hash[:model]}:#{record_hash[:id]} - #{record_hash[:error_messages]}"
6
- end
7
- end
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Validb::Logger::Console do
4
- describe "#out" do
5
- it "prints the hash output" do
6
- hash = { model: Blog, id: 1, error_messages: "Error message" }
7
-
8
- console_logger = Validb::Logger::Console.new
9
- $stdout.should_receive(:puts).with("\nBlog:1 - Error message")
10
- console_logger.out(hash)
11
- end
12
- end
13
- end