taskinator 0.0.12 → 0.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9893dc408bd6251f0be74277258efe4b21c1ccc
4
- data.tar.gz: 3a5359a8f80fac71079a0ef57e03d8b9318522e3
3
+ metadata.gz: e525f7ac6b173f06d6a4e9a3bcf498bfdde1e434
4
+ data.tar.gz: 13c8c943739f8cb17474cac9a7634a37dcf95a1e
5
5
  SHA512:
6
- metadata.gz: 77a3d39576e085c6db57d02ed0bde18cc7da0c21dee7ccb67bd176d20fe49894e6a7ef1cd0b3070eda8b0d20770830211104293f892c9c18aceeef16de5f03e9
7
- data.tar.gz: ec8370d8ee575566f8ba905056f6a8a336a6f42277fb3f3e705d81e422262a4ec68e85560ae097d7611067d1adc26aaa7ef1d4cfcc4e24c60f9b365accdde04c
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.12)
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.0)
34
- multi_json (~> 1.10)
33
+ coveralls (0.8.1)
34
+ json (~> 1.8)
35
35
  rest-client (>= 1.6.8, < 2)
36
- simplecov (~> 0.9.1)
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.4.3)
52
- minitest (5.6.0)
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.0)
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.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.9.2)
104
+ simplecov (0.10.0)
105
105
  docile (~> 1.1.0)
106
- multi_json (~> 1.0)
107
- simplecov-html (~> 0.9.0)
108
- simplecov-html (0.9.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.3.5)
121
+ tins (1.5.1)
122
122
  tzinfo (1.2.2)
123
123
  thread_safe (~> 0.1)
124
124
  unf (0.1.4)
@@ -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:#{Taskinator::Process.base_key}")
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:#{Taskinator::Process.base_key}")
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.create_process(*@args)
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 |*args|
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_(*args)
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
@@ -1,3 +1,3 @@
1
1
  module Taskinator
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -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:#{base_key}", i) }
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:#{base_key}", i) }
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(:create_process).with(*args).and_call_original
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(:create_process) { sub_process }
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.12
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-04-20 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis