six-updater 0.14.16 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
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-updater'
15
- s.version = '0.14.16'
15
+ s.version = '0.15.1'
16
16
  s.has_rdoc = true
17
17
  s.extra_rdoc_files = ['README', 'LICENSE']
18
18
  s.summary = 'Your summary here'
data/lib/six/updater.rb CHANGED
@@ -45,7 +45,7 @@ end
45
45
  module Six
46
46
  # TODO: Evaluate if this module should be a class instead?
47
47
  module Updater
48
- VERSION = '0.14.16'
48
+ VERSION = '0.15.1'
49
49
  COMPONENT = 'six-updater'
50
50
 
51
51
  # Configuration
@@ -36,6 +36,10 @@ module Six
36
36
  end
37
37
  end
38
38
 
39
+ def esc(val)
40
+ "\"#{val}\""
41
+ end
42
+
39
43
  def get_repositories
40
44
  cfg = File.join(@path, '.repositories.yml')
41
45
  @repositories = if FileTest.exist?(cfg)
@@ -216,7 +220,7 @@ module Six
216
220
  log.info "Found #{@folder_str}.7z, using it"
217
221
  #Six::Updater.zipcheck
218
222
  FileUtils.mkdir_p @path
219
- cmd = "7z x -o\"#{@path}\" \"#{file}\""
223
+ cmd = "7z x -o#{esc(@path)} #{esc(file)}"
220
224
  log.debug cmd
221
225
  output = %x[#{cmd}]
222
226
  log.debug output
@@ -307,22 +311,31 @@ module Six
307
311
  return
308
312
  end
309
313
 
310
- path = File.join(@path, 'keys')
314
+ path = File.join(@path, 'store', 'keys.tar')
315
+ path = File.join(@path, 'store', 'keys') unless File.exists?(path)
316
+ path = File.join(@path, 'keys') unless File.directory?(path)
311
317
  if File.exists?(path)
312
318
  log.info "Found keys, processing..."
313
319
  k_path = File.join(@config[:app_path], 'keys')
314
- Dir[File.join(path, '*.bikey')].each do |key|
315
- key[/(.*)\/(.*)/]
316
- path, file = $1, $2
317
- file[/(.*)_(.*)\.bikey/]
318
- prefix, suffix = $1, $2
319
- if suffix && prefix
320
- if suffix[/(\D*)\d*/]
321
- suf = $1
322
- Dir[File.join(k_path, "#{prefix}_#{suf}*.bikey")].each { |delkey| FileUtils.rm_f(delkey) } if suf
320
+ if File.directory? path
321
+ Dir[File.join(path, '*.bikey')].each do |key|
322
+ key[/(.*)\/(.*)/]
323
+ path, file = $1, $2
324
+ file[/(.*)_(.*)\.bikey/]
325
+ prefix, suffix = $1, $2
326
+ if suffix && prefix
327
+ if suffix[/(\D*)\d*/]
328
+ suf = $1
329
+ Dir[File.join(k_path, "#{prefix}_#{suf}*.bikey")].each { |delkey| FileUtils.rm_f(delkey) } if suf
330
+ end
323
331
  end
332
+ FileUtils.cp(key, k_path)
324
333
  end
325
- FileUtils.cp(key, k_path)
334
+ else
335
+ # TODO: Cleanup old keys, Ruby Tar library, examine content? - tarruby doesn't build on 1.9.1. mingw
336
+ cmd = "7z x #{esc(path)} -o #{esc(@config[:app_path])}"
337
+ cmd.gsub!("/", "\\")
338
+ system cmd
326
339
  end
327
340
  end
328
341
  end
@@ -342,8 +355,9 @@ module Six
342
355
  time = Time.now.to_i
343
356
  f = @modconfig[:folder].clone
344
357
  f.gsub!('@', '')
345
- path = File.join(@path, 'store', 'userconfig')
346
- path = File.join(@path, 'userconfig') unless File.exists?(path)
358
+ path = File.join(@path, 'store', 'userconfig.tar')
359
+ path = File.join(@path, 'store', 'userconfig') unless File.exists?(path)
360
+ path = File.join(@path, 'userconfig') unless File.directory?(path)
347
361
  if File.exists?(path)
348
362
  uconfig = File.join(@config[:app_path], 'userconfig')
349
363
  uconfigpath = File.join(uconfig, f)
@@ -352,9 +366,15 @@ module Six
352
366
  return
353
367
  end
354
368
  log.info "Found userconfig, processing..."
355
- FileUtils::mv(uconfigpath, "#{uconfigpath}_#{time}") if FileTest.exist?(uconfigpath)
356
- FileUtils::mkdir_p uconfig unless FileTest.exist?(uconfig)
357
- FileUtils::cp_r(path, uconfigpath)
369
+ FileUtils::mv(uconfigpath, "#{uconfigpath}_#{time}") if File.exists?(uconfigpath)
370
+ if File.directory? path
371
+ FileUtils::mkdir_p uconfig unless File.exists?(uconfig)
372
+ FileUtils::cp_r(path, uconfigpath)
373
+ else
374
+ cmd = "7z x #{esc(path)} -o #{esc(@config[:app_path])}"
375
+ cmd.gsub!("/", "\\")
376
+ system cmd
377
+ end
358
378
  end
359
379
  end
360
380
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: six-updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.16
4
+ version: 0.15.1
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: 2010-02-20 00:00:00 +01:00
12
+ date: 2010-02-21 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency