bumbleworks 0.0.41 → 0.0.42
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/README.md +0 -6
- data/lib/bumbleworks/ruote.rb +6 -3
- data/lib/bumbleworks/version.rb +1 -1
- data/spec/lib/bumbleworks/ruote_spec.rb +22 -13
- metadata +3 -3
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
# Bumbleworks
|
2
2
|
|
3
|
-
**IMPORTANT**: Ruote (a dependency of Bumbleworks) currently has a bug in its dependency graph. Until this is fixed (and we'll update this readme when it is), make sure you add this to your gemfile:
|
4
|
-
|
5
|
-
```ruby
|
6
|
-
gem 'rufus-scheduler', '~> 2.0'
|
7
|
-
```
|
8
|
-
|
9
3
|
**NOTE**: This product is still pre-release, and implementation is *not* in sync with documentation yet - hence the pre-release version. We'll follow [the Semantic Versioning Specification (Semver)](http://semver.org/), so you can assume anything at 0.x.x still has an unstable API. But we *are* actively developing this.
|
10
4
|
|
11
5
|
Bumbleworks is a gem that adds a workflow engine (via [ruote](http://github.com/jmettraux/ruote)) to your Ruby application, and adds tools for task authorization and locking. It also establishes conventions for easily loading process definitions and registering participant classes based on configurable file locations.
|
data/lib/bumbleworks/ruote.rb
CHANGED
@@ -99,14 +99,17 @@ module Bumbleworks
|
|
99
99
|
|
100
100
|
def register_participants(&block)
|
101
101
|
dashboard.register(&block) if block
|
102
|
-
set_catchall_if_needed
|
103
102
|
register_error_handler
|
103
|
+
set_catchall_if_needed
|
104
104
|
dashboard.participant_list
|
105
105
|
end
|
106
106
|
|
107
107
|
def register_error_handler
|
108
|
-
dashboard.
|
109
|
-
|
108
|
+
unless dashboard.participant_list.any? { |part| part.regex == '^error_handler_participant$' }
|
109
|
+
error_handler_participant = ::Ruote::ParticipantEntry.new(['^error_handler_participant$', ["Bumbleworks::ErrorHandlerParticipant", {}]])
|
110
|
+
dashboard.participant_list = dashboard.participant_list.unshift(error_handler_participant)
|
111
|
+
dashboard.on_error = 'error_handler_participant'
|
112
|
+
end
|
110
113
|
end
|
111
114
|
|
112
115
|
def set_catchall_if_needed
|
data/lib/bumbleworks/version.rb
CHANGED
@@ -225,6 +225,14 @@ describe Bumbleworks::Ruote do
|
|
225
225
|
described_class.should_receive(:register_error_handler)
|
226
226
|
described_class.start_worker!
|
227
227
|
end
|
228
|
+
|
229
|
+
it 'does not add another error_handler_participant if already registered' do
|
230
|
+
described_class.register_participants
|
231
|
+
described_class.start_worker!
|
232
|
+
described_class.dashboard.participant_list.map(&:classname).should == [
|
233
|
+
'Bumbleworks::ErrorHandlerParticipant', 'Bumbleworks::StorageParticipant']
|
234
|
+
Bumbleworks.dashboard.on_error.flatten[2].should == 'error_handler_participant'
|
235
|
+
end
|
228
236
|
end
|
229
237
|
|
230
238
|
describe '.register_participants' do
|
@@ -238,8 +246,8 @@ describe Bumbleworks::Ruote do
|
|
238
246
|
described_class.dashboard.participant_list.should be_empty
|
239
247
|
described_class.register_participants ®istration_block
|
240
248
|
described_class.dashboard.participant_list.should have(5).items
|
241
|
-
described_class.dashboard.participant_list.map(&:classname).should
|
242
|
-
'
|
249
|
+
described_class.dashboard.participant_list.map(&:classname).should == [
|
250
|
+
'Bumbleworks::ErrorHandlerParticipant', 'BeesHoney', 'MapleSyrup', 'NewCatchall', 'Bumbleworks::StorageParticipant']
|
243
251
|
end
|
244
252
|
|
245
253
|
it 'does not add storage participant catchall if already exists' do
|
@@ -251,16 +259,17 @@ describe Bumbleworks::Ruote do
|
|
251
259
|
described_class.dashboard.participant_list.should be_empty
|
252
260
|
described_class.register_participants ®istration_block
|
253
261
|
described_class.dashboard.participant_list.should have(3).items
|
254
|
-
described_class.dashboard.participant_list.map(&:classname).should
|
255
|
-
'
|
262
|
+
described_class.dashboard.participant_list.map(&:classname).should == [
|
263
|
+
'Bumbleworks::ErrorHandlerParticipant', 'BeesHoney', 'Ruote::StorageParticipant'
|
256
264
|
]
|
257
265
|
end
|
258
266
|
|
259
|
-
it 'adds catchall
|
267
|
+
it 'adds catchall and error_handler participants if block is nil' do
|
260
268
|
described_class.dashboard.participant_list.should be_empty
|
261
269
|
described_class.register_participants &nil
|
262
270
|
described_class.dashboard.participant_list.should have(2).item
|
263
|
-
described_class.dashboard.participant_list.
|
271
|
+
described_class.dashboard.participant_list.map(&:classname).should ==
|
272
|
+
['Bumbleworks::ErrorHandlerParticipant', 'Bumbleworks::StorageParticipant']
|
264
273
|
end
|
265
274
|
end
|
266
275
|
|
@@ -275,14 +284,14 @@ describe Bumbleworks::Ruote do
|
|
275
284
|
Bumbleworks.dashboard.on_error.flatten[2].should == 'error_handler_participant'
|
276
285
|
end
|
277
286
|
|
278
|
-
it '
|
279
|
-
described_class.
|
280
|
-
|
281
|
-
|
287
|
+
it 'does not override existing error_handler_participant' do
|
288
|
+
described_class.register_participants do
|
289
|
+
error_handler_participant 'Whatever'
|
290
|
+
end
|
291
|
+
described_class.register_error_handler
|
292
|
+
Bumbleworks.dashboard.participant_list.map(&:classname).should ==
|
293
|
+
['Whatever', 'Bumbleworks::StorageParticipant']
|
282
294
|
|
283
|
-
it 'skip registration if error_handlers list is empty' do
|
284
|
-
described_class.stub(:error_handlers => [])
|
285
|
-
Bumbleworks.dashboard.should_not_receive(:register_participant).with(:error_handler, Bumbleworks::ErrorHandlerParticipant)
|
286
295
|
end
|
287
296
|
end
|
288
297
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bumbleworks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.42
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -242,7 +242,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
242
|
version: '0'
|
243
243
|
segments:
|
244
244
|
- 0
|
245
|
-
hash:
|
245
|
+
hash: -1259087947392220578
|
246
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
247
|
none: false
|
248
248
|
requirements:
|
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
251
|
version: '0'
|
252
252
|
segments:
|
253
253
|
- 0
|
254
|
-
hash:
|
254
|
+
hash: -1259087947392220578
|
255
255
|
requirements: []
|
256
256
|
rubyforge_project:
|
257
257
|
rubygems_version: 1.8.23
|