oni 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Yzg0ZTUxZTdiN2E0YmVkM2M2NGFkYTNiMWY0ZDZiNDVhZDAyMmM1Ng==
5
- data.tar.gz: !binary |-
6
- MzJiNjliMjhiZjcwZTk4NTkyZjFkZjU4YTI1YjJkMmEyNjQ0Y2EwYw==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- OTE4MzgzNjMxZDI5YzZhYjVmYWQ2OTUzZWE1MTI5NzY5YzUzNWY0ZjY4MjNl
10
- MzhhN2JkOGFjNTEzMzk2ODU0YjlhNTE5YmY2NGQ3MzMxZTI5MDk3YmFjZWU5
11
- YjYwZmI5MmU0NGFmNjkwY2RhMGIxMzk1NDUwYzg4OTUwZGFiNTQ=
12
- data.tar.gz: !binary |-
13
- NjAzNWExYjhmNWI0ZWQzMjY2NWY0NTMwYjQ1MjZlNjExNDg2NjJlNWY5MmNl
14
- ZGY2Y2JiMTExMDgwNGE3ODVlMDJiNjk5NWRmMWM1ZjYwODg4YmQzNWMxYTUz
15
- ZDFiNjcxZGM0OTdiYTBhYWZmMjE3MjcxOWVlZmY2MDZmMmMzODc=
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2a436542360d389809d0b76b7108599fbb75bfe1
4
+ data.tar.gz: 778e26a13382c6f4fe71acbaeff5f1a6b3c76b99
5
+ SHA512:
6
+ metadata.gz: e6bd9b3db19847a9b3c52cc16e59d373290a74a2ba5c07c07004c7adb5ee9e24dbbfde99c3ccda1871591264f79e5c94634796624547f06a1749bed472673e92
7
+ data.tar.gz: 665c8b07e6728aa0aee95f869338d9a910b96e5b9cfa1f313a027f0c2077c3e97e36c33077750991a208506efd4a74768d57ed571f9c4381e798abb425875cbb
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- script: rake
2
+ script: bundle exec rake
3
3
 
4
4
  rvm:
5
5
  - 1.9.3
@@ -8,7 +8,7 @@ rvm:
8
8
  - jruby
9
9
  - jruby-head
10
10
  - jruby-1.7.4
11
- - rbx-2.1.1
11
+ - rbx-2.2.1
12
12
 
13
13
  notifications:
14
14
  email:
@@ -21,3 +21,5 @@ notifications:
21
21
  branches:
22
22
  only:
23
23
  - master
24
+
25
+ #cache: bundler
data/doc/changelog.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # @title Changelog
2
2
  # Changelog
3
3
 
4
+ ## 2.0.0 - December 16th, 2013
5
+
6
+ * Error callbacks now take an optional argument that contains extra error data
7
+ as returned by a worker.
8
+
4
9
  ## 1.0.0 - November 18th, 2013
5
10
 
6
11
  The first public release of Oni.
data/lib/oni/daemon.rb CHANGED
@@ -101,7 +101,12 @@ module Oni
101
101
  mapper = create_mapper
102
102
  input = mapper.map_input(message)
103
103
  worker = option(:worker).new(*input)
104
- output = worker.process
104
+
105
+ begin
106
+ output = worker.process
107
+ rescue => error
108
+ error(error, worker.extra_error_data)
109
+ end
105
110
 
106
111
  return mapper.map_output(output)
107
112
  end
@@ -139,8 +144,9 @@ module Oni
139
144
  # exception occured, not from the main thread.
140
145
  #
141
146
  # @param [StandardError] error
147
+ # @param [Mixed] extra_data Extra data made available to the method.
142
148
  #
143
- def error(error)
149
+ def error(error, extra_data = nil)
144
150
  raise error
145
151
  end
146
152
 
data/lib/oni/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oni
2
- VERSION = '1.0.0'
2
+ VERSION = '2.0.0'
3
3
  end # Oni
data/lib/oni/worker.rb CHANGED
@@ -14,5 +14,20 @@ module Oni
14
14
  def process
15
15
  raise NotImplementedError, 'You must implement #process yourself'
16
16
  end
17
+
18
+ ##
19
+ # Method for returning (optional) extra data that should be sent to
20
+ # {Oni::Daemon#error} upon encountering an error. This method can be used
21
+ # to for example return the mapped input so that it can be sent to Rollbar.
22
+ #
23
+ # @example
24
+ # def extra_error_data
25
+ # return {:user_id => current_user.id}
26
+ # end
27
+ #
28
+ # @return [Mixed]
29
+ #
30
+ def extra_error_data
31
+ end
17
32
  end # Worker
18
33
  end # Oni
@@ -22,6 +22,10 @@ describe Oni::Daemon do
22
22
  def process
23
23
  return @number * 2
24
24
  end
25
+
26
+ def extra_error_data
27
+ return @number
28
+ end
25
29
  end
