bluecollar-client 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -0
- data/bluecollar-client.gemspec +3 -3
- data/lib/bluecollar-client.rb +2 -0
- data/lib/bluecollar-client/client.rb +1 -1
- data/lib/bluecollar-client/version.rb +1 -1
- data/spec/units/client_spec.rb +16 -0
- metadata +8 -7
- data/.gitignore +0 -17
data/Rakefile
CHANGED
data/bluecollar-client.gemspec
CHANGED
@@ -6,12 +6,12 @@ require 'bluecollar-client/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "bluecollar-client"
|
8
8
|
spec.version = Bluecollar::VERSION
|
9
|
-
spec.authors = ["Denny Quesada"]
|
10
|
-
spec.email = ["denny.quesada@
|
9
|
+
spec.authors = ["Denny Quesada", "Nick Zalabak"]
|
10
|
+
spec.email = ["denny.quesada@gmail.com", "techwhizbang@gmail.com"]
|
11
11
|
spec.description = %q{Bluecollar client written in Ruby}
|
12
12
|
spec.summary = %q{Bluecollar client written in Ruby}
|
13
13
|
spec.homepage = ""
|
14
|
-
spec.license = "EPL"
|
14
|
+
spec.license = "EPL-V10"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
data/lib/bluecollar-client.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'json'
|
3
|
+
require 'securerandom'
|
4
|
+
|
3
5
|
require File.expand_path(File.dirname(__FILE__) + "/bluecollar-client/version")
|
4
6
|
require File.expand_path(File.dirname(__FILE__) + "/bluecollar-client/client_error")
|
5
7
|
require File.expand_path(File.dirname(__FILE__) + "/bluecollar-client/client")
|
@@ -42,7 +42,7 @@ module Bluecollar
|
|
42
42
|
raise ArgumentError.new("args must be an Array.") unless args.is_a? Array
|
43
43
|
|
44
44
|
begin
|
45
|
-
payload = { worker
|
45
|
+
payload = { "worker" => worker_name, "args" => args, "uuid" => SecureRandom.uuid, "scheduled-runtime" => nil }
|
46
46
|
JSON.dump(payload)
|
47
47
|
rescue
|
48
48
|
raise Bluecollar::ClientError.new("Error while creating JSON payload for #{worker_name}: #{args.inpsect}.\n#{e}:#{e.message}\nBacktrace:\n\t#{e.backtrace.join("\n\t")}")
|
data/spec/units/client_spec.rb
CHANGED
@@ -65,6 +65,10 @@ describe Bluecollar::Client do
|
|
65
65
|
|
66
66
|
describe "#redis_payload" do
|
67
67
|
context "with valid arguments" do
|
68
|
+
before do
|
69
|
+
SecureRandom.stub(:uuid).and_return("UUID")
|
70
|
+
end
|
71
|
+
|
68
72
|
subject { JSON.parse Bluecollar::Client.instance.send(:redis_payload, 'lazy_worker', [{arg1:"first"}]) }
|
69
73
|
|
70
74
|
it "should have the expected worker" do
|
@@ -74,6 +78,14 @@ describe Bluecollar::Client do
|
|
74
78
|
it "should have the expected args" do
|
75
79
|
subject['args'].first['arg1'].should eq("first")
|
76
80
|
end
|
81
|
+
|
82
|
+
it "should have the expected UUID" do
|
83
|
+
subject['uuid'].should eq("UUID")
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should have the expected scheduled-runtime" do
|
87
|
+
subject['scheduled-runtime'].should eq(nil)
|
88
|
+
end
|
77
89
|
end
|
78
90
|
|
79
91
|
context "with a args argument that is not an Array" do
|
@@ -86,6 +98,10 @@ describe Bluecollar::Client do
|
|
86
98
|
end
|
87
99
|
|
88
100
|
describe "#async_job_for" do
|
101
|
+
before do
|
102
|
+
SecureRandom.stub(:uuid).and_return("UUID")
|
103
|
+
end
|
104
|
+
|
89
105
|
subject { Bluecollar::Client.instance }
|
90
106
|
|
91
107
|
it "should push the data to the right queue" do
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluecollar-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Denny Quesada
|
9
|
+
- Nick Zalabak
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: redis
|
@@ -125,12 +126,12 @@ dependencies:
|
|
125
126
|
version: '0'
|
126
127
|
description: Bluecollar client written in Ruby
|
127
128
|
email:
|
128
|
-
- denny.quesada@
|
129
|
+
- denny.quesada@gmail.com
|
130
|
+
- techwhizbang@gmail.com
|
129
131
|
executables: []
|
130
132
|
extensions: []
|
131
133
|
extra_rdoc_files: []
|
132
134
|
files:
|
133
|
-
- .gitignore
|
134
135
|
- Gemfile
|
135
136
|
- README.md
|
136
137
|
- Rakefile
|
@@ -143,7 +144,7 @@ files:
|
|
143
144
|
- spec/units/client_spec.rb
|
144
145
|
homepage: ''
|
145
146
|
licenses:
|
146
|
-
- EPL
|
147
|
+
- EPL-V10
|
147
148
|
post_install_message:
|
148
149
|
rdoc_options: []
|
149
150
|
require_paths:
|
@@ -156,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
157
|
version: '0'
|
157
158
|
segments:
|
158
159
|
- 0
|
159
|
-
hash:
|
160
|
+
hash: 4207667502330405233
|
160
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
162
|
none: false
|
162
163
|
requirements:
|
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
166
|
version: '0'
|
166
167
|
segments:
|
167
168
|
- 0
|
168
|
-
hash:
|
169
|
+
hash: 4207667502330405233
|
169
170
|
requirements: []
|
170
171
|
rubyforge_project:
|
171
172
|
rubygems_version: 1.8.25
|