iron_response 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -15
- data/iron_response.gemspec +1 -1
- data/lib/iron_response/common.rb +2 -2
- data/lib/iron_response/version.rb +1 -1
- data/test/gem_dependency_test.rb +1 -1
- data/test/synopsis_test.rb +1 -1
- data/test/test_helper.rb +8 -6
- metadata +2 -18
data/README.md
CHANGED
@@ -8,13 +8,17 @@ Provides a response object to remote worker scripts. This allows you to write ma
|
|
8
8
|
require "iron_response"
|
9
9
|
|
10
10
|
config = {token: "123", project_id: "456"}
|
11
|
-
batch
|
11
|
+
batch = IronResponse::Batch.new(config)
|
12
|
+
|
13
|
+
code = IronWorkerNG::Code::Ruby.new
|
14
|
+
code.runtime = "ruby"
|
15
|
+
code.exec "test/workers/is_prime.rb"
|
16
|
+
batch.code = code
|
12
17
|
|
13
|
-
batch.
|
14
|
-
batch.
|
15
|
-
batch.create_code!(max_concurrency: 4)
|
18
|
+
batch.params_array = Array(1..10).map {|i| {number: i}}
|
19
|
+
batch.create_code!
|
16
20
|
|
17
|
-
results
|
21
|
+
results = batch.run!
|
18
22
|
|
19
23
|
p results
|
20
24
|
#=> [{"result"=>false}, {"result"=>true}, {"result"=>true}...]
|
@@ -127,28 +131,28 @@ require_relative "configuration"
|
|
127
131
|
require "iron_response"
|
128
132
|
|
129
133
|
config = Configuration.keys
|
130
|
-
batch = IronResponse::Batch.new
|
134
|
+
batch = IronResponse::Batch.new(config)
|
131
135
|
|
132
|
-
|
133
|
-
|
134
|
-
|
136
|
+
code = IronWorkerNG::Code::Ruby.new
|
137
|
+
code.runtime = "ruby"
|
138
|
+
code.exec "workers/my_worker.rb"
|
139
|
+
batch.code = code
|
135
140
|
|
136
141
|
# The `params_array` is an Array of Hashes
|
137
142
|
# that get sent as the payload to IronWorker scripts.
|
138
|
-
batch.params_array
|
143
|
+
batch.params_array = Array ("a".."z").map {|i| {letter: i}}
|
139
144
|
|
140
|
-
results
|
145
|
+
results = batch.run!
|
141
146
|
```
|
142
147
|
|
143
148
|
If your worker code requires any gems, you can use [`iron_worker_ng`](https://github.com/iron-io/iron_worker_ruby_ng)'s API:
|
144
149
|
|
145
150
|
```ruby
|
146
|
-
|
147
|
-
|
148
|
-
|
151
|
+
code.merge_gem("nokogiri", "< 1.6.0") # decreases remote build time
|
152
|
+
code.merge_gem("ecfs")
|
153
|
+
code.full_remote_build(true)
|
149
154
|
```
|
150
155
|
|
151
|
-
|
152
156
|
## Installation
|
153
157
|
|
154
158
|
Add this line to your application's Gemfile:
|
data/iron_response.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_dependency "iron_worker_ng"
|
19
19
|
gem.add_dependency "aws-s3"
|
20
20
|
gem.add_dependency "iron_cache"
|
21
|
-
gem.add_development_dependency "minitest", "~> 4.7.3"
|
21
|
+
#gem.add_development_dependency "minitest", "~> 4.7.3"
|
22
22
|
gem.add_development_dependency "pry"
|
23
23
|
gem.add_development_dependency "pry-rescue"
|
24
24
|
end
|
data/lib/iron_response/common.rb
CHANGED
@@ -10,7 +10,7 @@ module IronResponse
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def Common.s3_bucket_name(config)
|
13
|
-
config[:aws_s3][:bucket].nil? ? DEFAULT_S3_BUCKET :
|
13
|
+
config[:aws_s3][:bucket].nil? ? DEFAULT_S3_BUCKET : config[:aws_s3][:bucket]
|
14
14
|
end
|
15
15
|
|
16
16
|
def Common.iron_cache_key(task_id)
|
@@ -18,7 +18,7 @@ module IronResponse
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def Common.iron_cache_cache_name(config)
|
21
|
-
config[:iron_io][:cache].nil? ? DEFAULT_IRON_CACHE_CACHE_NAME :
|
21
|
+
config[:iron_io][:cache].nil? ? DEFAULT_IRON_CACHE_CACHE_NAME : config[:iron_io][:cache]
|
22
22
|
end
|
23
23
|
|
24
24
|
def Common.response_provider(config)
|
data/test/gem_dependency_test.rb
CHANGED
data/test/synopsis_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require_relative "configuration"
|
2
|
-
|
3
|
-
require "minitest/
|
4
|
-
require "
|
5
|
-
require "minitest
|
6
|
-
require "
|
7
|
-
require "
|
2
|
+
|
3
|
+
#require "minitest/unit"
|
4
|
+
#require "minitest/autorun"
|
5
|
+
#require "pry-rescue/minitest"
|
6
|
+
#require "minitest/pride"
|
7
|
+
#require "pry"
|
8
|
+
require "test/unit"
|
9
|
+
require "iron_response"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_worker_ng
|
@@ -59,22 +59,6 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: minitest
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 4.7.3
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 4.7.3
|
78
62
|
- !ruby/object:Gem::Dependency
|
79
63
|
name: pry
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|