taskinator 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/lib/taskinator/api.rb +2 -2
- data/lib/taskinator/definition/builder.rb +1 -1
- data/lib/taskinator/definition.rb +11 -2
- data/lib/taskinator/persistence.rb +12 -0
- data/lib/taskinator/version.rb +1 -1
- data/spec/taskinator/api_spec.rb +2 -4
- data/spec/taskinator/definition/builder_spec.rb +2 -2
- 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: e525f7ac6b173f06d6a4e9a3bcf498bfdde1e434
|
4
|
+
data.tar.gz: 13c8c943739f8cb17474cac9a7634a37dcf95a1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f8cab5e41d5b606778a1ea67178cfb68c7143ec447d5f3a3ef793ee26e0c45d58fcb1e5152b251a76a161f7247b32d5be6432a0cfc402cb1bb37112ce7f05c8
|
7
|
+
data.tar.gz: 526147b769e9b37e05e6fd59e8aafbaed5b64cbd00a5a2910f99b1fbd6bdeae5fb238ad0950bd1bb93f3efc0c8a47c7d835437db08d166803a27f8c32a518e05
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ GIT
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
taskinator (0.0.
|
11
|
+
taskinator (0.0.13)
|
12
12
|
connection_pool (>= 2.0.0)
|
13
13
|
json (>= 1.8.1)
|
14
14
|
redis (>= 3.0.6)
|
@@ -30,10 +30,10 @@ GEM
|
|
30
30
|
coderay (1.1.0)
|
31
31
|
columnize (0.9.0)
|
32
32
|
connection_pool (2.2.0)
|
33
|
-
coveralls (0.8.
|
34
|
-
|
33
|
+
coveralls (0.8.1)
|
34
|
+
json (~> 1.8)
|
35
35
|
rest-client (>= 1.6.8, < 2)
|
36
|
-
simplecov (~> 0.
|
36
|
+
simplecov (~> 0.10.0)
|
37
37
|
term-ansicolor (~> 1.3)
|
38
38
|
thor (~> 0.19.1)
|
39
39
|
delayed_job (4.0.6)
|
@@ -48,8 +48,8 @@ GEM
|
|
48
48
|
i18n (0.7.0)
|
49
49
|
json (1.8.2)
|
50
50
|
method_source (0.8.2)
|
51
|
-
mime-types (2.
|
52
|
-
minitest (5.6.
|
51
|
+
mime-types (2.5)
|
52
|
+
minitest (5.6.1)
|
53
53
|
mono_logger (1.1.0)
|
54
54
|
multi_json (1.11.0)
|
55
55
|
netrc (0.10.3)
|
@@ -60,7 +60,7 @@ GEM
|
|
60
60
|
pry-byebug (3.1.0)
|
61
61
|
byebug (~> 4.0)
|
62
62
|
pry (~> 0.10)
|
63
|
-
rack (1.6.
|
63
|
+
rack (1.6.1)
|
64
64
|
rack-protection (1.5.3)
|
65
65
|
rack
|
66
66
|
rake (10.4.2)
|
@@ -95,17 +95,17 @@ GEM
|
|
95
95
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
96
|
rspec-support (~> 3.2.0)
|
97
97
|
rspec-support (3.2.2)
|
98
|
-
sidekiq (3.3.
|
98
|
+
sidekiq (3.3.4)
|
99
99
|
celluloid (>= 0.16.0)
|
100
100
|
connection_pool (>= 2.1.1)
|
101
101
|
json
|
102
102
|
redis (>= 3.0.6)
|
103
103
|
redis-namespace (>= 1.3.1)
|
104
|
-
simplecov (0.
|
104
|
+
simplecov (0.10.0)
|
105
105
|
docile (~> 1.1.0)
|
106
|
-
|
107
|
-
simplecov-html (~> 0.
|
108
|
-
simplecov-html (0.
|
106
|
+
json (~> 1.8)
|
107
|
+
simplecov-html (~> 0.10.0)
|
108
|
+
simplecov-html (0.10.0)
|
109
109
|
sinatra (1.4.6)
|
110
110
|
rack (~> 1.4)
|
111
111
|
rack-protection (~> 1.4)
|
@@ -118,7 +118,7 @@ GEM
|
|
118
118
|
tilt (2.0.1)
|
119
119
|
timers (4.0.1)
|
120
120
|
hitimes
|
121
|
-
tins (1.
|
121
|
+
tins (1.5.1)
|
122
122
|
tzinfo (1.2.2)
|
123
123
|
thread_safe (~> 0.1)
|
124
124
|
unf (0.1.4)
|
data/lib/taskinator/api.rb
CHANGED
@@ -6,7 +6,7 @@ module Taskinator
|
|
6
6
|
def each(&block)
|
7
7
|
instance_cache = {}
|
8
8
|
Taskinator.redis do |conn|
|
9
|
-
uuids = conn.smembers("taskinator
|
9
|
+
uuids = conn.smembers("taskinator:processes")
|
10
10
|
uuids.each do |uuid|
|
11
11
|
yield Process.fetch(uuid, instance_cache)
|
12
12
|
end
|
@@ -15,7 +15,7 @@ module Taskinator
|
|
15
15
|
|
16
16
|
def size
|
17
17
|
Taskinator.redis do |conn|
|
18
|
-
conn.scard("taskinator
|
18
|
+
conn.scard("taskinator:processes")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -75,7 +75,7 @@ module Taskinator
|
|
75
75
|
|
76
76
|
# TODO: decide whether the sub process to dynamically receive arguments
|
77
77
|
|
78
|
-
sub_process = definition.
|
78
|
+
sub_process = definition.create_sub_process(*@args)
|
79
79
|
Builder.new(define_sub_process_task(@process, sub_process, options), definition, *@args)
|
80
80
|
end
|
81
81
|
|
@@ -4,7 +4,7 @@ module Taskinator
|
|
4
4
|
|
5
5
|
# defines a process
|
6
6
|
def define_process(*arg_list, &block)
|
7
|
-
define_singleton_method :_create_process_ do
|
7
|
+
define_singleton_method :_create_process_ do |args, options={}|
|
8
8
|
|
9
9
|
# TODO: better validation of arguments
|
10
10
|
raise ArgumentError, "wrong number of arguments (#{args.length} for #{arg_list.length})" if args.length < arg_list.length
|
@@ -12,6 +12,10 @@ module Taskinator
|
|
12
12
|
process = Process.define_sequential_process_for(self)
|
13
13
|
Builder.new(process, self, *args).instance_eval(&block)
|
14
14
|
process.save
|
15
|
+
|
16
|
+
# if this is a root process, then add it to the list
|
17
|
+
Persistence.add_process_to_list(process) unless options[:subprocess]
|
18
|
+
|
15
19
|
process
|
16
20
|
end
|
17
21
|
end
|
@@ -20,7 +24,12 @@ module Taskinator
|
|
20
24
|
# NOTE: the supplied @args are serialized and ultimately passed to each method of the defined process
|
21
25
|
def create_process(*args)
|
22
26
|
raise UndefinedProcessError unless respond_to?(:_create_process_)
|
23
|
-
_create_process_(
|
27
|
+
_create_process_(args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_sub_process(*args)
|
31
|
+
raise UndefinedProcessError unless respond_to?(:_create_process_)
|
32
|
+
_create_process_(args, :subprocess => true)
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
@@ -1,6 +1,18 @@
|
|
1
1
|
module Taskinator
|
2
2
|
module Persistence
|
3
3
|
|
4
|
+
class << self
|
5
|
+
def add_process_to_list(process)
|
6
|
+
Taskinator.redis do |conn|
|
7
|
+
conn.sadd "taskinator:#{list_key}", process.uuid
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def list_key
|
12
|
+
'processes'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
4
16
|
# mixin logic
|
5
17
|
def self.included(klass)
|
6
18
|
klass.class_eval do
|
data/lib/taskinator/version.rb
CHANGED
data/spec/taskinator/api_spec.rb
CHANGED
@@ -16,10 +16,9 @@ describe Taskinator::Api, :redis => true do
|
|
16
16
|
it "it enumerates processes" do
|
17
17
|
allow_any_instance_of(Process).to receive(:fetch) {}
|
18
18
|
|
19
|
-
base_key = Taskinator::Process.base_key
|
20
19
|
Taskinator.redis do |conn|
|
21
20
|
conn.multi do
|
22
|
-
3.times {|i| conn.sadd("taskinator:#{
|
21
|
+
3.times {|i| conn.sadd("taskinator:#{Taskinator::Persistence.list_key}", i) }
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
@@ -34,10 +33,9 @@ describe Taskinator::Api, :redis => true do
|
|
34
33
|
it { expect(subject.size).to eq(0) }
|
35
34
|
|
36
35
|
it "yields the number of processes" do
|
37
|
-
base_key = Taskinator::Process.base_key
|
38
36
|
Taskinator.redis do |conn|
|
39
37
|
conn.multi do
|
40
|
-
3.times {|i| conn.sadd("taskinator:#{
|
38
|
+
3.times {|i| conn.sadd("taskinator:#{Taskinator::Persistence.list_key}", i) }
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
@@ -196,13 +196,13 @@ describe Taskinator::Definition::Builder do
|
|
196
196
|
end
|
197
197
|
|
198
198
|
it "creates a sub process" do
|
199
|
-
expect(sub_definition).to receive(:
|
199
|
+
expect(sub_definition).to receive(:create_sub_process).with(*args).and_call_original
|
200
200
|
subject.sub_process(sub_definition)
|
201
201
|
end
|
202
202
|
|
203
203
|
it "creates a sub process task" do
|
204
204
|
sub_process = sub_definition.create_process(:argX, :argY, :argZ)
|
205
|
-
allow(sub_definition).to receive(:
|
205
|
+
allow(sub_definition).to receive(:create_sub_process) { sub_process }
|
206
206
|
expect(Taskinator::Task).to receive(:define_sub_process_task).with(process, sub_process, {})
|
207
207
|
subject.sub_process(sub_definition)
|
208
208
|
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.13
|
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-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|