fozzie 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTYwOWQ5MTkwM2FmYTJiNTJkOTVjNTgwZWY2ZjExNDRhZGMwMjdhNA==
5
+ data.tar.gz: !binary |-
6
+ Y2ZmNjIxOWI2N2UyZWNiMTZhYzJiMzk3NjA2NDYxOTc4ZGJjNjM4MA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ N2U2YmQzOWVhZDJiNTZhMWQ5M2U1ZjlkYjhkNzg4ZTE2YTFiNmRkMzEwNDM0
10
+ YjcwMjVjN2Y5OWY0OTM4NzE4MTRhM2FhNWIzYzc2MWE3ZDExNjFkNjUxNjlk
11
+ ODZlNzAyYjc2MjY3OGMyYzY5MDgwNGJmNGMwNTVjOWUyYzcyZjA=
12
+ data.tar.gz: !binary |-
13
+ OGVkMDYzODNhYmI0YTkyM2MyYmFiZGRjNGQ5YjMxOTY3MDRjMTM5M2E1NmZm
14
+ MmFiNDI2NTllYjZiNDNmYWE4Mzk4MDNlNzU5NDIxMDkwY2UyM2EwMTNhYWM4
15
+ MDJiYTdlMDhhOTFkNjhhOTFhZjdmM2MyN2Y1ZDYzYjgwMWExMDg=
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in fozzie.gemspec
4
- gemspec
4
+ gemspec
@@ -21,13 +21,9 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ["lib"]
22
22
 
23
23
  s.add_dependency 'sys-uname'
24
- s.add_dependency 'facets'
25
24
 
26
25
  s.add_development_dependency 'rake'
27
26
  s.add_development_dependency 'rspec'
28
- s.add_development_dependency 'guard'
29
- s.add_development_dependency 'guard-rspec'
30
- s.add_development_dependency 'rb-fsevent'
31
27
  s.add_development_dependency 'sinatra'
32
28
  s.add_development_dependency 'rack-test'
33
29
  end
@@ -0,0 +1,22 @@
1
+ class Hash
2
+ def symbolize_keys(&select)
3
+ dup.symbolize_keys!(&select)
4
+ end
5
+
6
+ def symbolize_keys!(&select)
7
+ if select
8
+ keys.each do |key|
9
+ if select[key]
10
+ new_key = (key.to_sym rescue key.to_s.to_sym)
11
+ self[new_key] = delete(key)
12
+ end
13
+ end
14
+ else
15
+ keys.each do |key|
16
+ new_key = (key.to_sym rescue key.to_s.to_sym)
17
+ self[new_key] = delete(key)
18
+ end
19
+ end
20
+ self
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ class Module
2
+ def alias_method_chain(target, feature)
3
+ aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
4
+ yield(aliased_target, punctuation) if block_given?
5
+
6
+ with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}"
7
+
8
+ alias_method without_method, target
9
+ alias_method target, with_method
10
+
11
+ case
12
+ when public_method_defined?(without_method)
13
+ public target
14
+ when protected_method_defined?(without_method)
15
+ protected target
16
+ when private_method_defined?(without_method)
17
+ private target
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ class String
2
+ def snakecase
3
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
4
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
5
+ tr('-', '_').
6
+ gsub(/\s/, '_').
7
+ gsub(/__+/, '_').
8
+ downcase
9
+ end
10
+ end
@@ -7,9 +7,13 @@
7
7
  #
8
8
  # Rack and Rails middleware is avaliable to gather statistics on the processing time of Controller actions.
9
9
  #
10
+
10
11
  module Fozzie
11
12
 
12
13
  require 'core_ext/module/monitor'
14
+ require 'core_ext/module/alias_method_chain' unless Module.methods.include?(:alias_method_chain)
15
+ require 'core_ext/string/snakecase'
16
+ require 'core_ext/hash/symbolize_keys'
13
17
 
14
18
  require 'fozzie/adapter'
15
19
 
@@ -1,5 +1,4 @@
1
1
  require 'yaml'
2
- require 'facets/hash/symbolize_keys'
3
2
  require 'sys/uname'
4
3
  require 'timeout'
5
4
 
@@ -1,6 +1,4 @@
1
1
  require 'core_ext/module/monitor'
2
- require 'facets/module/alias_method_chain' unless Module.methods.include?(:alias_method_chain)
3
- require 'facets/string/snakecase'
4
2
 
5
3
  module Fozzie
6
4
  module Sniff
@@ -46,7 +44,6 @@ module Fozzie
46
44
  self.singleton_class.class_eval { alias_method_chain target, feature }
47
45
  end
48
46
  end
49
-
50
47
  end
51
48
 
52
49
  end
@@ -1,3 +1,3 @@
1
1
  module Fozzie
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -72,14 +72,14 @@ shared_examples "interface" do
72
72
  end
73
73
 
74
74
  it "simply questions the passed val with if" do
75
- a = mock
75
+ a = double
76
76
  a.should_receive(:save).and_return({})
77
77
  subject.should_receive(:increment).with(["event.increment", "success"], 1)
78
78
  subject.increment_on('event.increment', a.save).should == {}
79
79
  end
80
80
 
81
81
  it "registers fail on nil return" do
82
- a = mock
82
+ a = double
83
83
  a.should_receive(:save).and_return(nil)
84
84
  subject.should_receive(:increment).with(["event.increment", "fail"], 1)
85
85
  subject.increment_on('event.increment', a.save).should == nil
@@ -87,21 +87,21 @@ shared_examples "interface" do
87
87
 
88
88
  describe "performing actions" do
