mongar 0.0.8 → 0.0.11
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.
- data/VERSION +1 -1
- data/lib/mongar.rb +31 -12
- data/lib/mongar/mongo/collection.rb +14 -16
- data/lib/mongar/replica.rb +11 -10
- data/mongar.gemspec +8 -9
- data/spec/fixtures/configure.rb +3 -0
- data/spec/fixtures/full_configure.rb +10 -2
- data/spec/integration_spec.rb +4 -0
- data/spec/mongar_spec.rb +73 -4
- metadata +66 -74
- data/lib/mongar/logger.rb +0 -15
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
data/lib/mongar.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'linguistics'
|
2
|
+
require 'logger'
|
2
3
|
|
3
4
|
class Mongar
|
5
|
+
class UnknownLogLevel < StandardError; end
|
6
|
+
|
4
7
|
autoload :Replica, 'mongar/replica'
|
5
8
|
autoload :Column, 'mongar/column'
|
6
9
|
autoload :Mongo, 'mongar/mongo'
|
7
|
-
autoload :Logger, 'mongar/logger'
|
8
|
-
|
9
|
-
include Mongar::Logger
|
10
10
|
|
11
11
|
Linguistics.use :en
|
12
12
|
|
13
|
-
attr_accessor :replicas, :status_collection, :log_level
|
13
|
+
attr_accessor :replicas, :status_collection, :log_level, :logger
|
14
14
|
|
15
15
|
class << self
|
16
16
|
def configure &block
|
@@ -21,14 +21,11 @@ class Mongar
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def initialize
|
24
|
+
self.log_level = :debug
|
25
|
+
self.logger = Logger.new(STDOUT)
|
24
26
|
self.replicas = []
|
25
27
|
end
|
26
28
|
|
27
|
-
def log_level(level = nil)
|
28
|
-
return @log_level if level.nil?
|
29
|
-
@log_level = level
|
30
|
-
end
|
31
|
-
|
32
29
|
def run
|
33
30
|
replicas.each do |replica|
|
34
31
|
replica.run
|
@@ -51,12 +48,12 @@ class Mongar
|
|
51
48
|
database = nil
|
52
49
|
collection = if destination.is_a?(Hash)
|
53
50
|
database = destination.keys.first
|
54
|
-
Mongar::Mongo::Collection.new(:name => destination.values.first, :
|
51
|
+
Mongar::Mongo::Collection.new(:name => destination.values.first, :logger => logger)
|
55
52
|
else
|
56
|
-
Mongar::Mongo::Collection.new(:name => destination, :
|
53
|
+
Mongar::Mongo::Collection.new(:name => destination, :logger => logger)
|
57
54
|
end
|
58
55
|
|
59
|
-
replica = Replica.new(:source => source, :destination => collection, :mongodb_name => database, :
|
56
|
+
replica = Replica.new(:source => source, :destination => collection, :mongodb_name => database, :logger => logger)
|
60
57
|
replica.instance_eval(&block)
|
61
58
|
self.replicas << replica
|
62
59
|
end
|
@@ -72,4 +69,26 @@ class Mongar
|
|
72
69
|
def set_status_collection(val)
|
73
70
|
self.status_collection = val
|
74
71
|
end
|
72
|
+
|
73
|
+
def log_level(level = nil)
|
74
|
+
return @log_level if level.nil?
|
75
|
+
unless [:fatal, :error, :warn, :info, :debug].include?(level)
|
76
|
+
raise UnknownLogLevel, "Log level #{level} is unknown. Valid levels are :fatal, :error, :warn, :info, :debug"
|
77
|
+
end
|
78
|
+
@log_level = level
|
79
|
+
set_log_level
|
80
|
+
end
|
81
|
+
|
82
|
+
def log(destination)
|
83
|
+
if destination == :stdout
|
84
|
+
@logger = Logger.new(STDOUT)
|
85
|
+
else
|
86
|
+
@logger = Logger.new(destination, 'daily')
|
87
|
+
end
|
88
|
+
set_log_level
|
89
|
+
end
|
90
|
+
|
91
|
+
def set_log_level
|
92
|
+
@logger.level = Logger.const_get(@log_level.to_s.upcase)
|
93
|
+
end
|
75
94
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
class Mongar::Mongo
|
2
2
|
class Collection
|
3
|
-
|
4
|
-
|
5
|
-
attr_reader :name, :log_level
|
3
|
+
attr_reader :name, :logger
|
6
4
|
attr_accessor :replica
|
7
5
|
|
8
6
|
def initialize(args = {})
|
9
7
|
@name = args[:name]
|
10
8
|
@replica = args[:replica]
|
11
|
-
@
|
9
|
+
@logger = args[:logger] || Logger.new(nil)
|
12
10
|
@last_logged_activity = nil
|
13
11
|
end
|
14
12
|
|
@@ -39,14 +37,14 @@ class Mongar::Mongo
|
|
39
37
|
end
|
40
38
|
|
41
39
|
def last_replicated_at=(date)
|
42
|
-
info " * Updating #{name}.last_replicated_at to #{date}"
|
40
|
+
logger.info " * Updating #{name}.last_replicated_at to #{date}"
|
43
41
|
status_collection.update({ :collection_name => name },
|
44
42
|
{ '$set' => { :collection_name => name, :last_replicated_at => date } },
|
45
43
|
{ :upsert => true })
|
46
44
|
end
|
47
45
|
|
48
46
|
def last_activity_at=(date)
|
49
|
-
debug "Saving #{name} last_activity_at to #{date}"
|
47
|
+
logger.debug "Saving #{name} last_activity_at to #{date}"
|
50
48
|
status_collection.update({ :collection_name => name },
|
51
49
|
{ '$set' => { :collection_name => name, :last_activity_at => date } },
|
52
50
|
{ :upsert => true })
|
@@ -54,7 +52,7 @@ class Mongar::Mongo
|
|
54
52
|
|
55
53
|
def log_activity
|
56
54
|
return unless should_log_activity?
|
57
|
-
debug "Logging activity for #{name}"
|
55
|
+
logger.debug "Logging activity for #{name}"
|
58
56
|
|
59
57
|
# should be able to set last_activity_at = new Date() but I can't figure out how to get
|
60
58
|
# ruby's mongo library to evaluate it instead of setting it to the string "new Date()"
|
@@ -75,35 +73,35 @@ class Mongar::Mongo
|
|
75
73
|
end
|
76
74
|
|
77
75
|
def find(key)
|
78
|
-
debug "#{name}.find #{key.inspect}"
|
76
|
+
logger.debug "#{name}.find #{key.inspect}"
|
79
77
|
collection.find_one(key)
|
80
78
|
end
|
81
79
|
|
82
80
|
def create(document)
|
83
81
|
log_activity
|
84
82
|
|
85
|
-
debug "#{name}.create #{document.inspect}"
|
86
|
-
!collection.insert(document).nil?
|
83
|
+
logger.debug "#{name}.create #{document.inspect}"
|
84
|
+
!collection.insert(document, { :safe => true }).nil?
|
87
85
|
end
|
88
86
|
|
89
87
|
def delete(key)
|
90
88
|
log_activity
|
91
89
|
|
92
|
-
debug "#{name}.delete #{key.inspect}"
|
90
|
+
logger.debug "#{name}.delete #{key.inspect}"
|
93
91
|
collection.remove(key, { :safe => true })
|
94
92
|
end
|
95
93
|
|
96
94
|
def update(key, document)
|
97
95
|
log_activity
|
98
96
|
|
99
|
-
debug "#{name}.update #{key.inspect} with #{document.inspect}"
|
100
|
-
collection.update(key, document, { :safe => true })
|
97
|
+
logger.debug "#{name}.update #{key.inspect} with #{document.inspect}"
|
98
|
+
collection.update(key, document, { :upsert => true, :safe => true })
|
101
99
|
end
|
102
100
|
|
103
101
|
def create_or_update(key, document)
|
104
102
|
log_activity
|
105
103
|
|
106
|
-
debug "#{name}.create_or_update #{key.inspect} with #{document.inspect}"
|
104
|
+
logger.debug "#{name}.create_or_update #{key.inspect} with #{document.inspect}"
|
107
105
|
|
108
106
|
collection.update(key, document, {:upsert => true, :safe => true})
|
109
107
|
end
|
@@ -111,7 +109,7 @@ class Mongar::Mongo
|
|
111
109
|
def mark_all_items_pending_deletion
|
112
110
|
log_activity
|
113
111
|
|
114
|
-
info " * Marking all items in #{name} for pending deletion"
|
112
|
+
logger.info " * Marking all items in #{name} for pending deletion"
|
115
113
|
|
116
114
|
collection.update({ '_id' => { '$exists' => true } }, { "$set" => { :pending_deletion => true } }, { :multi => true, :safe => true })
|
117
115
|
end
|
@@ -119,7 +117,7 @@ class Mongar::Mongo
|
|
119
117
|
def delete_all_items_pending_deletion
|
120
118
|
log_activity
|
121
119
|
|
122
|
-
info " * Deleting all items in #{name} that are pending deletion"
|
120
|
+
logger.info " * Deleting all items in #{name} that are pending deletion"
|
123
121
|
|
124
122
|
collection.remove({ :pending_deletion => true }, { :safe => true })
|
125
123
|
end
|
data/lib/mongar/replica.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
class Mongar
|
2
2
|
class Replica
|
3
|
-
|
4
|
-
|
5
|
-
attr_accessor :source, :destination, :log_level
|
3
|
+
attr_accessor :source, :destination, :logger
|
6
4
|
attr_accessor :mongodb_name
|
7
5
|
attr_accessor :created_finder, :deleted_finder, :updated_finder, :db_time_selector
|
8
6
|
attr_accessor :columns
|
9
7
|
|
10
8
|
def initialize(args = {})
|
11
|
-
self.
|
9
|
+
self.logger = args[:logger] || Logger.new(nil)
|
12
10
|
self.source = args[:source]
|
13
11
|
self.destination = args[:destination]
|
14
12
|
self.mongodb_name = args[:mongodb_name] || :default
|
@@ -28,20 +26,21 @@ class Mongar
|
|
28
26
|
end
|
29
27
|
|
30
28
|
def run
|
31
|
-
info "Replicating #{source.to_s} to #{mongodb.name}.#{destination.name}"
|
29
|
+
logger.info "Replicating #{source.to_s} to #{mongodb.name}.#{destination.name}"
|
32
30
|
|
33
31
|
if locked?
|
34
|
-
info " * Skipping locked replica"
|
32
|
+
logger.info " * Skipping locked replica"
|
35
33
|
return
|
36
34
|
end
|
37
35
|
|
38
36
|
time = current_time_on_database_server
|
37
|
+
logger.debug " * Time on server #{time}"
|
39
38
|
|
40
39
|
# Set the time back 1 second to make sure we don't miss any changes made mid-second
|
41
40
|
time -= 1 unless time.nil?
|
42
41
|
|
43
42
|
if do_full_refresh?
|
44
|
-
info " * Full refresh"
|
43
|
+
logger.info " * Full refresh"
|
45
44
|
|
46
45
|
destination.mark_all_items_pending_deletion!
|
47
46
|
|
@@ -51,16 +50,17 @@ class Mongar
|
|
51
50
|
else
|
52
51
|
last_replicated_at = destination.last_replicated_at
|
53
52
|
|
54
|
-
info " * Incremental updates since #{last_replicated_at}"
|
53
|
+
logger.info " * Incremental updates since #{last_replicated_at}"
|
55
54
|
|
56
55
|
run_sync_for([:deleted, :created_or_updated, :updated], last_replicated_at)
|
57
56
|
end
|
57
|
+
logger.debug " * Setting last_replicated_at to #{time}"
|
58
58
|
destination.last_replicated_at = time
|
59
59
|
destination.last_activity_at = nil
|
60
60
|
end
|
61
61
|
|
62
62
|
def run_sync_for(types, last_replicated_at)
|
63
|
-
info " * Syncing #{types.join(', ')} items"
|
63
|
+
logger.info " * Syncing #{types.join(', ')} items"
|
64
64
|
|
65
65
|
# find deleted
|
66
66
|
find(:deleted, last_replicated_at).each do |deleted_item|
|
@@ -150,6 +150,7 @@ class Mongar
|
|
150
150
|
end
|
151
151
|
|
152
152
|
def find(type, last_replicated_time)
|
153
|
+
logger.debug " * Find #{type} from last replicated time #{last_replicated_time}"
|
153
154
|
finder_function = self.send("#{type}_finder".to_sym)
|
154
155
|
return [] if finder_function.nil?
|
155
156
|
# execute the finder proc on the source object with an argument of the last replicated date/time
|
@@ -177,7 +178,7 @@ class Mongar
|
|
177
178
|
adapter = $1 if adapter =~ /::([^:]+)$/
|
178
179
|
|
179
180
|
time = if adapter == 'MysqlAdapter'
|
180
|
-
Time.parse(object.connection.execute("SELECT UTC_TIMESTAMP()").fetch_row.first)
|
181
|
+
Time.parse(object.connection.execute("SELECT UTC_TIMESTAMP()").fetch_row.first + " UTC")
|
181
182
|
elsif adapter == 'Mysql2Adapter'
|
182
183
|
object.connection.execute("SELECT UTC_TIMESTAMP()").first.first
|
183
184
|
elsif adapter == 'SQLServerAdapter'
|
data/mongar.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.0.
|
7
|
+
s.name = "mongar"
|
8
|
+
s.version = "0.0.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Philippe Green"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-04-19"
|
13
|
+
s.description = "Replicates data from ActiveRecord (or other Ruby data mapping class) to MongoDB"
|
14
|
+
s.email = "phil@greenviewdata.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.rdoc"
|
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
|
|
27
27
|
"VERSION",
|
28
28
|
"lib/mongar.rb",
|
29
29
|
"lib/mongar/column.rb",
|
30
|
-
"lib/mongar/logger.rb",
|
31
30
|
"lib/mongar/mongo.rb",
|
32
31
|
"lib/mongar/mongo/collection.rb",
|
33
32
|
"lib/mongar/replica.rb",
|
@@ -43,11 +42,11 @@ Gem::Specification.new do |s|
|
|
43
42
|
"spec/mongar_spec.rb",
|
44
43
|
"spec/spec_helper.rb"
|
45
44
|
]
|
46
|
-
s.homepage =
|
45
|
+
s.homepage = "http://github.com/gdi/mongar"
|
47
46
|
s.licenses = ["MIT"]
|
48
47
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version =
|
50
|
-
s.summary =
|
48
|
+
s.rubygems_version = "1.8.10"
|
49
|
+
s.summary = "Replicates data from ActiveRecord (or other Ruby data mapping class) to MongoDB"
|
51
50
|
|
52
51
|
if s.respond_to? :specification_version then
|
53
52
|
s.specification_version = 3
|
data/spec/fixtures/configure.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
Mongar.configure do
|
2
|
+
# You should put log_level and log statements at the top of the configure block
|
3
|
+
|
2
4
|
# Currently we only log to STDOUT, we have plans to use a
|
3
5
|
# plans to use a configurable logger.
|
4
|
-
# Valid log levels are :
|
5
|
-
|
6
|
+
# Valid log levels are :fatal, :error, :warn, :info, :debug
|
7
|
+
# Default is :debug
|
8
|
+
log_level :fatal
|
9
|
+
|
10
|
+
# Set the log destination to standard out
|
11
|
+
# You can also specify a file name, it will rotate daily
|
12
|
+
# log '/tmp/mongar.log'
|
13
|
+
log :stdout
|
6
14
|
|
7
15
|
mongo :default do
|
8
16
|
database 'mydb'
|
data/spec/integration_spec.rb
CHANGED
@@ -16,6 +16,10 @@ describe "Mongar" do
|
|
16
16
|
@collection = Mongar::Mongo.databases[:default].db['domains']
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should have set the log level properly" do
|
20
|
+
@mongar.logger.level.should == Logger::FATAL
|
21
|
+
end
|
22
|
+
|
19
23
|
it "should add, delete, and update items properly" do
|
20
24
|
# inserts
|
21
25
|
domain = Domain.create(:name => "test.com", :client_id => 1)
|
data/spec/mongar_spec.rb
CHANGED
@@ -1,9 +1,76 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Mongar" do
|
4
|
-
describe "
|
4
|
+
describe "#log" do
|
5
5
|
before do
|
6
|
-
|
6
|
+
@mongar = Mongar.new
|
7
|
+
end
|
8
|
+
it "should setup a logger for the file name specified" do
|
9
|
+
@mongar.log "/tmp/mongar_test.log"
|
10
|
+
@mongar.logger.instance_variable_get(:@logdev).instance_variable_get(:@filename).should == "/tmp/mongar_test.log"
|
11
|
+
end
|
12
|
+
it "should setup a logger for standard out" do
|
13
|
+
@mongar.log :stdout
|
14
|
+
@mongar.logger.instance_variable_get(:@logdev).instance_variable_get(:@dev).should be_a_kind_of(IO)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#log_level" do
|
19
|
+
before do
|
20
|
+
@mongar = Mongar.new
|
21
|
+
end
|
22
|
+
it "should set the log level on a logger created after the log_level statement" do
|
23
|
+
@mongar.log_level :fatal
|
24
|
+
@mongar.log :stdout
|
25
|
+
@mongar.logger.level.should == Logger::FATAL
|
26
|
+
end
|
27
|
+
it "should set the log level on a logger created before the log_level statement" do
|
28
|
+
@mongar.log :stdout
|
29
|
+
@mongar.log_level :fatal
|
30
|
+
@mongar.logger.level.should == Logger::FATAL
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#set_log_level" do
|
35
|
+
before do
|
36
|
+
@mongar = Mongar.new
|
37
|
+
@mongar.log :stdout
|
38
|
+
@mongar.instance_variable_set(:@log_level, :info)
|
39
|
+
@mongar.set_log_level
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should set the log level on each logger" do
|
43
|
+
@mongar.logger.level.should == Logger::INFO
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should convert :info to Logger::INFO" do
|
47
|
+
@mongar.instance_variable_set(:@log_level, :info)
|
48
|
+
@mongar.set_log_level
|
49
|
+
@mongar.logger.level.should == Logger::INFO
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should convert :fatal to Logger::FATAL" do
|
53
|
+
@mongar.instance_variable_set(:@log_level, :fatal)
|
54
|
+
@mongar.set_log_level
|
55
|
+
@mongar.logger.level.should == Logger::FATAL
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should convert :error to Logger::ERROR" do
|
59
|
+
@mongar.instance_variable_set(:@log_level, :error)
|
60
|
+
@mongar.set_log_level
|
61
|
+
@mongar.logger.level.should == Logger::ERROR
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should convert :warn to Logger::WARN" do
|
65
|
+
@mongar.instance_variable_set(:@log_level, :warn)
|
66
|
+
@mongar.set_log_level
|
67
|
+
@mongar.logger.level.should == Logger::WARN
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should convert :debug to Logger::DEBUG" do
|
71
|
+
@mongar.instance_variable_set(:@log_level, :debug)
|
72
|
+
@mongar.set_log_level
|
73
|
+
@mongar.logger.level.should == Logger::DEBUG
|
7
74
|
end
|
8
75
|
end
|
9
76
|
|
@@ -12,6 +79,8 @@ describe "Mongar" do
|
|
12
79
|
class Client
|
13
80
|
end
|
14
81
|
|
82
|
+
@logger = mock(Logger)
|
83
|
+
Logger.stub!(:new).and_return(@logger)
|
15
84
|
@mongar = Mongar.new
|
16
85
|
|
17
86
|
@block = lambda {}
|
@@ -35,7 +104,7 @@ describe "Mongar" do
|
|
35
104
|
end
|
36
105
|
|
37
106
|
it "should initialize a new replica with the source and destination objects" do
|
38
|
-
Mongar::Replica.should_receive(:new).with(:source => Client, :destination => @collection, :mongodb_name => nil, :
|
107
|
+
Mongar::Replica.should_receive(:new).with(:source => Client, :destination => @collection, :mongodb_name => nil, :logger => @logger)
|
39
108
|
@mongar.replicate({ Client => 'clients' }, &@block)
|
40
109
|
end
|
41
110
|
end
|
@@ -52,7 +121,7 @@ describe "Mongar" do
|
|
52
121
|
|
53
122
|
context "given a hash" do
|
54
123
|
it "should initialize a new replica" do
|
55
|
-
Mongar::Replica.should_receive(:new).with(:source => Client, :destination => @collection, :mongodb_name => :someotherdb, :
|
124
|
+
Mongar::Replica.should_receive(:new).with(:source => Client, :destination => @collection, :mongodb_name => :someotherdb, :logger => @logger)
|
56
125
|
@mongar.replicate(Client => { :someotherdb => 'clients'})
|
57
126
|
end
|
58
127
|
end
|
metadata
CHANGED
@@ -1,105 +1,102 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongar
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.11
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.8
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Philippe Green
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: linguistics
|
18
|
-
requirement: &
|
16
|
+
requirement: &70284555282580 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
|
-
version_requirements: *
|
27
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *70284555282580
|
25
|
+
- !ruby/object:Gem::Dependency
|
28
26
|
name: mongo
|
29
|
-
requirement: &
|
27
|
+
requirement: &70284555281820 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
35
33
|
type: :runtime
|
36
34
|
prerelease: false
|
37
|
-
version_requirements: *
|
38
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *70284555281820
|
36
|
+
- !ruby/object:Gem::Dependency
|
39
37
|
name: rspec
|
40
|
-
requirement: &
|
38
|
+
requirement: &70284555280780 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
45
43
|
version: 2.3.0
|
46
44
|
type: :development
|
47
45
|
prerelease: false
|
48
|
-
version_requirements: *
|
49
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *70284555280780
|
47
|
+
- !ruby/object:Gem::Dependency
|
50
48
|
name: yard
|
51
|
-
requirement: &
|
49
|
+
requirement: &70284555279440 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
51
|
+
requirements:
|
54
52
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
53
|
+
- !ruby/object:Gem::Version
|
56
54
|
version: 0.6.0
|
57
55
|
type: :development
|
58
56
|
prerelease: false
|
59
|
-
version_requirements: *
|
60
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *70284555279440
|
58
|
+
- !ruby/object:Gem::Dependency
|
61
59
|
name: bundler
|
62
|
-
requirement: &
|
60
|
+
requirement: &70284555278960 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
62
|
+
requirements:
|
65
63
|
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
64
|
+
- !ruby/object:Gem::Version
|
67
65
|
version: 1.0.0
|
68
66
|
type: :development
|
69
67
|
prerelease: false
|
70
|
-
version_requirements: *
|
71
|
-
- !ruby/object:Gem::Dependency
|
68
|
+
version_requirements: *70284555278960
|
69
|
+
- !ruby/object:Gem::Dependency
|
72
70
|
name: jeweler
|
73
|
-
requirement: &
|
71
|
+
requirement: &70284555303760 !ruby/object:Gem::Requirement
|
74
72
|
none: false
|
75
|
-
requirements:
|
73
|
+
requirements:
|
76
74
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
75
|
+
- !ruby/object:Gem::Version
|
78
76
|
version: 1.6.4
|
79
77
|
type: :development
|
80
78
|
prerelease: false
|
81
|
-
version_requirements: *
|
82
|
-
- !ruby/object:Gem::Dependency
|
79
|
+
version_requirements: *70284555303760
|
80
|
+
- !ruby/object:Gem::Dependency
|
83
81
|
name: rcov
|
84
|
-
requirement: &
|
82
|
+
requirement: &70284555303040 !ruby/object:Gem::Requirement
|
85
83
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version:
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
90
88
|
type: :development
|
91
89
|
prerelease: false
|
92
|
-
version_requirements: *
|
93
|
-
description: Replicates data from ActiveRecord (or other Ruby data mapping class)
|
90
|
+
version_requirements: *70284555303040
|
91
|
+
description: Replicates data from ActiveRecord (or other Ruby data mapping class)
|
92
|
+
to MongoDB
|
94
93
|
email: phil@greenviewdata.com
|
95
94
|
executables: []
|
96
|
-
|
97
95
|
extensions: []
|
98
|
-
|
99
|
-
extra_rdoc_files:
|
96
|
+
extra_rdoc_files:
|
100
97
|
- LICENSE.txt
|
101
98
|
- README.rdoc
|
102
|
-
files:
|
99
|
+
files:
|
103
100
|
- .document
|
104
101
|
- .rspec
|
105
102
|
- Gemfile
|
@@ -110,7 +107,6 @@ files:
|
|
110
107
|
- VERSION
|
111
108
|
- lib/mongar.rb
|
112
109
|
- lib/mongar/column.rb
|
113
|
-
- lib/mongar/logger.rb
|
114
110
|
- lib/mongar/mongo.rb
|
115
111
|
- lib/mongar/mongo/collection.rb
|
116
112
|
- lib/mongar/replica.rb
|
@@ -125,36 +121,32 @@ files:
|
|
125
121
|
- spec/mongar/replica_spec.rb
|
126
122
|
- spec/mongar_spec.rb
|
127
123
|
- spec/spec_helper.rb
|
128
|
-
has_rdoc: true
|
129
124
|
homepage: http://github.com/gdi/mongar
|
130
|
-
licenses:
|
125
|
+
licenses:
|
131
126
|
- MIT
|
132
127
|
post_install_message:
|
133
128
|
rdoc_options: []
|
134
|
-
|
135
|
-
require_paths:
|
129
|
+
require_paths:
|
136
130
|
- lib
|
137
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
132
|
none: false
|
139
|
-
requirements:
|
140
|
-
- -
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
|
143
|
-
segments:
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
segments:
|
144
138
|
- 0
|
145
|
-
|
146
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
hash: -260101698656845288
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
141
|
none: false
|
148
|
-
requirements:
|
149
|
-
- -
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version:
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
152
146
|
requirements: []
|
153
|
-
|
154
147
|
rubyforge_project:
|
155
|
-
rubygems_version: 1.
|
148
|
+
rubygems_version: 1.8.10
|
156
149
|
signing_key:
|
157
150
|
specification_version: 3
|
158
151
|
summary: Replicates data from ActiveRecord (or other Ruby data mapping class) to MongoDB
|
159
152
|
test_files: []
|
160
|
-
|
data/lib/mongar/logger.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
class Mongar
|
2
|
-
module Logger
|
3
|
-
def info(log_message)
|
4
|
-
return unless @log_level && [:info, :debug].include?(@log_level)
|
5
|
-
|
6
|
-
puts "Info: #{log_message}"
|
7
|
-
end
|
8
|
-
|
9
|
-
def debug(log_message)
|
10
|
-
return unless @log_level && @log_level == :debug
|
11
|
-
|
12
|
-
puts "Debug: #{log_message}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|