taskinator 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f06333f9729441692c47b0eecc144080b2711ff
4
- data.tar.gz: 4b6db6e7787af743783a45dea8070813d9d2df9e
3
+ metadata.gz: f38da174c5aa2c6925369594efb9a6bd2c9f7f92
4
+ data.tar.gz: f5f868792f18674fcaf36eb1f810979d573a00dc
5
5
  SHA512:
6
- metadata.gz: 4d352409fcbfce51f8591779c291cee6a2fcecd2513a33d07657c8e85045654af4af639908704e3e9f7fda3c72859781bf36d96c7e4dfdbb48decd3e2a38e161
7
- data.tar.gz: c849ec329437762c590e2858c794729cf08264343907692ba564a9a7cd5858da7109452c88bb9777299a36726008feea3dfb4201706913be011ad4996c7e0621
6
+ metadata.gz: 456f4e59f0be95f9e75cf077d75c1c839ddca9c11d983e675acd9ed54b1a64f957a19d35885ed07033c31b0f8e4f435f414e5847966376de28282529448e1884
7
+ data.tar.gz: cc736074a6f21baa49cfa76ab05566c17d48f653c54f25f00759f0ecf89ed9de0fbf77296e8071f3cdd6f487bccae256b35eddf94183f0f774eb4011f9cad729
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+ sudo: false # See http://docs.travis-ci.com/user/migrating-from-legacy
2
3
  cache: bundler
3
4
 
4
5
  services:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ v0.3.2 - 18 Sep 2015
2
+ ---
3
+ Bug fix to argument handling when using `create_process_remotely` method.
4
+
1
5
  v0.3.1 - 16 Sep 2015
2
6
  ---
3
7
  Added redis-semaphore gem, for fix to concurrent processes completion logic.
data/Gemfile.lock CHANGED
@@ -1,6 +1,6 @@
1
1
  GIT
2
2
  remote: git://github.com/mperham/sidekiq.git
3
- revision: 50fc8ee7c3f7c5e4049db598c0e14465a67a877c
3
+ revision: cf5933ab67eefb86e64d99a6aee4eaf18aada08f
4
4
  specs:
5
5
  sidekiq (3.5.0)
6
6
  celluloid (~> 0.17.0)
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- taskinator (0.3.1)
15
+ taskinator (0.3.2)
16
16
  connection_pool (>= 2.2.0)
17
17
  json (>= 1.8.2)
18
18
  redis (>= 3.2.1)
@@ -19,7 +19,20 @@ module Taskinator
19
19
  end
20
20
 
21
21
  def perform
22
- @definition._create_process_(false, *@args, :uuid => @uuid).enqueue!
22
+
23
+ # args may contain an options hash at the end
24
+ # so merge in the uuid into it, or add
25
+
26
+ process_args = args || []
27
+
28
+ if process_args.last.is_a?(Hash)
29
+ process_args.last.merge!(:uuid => uuid)
30
+ else
31
+ process_args << { :uuid => uuid }
32
+ end
33
+
34
+ @definition._create_process_(false, *process_args).enqueue!
35
+
23
36
  end
24
37
 
25
38
  private
@@ -1,3 +1,3 @@
1
1
  module Taskinator
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -28,7 +28,7 @@ module Taskinator
28
28
  ).each do |state|
29
29
 
30
30
  define_method :"#{state}?" do
31
- @current_state == state
31
+ current_state == state
32
32
  end
33
33
 
34
34
  end
@@ -4,9 +4,9 @@ describe Taskinator::CreateProcessWorker do
4
4
 
5
5
  let(:definition) { MockDefinition.create }
6
6
  let(:uuid) { SecureRandom.uuid }
7
- let(:args) { {:foo => :bar} }
7
+ let(:args) { [{:foo => :bar}] }
8
8
 
9
- subject { Taskinator::CreateProcessWorker.new(definition.name, uuid, Taskinator::Persistence.serialize(:foo => :bar)) }
9
+ subject { Taskinator::CreateProcessWorker.new(definition.name, uuid, Taskinator::Persistence.serialize(args)) }
10
10
 