89
89
  it "registers success" do
90
- a = mock
90
+ a = double
91
91
  a.should_receive(:save).and_return(true)
92
92
  subject.should_receive(:increment).with(["event.increment", "success"], 1)
93
93
  subject.increment_on('event.increment', a.save).should == true
94
94
  end
95
95
 
96
96
  it "registers failure" do
97
- a = mock
97
+ a = double
98
98
  a.should_receive(:save).and_return(false)
99
99
  subject.should_receive(:increment).with(["event.increment", "fail"], 1)
100
100
  subject.increment_on('event.increment', a.save).should == false
101
101
  end
102
102
 
103
103
  it "registers positive even when nested" do
104
- a = mock
104
+ a = double
105
105
  a.should_receive(:save).and_return(true)
106
106
  subject.should_receive(:timing).with('event.run', anything, anything)
107
107
  subject.should_receive(:increment).with(["event.increment", "success"], 1)
@@ -113,7 +113,7 @@ shared_examples "interface" do
113
113
  end
114
114
 
115
115
  it "registers negative even when nested" do
116
- a = mock
116
+ a = double
117
117
  a.should_receive(:save).and_return(false)
118
118
  subject.should_receive(:timing).with('event.run', anything, anything)
119
119
  subject.should_receive(:increment).with(["event.increment", "fail"], 1)
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fozzie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Marc Watts
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-29 00:00:00.000000000 Z
11
+ date: 2013-11-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: sys-uname
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,23 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: facets
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
23
  requirements:
43
24
  - - ! '>='
44
25
  - !ruby/object:Gem::Version
@@ -46,7 +27,6 @@ dependencies:
46
27
  - !ruby/object:Gem::Dependency
47
28
  name: rake
48
29
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
30
  requirements:
51
31
  - - ! '>='
52
32
  - !ruby/object:Gem::Version
@@ -54,7 +34,6 @@ dependencies:
54
34
  type: :development
55
35
  prerelease: false
56
36
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
37
  requirements:
59
38
  - - ! '>='
60
39
  - !ruby/object:Gem::Version
@@ -62,55 +41,6 @@ dependencies:
62
41
  - !ruby/object:Gem::Dependency
63
42
  name: rspec
64
43
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: guard
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: guard-rspec
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: rb-fsevent
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
44
  requirements:
115
45
  - - ! '>='
116
46
  - !ruby/object:Gem::Version
@@ -118,7 +48,6 @@ dependencies:
118
48
  type: :development
119
49
  prerelease: false
120
50
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
51
  requirements:
123
52
  - - ! '>='
124
53
  - !ruby/object:Gem::Version
@@ -126,7 +55,6 @@ dependencies:
126
55
  - !ruby/object:Gem::Dependency
127
56
  name: sinatra
128
57
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
58
  requirements:
131
59
  - - ! '>='
132
60
  - !ruby/object:Gem::Version
@@ -134,7 +62,6 @@ dependencies:
134
62
  type: :development
135
63
  prerelease: false
136
64
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
65
  requirements:
139
66
  - - ! '>='
140
67
  - !ruby/object:Gem::Version
@@ -142,7 +69,6 @@ dependencies:
142
69
  - !ruby/object:Gem::Dependency
143
70
  name: rack-test
144
71
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
72
  requirements:
147
73
  - - ! '>='
148
74
  - !ruby/object:Gem::Version
@@ -150,7 +76,6 @@ dependencies:
150
76
  type: :development
151
77
  prerelease: false
152
78
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
79
  requirements:
155
80
  - - ! '>='
156
81
  - !ruby/object:Gem::Version
@@ -168,12 +93,14 @@ files:
168
93
  - .rvmrc
169
94
  - .travis.yml
170
95
  - Gemfile
171
- - Guardfile
172
96
  - README.md
173
97
  - Rakefile
174
98
  - fozzie.gemspec
175
99
  - fozzie.yml.example
100
+ - lib/core_ext/hash/symbolize_keys.rb
101
+ - lib/core_ext/module/alias_method_chain.rb
176
102
  - lib/core_ext/module/monitor.rb
103
+ - lib/core_ext/string/snakecase.rb
177
104
  - lib/fozzie.rb
178
105
  - lib/fozzie/adapter.rb
179
106
  - lib/fozzie/adapter/statsd.rb
@@ -203,33 +130,26 @@ files:
203
130
  - spec/spec_helper.rb
204
131
  homepage:
205
132
  licenses: []
133
+ metadata: {}
206
134
  post_install_message:
207
135
  rdoc_options: []
208
136
  require_paths:
209
137
  - lib
210
138
  required_ruby_version: !ruby/object:Gem::Requirement
211
- none: false
212
139
  requirements:
213
140
  - - ! '>='
214
141
  - !ruby/object:Gem::Version
215
142
  version: '0'
216
- segments:
217
- - 0
218
- hash: -232887715390431794
219
143
  required_rubygems_version: !ruby/object:Gem::Requirement
220
- none: false
221
144
  requirements:
222
145
  - - ! '>='
223
146
  - !ruby/object:Gem::Version
224
147
  version: '0'
225
- segments:
226
- - 0
227
- hash: -232887715390431794
228
148
  requirements: []
229
149
  rubyforge_project: fozzie
230
- rubygems_version: 1.8.25
150
+ rubygems_version: 2.1.10
231
151
  signing_key:
232
- specification_version: 3
152
+ specification_version: 4
233
153
  summary: Ruby gem from Lonely Planet Online to register statistics. Currently supports
234
154
  Statsd.
235
155
  test_files:
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec', :cli => "--color" do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end