gateway 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/gateway.gemspec +3 -3
- data/lib/gateway/feature/performance.rb +9 -8
- data/spec/gateway_spec.rb +34 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/gateway.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "gateway"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aaron Qian"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-01-23"
|
13
13
|
s.description = " Opinionated Generic IO Connection Manager "
|
14
14
|
s.email = "aq1018@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.homepage = "http://github.com/aq1018/gateway"
|
45
45
|
s.licenses = ["MIT"]
|
46
46
|
s.require_paths = ["lib"]
|
47
|
-
s.rubygems_version = "1.8.
|
47
|
+
s.rubygems_version = "1.8.24"
|
48
48
|
s.summary = "Opinionated Generic IO Connection Manager"
|
49
49
|
|
50
50
|
if s.respond_to? :specification_version then
|
@@ -19,15 +19,16 @@ module Gateway
|
|
19
19
|
start_time = Time.now
|
20
20
|
|
21
21
|
begin
|
22
|
-
resp
|
23
|
-
status = success_status(resp)
|
24
|
-
desc = success_message(resp)
|
25
|
-
resp
|
26
|
-
rescue => e
|
27
|
-
status = error_status(e)
|
28
|
-
desc = error_message(e)
|
29
|
-
raise
|
22
|
+
resp = block.call
|
30
23
|
ensure
|
24
|
+
if e = $!
|
25
|
+
status = error_status(e)
|
26
|
+
desc = error_message(e)
|
27
|
+
else
|
28
|
+
status = success_status(resp)
|
29
|
+
desc = success_message(resp)
|
30
|
+
end
|
31
|
+
|
31
32
|
duration = Time.now - start_time
|
32
33
|
req = "#{action.to_s.upcase} #{req}"
|
33
34
|
profiler.performance(name.to_s, duration, status, desc, req)
|
data/spec/gateway_spec.rb
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Gateway" do
|
4
|
-
|
4
|
+
describe "Performance" do
|
5
|
+
before do
|
6
|
+
@profiler = Class.new do
|
7
|
+
attr_reader :args
|
8
|
+
def performance(*args) @args = args end
|
9
|
+
end.new
|
10
|
+
|
11
|
+
@class = Class.new do
|
12
|
+
include Gateway::Feature::Performance
|
13
|
+
|
14
|
+
attr_accessor :profiler
|
15
|
+
def name() 'hi' end
|
16
|
+
def initialize(p) @profiler = p end
|
17
|
+
end
|
18
|
+
|
19
|
+
@performer = @class.new @profiler
|
20
|
+
end
|
21
|
+
|
22
|
+
it "handles local jumps" do
|
23
|
+
def @performer.with_perf(*a) super{ return } end
|
24
|
+
|
25
|
+
@performer.with_perf(:foo, :req, {})
|
26
|
+
|
27
|
+
@performer.profiler.args.should eq ['hi', anything, 200, 'OK', 'FOO req']
|
28
|
+
end
|
29
|
+
|
30
|
+
it "handles local jumps with errors" do
|
31
|
+
def @performer.with_perf(*a) super{ raise 'hi' } end
|
32
|
+
|
33
|
+
expect { @performer.with_perf(:foo, :req, {}) }.to raise_error RuntimeError
|
34
|
+
|
35
|
+
@performer.profiler.args.should eq ['hi', anything, 500, 'RuntimeError - hi', 'FOO req']
|
36
|
+
end
|
37
|
+
end
|
5
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -169,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
segments:
|
171
171
|
- 0
|
172
|
-
hash:
|
172
|
+
hash: 3547257531865171305
|
173
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
174
|
none: false
|
175
175
|
requirements:
|
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
version: '0'
|
179
179
|
requirements: []
|
180
180
|
rubyforge_project:
|
181
|
-
rubygems_version: 1.8.
|
181
|
+
rubygems_version: 1.8.24
|
182
182
|
signing_key:
|
183
183
|
specification_version: 3
|
184
184
|
summary: Opinionated Generic IO Connection Manager
|