bumbleworks 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
@@ -125,12 +125,13 @@ module Bumbleworks
|
|
125
125
|
#
|
126
126
|
def root
|
127
127
|
@root ||= case
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
raise UndefinedSetting.new("Bumbleworks.root must be set") unless @root
|
128
|
+
when defined?(Rails) then Rails.root
|
129
|
+
when defined?(Rory) then Rory.root
|
130
|
+
when defined?(Padrino) then Padrino.root
|
131
|
+
when defined?(Sinatra::Application) then Sinatra::Application.root
|
133
132
|
end
|
133
|
+
raise UndefinedSetting.new("Bumbleworks.root must be set") unless @root
|
134
|
+
@root
|
134
135
|
end
|
135
136
|
|
136
137
|
# Add a storage adapter to the set of possible adapters. Takes an object
|
@@ -176,22 +177,26 @@ module Bumbleworks
|
|
176
177
|
find_folder(default_folders, @tasks_directory, "Tasks folder not found")
|
177
178
|
end
|
178
179
|
|
179
|
-
def find_folder(default_directories,
|
180
|
-
|
181
|
-
|
182
|
-
defined_directory =
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
next
|
189
|
-
|
180
|
+
def find_folder(default_directories, user_defined_directory, message)
|
181
|
+
if user_defined_directory
|
182
|
+
# use user-defined directory if specified
|
183
|
+
defined_directory = if user_defined_directory[0] == '/'
|
184
|
+
user_defined_directory
|
185
|
+
else
|
186
|
+
File.join(root, user_defined_directory)
|
187
|
+
end
|
188
|
+
else
|
189
|
+
# next look in default directory structure
|
190
|
+
defined_directory = default_directories.detect do |default_folder|
|
191
|
+
folder = File.join(root, default_folder)
|
192
|
+
next unless File.directory?(folder)
|
193
|
+
break folder
|
194
|
+
end
|
190
195
|
end
|
191
196
|
|
192
197
|
return defined_directory if File.directory?(defined_directory.to_s)
|
193
198
|
|
194
|
-
raise Bumbleworks::InvalidSetting, "#{message}
|
199
|
+
raise Bumbleworks::InvalidSetting, "#{message} (looked in #{user_defined_directory || default_directories.join(', ')})"
|
195
200
|
end
|
196
201
|
end
|
197
202
|
end
|
data/lib/bumbleworks/task.rb
CHANGED
data/lib/bumbleworks/version.rb
CHANGED
@@ -25,6 +25,17 @@ describe Bumbleworks::Configuration do
|
|
25
25
|
Object.send(:remove_const, :Rails)
|
26
26
|
end
|
27
27
|
|
28
|
+
it 'uses Padrino.root if defined' do
|
29
|
+
class Padrino
|
30
|
+
def self.root
|
31
|
+
'/Padrino/Root'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
configuration.root.should == '/Padrino/Root'
|
36
|
+
Object.send(:remove_const, :Padrino)
|
37
|
+
end
|
38
|
+
|
28
39
|
it 'uses Sinatra::Application.root if defined' do
|
29
40
|
class Sinatra
|
30
41
|
class Application
|
@@ -48,6 +59,17 @@ describe Bumbleworks::Configuration do
|
|
48
59
|
configuration.root.should == '/Rory/Root'
|
49
60
|
Object.send(:remove_const, :Rory)
|
50
61
|
end
|
62
|
+
|
63
|
+
it 'raises error if automatic root detection returns nil' do
|
64
|
+
class Rails
|
65
|
+
def self.root
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
expect{configuration.root}.to raise_error Bumbleworks::UndefinedSetting
|
71
|
+
Object.send(:remove_const, :Rails)
|
72
|
+
end
|
51
73
|
end
|
52
74
|
|
53
75
|
describe "#definitions_directory" do
|
@@ -72,12 +94,22 @@ describe Bumbleworks::Configuration do
|
|
72
94
|
|
73
95
|
it 'raises an error if default folder not found' do
|
74
96
|
configuration.root = '/Root'
|
75
|
-
expect{
|
97
|
+
expect {
|
98
|
+
configuration.definitions_directory
|
99
|
+
}.to raise_error(
|
100
|
+
Bumbleworks::InvalidSetting,
|
101
|
+
"Definitions folder not found (looked in lib/bumbleworks/process_definitions, lib/bumbleworks/processes)"
|
102
|
+
)
|
76
103
|
end
|
77
104
|
|
78
105
|
it 'raises an error if specific folder not found' do
|
79
106
|
configuration.definitions_directory = '/mumbo/jumbo'
|
80
|
-
expect{
|
107
|
+
expect {
|
108
|
+
configuration.definitions_directory
|
109
|
+
}.to raise_error(
|
110
|
+
Bumbleworks::InvalidSetting,
|
111
|
+
"Definitions folder not found (looked in /mumbo/jumbo)"
|
112
|
+
)
|
81
113
|
end
|
82
114
|
end
|
83
115
|
|
@@ -96,12 +128,22 @@ describe Bumbleworks::Configuration do
|
|
96
128
|
|
97
129
|
it 'raises an error if default folder not found' do
|
98
130
|
configuration.root = '/Root'
|
99
|
-
expect{
|
131
|
+
expect {
|
132
|
+
configuration.participants_directory
|
133
|
+
}.to raise_error(
|
134
|
+
Bumbleworks::InvalidSetting,
|
135
|
+
"Participants folder not found (looked in lib/bumbleworks/participants)"
|
136
|
+
)
|
100
137
|
end
|
101
138
|
|
102
139
|
it 'raises an error if specific folder not found' do
|
103
140
|
configuration.participants_directory = '/mumbo/jumbo'
|
104
|
-
expect{
|
141
|
+
expect {
|
142
|
+
configuration.participants_directory
|
143
|
+
}.to raise_error(
|
144
|
+
Bumbleworks::InvalidSetting,
|
145
|
+
"Participants folder not found (looked in /mumbo/jumbo)"
|
146
|
+
)
|
105
147
|
end
|
106
148
|
end
|
107
149
|
|
@@ -120,12 +162,22 @@ describe Bumbleworks::Configuration do
|
|
120
162
|
|
121
163
|
it 'raises an error if default folder not found' do
|
122
164
|
configuration.root = '/Root'
|
123
|
-
expect{
|
165
|
+
expect {
|
166
|
+
configuration.tasks_directory
|
167
|
+
}.to raise_error(
|
168
|
+
Bumbleworks::InvalidSetting,
|
169
|
+
"Tasks folder not found (looked in lib/bumbleworks/tasks)"
|
170
|
+
)
|
124
171
|
end
|
125
172
|
|
126
173
|
it 'raises an error if specific folder not found' do
|
127
174
|
configuration.tasks_directory = '/mumbo/jumbo'
|
128
|
-
expect{
|
175
|
+
expect {
|
176
|
+
configuration.tasks_directory
|
177
|
+
}.to raise_error(
|
178
|
+
Bumbleworks::InvalidSetting,
|
179
|
+
"Tasks folder not found (looked in /mumbo/jumbo)"
|
180
|
+
)
|
129
181
|
end
|
130
182
|
end
|
131
183
|
|
@@ -57,14 +57,6 @@ describe Bumbleworks::WorkitemEntityStorage do
|
|
57
57
|
Object.send(:remove_const, :LovelyEntity)
|
58
58
|
end
|
59
59
|
|
60
|
-
let(:entitied_workflow_item) {
|
61
|
-
Ruote::Workitem.new('fields' => {
|
62
|
-
'entity_id' => '15',
|
63
|
-
'entity_type' => 'LovelyEntity',
|
64
|
-
'params' => {'task' => 'go_to_work'}
|
65
|
-
})
|
66
|
-
}
|
67
|
-
|
68
60
|
it 'attempts to instantiate business entity from _id and _type fields' do
|
69
61
|
feh = FakeEntityHolder.new('entity_id' => '15', 'entity_type' => 'LovelyEntity')
|
70
62
|
feh.entity.identifier.should == '15'
|
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.25
|
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: 2013-07-
|
15
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ruote
|
@@ -227,12 +227,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
227
|
- - ! '>='
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
|
+
segments:
|
231
|
+
- 0
|
232
|
+
hash: -2155630126504321546
|
230
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
234
|
none: false
|
232
235
|
requirements:
|
233
236
|
- - ! '>='
|
234
237
|
- !ruby/object:Gem::Version
|
235
238
|
version: '0'
|
239
|
+
segments:
|
240
|
+
- 0
|
241
|
+
hash: -2155630126504321546
|
236
242
|
requirements: []
|
237
243
|
rubyforge_project:
|
238
244
|
rubygems_version: 1.8.23
|
@@ -271,4 +277,3 @@ test_files:
|
|
271
277
|
- spec/lib/bumbleworks_spec.rb
|
272
278
|
- spec/spec_helper.rb
|
273
279
|
- spec/support/path_helpers.rb
|
274
|
-
has_rdoc:
|