six-updater 0.22.0 → 0.22.1

Sign up to get free protection for your applications and to get access to all the features.
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.22.0'
16
+ s.version = '0.22.1'
17
17
  s.has_rdoc = true
18
18
  s.extra_rdoc_files = ['README', 'LICENSE']
19
19
  s.summary = 'Your summary here'
@@ -26,7 +26,7 @@ spec = Gem::Specification.new do |s|
26
26
  s.add_dependency('win32-shortcut', '>= 0.2.3')
27
27
  s.add_dependency('log4r', '>= 1.1.2')
28
28
  s.add_dependency('six-uac', '>= 0.1.0')
29
- s.add_dependency('six-rsync', '>= 0.3.4')
29
+ s.add_dependency('six-rsync', '>= 0.7.0')
30
30
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/*/**/*.rb")
31
31
  s.require_path = "lib"
32
32
  s.bindir = "bin"
@@ -36,7 +36,7 @@ end
36
36
  spec3 = Gem::Specification.new do |s|
37
37
  s.platform = "x86-mswin32"
38
38
  s.name = 'six-updater'
39
- s.version = '0.22.0'
39
+ s.version = '0.22.1'
40
40
  s.has_rdoc = true
41
41
  s.extra_rdoc_files = ['README', 'LICENSE']
42
42
  s.summary = 'Your summary here'
@@ -49,7 +49,7 @@ spec3 = Gem::Specification.new do |s|
49
49
  s.add_dependency('win32-shortcut', '>= 0.2.3')
50
50
  s.add_dependency('log4r', '>= 1.1.2')
51
51
  s.add_dependency('six-uac', '>= 0.1.0')
52
- s.add_dependency('six-rsync', '>= 0.3.4')
52
+ s.add_dependency('six-rsync', '>= 0.7.0')
53
53
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/*/**/*.rb")
54
54
  s.require_path = "lib"
55
55
  s.bindir = "bin"
@@ -58,7 +58,7 @@ end
58
58
 
59
59
  spec2 = Gem::Specification.new do |s|
60
60
  s.name = 'six-updater'
61
- s.version = '0.22.0'
61
+ s.version = '0.22.1'
62
62
  s.has_rdoc = true
63
63
  s.extra_rdoc_files = ['README', 'LICENSE']
64
64
  s.summary = 'Your summary here'
@@ -70,7 +70,7 @@ spec2 = Gem::Specification.new do |s|
70
70
  #s.add_dependency('win32-shortcut', '>= 0.2.3')
71
71
  s.add_dependency('log4r', '>= 1.1.2')
72
72
  #s.add_dependency('six-uac', '>= 0.1.0')
73
- s.add_dependency('six-rsync', '>= 0.4.0')
73
+ s.add_dependency('six-rsync', '>= 0.7.0')
74
74
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/*/**/*.rb")
75
75
  s.require_path = "lib"
76
76
  s.bindir = "bin"
@@ -1,5 +1,5 @@
1
- require 'six/updater/options'
2
- require 'six/updater'
1
+ require_relative 'updater/options'
2
+ require_relative 'updater'
3
3
 
4
4
  # TODO: Should exec outside the module
5
5
  module Six
data/lib/six/updater.rb CHANGED
@@ -20,10 +20,10 @@ end
20
20
  gem 'six-rsync'
21
21
  require 'six/rsync'
22
22
 
23
- require 'six/cleanup'
24
- require 'six/updater/mod'
23
+ require_relative 'cleanup'
24
+ require_relative 'updater/mod'
25
25
  #require 'sixupdater/gitrepo'
26
- require 'six/updater/rsyncrepo'
26
+ require_relative 'updater/rsyncrepo'
27
27
 
28
28
  include Six::Repositories
29
29
 
@@ -39,7 +39,7 @@ end
39
39
  module Six
40
40
  # TODO: Evaluate if this module should be a class instead?
41
41
  module Updater
42
- VERSION = '0.22.0'
42
+ VERSION = '0.22.1'
43
43
  COMPONENT = 'six-updater'
44
44
  LOG_LIMIT = 9999
45
45
 
@@ -449,6 +449,9 @@ module Six
449
449
  end
450
450
  =end
451
451
  else
