iron_worker_ng 0.8.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/VERSION +1 -1
  2. data/bin/iron_worker +48 -3
  3. data/lib/iron_worker_ng/client.rb +7 -7
  4. data/lib/iron_worker_ng/code/base.rb +48 -24
  5. data/lib/iron_worker_ng/code/builder.rb +4 -4
  6. data/lib/iron_worker_ng/code/dir_container.rb +33 -0
  7. data/lib/iron_worker_ng/code/runtime/binary.rb +1 -1
  8. data/lib/iron_worker_ng/code/runtime/go.rb +1 -1
  9. data/lib/iron_worker_ng/code/runtime/java.rb +1 -1
  10. data/lib/iron_worker_ng/code/runtime/mono.rb +1 -1
  11. data/lib/iron_worker_ng/code/runtime/node.rb +1 -1
  12. data/lib/iron_worker_ng/code/runtime/perl.rb +1 -1
  13. data/lib/iron_worker_ng/code/runtime/php.rb +3 -3
  14. data/lib/iron_worker_ng/code/runtime/python.rb +1 -1
  15. data/lib/iron_worker_ng/code/runtime/ruby.rb +4 -4
  16. data/lib/iron_worker_ng/feature/base.rb +4 -4
  17. data/lib/iron_worker_ng/feature/binary/merge_exec.rb +2 -2
  18. data/lib/iron_worker_ng/feature/common/merge_dir.rb +2 -2
  19. data/lib/iron_worker_ng/feature/common/merge_file.rb +2 -2
  20. data/lib/iron_worker_ng/feature/go/merge_exec.rb +2 -2
  21. data/lib/iron_worker_ng/feature/java/merge_exec.rb +2 -2
  22. data/lib/iron_worker_ng/feature/java/merge_jar.rb +2 -2
  23. data/lib/iron_worker_ng/feature/mono/merge_exec.rb +2 -2
  24. data/lib/iron_worker_ng/feature/node/merge_exec.rb +2 -2
  25. data/lib/iron_worker_ng/feature/perl/merge_exec.rb +2 -2
  26. data/lib/iron_worker_ng/feature/php/merge_exec.rb +2 -2
  27. data/lib/iron_worker_ng/feature/python/merge_exec.rb +2 -2
  28. data/lib/iron_worker_ng/feature/ruby/merge_exec.rb +2 -2
  29. data/lib/iron_worker_ng/feature/ruby/merge_gem.rb +3 -3
  30. metadata +3 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.4
1
+ 0.9.0
data/bin/iron_worker CHANGED
@@ -25,9 +25,9 @@ if $*.size == 1 && ($*[0] == '-v' || $*[0] == '--version')
25
25
  exit 0
26
26
  end
27
27
 
28
- if $*.size == 0 || (not ['codes.create', 'upload', 'tasks.create', 'queue', 'schedules.create', 'schedule', 'tasks.log', 'log'].include?($*[0]))
28
+ if $*.size == 0 || (not ['codes.create', 'upload', 'tasks.create', 'queue', 'schedules.create', 'schedule', 'tasks.log', 'log', 'run'].include?($*[0]))
29
29
  puts 'usage: iron_worker COMMAND [OPTIONS]'
30
- puts ' COMMAND: codes.create (upload), tasks.create (queue), schedules.create (schedule), tasks.log (log)'
30
+ puts ' COMMAND: codes.create (upload), tasks.create (queue), schedules.create (schedule), tasks.log (log), run'
31
31
  puts ' run iron_worker COMMAND --help to get more information about each command'
32
32
  exit 1
33
33
  end
@@ -53,7 +53,6 @@ if command == 'codes.create'
53
53
  end
54
54
 
55
55
  name = nil
56
- wfile = nil
57
56
 
58
57
  opts = OptionParser.new do |opts|
59
58
  opts.banner = "usage: iron_worker #{command} [OPTIONS]"
@@ -268,4 +267,50 @@ elsif command == 'tasks.log'
268
267
  rescue IronCore::Error
269
268
  end
270
269
  end
