sinatra-statsd-helper 0.1

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Michael Leinartas
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,7 @@
1
+ ## sinatra-statsd-middleware ##
2
+ sinatra-statsd-middleware is a thin wrapper around danielsdeleo/opscode's statsd middleware (https://github.com/manderson26/statsd/blob/master/lib/statsd/middleware.rb) for Sinatra. It provides wrapper methods around the request variables used by the middleware
3
+
4
+ ## Usage ##
5
+
6
+ require 'sinatra-statsd-middleware'
7
+
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'sinatra/base'
3
+ require 'statsd/middleware'
4
+
5
+ module Sinatra
6
+ module Helpers
7
+ module Statsd
8
+ VERSION = "0.1"
9
+
10
+ def statsd_client
11
+ request[Statsd::Middleware::STATSD_DOT_CLIENT]
12
+ end
13
+
14
+ def statsd_host_client
15
+ request[Statsd::Middleware::STATSD_DOT_HOST_DOT_CLIENT]
16
+ end
17
+
18
+ def statsd_service_client
19
+ request[Statsd::Middleware::STATSD_DOT_SERVICE_DOT_CLIENT]
20
+ end
21
+
22
+ def increment_host(key)
23
+ request[Statsd::Middleware::STATSD_DOT_HOST_DOT_INCREMENTS] << key
24
+ end
25
+
26
+ def increment_service(key)
27
+ request[Statsd::Middleware::STATSD_DOT_SERVICE_DOT_INCREMENTS] << key
28
+ end
29
+
30
+ def increment_all(key)
31
+ increment_host(key)
32
+ increment_service(key)
33
+ end
34
+
35
+ def timer_host(key)
36
+ request[Statsd::Middleware::STATSD_DOT_HOST_DOT_TIMERS] << key
37
+ end
38
+
39
+ def timer_service(key)
40
+ request[Statsd::Middleware::STATSD_DOT_SERVICE_DOT_TIMERS] << key
41
+ end
42
+
43
+ def timer_all(key)
44
+ timer_host(key)
45
+ timer_service(key)
46
+ end
47
+ end
48
+ end
49
+
50
+ helpers Helpers::Statsd
51
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "sinatra-statsd-helper"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sinatra-statsd-helper"
7
+ s.version = Sinatra::Helpers::Statsd::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.summary = 'A Sinatra helper to wrap danielsdeleo/opscode\'s Statsd Rack middleware'
10
+ s.description = 'sinatra-statsd-helper is a thin wrapper around danielsdeleo/opscode\'s Statsd Rack middleware'
11
+
12
+ s.required_ruby_version = ">= 1.8.7"
13
+ s.required_rubygems_version = ">= 1.3.6"
14
+
15
+ s.authors = ["Michael Leinartas"]
16
+ s.email = ["mleinartas@gmail.com"]
17
+ s.homepage = "https://github.com/mleinartas/stator"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = []
22
+ s.require_path = 'lib'
23
+
24
+ s.add_dependency "sinatra", ">= 1.0"
25
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-statsd-helper
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Leinartas
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-14 00:00:00.000000000 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ requirement: &2154654660 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '1.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2154654660
26
+ description: sinatra-statsd-helper is a thin wrapper around danielsdeleo/opscode's
27
+ Statsd Rack middleware
28
+ email:
29
+ - mleinartas@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE
35
+ - README.md
36
+ - lib/sinatra-statsd-helper.rb
37
+ - sinatra-statsd-helper.gemspec
38
+ has_rdoc: true
39
+ homepage: https://github.com/mleinartas/stator
40
+ licenses: []
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: 1.8.7
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: 1.3.6
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 1.6.2
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: A Sinatra helper to wrap danielsdeleo/opscode's Statsd Rack middleware
63
+ test_files: []