bumbleworks 0.0.53 → 0.0.54
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/README.md +19 -4
- data/lib/bumbleworks/configuration.rb +37 -23
- data/lib/bumbleworks/version.rb +1 -1
- data/spec/fixtures/apps/with_default_directories/{lib/bumbleworks/participants → participants}/honey_participant.rb +0 -0
- data/spec/fixtures/apps/with_default_directories/{lib/bumbleworks/participants → participants}/molasses_participant.rb +0 -0
- data/spec/fixtures/apps/with_default_directories/{lib/bumbleworks/process_definitions → process_definitions}/garbage_collector.rb +0 -0
- data/spec/fixtures/apps/with_default_directories/{lib/bumbleworks/process_definitions → process_definitions}/make_honey.rb +0 -0
- data/spec/fixtures/apps/with_default_directories/{lib/bumbleworks/process_definitions → process_definitions}/make_molasses.rb +0 -0
- data/spec/fixtures/apps/with_default_directories/{lib/bumbleworks/tasks → tasks}/make_some_honey_task.rb +0 -0
- data/spec/fixtures/apps/with_default_directories/{lib/bumbleworks/tasks → tasks}/taste_that_molasses_task.rb +0 -0
- data/spec/integration/example_configurations_spec.rb +2 -2
- data/spec/lib/bumbleworks/configuration_spec.rb +16 -16
- data/spec/lib/bumbleworks/participant_registration_spec.rb +2 -2
- data/spec/lib/bumbleworks/task_spec.rb +2 -2
- metadata +18 -18
data/README.md
CHANGED
@@ -96,7 +96,7 @@ If you want to use Sequel:
|
|
96
96
|
|
97
97
|
Bumbleworks uses [ruote](http://github.com/jmettraux/ruote), which allows process definitions to be written using a [Ruby DSL](http://ruote.rubyforge.org/definitions.html#ruby).
|
98
98
|
|
99
|
-
By default, your process definitions will be loaded from the `
|
99
|
+
By default, your process definitions will be loaded from the `processes` or `process_definitions` directory at `Bumbleworks.root` (see Determining the Root Directory for more info). This directory can have as many subdirectories as you want, and Bumbleworks will load everything recursively; note, however, that the directory hierarchy doesn't mean anything to Bumbleworks, and is only for your own organization. The directory is configurable by setting Bumbleworks.definitions_directory:
|
100
100
|
|
101
101
|
```ruby
|
102
102
|
Bumbleworks.configure do |c|
|
@@ -109,7 +109,7 @@ Note that if you override the default path, you can either specify an absolute p
|
|
109
109
|
|
110
110
|
### Participant Class Directory
|
111
111
|
|
112
|
-
If your app has a `participants`
|
112
|
+
If your app has a `participants` directory at Bumbleworks.root (see Determining the Root Directory), Bumbleworks will require all files in that directory by default before running your `register_participants` block (see below). You can customize this directory by setting Bumbleworks.participants_directory:
|
113
113
|
|
114
114
|
```ruby
|
115
115
|
Bumbleworks.configure do |c|
|
@@ -118,11 +118,26 @@ Bumbleworks.configure do |c|
|
|
118
118
|
end
|
119
119
|
```
|
120
120
|
|
121
|
+
### Task Class Directory
|
122
|
+
|
123
|
+
If your app has a `tasks` directory at Bumbleworks.root (see Determining the Root Directory), Bumbleworks will require all files in that directory when you run `Bumbleworks.register_tasks`. You can customize this directory by setting Bumbleworks.tasks_directory:
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
Bumbleworks.configure do |c|
|
127
|
+
c.tasks_directory = '/absolute/path/to/your/task/class/files'
|
128
|
+
# ...
|
129
|
+
end
|
130
|
+
```
|
131
|
+
|
121
132
|
### Determining the Root Directory
|
122
133
|
|
123
|
-
By default, Bumbleworks will attempt in several ways to find your root directory. In the most common cases (Rails, Sinatra, or Rory), it usually won't have trouble guessing the directory.
|
134
|
+
By default, Bumbleworks will attempt in several ways to find your root directory. In the most common cases (Rails, Sinatra, or Rory), it usually won't have trouble guessing the directory. The default `Bumbleworks.root` directory will be the framework's root with `lib/bumbleworks` appended.
|
124
135
|
|
125
|
-
If you're not using Rails, Sinatra, or Rory,
|
136
|
+
If you're not using Rails, Sinatra, or Rory, and you haven't explicitly set `Bumbleworks.root`, Bumbleworks will complain when you call any of the following methods:
|
137
|
+
- `Bumbleworks.load_definitions!`
|
138
|
+
- `Bumbleworks.register_tasks`
|
139
|
+
- `Bumbleworks.register_participants`
|
140
|
+
... **unless** your definitions directory, tasks directory, and participants directory (see above) are specified as absolute paths.
|
126
141
|
|
127
142
|
## Usage
|
128
143
|
|
@@ -26,15 +26,24 @@ module Bumbleworks
|
|
26
26
|
end
|
27
27
|
|
28
28
|
|
29
|
-
# Path to the root folder where Bumbleworks assets can be found.
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
29
|
+
# Path to the root folder where Bumbleworks assets can be found. By default,
|
30
|
+
# this path will be the root returned by the detected framework (see the
|
31
|
+
# #root method below), with "/lib/bumbleworks" appended, but you can override
|
32
|
+
# this by defining root explicitly.
|
33
|
+
# The definitions, tasks, and participants directories should exist here, if
|
34
|
+
# you're using the defaults for these directories, or if they're overridden
|
35
|
+
# with relative paths. So in a default install, the hierarchy should look
|
36
|
+
# like this:
|
37
|
+
# [defined root, or framework root]
|
38
|
+
# /lib
|
39
|
+
# /bumbleworks
|
40
|
+
# /participants
|
41
|
+
# /processes
|
42
|
+
# /tasks
|
35
43
|
#
|
36
|
-
# default:
|
37
|
-
# Exceptions: raises Bumbleworks::UndefinedSetting if
|
44
|
+
# default: ${Framework root}/lib/bumbleworks (or no default if not in framework)
|
45
|
+
# Exceptions: raises Bumbleworks::UndefinedSetting if no framework and not
|
46
|
+
# defined by the client
|
38
47
|
#
|
39
48
|
define_setting :root
|
40
49
|
|
@@ -42,14 +51,14 @@ module Bumbleworks
|
|
42
51
|
# will load all definition files by recursively traversing the directory
|
43
52
|
# tree under this folder. No specific loading order is guaranteed
|
44
53
|
#
|
45
|
-
# default: ${Bumbleworks.root}/
|
54
|
+
# default: ${Bumbleworks.root}/process_definitions then ${Bumbleworks.root}/processes
|
46
55
|
define_setting :definitions_directory
|
47
56
|
|
48
57
|
# Path to the folder which holds the ruote participant files. Bumbleworks
|
49
58
|
# will recursively traverse the directory tree under this folder and ensure
|
50
59
|
# that all found files are autoloaded before registration of participants.
|
51
60
|
#
|
52
|
-
# default: ${Bumbleworks.root}/
|
61
|
+
# default: ${Bumbleworks.root}/participants
|
53
62
|
define_setting :participants_directory
|
54
63
|
|
55
64
|
# Path to the folder which holds the optional task module files, which are
|
@@ -57,7 +66,7 @@ module Bumbleworks
|
|
57
66
|
# callbacks). Bumbleworks will recursively traverse the directory tree under
|
58
67
|
# this folder and ensure that all found files are autoloaded.
|
59
68
|
#
|
60
|
-
# default: ${Bumbleworks.root}/
|
69
|
+
# default: ${Bumbleworks.root}/tasks
|
61
70
|
define_setting :tasks_directory
|
62
71
|
|
63
72
|
# Bumbleworks requires a dedicated key-value storage for process information. Three
|
@@ -192,18 +201,14 @@ module Bumbleworks
|
|
192
201
|
# Bumbleworks.root = '/somewhere/else/'
|
193
202
|
#
|
194
203
|
# If the root is not defined, Bumbleworks will use the root of known
|
195
|
-
# frameworks (Rails, Sinatra and Rory)
|
196
|
-
# error if not defined.
|
204
|
+
# frameworks (Rails, Sinatra and Rory), appending "lib/bumbleworks".
|
205
|
+
# Otherwise, it will raise an error if not defined.
|
197
206
|
#
|
198
207
|
def root
|
199
|
-
@root ||=
|
200
|
-
|
201
|
-
|
202
|
-
when defined?(Padrino) then Padrino.root
|
203
|
-
when defined?(Sinatra::Application) then Sinatra::Application.root
|
208
|
+
@root ||= begin
|
209
|
+
raise UndefinedSetting.new("Bumbleworks.root must be set") unless framework_root
|
210
|
+
File.join(framework_root, "lib", "bumbleworks")
|
204
211
|
end
|
205
|
-
raise UndefinedSetting.new("Bumbleworks.root must be set") unless @root
|
206
|
-
@root
|
207
212
|
end
|
208
213
|
|
209
214
|
# Add a storage adapter to the set of possible adapters. Takes an object
|
@@ -257,18 +262,27 @@ module Bumbleworks
|
|
257
262
|
self.class.defined_settings
|
258
263
|
end
|
259
264
|
|
265
|
+
def framework_root
|
266
|
+
case
|
267
|
+
when defined?(Rails) then Rails.root
|
268
|
+
when defined?(Rory) then Rory.root
|
269
|
+
when defined?(Padrino) then Padrino.root
|
270
|
+
when defined?(Sinatra::Application) then Sinatra::Application.root
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
260
274
|
def default_definition_directory
|
261
|
-
default_folders = ['
|
275
|
+
default_folders = ['process_definitions', 'processes']
|
262
276
|
find_folder(default_folders, @definitions_directory, "Definitions folder not found")
|
263
277
|
end
|
264
278
|
|
265
279
|
def default_participant_directory
|
266
|
-
default_folders = ['
|
280
|
+
default_folders = ['participants']
|
267
281
|
find_folder(default_folders, @participants_directory, "Participants folder not found")
|
268
282
|
end
|
269
283
|
|
270
284
|
def default_tasks_directory
|
271
|
-
default_folders = ['
|
285
|
+
default_folders = ['tasks']
|
272
286
|
find_folder(default_folders, @tasks_directory, "Tasks folder not found")
|
273
287
|
end
|
274
288
|
|
data/lib/bumbleworks/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -19,7 +19,7 @@ describe Bumbleworks::Configuration do
|
|
19
19
|
|
20
20
|
it 'returns default directory when not set in configuration' do
|
21
21
|
load default_initializer
|
22
|
-
Bumbleworks.definitions_directory.should == File.join(default_app_path, '
|
22
|
+
Bumbleworks.definitions_directory.should == File.join(default_app_path, 'process_definitions')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -31,7 +31,7 @@ describe Bumbleworks::Configuration do
|
|
31
31
|
|
32
32
|
it 'returns default directory when not set in configuration' do
|
33
33
|
load default_initializer
|
34
|
-
Bumbleworks.participants_directory.should == File.join(default_app_path, '
|
34
|
+
Bumbleworks.participants_directory.should == File.join(default_app_path, 'participants')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -21,7 +21,7 @@ describe Bumbleworks::Configuration do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
configuration.root.should == '/Rails/Root'
|
24
|
+
configuration.root.should == '/Rails/Root/lib/bumbleworks'
|
25
25
|
Object.send(:remove_const, :Rails)
|
26
26
|
end
|
27
27
|
|
@@ -32,7 +32,7 @@ describe Bumbleworks::Configuration do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
configuration.root.should == '/Padrino/Root'
|
35
|
+
configuration.root.should == '/Padrino/Root/lib/bumbleworks'
|
36
36
|
Object.send(:remove_const, :Padrino)
|
37
37
|
end
|
38
38
|
|
@@ -45,7 +45,7 @@ describe Bumbleworks::Configuration do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
configuration.root.should == '/Sinatra/Root'
|
48
|
+
configuration.root.should == '/Sinatra/Root/lib/bumbleworks'
|
49
49
|
Object.send(:remove_const, :Sinatra)
|
50
50
|
end
|
51
51
|
|
@@ -56,7 +56,7 @@ describe Bumbleworks::Configuration do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
configuration.root.should == '/Rory/Root'
|
59
|
+
configuration.root.should == '/Rory/Root/lib/bumbleworks'
|
60
60
|
Object.send(:remove_const, :Rory)
|
61
61
|
end
|
62
62
|
|
@@ -82,14 +82,14 @@ describe Bumbleworks::Configuration do
|
|
82
82
|
it 'returns the default folder if not set by client app' do
|
83
83
|
File.stub(:directory? => true)
|
84
84
|
configuration.root = '/Root'
|
85
|
-
configuration.definitions_directory.should == '/Root/
|
85
|
+
configuration.definitions_directory.should == '/Root/process_definitions'
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'returns the second default folder if first does not exist' do
|
89
|
-
File.stub(:directory?).with('/Root/
|
90
|
-
File.stub(:directory?).with('/Root/
|
89
|
+
File.stub(:directory?).with('/Root/process_definitions').and_return(false)
|
90
|
+
File.stub(:directory?).with('/Root/processes').and_return(true)
|
91
91
|
configuration.root = '/Root'
|
92
|
-
configuration.definitions_directory.should == '/Root/
|
92
|
+
configuration.definitions_directory.should == '/Root/processes'
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'raises an error if default folder not found' do
|
@@ -98,7 +98,7 @@ describe Bumbleworks::Configuration do
|
|
98
98
|
configuration.definitions_directory
|
99
99
|
}.to raise_error(
|
100
100
|
Bumbleworks::InvalidSetting,
|
101
|
-
"Definitions folder not found (looked in
|
101
|
+
"Definitions folder not found (looked in process_definitions, processes)"
|
102
102
|
)
|
103
103
|
end
|
104
104
|
|
@@ -121,9 +121,9 @@ describe Bumbleworks::Configuration do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'returns the default folder if not set by client app' do
|
124
|
-
File.stub(:directory?).with('/Root/
|
124
|
+
File.stub(:directory?).with('/Root/participants').and_return(true)
|
125
125
|
configuration.root = '/Root'
|
126
|
-
configuration.participants_directory.should == '/Root/
|
126
|
+
configuration.participants_directory.should == '/Root/participants'
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'raises an error if default folder not found' do
|
@@ -132,7 +132,7 @@ describe Bumbleworks::Configuration do
|
|
132
132
|
configuration.participants_directory
|
133
133
|
}.to raise_error(
|
134
134
|
Bumbleworks::InvalidSetting,
|
135
|
-
"Participants folder not found (looked in
|
135
|
+
"Participants folder not found (looked in participants)"
|
136
136
|
)
|
137
137
|
end
|
138
138
|
|
@@ -155,9 +155,9 @@ describe Bumbleworks::Configuration do
|
|
155
155
|
end
|
156
156
|
|
157
157
|
it 'returns the default folder if not set by client app' do
|
158
|
-
File.stub(:directory?).with('/Root/
|
158
|
+
File.stub(:directory?).with('/Root/tasks').and_return(true)
|
159
159
|
configuration.root = '/Root'
|
160
|
-
configuration.tasks_directory.should == '/Root/
|
160
|
+
configuration.tasks_directory.should == '/Root/tasks'
|
161
161
|
end
|
162
162
|
|
163
163
|
it 'raises an error if default folder not found' do
|
@@ -166,7 +166,7 @@ describe Bumbleworks::Configuration do
|
|
166
166
|
configuration.tasks_directory
|
167
167
|
}.to raise_error(
|
168
168
|
Bumbleworks::InvalidSetting,
|
169
|
-
"Tasks folder not found (looked in
|
169
|
+
"Tasks folder not found (looked in tasks)"
|
170
170
|
)
|
171
171
|
end
|
172
172
|
|
@@ -287,7 +287,7 @@ describe Bumbleworks::Configuration do
|
|
287
287
|
configuration.clear!
|
288
288
|
|
289
289
|
configuration.root = '/Root'
|
290
|
-
configuration.definitions_directory.should == '/Root/
|
290
|
+
configuration.definitions_directory.should == '/Root/process_definitions'
|
291
291
|
end
|
292
292
|
end
|
293
293
|
|
@@ -4,9 +4,9 @@ describe Bumbleworks::ParticipantRegistration do
|
|
4
4
|
Bumbleworks.reset!
|
5
5
|
Bumbleworks.root = File.join(fixtures_path, 'apps', 'with_default_directories')
|
6
6
|
Object.should_receive(:autoload).with(:HoneyParticipant,
|
7
|
-
File.join(Bumbleworks.root, '
|
7
|
+
File.join(Bumbleworks.root, 'participants', 'honey_participant.rb'))
|
8
8
|
Object.should_receive(:autoload).with(:MolassesParticipant,
|
9
|
-
File.join(Bumbleworks.root, '
|
9
|
+
File.join(Bumbleworks.root, 'participants', 'molasses_participant.rb'))
|
10
10
|
Bumbleworks::ParticipantRegistration.autoload_all
|
11
11
|
end
|
12
12
|
end
|
@@ -31,9 +31,9 @@ describe Bumbleworks::Task do
|
|
31
31
|
it 'autoloads all task modules in directory' do
|
32
32
|
Bumbleworks.root = File.join(fixtures_path, 'apps', 'with_default_directories')
|
33
33
|
Object.should_receive(:autoload).with(:MakeSomeHoneyTask,
|
34
|
-
File.join(Bumbleworks.root, '
|
34
|
+
File.join(Bumbleworks.root, 'tasks', 'make_some_honey_task.rb'))
|
35
35
|
Object.should_receive(:autoload).with(:TasteThatMolassesTask,
|
36
|
-
File.join(Bumbleworks.root, '
|
36
|
+
File.join(Bumbleworks.root, 'tasks', 'taste_that_molasses_task.rb'))
|
37
37
|
Bumbleworks::Task.autoload_all
|
38
38
|
end
|
39
39
|
end
|
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.54
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ruote
|
@@ -197,13 +197,13 @@ files:
|
|
197
197
|
- lib/tasks/bumbleworks.rake
|
198
198
|
- spec/fixtures/apps/with_default_directories/config_initializer.rb
|
199
199
|
- spec/fixtures/apps/with_default_directories/full_initializer.rb
|
200
|
-
- spec/fixtures/apps/with_default_directories/
|
201
|
-
- spec/fixtures/apps/with_default_directories/
|
202
|
-
- spec/fixtures/apps/with_default_directories/
|
203
|
-
- spec/fixtures/apps/with_default_directories/
|
204
|
-
- spec/fixtures/apps/with_default_directories/
|
205
|
-
- spec/fixtures/apps/with_default_directories/
|
206
|
-
- spec/fixtures/apps/with_default_directories/
|
200
|
+
- spec/fixtures/apps/with_default_directories/participants/honey_participant.rb
|
201
|
+
- spec/fixtures/apps/with_default_directories/participants/molasses_participant.rb
|
202
|
+
- spec/fixtures/apps/with_default_directories/process_definitions/garbage_collector.rb
|
203
|
+
- spec/fixtures/apps/with_default_directories/process_definitions/make_honey.rb
|
204
|
+
- spec/fixtures/apps/with_default_directories/process_definitions/make_molasses.rb
|
205
|
+
- spec/fixtures/apps/with_default_directories/tasks/make_some_honey_task.rb
|
206
|
+
- spec/fixtures/apps/with_default_directories/tasks/taste_that_molasses_task.rb
|
207
207
|
- spec/fixtures/apps/with_specified_directories/config_initializer.rb
|
208
208
|
- spec/fixtures/apps/with_specified_directories/specific_directory/definitions/.gitkeep
|
209
209
|
- spec/fixtures/apps/with_specified_directories/specific_directory/participants/.gitkeep
|
@@ -258,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
segments:
|
260
260
|
- 0
|
261
|
-
hash:
|
261
|
+
hash: 4188325697829611705
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
none: false
|
264
264
|
requirements:
|
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
version: '0'
|
268
268
|
segments:
|
269
269
|
- 0
|
270
|
-
hash:
|
270
|
+
hash: 4188325697829611705
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
273
|
rubygems_version: 1.8.23
|
@@ -277,13 +277,13 @@ summary: Framework around ruote[http://github.com/jmettraux/ruote] workflow engi
|
|
277
277
|
test_files:
|
278
278
|
- spec/fixtures/apps/with_default_directories/config_initializer.rb
|
279
279
|
- spec/fixtures/apps/with_default_directories/full_initializer.rb
|
280
|
-
- spec/fixtures/apps/with_default_directories/
|
281
|
-
- spec/fixtures/apps/with_default_directories/
|
282
|
-
- spec/fixtures/apps/with_default_directories/
|
283
|
-
- spec/fixtures/apps/with_default_directories/
|
284
|
-
- spec/fixtures/apps/with_default_directories/
|
285
|
-
- spec/fixtures/apps/with_default_directories/
|
286
|
-
- spec/fixtures/apps/with_default_directories/
|
280
|
+
- spec/fixtures/apps/with_default_directories/participants/honey_participant.rb
|
281
|
+
- spec/fixtures/apps/with_default_directories/participants/molasses_participant.rb
|
282
|
+
- spec/fixtures/apps/with_default_directories/process_definitions/garbage_collector.rb
|
283
|
+
- spec/fixtures/apps/with_default_directories/process_definitions/make_honey.rb
|
284
|
+
- spec/fixtures/apps/with_default_directories/process_definitions/make_molasses.rb
|
285
|
+
- spec/fixtures/apps/with_default_directories/tasks/make_some_honey_task.rb
|
286
|
+
- spec/fixtures/apps/with_default_directories/tasks/taste_that_molasses_task.rb
|
287
287
|
- spec/fixtures/apps/with_specified_directories/config_initializer.rb
|
288
288
|
- spec/fixtures/apps/with_specified_directories/specific_directory/definitions/.gitkeep
|
289
289
|
- spec/fixtures/apps/with_specified_directories/specific_directory/participants/.gitkeep
|