452
+ # TODO: Include exe/cmdnline check;
453
+ # /proc/PID/exe
454
+ # /proc/PID/cmdline
452
455
  %x[ps -A | grep #{name}].split("\n").each do |line|
453
456
  unless line[/grep/]
454
457
  line[/^\s*([0-9]*)/]
@@ -486,6 +489,16 @@ module Six
486
489
  startgame(cmd)
487
490
  end
488
491
 
492
+ def afteraction
493
+ Dir.chdir(BASE_PATH)
494
+ case RUBY_PLATFORM
495
+ when /-mingw32$/, /-mswin32$/
496
+ system "afteraction.bat"
497
+ else
498
+ system "afteraction.sh"
499
+ end
500
+ end
501
+
489
502
  def startgame(cmd = nil)
490
503
  log.info "Starting the game with #{@config[:app_params]} -mod=#{@mods}#{cmd}"
491
504
  case RUBY_PLATFORM
@@ -52,6 +52,11 @@ module Six
52
52
  @modconfig[:disabled]
53
53
  end
54
54
 
55
+ def force?
56
+ log.info "Yet force is enabled, overriding disabled..." if @modconfig[:force]
57
+ @modconfig[:force]
58
+ end
59
+
55
60
  def installed?
56
61
  not_a_repository unless @installed
57
62
  @installed
@@ -130,6 +135,19 @@ module Six
130
135
  end
131
136
  end
132
137
 
138
+ def handle_cludes(opts)
139
+ if @modconfig.keys.include?(:include) || @modconfig.keys.include?(:exclude)
140
+ if @modconfig.keys.include?(:include)
141
+ opts[:include] = @modconfig[:include]
142
+ log.info "Includes: #{@modconfig[:include].join(", ")}"
143
+ end
144
+ if @modconfig.keys.include?(:exclude)
145
+ opts[:exclude] = @modconfig[:exclude]
146
+ log.info "Excludes: #{@modconfig[:exclude].join(", ")}"
147
+ end
148
+ end
149
+ end
150
+
133
151
  # UPDATE Process
134
152
  def update
135
153
  if self.skip?
@@ -141,14 +159,16 @@ module Six
141
159
  end
142
160
  return
143
161
  else
144
- return if self.disabled?
162
+ return if self.disabled? && !self.force?
145
163
  end
146
164
 
147
165
  return unless self.installed?
148
166
 
149
167
  @stat[:previous] = @repository.version
150
168
  log.info "Current Version: #{@stat[:previous]}, checking for updates..."
151
- done = begin; @repository.update; rescue => e; log.debug "#{e.class} #{e.message}: #{e.backtrace.join("\n")}"; nil; end
169
+ opts = {}
170
+ handle_cludes(opts)
171
+ done = begin; @repository.update(opts); rescue => e; log.debug "#{e.class} #{e.message}: #{e.backtrace.join("\n")}"; nil; end
152
172
 
153
173
  begin
154
174
  @stat[:current] = @repository.version
@@ -193,7 +213,7 @@ module Six
193
213
  # INSTALL process
194
214
  def install
195
215
  log.debug "Path: #{@path}"
196
- return if self.disabled?
216
+ return if self.disabled? && !self.force?
197
217
  if self.installed?
198
218
  log.info "Already installed, trying to update..."
199
219
  update
@@ -241,6 +261,7 @@ module Six
241
261
  @repository = RsyncRepo.new(@repositories, @path)
242
262
  opts = {}
243
263
  opts.merge!({:log => log}) if @config[:verbose]
264
+ handle_cludes(opts)
244
265
  begin
245
266
  @repository.clone(opts)
246
267
  @installed = true
@@ -311,7 +332,7 @@ module Six
311
332
 
312
333
  # Process keys
313
334
  def keys(force = true)
314
- return if self.disabled?
335
+ return if self.disabled? && !self.force?
315
336
  return unless self.installed?
316
337
 
317
338
  path = File.join(@path, 'store', 'keys.tar')
@@ -54,6 +54,10 @@ module Six
54
54
  second_todo << :cleanup if bool
55
55
  end
56
56
 
57
+ opts.on("-a", "--afteraction", "Runs user-configurable after-action script") do |bool|
58
+ general_todo << :afteraction if bool
59
+ end
60
+
57
61
  opts.on("-s", "--createshortcut", "Creates shortcut to run the game with the mods, in installation folder") do |bool|
58
62
  general_todo << :createshortcut if bool
59
63
  end
@@ -20,6 +20,18 @@ module Six
20
20
  cfg ? cfg[:version] : nil
21
21
  end
22
22
 
23
+ def config=(cnfg)
24
+ f = File.join(@path, '.rsync', 'config.yml')
25
+ #cfg = File.exists?(f) ? YAML::load_file(f) : nil
26
+ File.exists?(f) ? File.open(f, 'w') {|f| f.puts cnfg.to_yaml} : nil
27
+ end
28
+
29
+ def config
30
+ f = File.join(@path, '.rsync', 'config.yml')
31
+ cfg = File.exists?(f) ? YAML::load_file(f) : nil
32
+ cfg ? cfg : nil
33
+ end
34
+
23
35
  def convert(opts = {})
24
36
  @repository = Six::Repositories::Rsync.convert(@path, :log => log)
25
37
  end
@@ -42,7 +54,7 @@ module Six
42
54
 
43
55
  def clone(opts = {})
44
56
  done = false
45
- opts = {:path => File.dirname(@path), :depth => @depth, :log => log}
57
+ opts = opts.merge({:path => File.dirname(@path), :depth => @depth, :log => log})
46
58
  @repository = Rsync.clone(@repositories, File.basename(@path), opts)
47
59
  true
48
60
  end
@@ -50,12 +62,10 @@ module Six
50
62
  def update(opts = {})
51
63
  # Update the config file with our hosts list
52
64
  file = File.join(@path, '.rsync/config.yml')
53
- cfg = YAML::load_file(file)
54
- cfg[:hosts] = @repositories
55
- File.open(file, 'w') { |file| file.puts cfg.to_yaml }
65
+ opts[:hosts] = @repositories
56
66
 
57
67
  # Update!
58
- repository.update
68
+ repository.update(opts)
59
69
  true
60
70
  end
61
71
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: six-updater
3
3
  version: !ruby/object:Gem::Version
4
- hash: 71
4
+ hash: 69
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 22
9
- - 0
10
- version: 0.22.0
9
+ - 1
10
+ version: 0.22.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sickboy
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-20 00:00:00 +02:00
18
+ date: 2010-07-24 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- hash: 15
45
+ hash: 3
46
46
  segments:
47
47
  - 0
48
- - 4
48
+ - 7
49
49
  - 0
50
- version: 0.4.0
50
+ version: 0.7.0
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  description: Your summary here