270
+ elsif command == 'run'
271
+ if $*.size > 0 && $*[0][0] != '-'
272
+ $*.unshift('-n')
273
+ end
274
+
275
+ name = nil
276
+ payload = nil
277
+ payload_file = nil
278
+
279
+ opts = OptionParser.new do |opts|
280
+ opts.banner = "usage: iron_worker #{command} [OPTIONS]"
281
+
282
+ opts.on('-n', '--name NAME', 'code name or workerfile') do |v|
283
+ name = v
284
+ end
285
+
286
+ opts.on('-p', '--payload PAYLOAD', String, 'payload to pass') do |v|
287
+ payload = v
288
+ end
289
+
290
+ opts.on('-f', '--payload-file PAYLOAD_FILE', String, 'payload file to pass') do |v|
291
+ payload_file = v
292
+ end
293
+ end
294
+
295
+ begin
296
+ opts.parse!
297
+ rescue OptionParser::ParseError
298
+ puts $!.to_s
299
+ exit 1
300
+ end
301
+
302
+ if name.nil?
303
+ puts opts
304
+ exit 1
305
+ end
306
+
307
+ if payload.nil? and (not payload_file.nil?)
308
+ payload = File.read(payload_file)
309
+ end
310
+
311
+ code = IronWorkerNG::Code::Base.new(name)
312
+
313
+ IronCore::Logger.info 'IronWorkerNG', "Worker '#{name}' run started"
314
+
315
+ code.run(payload)
271
316
  end
@@ -63,14 +63,14 @@ module IronWorkerNG
63
63
  def codes_create(code, options = {})
64
64
  IronCore::Logger.debug 'IronWorkerNG', "Calling codes.create with code='#{code.to_s}' and options='#{options.to_s}'"
65
65
 
66
- zip_file = code.create_zip
66
+ container_file = code.create_container
67
67
 
68
68
  if code.remote_build_command.nil?
69
- res = @api.codes_create(code.name, zip_file, 'sh', '__runner__.sh', options)
69
+ res = @api.codes_create(code.name, container_file, 'sh', '__runner__.sh', options)
70
70
  else
71
71
  builder_code_name = code.name + (code.name.capitalize == code.name ? '::Builder' : '::builder')
72
72
 
73
- @api.codes_create(builder_code_name, zip_file, 'sh', '__runner__.sh', options)
73
+ @api.codes_create(builder_code_name, container_file, 'sh', '__runner__.sh', options)
74
74
 
75
75
  builder_task = tasks.create(builder_code_name, :code_name => code.name, :client_options => @api.options.to_json, :codes_create_options => options.to_json)
76
76
  builder_task = tasks.wait_for(builder_task.id)
@@ -83,7 +83,7 @@ module IronWorkerNG
83
83
  res = JSON.parse(builder_task.msg)
84
84
  end
85
85
 
86
- File.unlink(zip_file)
86
+ File.unlink(container_file)
87
87
 
88
88
  OpenStruct.new(res)
89
89
  end
@@ -123,7 +123,7 @@ module IronWorkerNG
123
123
  def tasks_create(code_name, params = {}, options = {})
124
124
  IronCore::Logger.debug 'IronWorkerNG', "Calling tasks.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
125
125
 
126
- res = @api.tasks_create(code_name, params.class == String ? params : params.to_json, options)
126
+ res = @api.tasks_create(code_name, params.is_a?(String) ? params : params.to_json, options)
127
127
 
128
128
  OpenStruct.new(res['tasks'][0])
129
129
  end
@@ -197,7 +197,7 @@ module IronWorkerNG
197
197
  def schedules_create(code_name, params = {}, options = {})
198
198
  IronCore::Logger.debug 'IronWorkerNG', "Calling schedules.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
199
199
 
200
- res = @api.schedules_create(code_name, params.class == String ? params : params.to_json, options)
200
+ res = @api.schedules_create(code_name, params.is_a?(String) ? params : params.to_json, options)
201
201
 
202
202
  OpenStruct.new(res['schedules'][0])
203
203
  end
@@ -227,7 +227,7 @@ module IronWorkerNG
227
227
  end
228
228
 
229
229
  def params_for_legacy(code_name, params)
230
- if params.class == String
230
+ if params.is_a?(String)
231
231
  params = JSON.parse(params)
232
232
  end
233
233
 
@@ -1,6 +1,8 @@
1
1
  require 'tmpdir'
2
2
  require 'zip/zip'
3
+ require 'fileutils'
3
4
 
5
+ require_relative 'dir_container'
4
6
  require_relative '../feature/base'
5
7
  require_relative '../feature/common/merge_file'
6
8
  require_relative '../feature/common/merge_dir'
@@ -173,20 +175,20 @@ module IronWorkerNG
173
175
  Digest::MD5.hexdigest(@features.map { |f| f.hash_string }.join)
174
176
  end
175
177
 
176
- def runtime_bundle(zip)
178
+ def runtime_bundle(container)
177
179
  end
178
180
 
179
- def runtime_run_code
181
+ def runtime_run_code(local = false)
180
182
  ''
181
183
  end
182
184
 
183
- def bundle(zip)
185
+ def bundle(container, local = false)
184
186
  @features.each do |feature|
185
- feature.bundle(zip)
187
+ feature.bundle(container)
186
188
  end
187
189
 
188
190
  unless @inside_builder
189
- zip.get_output_stream(@dest_dir + '__runner__.sh') do |runner|
191
+ container.get_output_stream(@dest_dir + '__runner__.sh') do |runner|
190
192
  runner.write <<RUNNER
191
193
  #!/bin/sh
192
194
  # #{IronWorkerNG.full_version}
@@ -204,15 +206,15 @@ root() {
204
206
 
205
207
  cd "$(root "$@")"
206
208
 
207
- #{runtime_run_code}
209
+ #{runtime_run_code(local)}
208
210
  RUNNER
209
211
  end
210
212
  end
211
213
 
212
- runtime_bundle(zip)
214
+ runtime_bundle(container)
213
215
  end
214
216
 
215
- def create_zip
217
+ def create_container(local = false)
216
218
  unless @inside_builder
217
219
  if @exec.nil?
218
220
  IronCore::Logger.error 'IronWorkerNG', 'No exec specified', IronCore::Error
@@ -225,35 +227,57 @@ RUNNER
225
227
 
226
228
  fixate
227
229
 
228
- zip_name = Dir.tmpdir + '/' + Dir::Tmpname.make_tmpname("iron-worker-ng-", "code.zip")
230
+ container_name = Dir.tmpdir + '/' + Dir::Tmpname.make_tmpname('iron-worker-ng-', "container#{local ? '' : '.zip'}")
229
231
 
230
- IronCore::Logger.debug 'IronWorkerNG', "Creating code zip '#{zip_name}'"
232
+ IronCore::Logger.debug 'IronWorkerNG', "Creating #{local ? 'local ' : ''}code container '#{container_name}'"
231
233
 
232
- if @remote_build_command
233
- @dest_dir = '__build__/'
234
- end
235
-
236
- Zip::ZipFile.open(zip_name, Zip::ZipFile::CREATE) do |zip|
237
- bundle(zip)
234
+ if local
235
+ container = IronWorkerNG::Code::DirContainer.new(container_name)
238
236
 
237
+ bundle(container)
238
+ else
239
239
  if @remote_build_command
240
- IronCore::Logger.info 'IronWorkerNG', 'Creating builder'
240
+ @dest_dir = '__build__/'
241
+ end
241
242
 
242
- builder = IronWorkerNG::Code::Builder.new
243
- builder.remote_build_command = @remote_build_command
243
+ Zip::ZipFile.open(container_name, Zip::ZipFile::CREATE) do |container|
244
+ bundle(container)
244
245
 
245
- builder.gem('iron_worker_ng')
246
+ if @remote_build_command
247
+ IronCore::Logger.info 'IronWorkerNG', 'Creating builder'
248
+
249
+ builder = IronWorkerNG::Code::Builder.new
250
+ builder.remote_build_command = @remote_build_command
246
251
 
247
- builder.fixate
248
- builder.bundle(zip)
252
+ builder.gem('iron_worker_ng')
253
+
254
+ builder.fixate
255
+ builder.bundle(container)
256
+ end
257
+ end
258
+
259
+ if @remote_build_command
260
+ @dest_dir = ''
249
261
  end
250
262
  end
251
263
 
264
+ container_name
265
+ end
266
+
267
+ def run(params = {})
268
+ container_name = create_container(true)
269
+
270
+ payload = File.open("#{container_name}/__payload__", 'wb')
271
+ payload.write(params.is_a?(String) ? params : params.to_json)
272
+ payload.close
273
+
252
274
  if @remote_build_command
253
- @dest_dir = ''
275
+ system("cd #{container_name} && #{@remote_build_command}")
254
276
  end
255
277
 
256
- zip_name
278
+ system("sh #{container_name}/__runner__.sh -d #{container_name} -payload #{container_name}/__payload__ -id 0")
279
+
280
+ FileUtils.rm_f(container_name)
257
281
  end
258
282
 
259
283
  def to_s
@@ -13,19 +13,19 @@ module IronWorkerNG
13
13
  runtime(:ruby)
14
14
  end
15
15
 
16
- def bundle(zip)
16
+ def bundle(container)
17
17
  @exec = IronWorkerNG::Feature::Ruby::MergeExec::Feature.new(self, '__builder__.rb', nil)
18
18
 
19
- super(zip)
19
+ super(container)
20
20
 
21
- zip.get_output_stream(@dest_dir + '__builder__.sh') do |builder|
21
+ container.get_output_stream(@dest_dir + '__builder__.sh') do |builder|
22
22
  builder.write <<BUILDER_SH
23
23
  # #{IronWorkerNG.full_version}
24
24
  #{remote_build_command}
25
25
  BUILDER_SH
26
26
  end
27
27
 
28
- zip.get_output_stream(@dest_dir + '__builder__.rb') do |builder|
28
+ container.get_output_stream(@dest_dir + '__builder__.rb') do |builder|
29
29
  builder.write <<BUILDER_RUBY
30
30
  # #{IronWorkerNG.full_version}
31
31
 
@@ -0,0 +1,33 @@
1
+ require 'fileutils'
2
+
3
+ module IronWorkerNG
4
+ module Code
5
+ class DirContainer
6
+ def initialize(dir)
7
+ @dir = dir
8
+ end
9
+
10
+ def full_dest(dest)
11
+ @dir + '/' + dest
12
+ end
13
+
14
+ def add(dest, src)
15
+ FileUtils.mkdir_p(File.dirname(full_dest(dest)))
16
+
17
+ if File.directory?(src)
18
+ FileUtils.mkdir(full_dest(dest))
19
+ else
20
+ FileUtils.cp(src, full_dest(dest))
21
+ end
22
+ end
23
+
24
+ def get_output_stream(dest, &block)
25
+ FileUtils.mkdir_p(File.dirname(full_dest(dest)))
26
+
27
+ file = File.open(full_dest(dest), 'wb')
28
+ yield file
29
+ file.close
30
+ end
31
+ end
32
+ end
33
+ end
@@ -6,7 +6,7 @@ module IronWorkerNG
6
6
  module Binary
7
7
  include IronWorkerNG::Feature::Binary::MergeExec::InstanceMethods
8
8
 
9
- def runtime_run_code
9
+ def runtime_run_code(local = false)
10
10
  <<RUN_CODE
11
11
  chmod +x #{File.basename(@exec.path)}
12
12
 
@@ -6,7 +6,7 @@ module IronWorkerNG
6
6
  module Go
7
7
  include IronWorkerNG::Feature::Go::MergeExec::InstanceMethods
8
8
 
9
- def runtime_run_code
9
+ def runtime_run_code(local = false)
10
10
  <<RUN_CODE
11
11
  go run #{File.basename(@exec.path)} "$@"
12
12
  RUN_CODE
@@ -8,7 +8,7 @@ module IronWorkerNG
8
8
  include IronWorkerNG::Feature::Java::MergeJar::InstanceMethods
9
9
  include IronWorkerNG::Feature::Java::MergeExec::InstanceMethods
10
10
 
11
- def runtime_run_code
11
+ def runtime_run_code(local = false)
12
12
  classpath_array = []
13
13
 
14
14
  @features.each do |f|
@@ -6,7 +6,7 @@ module IronWorkerNG
6
6
  module Mono
7
7
  include IronWorkerNG::Feature::Mono::MergeExec::InstanceMethods
8
8
 
9
- def runtime_run_code
9
+ def runtime_run_code(local = false)
10
10
  <<RUN_CODE
11
11
  mono #{File.basename(@exec.path)} "$@"
12
12
  RUN_CODE
@@ -6,7 +6,7 @@ module IronWorkerNG
6
6
  module Node
7
7
  include IronWorkerNG::Feature::Node::MergeExec::InstanceMethods
8
8
 
9
- def runtime_run_code
9
+ def runtime_run_code(local = false)
10
10
  <<RUN_CODE
11
11
  node #{File.basename(@exec.path)} "$@"
12
12
  RUN_CODE
@@ -6,7 +6,7 @@ module IronWorkerNG
6
6
  module Perl
7
7
  include IronWorkerNG::Feature::Perl::MergeExec::InstanceMethods
8
8
 
9
- def runtime_run_code
9
+ def runtime_run_code(local = false)
10
10
  <<RUN_CODE
11
11
  perl #{File.basename(@exec.path)} "$@"
12
12
  RUN_CODE
@@ -6,8 +6,8 @@ module IronWorkerNG
6
6
  module PHP
7
7
  include IronWorkerNG::Feature::PHP::MergeExec::InstanceMethods
8
8
 
9
- def runtime_bundle(zip)
10
- zip.get_output_stream(@dest_dir + '__runner__.php') do |runner|
9
+ def runtime_bundle(container)
10
+ container.get_output_stream(@dest_dir + '__runner__.php') do |runner|
11
11
  runner.write <<PHP_RUNNER
12
12
  <?php
13
13
  /* #{IronWorkerNG.full_version} */
@@ -48,7 +48,7 @@ PHP_RUNNER
48
48
  end
49
49
  end
50
50
 
51
- def runtime_run_code
51
+ def runtime_run_code(local = false)
52
52
  <<RUN_CODE
53
53
  TERM=dumb php __runner__.php "$@"
54
54
  RUN_CODE
@@ -6,7 +6,7 @@ module IronWorkerNG
6
6
  module Python
7
7
  include IronWorkerNG::Feature::Python::MergeExec::InstanceMethods
8
8
 
9
- def runtime_run_code
9
+ def runtime_run_code(local = false)
10
10
  <<RUN_CODE
11
11
  python #{File.basename(@exec.path)} "$@"
12
12
  RUN_CODE
@@ -10,8 +10,8 @@ module IronWorkerNG
10
10
  include IronWorkerNG::Feature::Ruby::MergeGemfile::InstanceMethods
11
11
  include IronWorkerNG::Feature::Ruby::MergeExec::InstanceMethods
12
12
 
13
- def runtime_bundle(zip)
14
- zip.get_output_stream(@dest_dir + '__runner__.rb') do |runner|
13
+ def runtime_bundle(container)
14
+ container.get_output_stream(@dest_dir + '__runner__.rb') do |runner|
15
15
  runner.write <<RUBY_RUNNER
16
16
  # #{IronWorkerNG.full_version}
17
17
 
@@ -85,9 +85,9 @@ RUBY_RUNNER
85
85
  end
86
86
  end
87
87
 
88
- def runtime_run_code
88
+ def runtime_run_code(local = false)
89
89
  <<RUN_CODE
90
- ruby __runner__.rb "$@"
90
+ #{local ? 'GEM_PATH="" ' : ''}ruby __runner__.rb "$@"
91
91
  RUN_CODE
92
92
  end
93
93
  end
@@ -11,7 +11,7 @@ module IronWorkerNG
11
11
  @code.base_dir + path
12
12
  end
13
13
 
14
- def zip_add(zip, dest, src)
14
+ def container_add(container, dest, src)
15
15
  new_src, clean = IronWorkerNG::Fetcher.fetch(src, true)
16
16
 
17
17
  new_src = File.expand_path(new_src) unless new_src.nil?
@@ -24,10 +24,10 @@ module IronWorkerNG
24
24
 
25
25
  if File.directory?(src)
26
26
  Dir.glob(src + '/**/**') do |path|
27
- zip.add(@code.dest_dir + dest + path[src.length .. -1], path)
27
+ container.add(@code.dest_dir + dest + path[src.length .. -1], path)
28
28
  end
29
29
  else
30
- zip.add(@code.dest_dir + dest, src)
30
+ container.add(@code.dest_dir + dest, src)
31
31
  end
32
32
 
33
33
  unless clean.nil?
@@ -39,7 +39,7 @@ module IronWorkerNG
39
39
  ''
40
40
  end
41
41
 
42
- def bundle(zip)
42
+ def bundle(container)
43
43
  end
44
44
  end
45
45
  end
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling binary exec with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
  end
24
24
 
@@ -26,10 +26,10 @@ module IronWorkerNG
26
26
  Digest::MD5.hexdigest(s)
27
27
  end
28
28
 
29
- def bundle(zip)
29
+ def bundle(container)
30
30
  IronCore::Logger.debug 'IronWorkerNG', "Bundling dir with path='#{@path}' and dest='#{@dest}'"
31
31
 
32
- zip_add(zip, @dest + File.basename(@path), rebase(@path))
32
+ container_add(container, @dest + File.basename(@path), rebase(@path))
33
33
  end
34
34
  end
35
35
 
@@ -20,10 +20,10 @@ module IronWorkerNG
20
20
  Digest::MD5.hexdigest(@path + @dest + File.mtime(rebase(@path)).to_i.to_s)
21
21
  end
22
22
 
23
- def bundle(zip)
23
+ def bundle(container)
24
24
  IronCore::Logger.debug 'IronWorkerNG', "Bundling file with path='#{@path}' and dest='#{@dest}'"
25
25
 
26
- zip_add(zip, @dest + File.basename(@path), rebase(@path))
26
+ container_add(container, @dest + File.basename(@path), rebase(@path))
27
27
  end
28
28
  end
29
29
 
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling go exec with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
  end
24
24
 
@@ -17,10 +17,10 @@ module IronWorkerNG
17
17
  Digest::MD5.hexdigest(@path + @klass + File.mtime(rebase(@path)).to_i.to_s)
18
18
  end
19
19
 
20
- def bundle(zip)
20
+ def bundle(container)
21
21
  IronCore::Logger.debug 'IronWorkerNG', "Bundling java exec with path='#{@path}' and class='#{@klass}'"
22
22
 
23
- zip_add(zip, File.basename(@path), rebase(@path))
23
+ container_add(container, File.basename(@path), rebase(@path))
24
24
  end
25
25
 
26
26
  def code_for_classpath
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling java jar with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
 
24
24
  def code_for_classpath
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling mono exec with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
  end
24
24
 
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling node exec with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
  end
24
24
 
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling perl exec with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
  end
24
24
 
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling php exec with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
  end
24
24
 
@@ -15,10 +15,10 @@ module IronWorkerNG
15
15
  Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
16
16
  end
17
17
 
18
- def bundle(zip)
18
+ def bundle(container)
19
19
  IronCore::Logger.debug 'IronWorkerNG', "Bundling python exec with path='#{@path}'"
20
20
 
21
- zip_add(zip, File.basename(@path), rebase(@path))
21
+ container_add(container, File.basename(@path), rebase(@path))
22
22
  end
23
23
  end
24
24
 
@@ -17,10 +17,10 @@ module IronWorkerNG
17
17
  Digest::MD5.hexdigest(@path + @klass + File.mtime(rebase(@path)).to_i.to_s)
18
18
  end
19
19
 
20
- def bundle(zip)
20
+ def bundle(container)
21
21
  IronCore::Logger.debug 'IronWorkerNG', "Bundling ruby exec with path='#{path}' and class='#{klass}'"
22
22
 
23
- zip_add(zip, File.basename(@path), rebase(@path))
23
+ container_add(container, File.basename(@path), rebase(@path))
24
24
  end
25
25
  end
26
26
 
@@ -37,12 +37,12 @@ module IronWorkerNG
37
37
  Digest::MD5.hexdigest(@spec.full_name)
38
38
  end
39
39
 
40
- def bundle(zip)
40
+ def bundle(container)
41
41
  if @spec.extensions.length == 0 || IronWorkerNG::Feature::Ruby::MergeGem.merge_binary?
42
42
  IronCore::Logger.debug 'IronWorkerNG', "Bundling ruby gem with name='#{@spec.name}' and version='#{@spec.version}'"
43
43
 
44
- zip_add(zip, '__gems__/gems/' + @spec.full_name, gem_path)
45
- zip_add(zip, "__gems__/specifications/#{@spec.full_name}.gemspec", gem_path + '/../../specifications/' + @spec.full_name + '.gemspec')
44
+ container_add(container, '__gems__/gems/' + @spec.full_name, gem_path)
45
+ container_add(container, "__gems__/specifications/#{@spec.full_name}.gemspec", gem_path + '/../../specifications/' + @spec.full_name + '.gemspec')
46
46
  else
47
47
  IronCore::Logger.warn 'IronWorkerNG', "Skipping ruby gem with name='#{@spec.name}' and version='#{@spec.version}' as it contains native extensions"
48
48
  end
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: 0.8.4
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -113,6 +113,7 @@ files:
113
113
  - lib/iron_worker_ng/code/base.rb
114
114
  - lib/iron_worker_ng/code/binary.rb
115
115
  - lib/iron_worker_ng/code/builder.rb
116
+ - lib/iron_worker_ng/code/dir_container.rb
116
117
  - lib/iron_worker_ng/code/go.rb
117
118
  - lib/iron_worker_ng/code/java.rb
118
119
  - lib/iron_worker_ng/code/mono.rb
@@ -161,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
162
  version: '0'
162
163
  segments:
163
164
  - 0
164
- hash: -427365489
165
+ hash: 837810259
165
166
  required_rubygems_version: !ruby/object:Gem::Requirement
166
167
  none: false
167
168
  requirements: