stashing 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/stashing.rb +7 -4
- data/lib/stashing/version.rb +1 -1
- data/spec/stashing/stashing_spec.rb +11 -1
- metadata +16 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d588a9a51ab6e899f51a7f11458e8aa0b72bdb72
|
4
|
+
data.tar.gz: 34a3cea7676073e6108929683a5602e54d482f6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c296ab2456f24d54c677c8c99c5033a2bad31ef67791cb593bb1983addd1449d48652a70251b60eec575123e1586d48fe4ae3219e5f44a3c6b193a54c1fd7a58
|
7
|
+
data.tar.gz: 80b8946fa99fc0425e49c3a960bf0bf10c44789ce15f4599ef3862a200f064cbbfb395f2c66365fc63ce33af95da7e2c39e5f7ad05e45683a07e23228903bdcf
|
data/Gemfile.lock
CHANGED
data/lib/stashing.rb
CHANGED
@@ -23,11 +23,14 @@ class Stashing
|
|
23
23
|
def self.watch(event, opts = {}, &block)
|
24
24
|
event_group = opts[:event_group] || event
|
25
25
|
ActiveSupport::Notifications.subscribe(event) do |*args|
|
26
|
-
|
27
|
-
|
26
|
+
begin
|
27
|
+
# It's necessary to add the custom_fields at runtime, otherwise LogStasher overrides them.
|
28
|
+
Stashing.custom_fields << event_group unless Stashing.custom_fields.include? event_group
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
# Calling the processing block with the Notification args, plus the event_stash
|
31
|
+
block.call(*args, stash[event_group])
|
32
|
+
rescue StandardError
|
33
|
+
end
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end
|
data/lib/stashing/version.rb
CHANGED
@@ -13,9 +13,19 @@ describe 'Stashing' do
|
|
13
13
|
|
14
14
|
describe "#watch" do
|
15
15
|
it "subscribes to the required event" do
|
16
|
-
ActiveSupport::Notifications = double("Notifications")
|
17
16
|
ActiveSupport::Notifications.should_receive(:subscribe).with('event_name')
|
18
17
|
Stashing.watch('event_name')
|
19
18
|
end
|
19
|
+
|
20
|
+
it "never raises an exception" do
|
21
|
+
Stashing.watch('event_name') do
|
22
|
+
1 / 0
|
23
|
+
end
|
24
|
+
expect {
|
25
|
+
ActiveSupport::Notifications.instrument "event_name", this: :data do
|
26
|
+
"test"
|
27
|
+
end
|
28
|
+
}.to_not raise_error
|
29
|
+
end
|
20
30
|
end
|
21
31
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stashing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Boisard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstasher
|
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: request_store
|
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: '0'
|
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: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.0.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: 1.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.0'
|
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: '3.0'
|
83
83
|
description: Logstash wrapper for easy ActiveSupport::Notifications logging
|
@@ -87,7 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
-
|
90
|
+
- .travis.yml
|
91
91
|
- Gemfile
|
92
92
|
- Gemfile.lock
|
93
93
|
- README.md
|
@@ -110,21 +110,20 @@ require_paths:
|
|
110
110
|
- lib
|
111
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- -
|
113
|
+
- - '>='
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
|
-
- -
|
118
|
+
- - '>='
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project: stashing
|
123
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.0.14
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Logstash wrapper for easy ActiveSupport::Notifications logging
|
127
127
|
test_files:
|
128
128
|
- spec/spec_helper.rb
|
129
129
|
- spec/stashing/stashing_spec.rb
|
130
|
-
has_rdoc:
|