six-updater 0.17.2 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +4 -4
  2. data/lib/six/updater.rb +56 -7
  3. metadata +4 -4
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ require 'rake/testtask'
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.platform = "x86-mingw32"
15
15
  s.name = 'six-updater'
16
- s.version = '0.17.2'
16
+ s.version = '0.17.3'
17
17
  s.has_rdoc = true
18
18
  s.extra_rdoc_files = ['README', 'LICENSE']
19
19
  s.summary = 'Your summary here'
@@ -35,7 +35,7 @@ end
35
35
  spec3 = Gem::Specification.new do |s|
36
36
  s.platform = "x86-mswin32"
37
37
  s.name = 'six-updater'
38
- s.version = '0.17.2'
38
+ s.version = '0.17.3'
39
39
  s.has_rdoc = true
40
40
  s.extra_rdoc_files = ['README', 'LICENSE']
41
41
  s.summary = 'Your summary here'
@@ -56,7 +56,7 @@ end
56
56
 
57
57
  spec2 = Gem::Specification.new do |s|
58
58
  s.name = 'six-updater'
59
- s.version = '0.17.2'
59
+ s.version = '0.17.3'
60
60
  s.has_rdoc = true
61
61
  s.extra_rdoc_files = ['README', 'LICENSE']
62
62
  s.summary = 'Your summary here'
@@ -68,7 +68,7 @@ spec2 = Gem::Specification.new do |s|
68
68
  #s.add_dependency('win32-shortcut', '>= 0.2.3')
69
69
  s.add_dependency('log4r', '>= 1.1.2')
70
70
  #s.add_dependency('six-uac', '>= 0.1.0')
71
- s.add_dependency('six-rsync', '>= 0.3.4')
71
+ s.add_dependency('six-rsync', '>= 0.4.0')
72
72
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/*/**/*.rb")
73
73
  s.require_path = "lib"
74
74
  s.bindir = "bin"
@@ -38,9 +38,10 @@ end
38
38
  module Six
39
39
  # TODO: Evaluate if this module should be a class instead?
40
40
  module Updater
41
- VERSION = '0.17.2'
41
+ VERSION = '0.17.3'
42
42
  COMPONENT = 'six-updater'
43
43
  LOG_LIMIT = 9999
44
+ FOLDER = /(.*)\/(.*)/
44
45
 
45
46
  # Configuration
46
47
  case RUBY_PLATFORM
@@ -63,7 +64,6 @@ module Six
63
64
  p.gsub!('\\', '/')
64
65
  p
65
66
  end
66
- TOOL_PATH = File.join(BASE_PATH, 'tools')
67
67
 
68
68
  case RUBY_PLATFORM
69
69
  when /-mingw32$/, /-mswin32$/
@@ -77,11 +77,16 @@ module Six
77
77
  BASE_PATH
78
78
  end
79
79
  HOME_PATH = File.exists?(File.join(ENV['APPDATA'])) ? File.join(ENV['APPDATA']) : TEMP_PATH
80
- bpath = BASE_PATH.clone
81
- bpath.gsub!('/', '\\')
82
- tpath = "#{File.join(bpath, 'tools')};#{File.join(bpath, 'tools', 'bin')}"
80
+
81
+ # TODO: Deprecated; This has moved to the six-updater.rb included in the windows suite
82
+ # But requires everyone to update to it, unless we do it for them :D
83
+ path = File.join(BASE_PATH, "tools")
84
+ rubypath = File.join(path, 'ruby', 'bin')
85
+ rubypath.gsub!("/", "\\")
86
+ tpath = "#{path};#{File.join(path, 'bin')};#{rubypath}"
83
87
  tpath.gsub!('/', '\\')
84
- ENV['PATH'] = "#{bpath};#{tpath};#{ENV['PATH']}"
88
+ ENV['PATH'] = "" unless ENV['PATH']
89
+ ENV['PATH'] = "#{tpath};#{ENV['PATH']}" unless ENV['PATH'].include?(tpath)
85
90
  else
86
91
  HOME_PATH = ENV['HOME']
87
92
  TEMP_PATH = '/tmp'
@@ -181,9 +186,13 @@ module Six
181
186
  log.info 'Run with --help for help'
182
187
  log.warn "WARNING: Please make sure anything ArmA related has been closed / shutdown, incl explorer windows, etc"
183
188
  log.debug "BASE_PATH: #{BASE_PATH}"
184
- log.debug "TOOL_PATH: #{TOOL_PATH}"
185
189
  log.debug "@config #{@config}"
186
190
 
191
+ unless @zip7_installed ||= begin; %x[7z]; $? == 0; rescue; false; end
192
+ puts "7z command not found"
193
+ raise StandardError
194
+ end
195
+
187
196
  # Process the config file
188
197
  config = "#{COMPONENT}.yml"
189
198
  config = File.join(DATA_PATH, config)
@@ -278,6 +287,11 @@ module Six
278
287
  end
279
288
  log.debug "@config #{@config}"
280
289
 
290
+ procs = find_process(process_name)
291
+ unless procs.empty?
292
+ log.warn "WARNING: Found open arma processes! #{procs}, you might want to abort and close them!"
293
+ end
294
+
281
295
  # PreProcess the config data
282
296
  @mods = []
283
297
  @mods << @config[:mods] if @config[:mods]
@@ -334,6 +348,41 @@ module Six
334
348
  STDIN.gets
335
349
  end
336
350
 
351
+ def find_process(name)
352
+ # TODO: Filter for process's folder.
353
+
354
+ pids = []
355
+ case RUBY_PLATFORM
356
+ when /-mingw32$/, /-mswin32$/
357
+ out = %x[tasklist]
358
+ out.split("\n").each do |line|
359
+ if line =~ /\A#{name}[\t| ]*([0-9]*)/
360
+ pid = $1
361
+ if pid.size > 0
362
+ pid = pid.to_i
363
+ pids << pid
364
+ end
365
+ end
366
+ end
367
+ else
368
+ %x[ps -A | grep #{name}].split("\n").each do |line|
369
+ unless line[/grep/]
370
+ line[/^\s*([0-9]*)/]
371
+ pids << $1
372
+ end
373
+ end
374
+ end
375
+ pids
376
+ end
377
+
378
+ def process_name
379
+ if @config[:app_exe][FOLDER]
380
+ $2
381
+ else
382
+ @config[:app_exe]
383
+ end
384
+ end
385
+
337
386
  def sure?
338
387
  log.info "Are you really sure? Please press Enter to continue, or close the application to abort."
339
388
  wait
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 17
8
- - 2
9
- version: 0.17.2
8
+ - 3
9
+ version: 0.17.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sickboy
@@ -40,9 +40,9 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  segments:
42
42
  - 0
43
- - 3
44
43
  - 4
45
- version: 0.3.4
44
+ - 0
45
+ version: 0.4.0
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  description: Your summary here