iron_worker_ng 1.6.2 → 1.6.3
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 +4 -4
- data/README.md +8 -0
- data/bin/iron_worker +6 -2
- data/lib/iron_worker_ng/api_client.rb +4 -0
- data/lib/iron_worker_ng/cli.rb +9 -1
- data/lib/iron_worker_ng/client.rb +7 -8
- data/lib/iron_worker_ng/code/runtime/php.rb +1 -1
- data/lib/iron_worker_ng/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70aa324ca6fd1f4fe49bcfe3294d37b6302926b3
|
4
|
+
data.tar.gz: 62d5a435dca86736b109a4282eb98f8476a86ee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9efaa8366ddd501b743cb36f64518d038daa6c50be43d70ff0e75a323def3dde72663d2959ba306940d1aef20fed60d08d086076d995beed6afb9676b92c10b0
|
7
|
+
data.tar.gz: 1d5cd976a688c710f624c8b542a697fc806da3d1bd0fabe18b7e3e3cf34efd77cc0e898f66fb2c195712d9ba733c9a67ad5efb025af938b6d3c8594792cb0982
|
data/README.md
CHANGED
@@ -662,3 +662,11 @@ Cancel the scheduled task specified by `schedule_id`.
|
|
662
662
|
```ruby
|
663
663
|
client.schedules.cancel('1234567890')
|
664
664
|
```
|
665
|
+
|
666
|
+
### patch your worker using cli
|
667
|
+
|
668
|
+
If you have an uploaded worker named `super_code` with files `qux.rb, bar.rb, etc.` and want to replace the content of `bar.rb` with a local file `foo.rb`, `qux.rb` with `baz.rb` just run a command:
|
669
|
+
|
670
|
+
iron_worker patch super_code -p 'foo.rb=bar.rb,baz.rb=lib/qux.rb.rb,foo.rb,foo2.rb'
|
671
|
+
|
672
|
+
No need to pass the same two file names `foo.rb=foo.rb`, only one `foo.rb` would be enough. Normally the patched version is put in place of the originals.
|
data/bin/iron_worker
CHANGED
@@ -34,6 +34,10 @@ def common_opts(opts)
|
|
34
34
|
opts.on('--token TOKEN', 'token') do |v|
|
35
35
|
@cli.token = v
|
36
36
|
end
|
37
|
+
|
38
|
+
opts.on('--http-proxy HTTP_PROXY', 'http proxy') do |v|
|
39
|
+
@cli.http_proxy = v
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
43
|
if $*.size == 1 && ($*[0] == '-v' || $*[0] == '--version')
|
@@ -125,8 +129,8 @@ elsif command == 'patch'
|
|
125
129
|
opts = OptionParser.new do |opts|
|
126
130
|
opts.banner = "usage: iron_worker patch CODE_PACKAGE_NAME [OPTIONS]"
|
127
131
|
|
128
|
-
opts.on('-p', '--patch PATCH', 'patch file') do |v|
|
129
|
-
options[:patch] = v
|
132
|
+
opts.on('-p', '--patch PATCH', Array, 'target and patch file names: \'foo.rb=bar.rb,baz.rb=lib/qux.rb,foo1.rb,foo2.rb\'') do |v|
|
133
|
+
options[:patch] = Hash[v.map{|s| s.include?('=') ? s.split('='): [s, s]}]
|
130
134
|
end
|
131
135
|
|
132
136
|
common_opts(opts)
|
@@ -17,6 +17,10 @@ module IronWorkerNG
|
|
17
17
|
|
18
18
|
super('iron', 'worker', options, default_options, [:project_id, :token, :api_version])
|
19
19
|
|
20
|
+
#puts "nhp.proxy yo #{rest.wrapper.http.proxy_uri}" if defined? Net::HTTP::Persistent
|
21
|
+
#puts "RestClient.proxy yo #{RestClient.proxy}" if defined? RestClient
|
22
|
+
#puts "InternalClient.proxy yo #{Rest::InternalClient.proxy}" if defined? Rest::InternalClient
|
23
|
+
|
20
24
|
IronCore::Logger.error 'IronWorkerNG', "Token is not set", IronCore::Error if @token.nil?
|
21
25
|
|
22
26
|
check_id(@project_id, 'project_id')
|
data/lib/iron_worker_ng/cli.rb
CHANGED
@@ -10,6 +10,7 @@ module IronWorkerNG
|
|
10
10
|
@env = nil
|
11
11
|
@project_id = nil
|
12
12
|
@token = nil
|
13
|
+
@http_proxy = nil
|
13
14
|
end
|
14
15
|
|
15
16
|
def beta?
|
@@ -41,6 +42,11 @@ module IronWorkerNG
|
|
41
42
|
|
42
43
|
@token = token
|
43
44
|
end
|
45
|
+
|
46
|
+
def http_proxy=(http_proxy)
|
47
|
+
@client = nil
|
48
|
+
@http_proxy = http_proxy
|
49
|
+
end
|
44
50
|
|
45
51
|
def log(msg)
|
46
52
|
IronCore::Logger.info 'IronWorkerNG', msg
|
@@ -54,7 +60,9 @@ module IronWorkerNG
|
|
54
60
|
if @client.nil?
|
55
61
|
log_group "Creating client"
|
56
62
|
|
57
|
-
@client = IronWorkerNG::Client.new(:config => @config, :env => @env, :project_id => @project_id, :token => @token
|
63
|
+
@client = IronWorkerNG::Client.new(:config => @config, :env => @env, :project_id => @project_id, :token => @token,
|
64
|
+
:http_proxy => @http_proxy
|
65
|
+
)
|
58
66
|
|
59
67
|
project = client.projects.get
|
60
68
|
|
@@ -171,8 +171,8 @@ module IronWorkerNG
|
|
171
171
|
|
172
172
|
def codes_patch(name, options = {})
|
173
173
|
IronCore::Logger.debug 'IronWorkerNG', "Calling codes.patch with name='#{name}' and options='#{options.to_s}'"
|
174
|
-
|
175
|
-
code = codes.list(:
|
174
|
+
|
175
|
+
code = codes.list(per_page: 100).find { |c| c.name == name }
|
176
176
|
|
177
177
|
if code.nil?
|
178
178
|
IronCore::Logger.error 'IronWorkerNG', "Can't find code with name='#{name}' to patch", IronCore::Error
|
@@ -208,9 +208,8 @@ original_code_zip.write(original_code_data)
|
|
208
208
|
original_code_zip.close
|
209
209
|
`cd code && unzip code.zip && rm code.zip && cd ..`
|
210
210
|
|
211
|
-
|
212
|
-
|
213
|
-
system("cd code && patch -fp1 <../\#{patch_file} && cd ..") || exit(1)
|
211
|
+
patch_params = JSON.parse(params[:patch])
|
212
|
+
patch_params.each {|k, v| system("cat patch/\#{k} > code/\#{v}")}
|
214
213
|
|
215
214
|
code_container = IronWorkerNG::Code::Container::Zip.new
|
216
215
|
|
@@ -233,7 +232,8 @@ EXEC_FILE
|
|
233
232
|
patcher_code.runtime = :ruby
|
234
233
|
patcher_code.name = patcher_code_name
|
235
234
|
patcher_code.exec(exec_file_name)
|
236
|
-
|
235
|
+
options[:patch].keys.each {|v| patcher_code.file(v, 'patch')}
|
236
|
+
patch_params = Hash[options[:patch].map {|k,v| [File.basename(k), v]}]
|
237
237
|
|
238
238
|
patcher_container_file = patcher_code.create_container
|
239
239
|
|
@@ -242,8 +242,7 @@ EXEC_FILE
|
|
242
242
|
FileUtils.rm_rf(exec_dir)
|
243
243
|
File.unlink(patcher_container_file)
|
244
244
|
|
245
|
-
patcher_task = tasks.create(patcher_code_name, :code_id => code._id, :client_options => @api.options.to_json)
|
246
|
-
|
245
|
+
patcher_task = tasks.create(patcher_code_name, :code_id => code._id, :client_options => @api.options.to_json, patch: patch_params.to_json)
|
247
246
|
patcher_task = tasks.wait_for(patcher_task._id)
|
248
247
|
|
249
248
|
if patcher_task.status != 'complete'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_worker_ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kirilenko
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_core
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.
|
20
|
+
version: 1.0.6
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0.
|
27
|
+
version: 1.0.6
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
240
|
version: 1.3.6
|
241
241
|
requirements: []
|
242
242
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.4.2
|
244
244
|
signing_key:
|
245
245
|
specification_version: 4
|
246
246
|
summary: New generation ruby client for IronWorker
|