six-rsync 0.2.1 → 0.2.2

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.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/six/rsync/lib.rb +58 -43
  3. data/lib/six/rsync.rb +1 -1
  4. metadata +2 -2
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require 'rake/testtask'
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = 'six-rsync'
15
- s.version = '0.2.1'
15
+ s.version = '0.2.2'
16
16
  s.has_rdoc = true
17
17
  s.extra_rdoc_files = ['README', 'LICENSE']
18
18
  s.summary = 'Your summary here'
data/lib/six/rsync/lib.rb CHANGED
@@ -401,51 +401,66 @@ module Six
401
401
  # direct unpack of gz into working folder
402
402
  # Update file
403
403
  if online
404
- # TODO: Progress bar
405
- if mismatch.count > (@repos_remote[typ].count / 2)
406
- @logger.info "Many files mismatched (#{mismatch.count}), running full update on .pack folder"
407
- arr_opts = []
408
- arr_opts << PARAMS
409
- if host[/\A(\w)*\@/]
410
- arr_opts << RSH
411
- end
412
-
413
- arr_opts << esc(File.join(host, '.pack/.'))
414
- arr_opts << esc(pack_path)
415
- begin
416
- command('', arr_opts)
417
- rescue
418
- @logger.warn "There was a problem during updating, please retry!"
419
- end
420
- else
421
- c = mismatch.size
422
- @logger.info "Fetching #{mismatch.size} files... Please wait"
423
- slist = File.join(TOOLS_PATH, ".six-updater_#{rand 9999}-list")
424
- File.open(slist, 'w') do |f|
425
- mismatch.each { |e| f.puts e }
426
- end
427
- arr_opts = []
428
- arr_opts << PARAMS
404
+ hosts = config[:hosts].clone
405
+ done = false
406
+
407
+ ## Pack
408
+ if online
409
+ b = false
410
+ while hosts.size > 0 && !done do
411
+ # FIXME: Nasty
412
+ if b
413
+ host = hosts.sample
414
+ @logger.info "Trying #{host}"
415
+ end
416
+ b = true
417
+ hosts -= [host]
418
+ begin
419
+ # TODO: Progress bar
420
+ if mismatch.count > (@repos_remote[typ].count / 2)
421
+ @logger.info "Many files mismatched (#{mismatch.count}), running full update on .pack folder"
422
+ arr_opts = []
423
+ arr_opts << PARAMS
424
+ if host[/\A(\w)*\@/]
425
+ arr_opts << RSH
426
+ end
427
+
428
+ arr_opts << esc(File.join(host, '.pack/.'))
429
+ arr_opts << esc(pack_path)
430
+ command('', arr_opts)
431
+ else
432
+ c = mismatch.size
433
+ @logger.info "Fetching #{mismatch.size} files... Please wait"
434
+ slist = File.join(TOOLS_PATH, ".six-updater_#{rand 9999}-list")
435
+ File.open(slist, 'w') do |f|
436
+ mismatch.each { |e| f.puts e }
437
+ end
438
+ arr_opts = []
439
+ arr_opts << PARAMS
429
440
 
430
- arr_opts << RSH if host[/\A(\w)*\@/]
431
-
432
- slist = "\"#{slist}\""
433
-
434
- while slist[WINDRIVE] do
435
- drive = slist[WINDRIVE]
436
- slist.gsub!(drive, "\"/cygdrive/#{$1}")
437
- end
438
- arr_opts << "--files-from=#{slist}"
439
-
440
- arr_opts << esc(File.join(host, '.pack/.'))
441
- arr_opts << esc(pack_path)
442
-
443
- begin
444
- command('', arr_opts)
445
- rescue
446
- @logger.warn "There was a problem during updating, please retry!"
441
+ arr_opts << RSH if host[/\A(\w)*\@/]
442
+
443
+ slist = "\"#{slist}\""
444
+
445
+ while slist[WINDRIVE] do
446
+ drive = slist[WINDRIVE]
447
+ slist.gsub!(drive, "\"/cygdrive/#{$1}")
448
+ end
449
+ arr_opts << "--files-from=#{slist}"
450
+
451
+ arr_opts << esc(File.join(host, '.pack/.'))
452
+ arr_opts << esc(pack_path)
453
+
454
+ command('', arr_opts)
455
+ FileUtils.rm_f slist
456
+ end
457
+ done = true
458
+ rescue
459
+ @logger.warn "Failure"
460
+ @logger.debug "#{$!}"
461
+ end
447
462
  end
448
- FileUtils.rm_f slist
463
+ @logger.warn "There was a problem during updating, please retry!" unless done
449
464
  end
450
465
  end
451
466
  when :wd
data/lib/six/rsync.rb CHANGED
@@ -30,7 +30,7 @@ module Six
30
30
  end
31
31
 
32
32
  module Rsync
33
- VERSION = '0.2.1'
33
+ VERSION = '0.2.2'
34
34
  TOOLS_PATH = File.join(BASE_PATH, 'tools')
35
35
  FOLDER = /(.*)\/(.*)/
36
36
  ENV['PATH'] = ENV['PATH'] + ";#{TOOLS_PATH};#{File.join(TOOLS_PATH, 'bin')}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: six-rsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sickboy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-06 00:00:00 +01:00
12
+ date: 2009-12-07 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15