11
11
  describe "#initialize" do
12
12
  it {
@@ -14,19 +14,19 @@ describe Taskinator::CreateProcessWorker do
14
14
  }
15
15
 
16
16
  it {
17
- Taskinator::CreateProcessWorker.new(definition.name, uuid, Taskinator::Persistence.serialize(:foo => :bar))
17
+ Taskinator::CreateProcessWorker.new(definition.name, uuid, Taskinator::Persistence.serialize(args))
18
18
  expect(subject.definition).to eq(definition)
19
19
  }
20
20
 
21
21
  it {
22
22
  MockDefinition.const_set(definition.name, definition)
23
- Taskinator::CreateProcessWorker.new("MockDefinition::#{definition.name}", uuid, Taskinator::Persistence.serialize(:foo => :bar))
23
+ Taskinator::CreateProcessWorker.new("MockDefinition::#{definition.name}", uuid, Taskinator::Persistence.serialize(args))
24
24
  expect(subject.definition).to eq(definition)
25
25
  }
26
26
 
27
27
  it {
28
28
  expect {
29
- Taskinator::CreateProcessWorker.new("NonExistent", uuid, Taskinator::Persistence.serialize(:foo => :bar))
29
+ Taskinator::CreateProcessWorker.new("NonExistent", uuid, Taskinator::Persistence.serialize(args))
30
30
  }.to raise_error(NameError)
31
31
  }
32
32
 
@@ -40,9 +40,42 @@ describe Taskinator::CreateProcessWorker do
40
40
  end
41
41
 
42
42
  describe "#perform" do
43
- it "should create the process" do
44
- expect(definition).to receive(:_create_process_).with(false, *args, :uuid => uuid).and_return(double('process', :enqueue! => nil))
45
- subject.perform
43
+ describe "create the process" do
44
+ it "with no arguments" do
45
+ process_args = [{:uuid => uuid}]
46
+ args = Taskinator::Persistence.serialize([])
47
+
48
+ expect(definition).to receive(:_create_process_).with(false, *process_args).and_return(double('process', :enqueue! => nil))
49
+
50
+ Taskinator::CreateProcessWorker.new(definition.name, uuid, args).perform
51
+ end
52
+
53
+ it "with arguments" do
54
+ process_args = [:foo, :bar, {:uuid => uuid}]
55
+ serialized_args = Taskinator::Persistence.serialize([:foo, :bar])
56
+
57
+ expect(definition).to receive(:_create_process_).with(false, *process_args).and_return(double('process', :enqueue! => nil))
58
+
59
+ Taskinator::CreateProcessWorker.new(definition.name, uuid, serialized_args).perform
60
+ end
61
+
62
+ it "with options" do
63
+ process_args = [{:foo => :bar, :uuid => uuid}]
64
+ serialized_args = Taskinator::Persistence.serialize([{:foo => :bar}])
65
+
66
+ expect(definition).to receive(:_create_process_).with(false, *process_args).and_return(double('process', :enqueue! => nil))
67
+
68
+ Taskinator::CreateProcessWorker.new(definition.name, uuid, serialized_args).perform
69
+ end
70
+
71
+ it "with arguments and options" do
72
+ process_args = [:foo, {:bar => :baz, :uuid => uuid}]
73
+ serialized_args = Taskinator::Persistence.serialize([:foo, {:bar => :baz}])
74
+
75
+ expect(definition).to receive(:_create_process_).with(false, *process_args).and_return(double('process', :enqueue! => nil))
76
+
77
+ Taskinator::CreateProcessWorker.new(definition.name, uuid, serialized_args).perform
78
+ end
46
79
  end
47
80
 
48
81
  it "should enqueue the process" do
@@ -156,6 +156,8 @@ describe Taskinator::Task do
156
156
 
157
157
  describe "#tasks_count" do
158
158
  it {
159
+ process_uuid = SecureRandom.hex
160
+ allow(subject).to receive(:process_uuid) { process_uuid }
159
161
  expect(subject.tasks_count).to eq(0)
160
162
  }
161
163
  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.3.1
4
+ version: 0.3.2
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-09-16 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis