iron_worker 2.4.2 → 2.4.3

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: d686c3db4952165f77d6ab2bbaca5c0a50f58b04
4
- data.tar.gz: 9abed5a00fe87b71f0dd0423376b1e812af516ab
3
+ metadata.gz: 45f10beed01a145026c8ecf904b458d2d98c0de3
4
+ data.tar.gz: f915424385129c96823f092213ac9985ffd37c43
5
5
  SHA512:
6
- metadata.gz: f594597acfad83b64a32e82b87e2fd984ed8fde74dd79e01dbae86834b8cbea86434b16ef7d0cb098d779b5ccb997df3ac7095e26627517e07060e24adf44c01
7
- data.tar.gz: c267c7c5dd765e375a7aab178bd1dddceb99683fd6a5147b1af6f716152c908fb21732dc89057eeb0d3987a8217dd16d0dde69f0ae96cfa98ee3312e3df71118
6
+ metadata.gz: aec12031b24ba4b60d3a55358f671827186c2464231d5ba3e8c4c62f68f6ad4ed998e4c9483d4d2ea6c33d393d0ead3c2a8ae6839dc1ae0c0e30e2245a88d5af
7
+ data.tar.gz: 248199b7bd787670c6f3035af208f850a25c427bd3d7f4efc2caf1893c4dfb989b011824dd97408475a4df7bb1233d3d267b6ca4514d4079ba672f4989c1442c
@@ -1,6 +1,13 @@
1
1
  require 'base64'
2
2
  require 'logger'
3
- require 'zip'
3
+ begin
4
+ # Little hack until everyone upgrades to rubyzip >= 1
5
+ require 'zip'
6
+ ZIPCLZ = Zip::File
7
+ rescue Exception => ex
8
+ require 'zip/zip'
9
+ ZIPCLZ = Zip::ZipFile
10
+ end
4
11
  require 'bundler'
5
12
  require 'rest_client'
6
13
  require 'json'
@@ -26,7 +33,7 @@ module IronWorker
26
33
  super("worker-aws-us-east-1.iron.io", token, options)
27
34
  self.host = self.config.host if self.config && self.config.host
28
35
  # automerge simple worker gem and dependencies
29
- self.config.merge_gem('rubyzip', :require=>'zip')
36
+ self.config.merge_gem('rubyzip', :require => 'zip')
30
37
  self.config.merge_gem('rest-client')
31
38
  self.config.merge_gem('rest')
32
39
  self.config.merge_gem('iron_worker')
@@ -58,7 +65,7 @@ module IronWorker
58
65
  zip_filename = build_merged_file(filename, options[:merge], options[:unmerge], options[:merged_gems], options[:unmerged_gems], options[:merged_mailers], options[:merged_folders], class_name)
59
66
 
60
67
  # Check for code changes.
61
- zipfile = Zip::File.open(zip_filename, Zip::File::CREATE)
68
+ zipfile = ZIPCLZ.open(zip_filename, ZIPCLZ::CREATE)
62
69
  crc = zipfile.entries.collect { |x| x.crc }.inject(:+)
63
70
  new_code = false
64
71
  if self.config.force_upload || crc.to_s != existing_md5
@@ -72,7 +79,7 @@ module IronWorker
72
79
  end
73
80
 
74
81
  if new_code
75
- upload_code(name, zip_filename, 'runner.rb', :runtime=>'ruby')
82
+ upload_code(name, zip_filename, 'runner.rb', :runtime => 'ruby')
76
83
  end
77
84
 
78
85
  rescue Exception => ex
@@ -332,9 +339,9 @@ end
332
339
 
333
340
  end
334
341
  #puts 'funner.rb=' + tmp_file
335
- merge['runner.rb'] = {:path=>tmp_file}
342
+ merge['runner.rb'] = {:path => tmp_file}
336
343
  #puts 'filename=' + filename
337
- merge[File.basename(filename)] = {:path=>filename}
344
+ merge[File.basename(filename)] = {:path => filename}
338
345
  #puts "merge before uniq! " + merge.inspect
339
346
  # puts "merge after uniq! " + merge.inspect
340
347
 
@@ -345,7 +352,7 @@ end
345
352
  File.delete(fname2) if File.exist?(fname2)
346
353
  #merging all gems and deps
347
354
  merged_gems.merge!(gems_dependencies)
348
- Zip::File.open(fname2, 'w') do |f|
355
+ ZIPCLZ.open(fname2, 'w') do |f|
349
356
  if merged_gems && merged_gems.size > 0
350
357
  merged_gems.each_pair do |k, gem|
351
358
  next unless gem[:merge]
@@ -364,10 +371,10 @@ end
364
371
  Dir.glob(paths_to_use).each do |file|
365
372
  # todo: could check if directory and it not lib, skip it
366
373
  #IronWorker.logger.debug 'file for gem=' + file.inspect
367
- # puts 'gem2=' + gem.inspect
374
+ # puts 'gem2=' + gem.inspect
368
375
  zdest = "gems/#{gem[:name]}/#{file.sub(path+'/', '')}"
369
376
  # puts 'gem file=' + file.to_s
370
- #IronWorker.logger.debug 'zip dest=' + zdest
377
+ #IronWorker.logger.debug 'zip dest=' + zdest
371
378
  f.add(zdest, file)
372
379
  end
373
380
  else
@@ -424,7 +431,7 @@ end
424
431
  def package_code(files)
425
432
  fname2 = "package.zip"
426
433
  File.delete(fname2) if File.exist?(fname2)
427
- Zip::File.open(fname2, 'w') do |f|
434
+ ZIPCLZ.open(fname2, 'w') do |f|
428
435
  files.each do |file|
429
436
  f.add(file, file)
430
437
  end
@@ -437,10 +444,10 @@ end
437
444
  def upload_code(name, package_file, exec_file, options={})
438
445
  IronWorker.logger.info 'file size to upload: ' + File.size(package_file).to_s
439
446
  options = {
440
- "name"=>name,
441
- "standalone"=>true,
442
- "runtime"=>options[:runtime] || "ruby",
443
- "file_name"=> exec_file # File.basename(filename)
447
+ "name" => name,
448
+ "standalone" => true,
449
+ "runtime" => options[:runtime] || "ruby",
450
+ "file_name" => exec_file # File.basename(filename)
444
451
  }
445
452
  #puts 'options for upload=' + options.inspect
446
453
  IronWorker.logger.info "Uploading now..."
@@ -608,19 +615,19 @@ end
608
615
 
609
616
  def log(task_id, options={})
610
617
  data = options
611
- ret = get("#{project_url_prefix(get_project_id(options))}tasks/#{task_id}/log", data, :parse=>false)
618
+ ret = get("#{project_url_prefix(get_project_id(options))}tasks/#{task_id}/log", data, :parse => false)
612
619
  ret
613
620
  end
614
621
 
615
622
 
616
623
  def status(task_id, options={})
617
- data = {"task_id"=>task_id}
624
+ data = {"task_id" => task_id}
618
625
  ret = get("#{project_url_prefix(get_project_id(options))}tasks/#{task_id}", data)
619
626
  ret
620
627
  end
621
628
 
622
629
  def schedule_status(schedule_id, options={})
623
- data = {"schedule_id"=>schedule_id}
630
+ data = {"schedule_id" => schedule_id}
624
631
  ret = get("#{project_url_prefix(get_project_id(options))}schedules/#{schedule_id}", data)
625
632
  ret
626
633
  end
@@ -1,4 +1,4 @@
1
1
  module IronWorker
2
- VERSION = "2.4.2"
2
+ VERSION = "2.4.3"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-12 00:00:00.000000000 Z
11
+ date: 2014-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iron_core