hallmonitor 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +3 -7
- data/hallmonitor.gemspec +1 -1
- data/lib/hallmonitor/monitored.rb +2 -1
- data/lib/hallmonitor/version.rb +2 -2
- data/spec/monitored_spec.rb +62 -0
- data/{test/helper.rb → spec/spec_helper.rb} +1 -5
- metadata +26 -49
- data/.rvmrc +0 -81
- data/test/monitored_test.rb +0 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e16cfca32beb420afc940491d0018e219dc404a
|
4
|
+
data.tar.gz: a672e26fc13b15643fedb6e7f8a74e8b16d39ac2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 108ae8c19ae8b5165cd340a75f4f85623c3dee57cca01c70e83e4442e9b7851691d4a675af12fc70bf801a942374dccc45187d04d2ab14d1a810acf10c26e163
|
7
|
+
data.tar.gz: 5c5c916b125ec7cebf4c30daad286276212ed4a037cdcbec56f5e2857d833fbbd00d4d192afc681bad38aa82d2ca2b7b16f2fc2e3b6492be2c3f5953ca8f8453
|
data/Rakefile
CHANGED
@@ -2,14 +2,10 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'bundler/gem_tasks'
|
5
|
-
require 'rake/testtask'
|
6
|
-
Rake::TestTask.new(:test) do |test|
|
7
|
-
test.libs << 'lib' << 'test'
|
8
|
-
test.pattern = 'test/**/*_test.rb'
|
9
|
-
test.verbose = true
|
10
|
-
end
|
11
5
|
|
12
|
-
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
task :default => :spec
|
13
9
|
|
14
10
|
require 'rdoc/task'
|
15
11
|
Rake::RDocTask.new do |rdoc|
|
data/hallmonitor.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
s.add_runtime_dependency("json", [">= 0"])
|
25
25
|
s.add_runtime_dependency("statsd-ruby", [">= 0"])
|
26
|
-
s.add_development_dependency("
|
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
29
|
s.add_development_dependency("pry-debugger", [">= 0"])
|
data/lib/hallmonitor/version.rb
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class Thing
|
4
|
+
include Hallmonitor::Monitored
|
5
|
+
end
|
6
|
+
|
7
|
+
describe Hallmonitor::Monitored do
|
8
|
+
subject {Thing.new}
|
9
|
+
|
10
|
+
describe "#watch" do
|
11
|
+
let(:retval) {"Hello World"}
|
12
|
+
let(:name) {"foo"}
|
13
|
+
before do
|
14
|
+
expect(Hallmonitor::Outputter).to receive(:output).with{|x|x.name == name}
|
15
|
+
end
|
16
|
+
it "should return the value the block returns" do
|
17
|
+
value = subject.watch(name) do
|
18
|
+
retval
|
19
|
+
end
|
20
|
+
expect(value).to eq(retval)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#emit" do
|
25
|
+
describe "with a string parameter" do
|
26
|
+
let(:name) {"foo"}
|
27
|
+
before do
|
28
|
+
expect(Hallmonitor::Outputter).to receive(:output).with{|x|x.name == name}
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should emit an event with the passed in name" do
|
32
|
+
subject.emit(name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "with a block" do
|
37
|
+
it "should yield to the block" do
|
38
|
+
yielded = false
|
39
|
+
var = nil
|
40
|
+
subject.emit("foo") do |thing|
|
41
|
+
var = thing
|
42
|
+
yielded = true
|
43
|
+
end
|
44
|
+
expect(var).to_not be_nil
|
45
|
+
expect(var.name).to eq("foo")
|
46
|
+
expect(yielded).to be_true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'with an event parameter' do
|
51
|
+
let(:event) {Hallmonitor::Event.new("bar")}
|
52
|
+
before do
|
53
|
+
expect(Hallmonitor::Outputter).to receive(:output).with(event)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should emit the passed in event" do
|
57
|
+
subject.emit(event)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
@@ -7,12 +7,8 @@ rescue Bundler::BundlerError => e
|
|
7
7
|
$stderr.puts "Run `bundle install` to install missing gems"
|
8
8
|
exit e.status_code
|
9
9
|
end
|
10
|
-
require '
|
11
|
-
require 'shoulda'
|
10
|
+
require 'rspec'
|
12
11
|
|
13
12
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
13
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
14
|
require 'hallmonitor'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|
metadata
CHANGED
@@ -1,84 +1,74 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hallmonitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chris TenHarmsel
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: json
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: statsd-ruby
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
47
|
+
version: '2.14'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
54
|
+
version: '2.14'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rdoc
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: bundler
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,33 +83,29 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: pry-debugger
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rake
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
description: Hallmonitor is a simple event monitoring framework in Ruby
|
@@ -132,7 +117,6 @@ extra_rdoc_files: []
|
|
132
117
|
files:
|
133
118
|
- .document
|
134
119
|
- .gitignore
|
135
|
-
- .rvmrc
|
136
120
|
- Gemfile
|
137
121
|
- LICENSE.txt
|
138
122
|
- README.md
|
@@ -149,39 +133,32 @@ files:
|
|
149
133
|
- lib/hallmonitor/outputters/statsd_outputter.rb
|
150
134
|
- lib/hallmonitor/timed_event.rb
|
151
135
|
- lib/hallmonitor/version.rb
|
152
|
-
-
|
153
|
-
-
|
136
|
+
- spec/monitored_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
154
138
|
homepage: http://github.com/epchris/hallmonitor
|
155
139
|
licenses:
|
156
140
|
- MIT
|
141
|
+
metadata: {}
|
157
142
|
post_install_message:
|
158
143
|
rdoc_options: []
|
159
144
|
require_paths:
|
160
145
|
- lib
|
161
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
-
none: false
|
163
147
|
requirements:
|
164
|
-
- -
|
148
|
+
- - '>='
|
165
149
|
- !ruby/object:Gem::Version
|
166
150
|
version: '0'
|
167
|
-
segments:
|
168
|
-
- 0
|
169
|
-
hash: 4277465869817980357
|
170
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
-
none: false
|
172
152
|
requirements:
|
173
|
-
- -
|
153
|
+
- - '>='
|
174
154
|
- !ruby/object:Gem::Version
|
175
155
|
version: '0'
|
176
|
-
segments:
|
177
|
-
- 0
|
178
|
-
hash: 4277465869817980357
|
179
156
|
requirements: []
|
180
157
|
rubyforge_project:
|
181
|
-
rubygems_version:
|
158
|
+
rubygems_version: 2.0.14
|
182
159
|
signing_key:
|
183
|
-
specification_version:
|
160
|
+
specification_version: 4
|
184
161
|
summary: Simple Ruby Event Monitoring
|
185
162
|
test_files:
|
186
|
-
-
|
187
|
-
-
|
163
|
+
- spec/monitored_spec.rb
|
164
|
+
- spec/spec_helper.rb
|
data/.rvmrc
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
-
# development environment upon cd'ing into the directory
|
5
|
-
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
7
|
-
environment_id="ruby-1.9.3-p0@hallmonitor"
|
8
|
-
|
9
|
-
#
|
10
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
11
|
-
#
|
12
|
-
# rvmrc_rvm_version="1.10.2" # 1.10.1 seams as a safe start
|
13
|
-
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
-
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
-
# return 1
|
16
|
-
# }
|
17
|
-
#
|
18
|
-
|
19
|
-
#
|
20
|
-
# Uncomment following line if you want options to be set only for given project.
|
21
|
-
#
|
22
|
-
# PROJECT_JRUBY_OPTS=( --1.9 )
|
23
|
-
#
|
24
|
-
# The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
|
25
|
-
#
|
26
|
-
# chmod +x ${rvm_path}/hooks/after_use_jruby_opts
|
27
|
-
#
|
28
|
-
|
29
|
-
#
|
30
|
-
# First we attempt to load the desired environment directly from the environment
|
31
|
-
# file. This is very fast and efficient compared to running through the entire
|
32
|
-
# CLI and selector. If you want feedback on which environment was used then
|
33
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
34
|
-
#
|
35
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
36
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
37
|
-
then
|
38
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
39
|
-
|
40
|
-
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
41
|
-
then
|
42
|
-
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
43
|
-
fi
|
44
|
-
else
|
45
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
46
|
-
if ! rvm --create "$environment_id"
|
47
|
-
then
|
48
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
49
|
-
return 1
|
50
|
-
fi
|
51
|
-
fi
|
52
|
-
|
53
|
-
#
|
54
|
-
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
55
|
-
# it be automatically loaded. Uncomment the following and adjust the filename if
|
56
|
-
# necessary.
|
57
|
-
#
|
58
|
-
# filename=".gems"
|
59
|
-
# if [[ -s "$filename" ]]
|
60
|
-
# then
|
61
|
-
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
62
|
-
# fi
|
63
|
-
|
64
|
-
# If you use bundler, this might be useful to you:
|
65
|
-
# if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
|
66
|
-
# then
|
67
|
-
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
68
|
-
# gem install bundler
|
69
|
-
# fi
|
70
|
-
# if [[ -s Gemfile ]] && command -v bundle
|
71
|
-
# then
|
72
|
-
# bundle install
|
73
|
-
# fi
|
74
|
-
|
75
|
-
if [[ $- == *i* ]] # check for interactive shells
|
76
|
-
then
|
77
|
-
echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
|
78
|
-
else
|
79
|
-
echo "Using: $GEM_HOME" # don't use colors in interactive shells
|
80
|
-
fi
|
81
|
-
|
data/test/monitored_test.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class MonitoredTest < Test::Unit::TestCase
|
4
|
-
class TestMe
|
5
|
-
include Hallmonitor::Monitored
|
6
|
-
end
|
7
|
-
context "A class that includes Monitored module" do
|
8
|
-
|
9
|
-
setup do
|
10
|
-
@test_me = TestMe.new
|
11
|
-
end
|
12
|
-
|
13
|
-
should "add an emit method to instances" do
|
14
|
-
@test_me.respond_to?(:emit)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|