hallmonitor 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hallmonitor.gemspec +3 -2
- data/lib/hallmonitor/outputter.rb +12 -0
- data/lib/hallmonitor/version.rb +1 -1
- data/spec/monitored_spec.rb +18 -14
- metadata +37 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59821e12e07570bd3f1228ee067960cc983b6b59
|
4
|
+
data.tar.gz: 849bad68b337b8dd168be233ee7daf78158578ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e59406968fee011c43564926e26e090ddd27e6cc79d21433a6e06c2eff39dd07e58e50ad9caea32b21038b30b29a63b7eaa0454e2adbc8603cdc0c4d3ea69078
|
7
|
+
data.tar.gz: a12b10c4dd56f4496db7f6a71b49b0c7e6ea7b0af67d4142276f470ea17b99174c846693be644696277582908ee117f0b56e4951332f58ed6f9705c269882849
|
data/hallmonitor.gemspec
CHANGED
@@ -20,12 +20,13 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.files = `git ls-files`.split($/)
|
21
21
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
22
22
|
s.require_paths = ["lib"]
|
23
|
-
|
23
|
+
|
24
24
|
s.add_runtime_dependency("json", [">= 0"])
|
25
25
|
s.add_runtime_dependency("statsd-ruby", [">= 0"])
|
26
26
|
s.add_development_dependency("rspec", [">= 2.14"])
|
27
27
|
s.add_development_dependency("rdoc", [">= 0"])
|
28
28
|
s.add_development_dependency("bundler", ["~> 1.3"])
|
29
|
-
s.add_development_dependency("pry-
|
29
|
+
s.add_development_dependency("pry-byebug", [">= 0"])
|
30
30
|
s.add_development_dependency("rake", [">= 0"])
|
31
|
+
s.add_development_dependency("yard", [">= 0"])
|
31
32
|
end
|
@@ -8,16 +8,28 @@ module Hallmonitor
|
|
8
8
|
@name = name
|
9
9
|
end
|
10
10
|
|
11
|
+
# Returns the current list of outputters
|
12
|
+
# @return [Object] Outputters
|
13
|
+
def self.outputters
|
14
|
+
@@outputters
|
15
|
+
end
|
16
|
+
|
17
|
+
# Adds an outputter. Outputters are required to respond to :process
|
18
|
+
# @see Hallmonitor::Outputters::StatsdOutputter
|
11
19
|
def self.add_outputter(outputter)
|
12
20
|
@@outputters << outputter if outputter.respond_to?(:process)
|
13
21
|
end
|
14
22
|
|
23
|
+
# Outputs the event via each configured outputter
|
24
|
+
# @param event [Event] The event to output
|
15
25
|
def self.output(event)
|
16
26
|
@@outputters.each do |o|
|
17
27
|
o.process(event)
|
18
28
|
end
|
19
29
|
end
|
20
30
|
|
31
|
+
# Processes and event. Child classes should implement this to output events
|
32
|
+
# @param event [Event] the event to process
|
21
33
|
def process(event)
|
22
34
|
# Nothing
|
23
35
|
end
|
data/lib/hallmonitor/version.rb
CHANGED
data/spec/monitored_spec.rb
CHANGED
@@ -4,30 +4,34 @@ class Thing
|
|
4
4
|
include Hallmonitor::Monitored
|
5
5
|
end
|
6
6
|
|
7
|
+
RSpec::Matchers.define :an_event_with_name do |expected_name|
|
8
|
+
match{ |actual| actual.name == expected_name}
|
9
|
+
end
|
10
|
+
|
7
11
|
describe Hallmonitor::Monitored do
|
8
12
|
subject {Thing.new}
|
9
13
|
|
10
|
-
describe "#watch" do
|
14
|
+
describe "#watch" do
|
11
15
|
let(:retval) {"Hello World"}
|
12
16
|
let(:name) {"foo"}
|
13
|
-
before do
|
14
|
-
expect(Hallmonitor::Outputter).to receive(:output).with
|
17
|
+
before do
|
18
|
+
expect(Hallmonitor::Outputter).to receive(:output).with(an_event_with_name(name))
|
15
19
|
end
|
16
|
-
it "should return the value the block returns" do
|
17
|
-
value = subject.watch(name) do
|
20
|
+
it "should return the value the block returns" do
|
21
|
+
value = subject.watch(name) do
|
18
22
|
retval
|
19
23
|
end
|
20
24
|
expect(value).to eq(retval)
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
24
|
-
describe "#emit" do
|
25
|
-
describe "with a string parameter" do
|
28
|
+
describe "#emit" do
|
29
|
+
describe "with a string parameter" do
|
26
30
|
let(:name) {"foo"}
|
27
|
-
before do
|
28
|
-
expect(Hallmonitor::Outputter).to receive(:output).with
|
31
|
+
before do
|
32
|
+
expect(Hallmonitor::Outputter).to receive(:output).with(an_event_with_name(name))
|
29
33
|
end
|
30
|
-
|
34
|
+
|
31
35
|
it "should emit an event with the passed in name" do
|
32
36
|
subject.emit(name)
|
33
37
|
end
|
@@ -43,16 +47,16 @@ describe Hallmonitor::Monitored do
|
|
43
47
|
end
|
44
48
|
expect(var).to_not be_nil
|
45
49
|
expect(var.name).to eq("foo")
|
46
|
-
expect(yielded).to
|
50
|
+
expect(yielded).to be_truthy
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
50
|
-
describe 'with an event parameter' do
|
54
|
+
describe 'with an event parameter' do
|
51
55
|
let(:event) {Hallmonitor::Event.new("bar")}
|
52
|
-
before do
|
56
|
+
before do
|
53
57
|
expect(Hallmonitor::Outputter).to receive(:output).with(event)
|
54
58
|
end
|
55
|
-
|
59
|
+
|
56
60
|
it "should emit the passed in event" do
|
57
61
|
subject.emit(event)
|
58
62
|
end
|
metadata
CHANGED
@@ -1,111 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hallmonitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris TenHarmsel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: statsd-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.14'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rdoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry-
|
84
|
+
name: pry-byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
description: Hallmonitor is a simple event monitoring framework in Ruby
|
@@ -115,8 +129,8 @@ executables: []
|
|
115
129
|
extensions: []
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
118
|
-
- .document
|
119
|
-
- .gitignore
|
132
|
+
- ".document"
|
133
|
+
- ".gitignore"
|
120
134
|
- Gemfile
|
121
135
|
- LICENSE.txt
|
122
136
|
- README.md
|
@@ -145,20 +159,21 @@ require_paths:
|
|
145
159
|
- lib
|
146
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
161
|
requirements:
|
148
|
-
- -
|
162
|
+
- - ">="
|
149
163
|
- !ruby/object:Gem::Version
|
150
164
|
version: '0'
|
151
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
166
|
requirements:
|
153
|
-
- -
|
167
|
+
- - ">="
|
154
168
|
- !ruby/object:Gem::Version
|
155
169
|
version: '0'
|
156
170
|
requirements: []
|
157
171
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.2.2
|
159
173
|
signing_key:
|
160
174
|
specification_version: 4
|
161
175
|
summary: Simple Ruby Event Monitoring
|
162
176
|
test_files:
|
163
177
|
- spec/monitored_spec.rb
|
164
178
|
- spec/spec_helper.rb
|
179
|
+
has_rdoc:
|