bumbleworks 0.0.7 → 0.0.8
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/lib/bumbleworks.rb +2 -2
- data/lib/bumbleworks/ruote.rb +16 -0
- data/lib/bumbleworks/version.rb +1 -1
- data/lib/tasks/bumbleworks.rake +4 -3
- data/spec/lib/bumbleworks/ruote_spec.rb +9 -0
- data/spec/lib/bumbleworks_spec.rb +2 -2
- metadata +2 -2
data/lib/bumbleworks.rb
CHANGED
@@ -89,8 +89,8 @@ module Bumbleworks
|
|
89
89
|
# Registers all process_definitions in the configured definitions_directory
|
90
90
|
# with the Ruote engine.
|
91
91
|
#
|
92
|
-
def load_definitions!
|
93
|
-
Bumbleworks::ProcessDefinition.create_all_from_directory!(definitions_directory)
|
92
|
+
def load_definitions!(options = {})
|
93
|
+
Bumbleworks::ProcessDefinition.create_all_from_directory!(definitions_directory, options)
|
94
94
|
end
|
95
95
|
|
96
96
|
# @public
|
data/lib/bumbleworks/ruote.rb
CHANGED
@@ -14,9 +14,25 @@ module Bumbleworks
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
# Start a worker, which will begin polling for messages in
|
18
|
+
# the workflow storage. You can run multiple workers if you
|
19
|
+
# are using a storage that supports them (such as Sequel or
|
20
|
+
# Redis, but not Hash) - they all just have to be connected
|
21
|
+
# to the same storage, and be able to instantiate participants
|
22
|
+
# in the participant list.
|
23
|
+
#
|
24
|
+
# @param [Hash] options startup options for the worker
|
25
|
+
# @option options [Boolean] :verbose whether or not to spin up
|
26
|
+
# a "noisy" worker, which will output all messages picked up
|
27
|
+
# @option options [Boolean] :join whether or not to join the worker
|
28
|
+
# thread; if false, this method will return, and the worker
|
29
|
+
# thread will be disconnected, and killed if the calling process
|
30
|
+
# exits.
|
31
|
+
#
|
17
32
|
def start_worker!(options = {})
|
18
33
|
@dashboard = nil
|
19
34
|
dashboard(:start_worker => true)
|
35
|
+
dashboard.noisy = options[:verbose] == true
|
20
36
|
dashboard.join if options[:join] == true
|
21
37
|
dashboard.worker
|
22
38
|
end
|
data/lib/bumbleworks/version.rb
CHANGED
data/lib/tasks/bumbleworks.rake
CHANGED
@@ -2,13 +2,13 @@ namespace :bumbleworks do
|
|
2
2
|
desc 'Start a Bumbleworks worker'
|
3
3
|
task :start_worker => :environment do
|
4
4
|
puts "Starting Bumbleworks worker..." if verbose == true
|
5
|
-
Bumbleworks.start_worker!(:join => true)
|
5
|
+
Bumbleworks.start_worker!(:join => true, :verbose => verbose)
|
6
6
|
end
|
7
7
|
|
8
8
|
desc 'Reload all process definitions from directory'
|
9
9
|
task :reload_definitions => :environment do
|
10
10
|
puts "Reloading all Bumbleworks process definitions..." if verbose == true
|
11
|
-
Bumbleworks.load_definitions!
|
11
|
+
Bumbleworks.load_definitions!(:verbose => verbose)
|
12
12
|
end
|
13
13
|
|
14
14
|
desc 'Launch a given Bumbleworks process'
|
@@ -16,6 +16,7 @@ namespace :bumbleworks do
|
|
16
16
|
process = args[:process]
|
17
17
|
raise ArgumentError, "Process name required" unless process
|
18
18
|
puts "Launching process '#{process}'..." if verbose == true
|
19
|
-
Bumbleworks.launch!(process)
|
19
|
+
wfid = Bumbleworks.launch!(process)
|
20
|
+
puts "WFID: #{wfid}" if verbose == true
|
20
21
|
end
|
21
22
|
end
|
@@ -37,6 +37,7 @@ describe Bumbleworks::Ruote do
|
|
37
37
|
it 'joins current thread if :join option is true' do
|
38
38
|
Bumbleworks.storage = {}
|
39
39
|
::Ruote::Dashboard.stub(:new).and_return(dash_double = double('dash', :worker => nil))
|
40
|
+
dash_double.should_receive(:noisy=).with(false)
|
40
41
|
dash_double.should_receive(:join)
|
41
42
|
described_class.start_worker!(:join => true)
|
42
43
|
end
|
@@ -44,9 +45,17 @@ describe Bumbleworks::Ruote do
|
|
44
45
|
it 'returns if :join option not true' do
|
45
46
|
Bumbleworks.storage = {}
|
46
47
|
::Ruote::Dashboard.stub(:new).and_return(dash_double = double('dash', :worker => nil))
|
48
|
+
dash_double.should_receive(:noisy=).with(false)
|
47
49
|
dash_double.should_receive(:join).never
|
48
50
|
described_class.start_worker!
|
49
51
|
end
|
52
|
+
|
53
|
+
it 'sets dashboard to noisy if :verbose option true' do
|
54
|
+
Bumbleworks.storage = {}
|
55
|
+
::Ruote::Dashboard.stub(:new).and_return(dash_double = double('dash', :worker => nil))
|
56
|
+
dash_double.should_receive(:noisy=).with(true)
|
57
|
+
described_class.start_worker!(:verbose => true)
|
58
|
+
end
|
50
59
|
end
|
51
60
|
|
52
61
|
describe '.register_participants' do
|
@@ -64,8 +64,8 @@ describe Bumbleworks do
|
|
64
64
|
it 'creates all definitions from directory' do
|
65
65
|
described_class.stub(:definitions_directory).and_return(:defs_dir)
|
66
66
|
described_class.storage = {}
|
67
|
-
Bumbleworks::ProcessDefinition.should_receive(:create_all_from_directory!).with(:defs_dir)
|
68
|
-
described_class.load_definitions!
|
67
|
+
Bumbleworks::ProcessDefinition.should_receive(:create_all_from_directory!).with(:defs_dir, :fake_options)
|
68
|
+
described_class.load_definitions!(:fake_options)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
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.8
|
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-05-
|
15
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ruote
|