taskinator 0.0.13 → 0.0.14
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/Gemfile.lock +1 -1
- data/lib/taskinator/definition/builder.rb +7 -1
- data/lib/taskinator/definition.rb +3 -0
- data/lib/taskinator/persistence.rb +2 -1
- data/lib/taskinator/tasks.rb +1 -1
- data/lib/taskinator/version.rb +1 -1
- data/spec/taskinator/definition/builder_spec.rb +1 -1
- data/spec/taskinator/definition_spec.rb +1 -1
- data/spec/taskinator/process_spec.rb +7 -5
- data/spec/taskinator/task_spec.rb +11 -8
- 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: 51c713c1cb5cfa95439381d7f120bfa2bfb846b6
|
4
|
+
data.tar.gz: 79d1bcb30bae42edad8428fefc19e4870f0c5024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ad95201f5f020d97f731122071a57a3aa092163594a2bc72982950596589af3deb97daebd082c32ad9959695785f36018c730428d4638eb50f27cf4bf8a869
|
7
|
+
data.tar.gz: 023087cad85ee39f7cbea9310277b8e382c4926696677a89ebd9c5889a6ff48e9d60c59c085ff7851f4d368330ad6976963a0cb7d741bffb79cdde424b36ab52
|
data/Gemfile.lock
CHANGED
@@ -42,7 +42,13 @@ module Taskinator
|
|
42
42
|
raise NoMethodError, method unless @executor.respond_to?(method)
|
43
43
|
raise ArgumentError, 'block' unless block_given?
|
44
44
|
|
45
|
-
|
45
|
+
#
|
46
|
+
# `for_each` is an exception, since it invokes the definition
|
47
|
+
# in order to yield elements to the builder, and any options passed
|
48
|
+
# are included with the builder options
|
49
|
+
#
|
50
|
+
method_args = options.any? ? [*@args, options] : @args
|
51
|
+
@executor.send(method, *method_args) do |*args|
|
46
52
|
Builder.new(@process, @definition, *args).instance_eval(&block)
|
47
53
|
end
|
48
54
|
end
|
@@ -7,6 +7,9 @@ module Taskinator
|
|
7
7
|
define_singleton_method :_create_process_ do |args, options={}|
|
8
8
|
|
9
9
|
# TODO: better validation of arguments
|
10
|
+
|
11
|
+
# FIXME: arg_list should only contain an array of symbols
|
12
|
+
|
10
13
|
raise ArgumentError, "wrong number of arguments (#{args.length} for #{arg_list.length})" if args.length < arg_list.length
|
11
14
|
|
12
15
|
process = Process.define_sequential_process_for(self)
|
data/lib/taskinator/tasks.rb
CHANGED
data/lib/taskinator/version.rb
CHANGED
@@ -99,7 +99,7 @@ describe Taskinator::Definition::Builder do
|
|
99
99
|
@executor = executor
|
100
100
|
end
|
101
101
|
|
102
|
-
expect(executor).to receive(:iterator_method).with(*
|
102
|
+
expect(executor).to receive(:iterator_method).with(*args) do |*a, &block|
|
103
103
|
3.times(&block)
|
104
104
|
end
|
105
105
|
|
@@ -144,13 +144,13 @@ describe Taskinator::Process do
|
|
144
144
|
describe "#fail!" do
|
145
145
|
it { expect(subject).to respond_to(:fail!) }
|
146
146
|
it {
|
147
|
-
expect(subject).to receive(:fail)
|
147
|
+
expect(subject).to receive(:fail)
|
148
148
|
subject.start!
|
149
|
-
subject.fail!
|
149
|
+
subject.fail!
|
150
150
|
}
|
151
151
|
it {
|
152
152
|
subject.start!
|
153
|
-
subject.fail!
|
153
|
+
subject.fail!
|
154
154
|
expect(subject.current_state.name).to eq(:failed)
|
155
155
|
}
|
156
156
|
end
|
@@ -363,9 +363,11 @@ describe Taskinator::Process do
|
|
363
363
|
it "fails when tasks fail" do
|
364
364
|
tasks.each {|t| subject.tasks << t }
|
365
365
|
|
366
|
-
|
366
|
+
error = StandardError.new
|
367
367
|
|
368
|
-
subject.
|
368
|
+
expect(subject).to receive(:fail!).with(error)
|
369
|
+
|
370
|
+
subject.task_failed(tasks.first, error)
|
369
371
|
end
|
370
372
|
end
|
371
373
|
|
@@ -95,14 +95,15 @@ describe Taskinator::Task do
|
|
95
95
|
describe "#fail!" do
|
96
96
|
it { expect(subject).to respond_to(:fail!) }
|
97
97
|
it {
|
98
|
-
|
99
|
-
expect(
|
98
|
+
error = StandardError.new
|
99
|
+
expect(subject).to receive(:fail).with(error)
|
100
|
+
expect(process).to receive(:task_failed).with(subject, error)
|
100
101
|
subject.start!
|
101
|
-
subject.fail!(
|
102
|
+
subject.fail!(error)
|
102
103
|
}
|
103
104
|
it {
|
104
105
|
subject.start!
|
105
|
-
subject.fail!
|
106
|
+
subject.fail!
|
106
107
|
expect(subject.current_state.name).to eq(:failed)
|
107
108
|
}
|
108
109
|
end
|
@@ -171,8 +172,9 @@ describe Taskinator::Task do
|
|
171
172
|
end
|
172
173
|
|
173
174
|
it "handles failure" do
|
174
|
-
|
175
|
-
|
175
|
+
error = StandardError.new
|
176
|
+
allow(subject.executor).to receive(subject.method).with(*subject.args).and_raise(error)
|
177
|
+
expect(subject).to receive(:fail!).with(error)
|
176
178
|
subject.start!
|
177
179
|
end
|
178
180
|
end
|
@@ -278,8 +280,9 @@ describe Taskinator::Task do
|
|
278
280
|
end
|
279
281
|
|
280
282
|
it "handles failure" do
|
281
|
-
|
282
|
-
|
283
|
+
error = StandardError.new
|
284
|
+
allow(sub_process).to receive(:start!).and_raise(error)
|
285
|
+
expect(subject).to receive(:fail!).with(error)
|
283
286
|
subject.start!
|
284
287
|
end
|
285
288
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taskinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Stefano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|