syslog_client 0.1.8 → 0.1.9
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/lib/syslog_client/base.rb +2 -2
- data/lib/syslog_client/version.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- data/spec/syslog_client/base_spec.rb +12 -0
- data/spec/syslog_client/deal_flow_spec.rb +12 -0
- data/spec/syslog_client/editor_spec.rb +33 -0
- data/spec/syslog_client/exception_spec.rb +12 -0
- data/spec/syslog_client/match_shop_spec.rb +12 -0
- metadata +55 -64
data/lib/syslog_client/base.rb
CHANGED
@@ -59,8 +59,8 @@ module SyslogClient
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def mongodb=(connection)
|
62
|
-
unless connection.is_a?(Mongo::Connection)
|
63
|
-
raise ArgumentError, 'The mongodb should be an instance of Mongo::Connection!'
|
62
|
+
unless connection.is_a?(Mongo::Connection) || connection.is_a?(Mongo::MongoClient)
|
63
|
+
raise ArgumentError, 'The mongodb should be an instance of Mongo::Connection or Mongo::MongoClient!'
|
64
64
|
end
|
65
65
|
@@mongodb = connection
|
66
66
|
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe SyslogClient::Base do
|
4
|
+
|
5
|
+
it 'current store_name is mongodb' do
|
6
|
+
SyslogClient::Base.store_name.should == :mongodb
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'current db_name is crawlerdata_web' do
|
10
|
+
SyslogClient::Base.db_name.should == 'crawlerdata_web'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe SyslogClient::DealFlow do
|
4
|
+
|
5
|
+
it 'send_log' do
|
6
|
+
now = Time.now
|
7
|
+
lambda { SyslogClient::DealFlow.send_log(:aaa => 1) }.should raise_error(ArgumentError)
|
8
|
+
|
9
|
+
SyslogClient::DealFlow.send_log(:deal_id => 1, :operation => 'crawl_deal_page', :operation_time => now, :result => 200, :message => 'this is a test!').first.slice(:deal_id, :operation, :operation_time, :operator, :result, :message).should ==
|
10
|
+
{ :deal_id => 1, :operation => 'crawl_deal_page', :operation_time => now.to_s(:db), :result => '200', :message => 'this is a test!', :operator => 'java_crawler' }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe SyslogClient::Editor do
|
4
|
+
|
5
|
+
it 'send_log' do
|
6
|
+
now = Time.now
|
7
|
+
lambda { SyslogClient::Editor.send_log(:aaa => 1) }.should raise_error(ArgumentError)
|
8
|
+
|
9
|
+
result = SyslogClient::Editor.send_log(:user_id => 1, :reason => 'tumayun', :entry_class => 'Deal', :entry_id => 1, :operation_time => now, :changes => { 'title' => ['a', 'b'], 'publish_status' => [1, 4] })
|
10
|
+
result = result.collect { |r| r.except(:_id) }
|
11
|
+
result.should be_include({
|
12
|
+
:user_id => 1,
|
13
|
+
:reason => 'tumayun',
|
14
|
+
:entry_class => 'Deal',
|
15
|
+
:entry_id => 1,
|
16
|
+
:operation_time => now.to_s(:db),
|
17
|
+
:operation => 'title',
|
18
|
+
:value => 'b',
|
19
|
+
:value_was => 'a'
|
20
|
+
})
|
21
|
+
|
22
|
+
result.should be_include({
|
23
|
+
:user_id => 1,
|
24
|
+
:reason => 'tumayun',
|
25
|
+
:entry_class => 'Deal',
|
26
|
+
:entry_id => 1,
|
27
|
+
:operation_time => now.to_s(:db),
|
28
|
+
:operation => 'publish_status',
|
29
|
+
:value => '4',
|
30
|
+
:value_was => '1'
|
31
|
+
})
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe SyslogClient::Exception do
|
4
|
+
|
5
|
+
it 'send_log' do
|
6
|
+
now = Time.now
|
7
|
+
lambda { SyslogClient::Exception.send_log(:aaa => 1) }.should raise_error(ArgumentError)
|
8
|
+
|
9
|
+
SyslogClient::Exception.send_log(:operator => 'tumayun', :exception_class => 'NoMethodError', :message => 'no method ...', :operation_time => now).first.except(:_id).should ==
|
10
|
+
{ :operator => 'tumayun', :exception_class => 'NoMethodError', :message => 'no method ...', :operation_time => now.to_s(:db) }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe SyslogClient::MatchShop do
|
4
|
+
|
5
|
+
it 'send_log' do
|
6
|
+
now = Time.now
|
7
|
+
lambda { SyslogClient::MatchShop.send_log(:aaa => 1) }.should raise_error(ArgumentError)
|
8
|
+
|
9
|
+
SyslogClient::MatchShop.send_log(:reason => 'tumayun', :source => 1, :deal_id => 1, :tuan_shop_id => 1, :shop_info_id => 1, :operation_time => now).first.except(:_id).should ==
|
10
|
+
{ :reason => 'tumayun', :source => '1', :deal_id => 1, :tuan_shop_id => '1', :shop_info_id => '1', :operation_time => now.to_s(:db) }
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,64 +1,54 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: syslog_client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 8
|
10
|
-
version: 0.1.8
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.9
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- tumayun
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-12-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: logglier
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 2
|
33
|
-
- 8
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 0.2.8
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: mongo
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
25
|
none: false
|
42
|
-
requirements:
|
26
|
+
requirements:
|
43
27
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.2.8
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: mongo
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
50
37
|
version: 1.7.1
|
51
38
|
type: :runtime
|
52
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.7.1
|
53
46
|
description: syslog client with tuan800
|
54
47
|
email: tumayun.2010@gmail.com
|
55
48
|
executables: []
|
56
|
-
|
57
49
|
extensions: []
|
58
|
-
|
59
50
|
extra_rdoc_files: []
|
60
|
-
|
61
|
-
files:
|
51
|
+
files:
|
62
52
|
- .gitignore
|
63
53
|
- README.md
|
64
54
|
- lib/syslog_client.rb
|
@@ -68,40 +58,41 @@ files:
|
|
68
58
|
- lib/syslog_client/exception.rb
|
69
59
|
- lib/syslog_client/match_shop.rb
|
70
60
|
- lib/syslog_client/version.rb
|
61
|
+
- spec/spec_helper.rb
|
62
|
+
- spec/syslog_client/base_spec.rb
|
63
|
+
- spec/syslog_client/deal_flow_spec.rb
|
64
|
+
- spec/syslog_client/editor_spec.rb
|
65
|
+
- spec/syslog_client/exception_spec.rb
|
66
|
+
- spec/syslog_client/match_shop_spec.rb
|
71
67
|
- syslog_client.gemspec
|
72
|
-
has_rdoc: true
|
73
68
|
homepage: https://github.com/tumayun/syslog_client
|
74
69
|
licenses: []
|
75
|
-
|
76
70
|
post_install_message:
|
77
71
|
rdoc_options: []
|
78
|
-
|
79
|
-
require_paths:
|
72
|
+
require_paths:
|
80
73
|
- lib
|
81
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
75
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
|
88
|
-
- 0
|
89
|
-
version: "0"
|
90
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
81
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
97
|
-
- 0
|
98
|
-
version: "0"
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
99
86
|
requirements: []
|
100
|
-
|
101
87
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.8.24
|
103
89
|
signing_key:
|
104
90
|
specification_version: 3
|
105
91
|
summary: syslog client!
|
106
|
-
test_files:
|
107
|
-
|
92
|
+
test_files:
|
93
|
+
- spec/spec_helper.rb
|
94
|
+
- spec/syslog_client/base_spec.rb
|
95
|
+
- spec/syslog_client/deal_flow_spec.rb
|
96
|
+
- spec/syslog_client/editor_spec.rb
|
97
|
+
- spec/syslog_client/exception_spec.rb
|
98
|
+
- spec/syslog_client/match_shop_spec.rb
|