bumbleworks 0.0.77 → 0.0.78
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.
- checksums.yaml +4 -4
- data/lib/bumbleworks/entity.rb +12 -7
- data/lib/bumbleworks/version.rb +1 -1
- data/spec/lib/bumbleworks/entity_spec.rb +31 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93db3b577ea6a3ae073459e9fd407d9aeb217c40
|
4
|
+
data.tar.gz: 20fae058c24f92274ebe9ba5d1929e9ac972960c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90190f2f09fdd353d63dcd4fc9d5bf7b2a78df2952993b791dbdddf940b933f74494dec8c7ed69229bb5e9902b2cb98b7831eb2771687edf3fc4e8cc12e3009a
|
7
|
+
data.tar.gz: 5ad45cb7eb9e3d7574deb08f17f0662b7a777e9de5f366f142056db0eb22dc04f120e135f242001e8bd3ff3a3a8262455a4bd1114984f850d6ba162748a36331
|
data/lib/bumbleworks/entity.rb
CHANGED
@@ -46,14 +46,19 @@ module Bumbleworks
|
|
46
46
|
processes_by_name.values.compact
|
47
47
|
end
|
48
48
|
|
49
|
+
def cancel_process!(process_name, options = {})
|
50
|
+
process = processes_by_name[process_name.to_sym]
|
51
|
+
return nil unless process
|
52
|
+
process.cancel!
|
53
|
+
unless options[:clear_identifiers] == false
|
54
|
+
identifier_attribute = attribute_for_process_name(process_name.to_sym)
|
55
|
+
persist_process_identifier(identifier_attribute, nil)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
49
59
|
def cancel_all_processes!(options = {})
|
50
|
-
processes_by_name.each do |
|
51
|
-
|
52
|
-
process.cancel!
|
53
|
-
unless options[:clear_identifiers] == false
|
54
|
-
identifier_attribute = attribute_for_process_name(name)
|
55
|
-
persist_process_identifier(identifier_attribute, nil)
|
56
|
-
end
|
60
|
+
processes_by_name.keys.each do |process_name|
|
61
|
+
cancel_process!(process_name, options)
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
data/lib/bumbleworks/version.rb
CHANGED
@@ -60,19 +60,25 @@ describe Bumbleworks::Entity do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
describe '#
|
64
|
-
it 'cancels
|
63
|
+
describe '#cancel_processes!' do
|
64
|
+
it 'cancels process with given name' do
|
65
65
|
entity = entity_class.new
|
66
66
|
allow(entity).to receive_messages(:processes_by_name => {
|
67
|
-
:foof =>
|
68
|
-
:nook => bp2 = Bumbleworks::Process.new('pickles')
|
67
|
+
:foof => bp = Bumbleworks::Process.new('1234')
|
69
68
|
})
|
70
|
-
expect(
|
71
|
-
|
72
|
-
|
69
|
+
expect(bp).to receive(:cancel!)
|
70
|
+
allow(entity).to receive(:attribute_for_process_name).
|
71
|
+
with(:foof).and_return(:foof_pid)
|
73
72
|
expect(entity).to receive(:update).with(:foof_pid => nil)
|
74
|
-
|
75
|
-
|
73
|
+
entity.cancel_process!('foof')
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'does nothing if no process for given name' do
|
77
|
+
entity = entity_class.new
|
78
|
+
allow(entity).to receive_messages(:processes_by_name => {})
|
79
|
+
expect {
|
80
|
+
entity.cancel_process!('snord')
|
81
|
+
}.not_to raise_error
|
76
82
|
end
|
77
83
|
|
78
84
|
it 'does not clear identifiers if clear_identifiers option is false' do
|
@@ -82,7 +88,22 @@ describe Bumbleworks::Entity do
|
|
82
88
|
})
|
83
89
|
expect(bp).to receive(:cancel!)
|
84
90
|
expect(entity).to receive(:update).never
|
85
|
-
entity.
|
91
|
+
entity.cancel_process!(:foof, :clear_identifiers => false)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe '#cancel_all_processes!' do
|
96
|
+
it 'cancels all processes' do
|
97
|
+
entity = entity_class.new
|
98
|
+
allow(entity).to receive_messages(:processes_by_name => {
|
99
|
+
:foof => bp1 = Bumbleworks::Process.new('1234'),
|
100
|
+
:nook => bp2 = Bumbleworks::Process.new('pickles'),
|
101
|
+
:thulf => nil
|
102
|
+
})
|
103
|
+
expect(entity).to receive(:cancel_process!).with(:foof, :the_options)
|
104
|
+
expect(entity).to receive(:cancel_process!).with(:nook, :the_options)
|
105
|
+
expect(entity).to receive(:cancel_process!).with(:thulf, :the_options)
|
106
|
+
entity.cancel_all_processes!(:the_options)
|
86
107
|
end
|
87
108
|
end
|
88
109
|
|
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.78
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maher Hawash
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: ruote
|