26
30
 
27
31
  Class.new(Oni::Daemon) do
@@ -43,6 +47,10 @@ describe Oni::Daemon do
43
47
  yield({:number => 10})
44
48
  end
45
49
 
50
+ def error(error, extra_data = nil)
51
+ raise "#{error.message}: #{extra_data}"
52
+ end
53
+
46
54
  def complete(message, output, timings)
47
55
  @message = message
48
56
  @output = output
@@ -133,7 +141,7 @@ describe Oni::Daemon do
133
141
  Class.new(example_daemon) do
134
142
  set :threads, 0
135
143
 
136
- def error(error)
144
+ def error(error, extra_data = nil)
137
145
  raise 'custom error'
138
146
  end
139
147
  end
@@ -151,4 +159,16 @@ describe Oni::Daemon do
151
159
  lambda { daemon.start }.should raise_error(RuntimeError, 'custom error')
152
160
  end
153
161
  end
162
+
163
+ context 'error handling with extra data' do
164
+ example 'include the extra data' do
165
+ instance = example_daemon.new
166
+
167
+ instance.option(:worker).any_instance.stub(:process) { raise 'example' }
168
+
169
+ block = lambda { instance.run_worker(:number => 10) }
170
+
171
+ block.should raise_error(RuntimeError, 'example: 10')
172
+ end
173
+ end
154
174
  end
metadata CHANGED
@@ -1,134 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: oni
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Yorick Peterse
8
8
  - Wilco van Duinkerken
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-18 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2013-12-16 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
15
16
  name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ! '>='
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
17
  prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ! '>='
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: bundler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - &id002
21
+ - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
35
24
  type: :development
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: bundler
36
28
  prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ! '>='
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rspec
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
48
- version: '0'
29
+ requirement: &id003 !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - *id002
49
32
  type: :development
33
+ version_requirements: *id003
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec
50
36
  prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: yard
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: '0'
37
+ requirement: &id004 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - *id002
63
40
  type: :development
41
+ version_requirements: *id004
42
+ - !ruby/object:Gem::Dependency
43
+ name: yard
64
44
  prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: simplecov
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
45
+ requirement: &id005 !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - *id002
77
48
  type: :development
49
+ version_requirements: *id005
50
+ - !ruby/object:Gem::Dependency
51
+ name: simplecov
78
52
  prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ! '>='
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: kramdown
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ! '>='
89
- - !ruby/object:Gem::Version
90
- version: '0'
53
+ requirement: &id006 !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - *id002
91
56
  type: :development
57
+ version_requirements: *id006
58
+ - !ruby/object:Gem::Dependency
59
+ name: kramdown
92
60
  prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ! '>='
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: ci_reporter
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ! '>='
103
- - !ruby/object:Gem::Version
104
- version: '0'
61
+ requirement: &id007 !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - *id002
105
64
  type: :development
65
+ version_requirements: *id007
66
+ - !ruby/object:Gem::Dependency
67
+ name: ci_reporter
106
68
  prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: aws-sdk
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
69
+ requirement: &id008 !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - *id002
119
72
  type: :development
73
+ version_requirements: *id008
74
+ - !ruby/object:Gem::Dependency
75
+ name: aws-sdk
120
76
  prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
77
+ requirement: &id009 !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - *id002
80
+ type: :development
81
+ version_requirements: *id009
126
82
  description: Framework for building concurrent daemons in Ruby.
127
83
  email:
128
84
  executables: []
85
+
129
86
  extensions: []
87
+
130
88
  extra_rdoc_files: []
131
- files:
89
+
90
+ files:
132
91
  - .gitignore
133
92
  - .travis.yml
134
93
  - .yardopts
@@ -161,30 +120,31 @@ files:
161
120
  - task/tag.rake
162
121
  - task/test.rake
163
122
  homepage:
164
- licenses:
123
+ licenses:
165
124
  - MIT
166
125
  metadata: {}
126
+
167
127
  post_install_message:
168
128
  rdoc_options: []
169
- require_paths:
129
+
130
+ require_paths:
170
131
  - lib
171
- required_ruby_version: !ruby/object:Gem::Requirement
172
- requirements:
173
- - - ! '>='
174
- - !ruby/object:Gem::Version
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
175
136
  version: 1.9.3
176
- required_rubygems_version: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ! '>='
179
- - !ruby/object:Gem::Version
180
- version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - *id002
181
140
  requirements: []
141
+
182
142
  rubyforge_project:
183
- rubygems_version: 2.1.2
143
+ rubygems_version: 2.1.10
184
144
  signing_key:
185
145
  specification_version: 4
186
146
  summary: Framework for building concurrent daemons in Ruby.
187
- test_files:
147
+ test_files:
188
148
  - spec/oni/configurable_spec.rb
189
149
  - spec/oni/daemon_spec.rb
190
150
  - spec/oni/daemons/sqs_spec.rb