bumbleworks 0.0.4
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/.gitignore +2 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.watchr +89 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +84 -0
- data/LICENSE.txt +22 -0
- data/README.md +160 -0
- data/Rakefile +9 -0
- data/bumbleworks.gemspec +30 -0
- data/doc/GUIDE.md +337 -0
- data/doc/TERMS.md +9 -0
- data/lib/bumbleworks.rb +123 -0
- data/lib/bumbleworks/configuration.rb +182 -0
- data/lib/bumbleworks/hash_storage.rb +13 -0
- data/lib/bumbleworks/participant_registration.rb +19 -0
- data/lib/bumbleworks/process_definition.rb +143 -0
- data/lib/bumbleworks/ruote.rb +64 -0
- data/lib/bumbleworks/storage_adapter.rb +23 -0
- data/lib/bumbleworks/support.rb +20 -0
- data/lib/bumbleworks/task.rb +109 -0
- data/lib/bumbleworks/tree_builder.rb +60 -0
- data/lib/bumbleworks/version.rb +3 -0
- data/spec/fixtures/apps/with_default_directories/app/participants/honey_participant.rb +3 -0
- data/spec/fixtures/apps/with_default_directories/app/participants/molasses_participant.rb +3 -0
- data/spec/fixtures/apps/with_default_directories/config_initializer.rb +4 -0
- data/spec/fixtures/apps/with_default_directories/full_initializer.rb +12 -0
- data/spec/fixtures/apps/with_default_directories/lib/process_definitions/garbage_collector.rb +3 -0
- data/spec/fixtures/apps/with_default_directories/lib/process_definitions/make_honey.rb +3 -0
- data/spec/fixtures/apps/with_default_directories/lib/process_definitions/make_molasses.rb +6 -0
- data/spec/fixtures/apps/with_specified_directories/config_initializer.rb +5 -0
- data/spec/fixtures/apps/with_specified_directories/specific_directory/definitions/.gitkeep +0 -0
- data/spec/fixtures/apps/with_specified_directories/specific_directory/participants/.gitkeep +0 -0
- data/spec/fixtures/definitions/a_list_of_jams.rb +4 -0
- data/spec/fixtures/definitions/nested_folder/test_nested_process.rb +3 -0
- data/spec/fixtures/definitions/test_process.rb +5 -0
- data/spec/integration/configuration_spec.rb +43 -0
- data/spec/integration/sample_application_spec.rb +45 -0
- data/spec/lib/bumbleworks/configuration_spec.rb +162 -0
- data/spec/lib/bumbleworks/participant_registration_spec.rb +13 -0
- data/spec/lib/bumbleworks/process_definition_spec.rb +178 -0
- data/spec/lib/bumbleworks/ruote_spec.rb +107 -0
- data/spec/lib/bumbleworks/storage_adapter_spec.rb +41 -0
- data/spec/lib/bumbleworks/support_spec.rb +40 -0
- data/spec/lib/bumbleworks/task_spec.rb +274 -0
- data/spec/lib/bumbleworks/tree_builder_spec.rb +95 -0
- data/spec/lib/bumbleworks_spec.rb +133 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/support/path_helpers.rb +11 -0
- metadata +262 -0
@@ -0,0 +1,133 @@
|
|
1
|
+
describe Bumbleworks do
|
2
|
+
describe ".configure" do
|
3
|
+
it 'yields the current configuration' do
|
4
|
+
existing_configuration = described_class.configuration
|
5
|
+
described_class.configure do |c|
|
6
|
+
expect(c).to equal(existing_configuration)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'allows multiple cumulative configuration blocks' do
|
11
|
+
described_class.configure do |c|
|
12
|
+
c.root = 'pickles'
|
13
|
+
c.autostart_worker = false
|
14
|
+
end
|
15
|
+
|
16
|
+
described_class.configure do |c|
|
17
|
+
c.autostart_worker = true
|
18
|
+
end
|
19
|
+
|
20
|
+
described_class.configuration.root.should == 'pickles'
|
21
|
+
described_class.configuration.autostart_worker.should == true
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'requires a block' do
|
25
|
+
expect { described_class.configure }.to raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe ".configure!" do
|
30
|
+
it 'resets configuration and yields new configuration' do
|
31
|
+
existing_configuration = described_class.configuration
|
32
|
+
described_class.configure! do |c|
|
33
|
+
expect(c).not_to equal(existing_configuration)
|
34
|
+
expect(c).to equal(described_class.configuration)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '.storage' do
|
40
|
+
it 'can set directly' do
|
41
|
+
storage = double("Storage")
|
42
|
+
Bumbleworks.storage = storage
|
43
|
+
Bumbleworks.storage.should == storage
|
44
|
+
Bumbleworks.configuration.storage.should == storage
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'can set with a block' do
|
48
|
+
storage = double("Storage")
|
49
|
+
Bumbleworks.configure {|c| c.storage = storage }
|
50
|
+
Bumbleworks.storage.should == storage
|
51
|
+
Bumbleworks.configuration.storage.should == storage
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '.register_participants' do
|
56
|
+
it 'stores the block' do
|
57
|
+
participant_block = lambda { bees_honey 'BeesHoney' }
|
58
|
+
described_class.register_participants &participant_block
|
59
|
+
described_class.instance_variable_get('@participant_block').should == participant_block
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '.start!' do
|
64
|
+
before :each do
|
65
|
+
described_class.reset!
|
66
|
+
Bumbleworks::ParticipantRegistration.stub(:autoload_all)
|
67
|
+
described_class.stub(:load_process_definitions)
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'registers pre-configured participants with ruote' do
|
71
|
+
the_block = lambda {}
|
72
|
+
described_class.register_participants &the_block
|
73
|
+
Bumbleworks::Ruote.should_receive(:register_participants).with(&the_block)
|
74
|
+
described_class.start!
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'registers process definitions with dashboard' do
|
78
|
+
described_class.storage = {}
|
79
|
+
described_class.should_receive(:load_process_definitions)
|
80
|
+
described_class.start!
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'does not automatically start a worker by default' do
|
84
|
+
described_class.storage = {}
|
85
|
+
described_class.start!
|
86
|
+
Bumbleworks::Ruote.dashboard.worker.should be_nil
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'starts a worker if autostart_worker config setting is true' do
|
90
|
+
described_class.storage = {}
|
91
|
+
described_class.autostart_worker = true
|
92
|
+
described_class.start!
|
93
|
+
Bumbleworks::Ruote.dashboard.worker.should_not be_nil
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '.configuration' do
|
98
|
+
before :each do
|
99
|
+
Bumbleworks.reset!
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'creates an instance of Bumbleworks::Configuration' do
|
103
|
+
described_class.configuration.should be_an_instance_of(Bumbleworks::Configuration)
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'returns the same instance when called multiple times' do
|
107
|
+
configuration = described_class.configuration
|
108
|
+
described_class.configuration.should == configuration
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'automatically adds Redis adapter if defined' do
|
112
|
+
stub_const('Bumbleworks::Redis::Adapter', Bumbleworks::StorageAdapter)
|
113
|
+
described_class.configuration.storage_adapters.should include(Bumbleworks::Redis::Adapter)
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'automatically adds Sequel adapter if defined' do
|
117
|
+
stub_const('Bumbleworks::Sequel::Adapter', Bumbleworks::StorageAdapter)
|
118
|
+
described_class.configuration.storage_adapters.should include(Bumbleworks::Sequel::Adapter)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe 'Bumbleworks::Ruote delegation' do
|
123
|
+
it 'includes dashboard' do
|
124
|
+
Bumbleworks::Ruote.should_receive(:dashboard).and_return(:oh_goodness_me)
|
125
|
+
Bumbleworks.dashboard.should == :oh_goodness_me
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'includes start_worker' do
|
129
|
+
Bumbleworks::Ruote.should_receive(:start_worker!).and_return(:lets_do_it)
|
130
|
+
Bumbleworks.start_worker!.should == :lets_do_it
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
4
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
5
|
+
# in spec/support/ and its subdirectories.
|
6
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
7
|
+
|
8
|
+
require './lib/bumbleworks'
|
9
|
+
Bumbleworks.env = 'test'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
17
|
+
# the seed, which is printed after each run.
|
18
|
+
# --seed 1234
|
19
|
+
config.order = 'random'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bumbleworks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Maher Hawash
|
9
|
+
- Ravi Gadad
|
10
|
+
- Laurie Kemmerer
|
11
|
+
- David Miller
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: ruote
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.3'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rake
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rspec
|
67
|
+
requirement: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
type: :development
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: watchr
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: debugger
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: sqlite3
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: simplecov
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
type: :development
|
138
|
+
prerelease: false
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
description: Bumbleworks adds a workflow engine (via ruote[http://github.com/jmettraux/ruote]
|
146
|
+
to your application.
|
147
|
+
email:
|
148
|
+
- mhawash@renewfund.com
|
149
|
+
- ravi@renewfund.com
|
150
|
+
- laurie@renewfund.com
|
151
|
+
- dave.miller@renewfund.com
|
152
|
+
executables: []
|
153
|
+
extensions: []
|
154
|
+
extra_rdoc_files: []
|
155
|
+
files:
|
156
|
+
- .gitignore
|
157
|
+
- .rspec
|
158
|
+
- .ruby-version
|
159
|
+
- .watchr
|
160
|
+
- Gemfile
|
161
|
+
- Gemfile.lock
|
162
|
+
- LICENSE.txt
|
163
|
+
- README.md
|
164
|
+
- Rakefile
|
165
|
+
- bumbleworks.gemspec
|
166
|
+
- doc/GUIDE.md
|
167
|
+
- doc/TERMS.md
|
168
|
+
- lib/bumbleworks.rb
|
169
|
+
- lib/bumbleworks/configuration.rb
|
170
|
+
- lib/bumbleworks/hash_storage.rb
|
171
|
+
- lib/bumbleworks/participant_registration.rb
|
172
|
+
- lib/bumbleworks/process_definition.rb
|
173
|
+
- lib/bumbleworks/ruote.rb
|
174
|
+
- lib/bumbleworks/storage_adapter.rb
|
175
|
+
- lib/bumbleworks/support.rb
|
176
|
+
- lib/bumbleworks/task.rb
|
177
|
+
- lib/bumbleworks/tree_builder.rb
|
178
|
+
- lib/bumbleworks/version.rb
|
179
|
+
- spec/fixtures/apps/with_default_directories/app/participants/honey_participant.rb
|
180
|
+
- spec/fixtures/apps/with_default_directories/app/participants/molasses_participant.rb
|
181
|
+
- spec/fixtures/apps/with_default_directories/config_initializer.rb
|
182
|
+
- spec/fixtures/apps/with_default_directories/full_initializer.rb
|
183
|
+
- spec/fixtures/apps/with_default_directories/lib/process_definitions/garbage_collector.rb
|
184
|
+
- spec/fixtures/apps/with_default_directories/lib/process_definitions/make_honey.rb
|
185
|
+
- spec/fixtures/apps/with_default_directories/lib/process_definitions/make_molasses.rb
|
186
|
+
- spec/fixtures/apps/with_specified_directories/config_initializer.rb
|
187
|
+
- spec/fixtures/apps/with_specified_directories/specific_directory/definitions/.gitkeep
|
188
|
+
- spec/fixtures/apps/with_specified_directories/specific_directory/participants/.gitkeep
|
189
|
+
- spec/fixtures/definitions/a_list_of_jams.rb
|
190
|
+
- spec/fixtures/definitions/nested_folder/test_nested_process.rb
|
191
|
+
- spec/fixtures/definitions/test_process.rb
|
192
|
+
- spec/integration/configuration_spec.rb
|
193
|
+
- spec/integration/sample_application_spec.rb
|
194
|
+
- spec/lib/bumbleworks/configuration_spec.rb
|
195
|
+
- spec/lib/bumbleworks/participant_registration_spec.rb
|
196
|
+
- spec/lib/bumbleworks/process_definition_spec.rb
|
197
|
+
- spec/lib/bumbleworks/ruote_spec.rb
|
198
|
+
- spec/lib/bumbleworks/storage_adapter_spec.rb
|
199
|
+
- spec/lib/bumbleworks/support_spec.rb
|
200
|
+
- spec/lib/bumbleworks/task_spec.rb
|
201
|
+
- spec/lib/bumbleworks/tree_builder_spec.rb
|
202
|
+
- spec/lib/bumbleworks_spec.rb
|
203
|
+
- spec/spec_helper.rb
|
204
|
+
- spec/support/path_helpers.rb
|
205
|
+
homepage: ''
|
206
|
+
licenses:
|
207
|
+
- MIT
|
208
|
+
post_install_message:
|
209
|
+
rdoc_options: []
|
210
|
+
require_paths:
|
211
|
+
- lib
|
212
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
+
none: false
|
214
|
+
requirements:
|
215
|
+
- - ! '>='
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '0'
|
218
|
+
segments:
|
219
|
+
- 0
|
220
|
+
hash: 3704003548247520954
|
221
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
|
+
none: false
|
223
|
+
requirements:
|
224
|
+
- - ! '>='
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '0'
|
227
|
+
segments:
|
228
|
+
- 0
|
229
|
+
hash: 3704003548247520954
|
230
|
+
requirements: []
|
231
|
+
rubyforge_project:
|
232
|
+
rubygems_version: 1.8.23
|
233
|
+
signing_key:
|
234
|
+
specification_version: 3
|
235
|
+
summary: Framework around ruote[http://github.com/jmettraux/ruote] workflow engine
|
236
|
+
test_files:
|
237
|
+
- spec/fixtures/apps/with_default_directories/app/participants/honey_participant.rb
|
238
|
+
- spec/fixtures/apps/with_default_directories/app/participants/molasses_participant.rb
|
239
|
+
- spec/fixtures/apps/with_default_directories/config_initializer.rb
|
240
|
+
- spec/fixtures/apps/with_default_directories/full_initializer.rb
|
241
|
+
- spec/fixtures/apps/with_default_directories/lib/process_definitions/garbage_collector.rb
|
242
|
+
- spec/fixtures/apps/with_default_directories/lib/process_definitions/make_honey.rb
|
243
|
+
- spec/fixtures/apps/with_default_directories/lib/process_definitions/make_molasses.rb
|
244
|
+
- spec/fixtures/apps/with_specified_directories/config_initializer.rb
|
245
|
+
- spec/fixtures/apps/with_specified_directories/specific_directory/definitions/.gitkeep
|
246
|
+
- spec/fixtures/apps/with_specified_directories/specific_directory/participants/.gitkeep
|
247
|
+
- spec/fixtures/definitions/a_list_of_jams.rb
|
248
|
+
- spec/fixtures/definitions/nested_folder/test_nested_process.rb
|
249
|
+
- spec/fixtures/definitions/test_process.rb
|
250
|
+
- spec/integration/configuration_spec.rb
|
251
|
+
- spec/integration/sample_application_spec.rb
|
252
|
+
- spec/lib/bumbleworks/configuration_spec.rb
|
253
|
+
- spec/lib/bumbleworks/participant_registration_spec.rb
|
254
|
+
- spec/lib/bumbleworks/process_definition_spec.rb
|
255
|
+
- spec/lib/bumbleworks/ruote_spec.rb
|
256
|
+
- spec/lib/bumbleworks/storage_adapter_spec.rb
|
257
|
+
- spec/lib/bumbleworks/support_spec.rb
|
258
|
+
- spec/lib/bumbleworks/task_spec.rb
|
259
|
+
- spec/lib/bumbleworks/tree_builder_spec.rb
|
260
|
+
- spec/lib/bumbleworks_spec.rb
|
261
|
+
- spec/spec_helper.rb
|
262
|
+
- spec/support/path_helpers.rb
|