six-updater 0.12.7 → 0.13.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.12.7'
15
+ s.version = '0.13.1'
16
16
  s.has_rdoc = true
17
17
  s.extra_rdoc_files = ['README', 'LICENSE']
18
18
  s.summary = 'Your summary here'
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
20
20
  s.author = 'Sickboy'
21
21
  s.email = 'sb@dev-heaven.net'
22
22
  s.add_dependency('log4r', '>= 1.1.0')
23
- s.add_dependency('six-rsync', '>= 0.1.0')
23
+ s.add_dependency('six-rsync', '>= 0.3.0')
24
24
  s.add_dependency('win32-process', '>= 0.6.0')
25
25
  s.add_dependency('win32-shortcut', '>= 0.2.3')
26
26
  # s.executables = ['your_executable_here']
@@ -4,7 +4,7 @@ require 'six/updater'
4
4
  # TODO: Should exec outside the module
5
5
  module Six
6
6
  module Updater
7
- PID_FILE = File.join(BASE_PATH, "#{COMPONENT}.pid")
7
+ PID_FILE = File.join(DATA_PATH, "#{COMPONENT}.pid")
8
8
  if not defined?(Ocra)
9
9
  #Signal.trap("EXIT") { exit_app }
10
10
  #Signal.trap("INT") { exit_app }
data/lib/six/updater.rb CHANGED
@@ -44,7 +44,7 @@ end
44
44
  module Six
45
45
  # TODO: Evaluate if this module should be a class instead?
46
46
  module Updater
47
- VERSION = '0.12.7'
47
+ VERSION = '0.13.1'
48
48
  COMPONENT = 'six-updater'
49
49
 
50
50
  # Configuration
@@ -80,6 +80,17 @@ module Six
80
80
  "\"#{File.join(TOOL_PATH, 'six-downloader.exe')}\""
81
81
  end
82
82
 
83
+ DATA_PATH = File.join(ENV['APPDATA'], 'Six-Updater')
84
+
85
+ lf = File.join(DATA_PATH, "logs")
86
+ FileUtils.mkdir_p(lf) unless File.exists?(lf)
87
+
88
+ cf = File.join(DATA_PATH, "#{COMPONENT}.yml")
89
+ unless File.exists?(cf)
90
+ cfo = File.join(BASE_PATH, "#{COMPONENT}.yml")
91
+ FileUtils.mv(cfo, cf) if File.exists?(cfo)
92
+ end
93
+
83
94
  LOG_LIMIT = 9999
84
95
  # TODO: Allow downloader yml instead?
85
96
  # TODO: Auto update always etc? :D
@@ -99,7 +110,6 @@ module Six
99
110
  @config[:depth] = 1
100
111
  @config[:folders] = []
101
112
  @config[:server] = Hash.new
102
- @config[:server_path] = File.join(BASE_PATH, 'servers')
103
113
  @config[:verbose] = false
104
114
 
105
115
  # FIXME: Solve this properly!
@@ -119,7 +129,7 @@ module Six
119
129
 
120
130
  if not defined?(Ocra)
121
131
  # Create Outputters
122
- path = File.join(BASE_PATH, 'logs')
132
+ path = File.join(DATA_PATH, 'logs')
123
133
  FileUtils::mkdir_p path
124
134
  o_file = Log4r::FileOutputter.new "#{COMPONENT}-file",
125
135
  'level' => 0, # All
@@ -152,7 +162,7 @@ module Six
152
162
 
153
163
  # Process the config file
154
164
  config = "#{COMPONENT}.yml"
155
- config = File.join(BASE_PATH, config)
165
+ config = File.join(DATA_PATH, config)
156
166
  if ARGV[0]
157
167
  # FIXME: This is not a very good catch..
158
168
  if ARGV[0][/.*\..*/]
@@ -182,7 +192,6 @@ module Six
182
192
  @config[:app_exe] = @config[:armaexe] if @config[:armaexe]
183
193
  @config[:app_params] = @config[:armaparams] if @config[:armaparams]
184
194
  #@config[:git_path] = @config[:gitpath] if @config[:gitpath]
185
- @config[:server_path] = @config[:serverpath] if @config[:serverpath]
186
195
 
187
196
  # Determine arma distribution and location
188
197
  unless @config[:app_path]
@@ -233,56 +242,6 @@ module Six
233
242
  @config[:app_modpath] = @config[:app_path]
234
243
  end
235
244
 
236
- # Nasty workaround for cygwin on Vista vs XP, vs acl's
237
- =begin
238
- @config[:app_path][/\A(\w\:)/]
239
- str = "#{$1}/ /six-app-root ntfs noacl 0 0"
240
- etc = File.join(TOOL_PATH, 'etc')
241
- FileUtils.mkdir_p etc
242
- File.open(File.join(etc, 'fstab'), 'w') { |file| file.puts str }
243
- ENV['six-app-root'] = '/six-app-root'
244
- =end
245
- puts
246
- if @config[:server][:repository]
247
- log.info "Checking for latest updates of #{@config[:server][:name]} server info"
248
- path = File.join(@config[:server_path], @config[:server][:name])
249
-
250
- opts = {}
251
- opts.merge!({:log => log}) if @config[:verbose]
252
-
253
- case @config[:server][:repository][0]
254
- #when /\Agit:\/\//
255
- # repo = GitRepo.new(@config[:server][:repository], path)
256
- when /\Arsync:\/\//
257
- repo = RsyncRepo.new(@config[:server][:repository], path)
258
- end
259
-
260
- if FileTest.exist?(File.join(path, '.git')) || FileTest.exist?(File.join(path, '.rsync'))
261
- repo.reset(:hard => true)
262
- repo.update
263
- else
264
- #FileUtils::mkdir_p path
265
- repo.clone
266
- end
267
-
268
- begin
269
- srv = File.join(path, 'server.yml')
270
- File.open(srv) do |f|
271
- cfg = YAML::load(f)
272
- @config[:folders].each do |f|
273
- cfg[:folders].each do |f2|
274
- @config[:folders] -= [f] if f2[:folder] == f[:folder]
275
- end
276
- end
277
- @config[:folders] = cfg[:folders] + @config[:folders]
278
- @config[:server] = cfg.merge @config[:server]
279
- end
280
- rescue
281
- log.warn "WARNING: Server configured but unable to get data from repository"
282
- log.debug "#{$!}"
283
- end
284
- end
285
-
286
245
  @config[:folders].uniq!
287
246
  log.debug "@config #{@config}"
288
247
 
@@ -410,23 +369,7 @@ module Six
410
369
  end
411
370
 
412
371
  def uninstall
413
- if @config[:server]
414
- if @config[:server][:name]
415
- log.info "#{@config[:server][:name]} server"
416
- path = File.join(@config[:server_path], @config[:server][:name])
417
- if FileTest.exist?(path)
418
- log.warn "###########"
419
- log.warn "# WARNING #"
420
- log.warn "###########"
421
- log.warn "You are about to uninstall the specified repository"
422
- sure?
423
- log.warn 'Uninstalling...'
424
- FileUtils.rm_rf path
425
- #FileUtils.rm_f @modconfig[:changelog] if FileTest.exists?(@modconfig[:changelog])
426
- #FileUtils.rm_f @modconfig[:versionfile] if FileTest.exists?(@modconfig[:versionfile])
427
- end
428
- end
429
- end
372
+ log.warn "Uninstall feature temporary disabled. Please delete the modfolder manually for uninstall"
430
373
  =begin
431
374
  @config[:folders].each do |config|
432
375
  log.info "= #{config[:folder]}"
@@ -21,11 +21,6 @@ module Six
21
21
  else
22
22
  @modconfig[:versionfile] = File.join(@config[:app_modpath], @modconfig[:folder], '.version.txt')
23
23
  end
24
- if @modconfig[:changelog]
25
- @modconfig[:changelog] = File.join(@config[:app_modpath], @modconfig[:folder], @modconfig[:changelog])
26
- else
27
- @modconfig[:changelog] = File.join(BASE_PATH, 'changelogs', "Changelog_#{@folder_str}.txt")
28
- end
29
24
 
30
25
  unless @modconfig[:depth]
31
26
  @modconfig[:depth] = @config[:depth]
@@ -86,37 +81,6 @@ module Six
86
81
  end
87
82
  end
88
83
 
89
- # Process Comment Changelog
90
- def write_changelog
91
- str = "#{@stat[:current]}"
92
- str += " - #{@stat[:previous]}" if @stat[:previous]
93
- log.info str
94
-
95
- history = @repository.repository.log(LOG_LIMIT)
96
- @stat[:changelog] = []
97
- if @stat[:previous]
98
- history.between(@stat[:previous], @stat[:current]).each do |c|
99
- c.message.split("\n").each { |msg| @stat[:changelog] << msg }
100
- end
101
- else
102
- history.each do |c|
103
- c.message.split("\n").each { |msg| @stat[:changelog] << msg }
104
- end
105
- # DONT SORT, otherwise all messed up stuff :)
106
- #@stat[:changelog].sort!
107
- end
108
-
109
- # TODO: Clean empty lines etc
110
- content = "== #{str}\n"
111
- content += @stat[:changelog].join("\n")
112
- content += "\n\n"
113
- File.open(@modconfig[:changelog], 'r') { |file| content += file.read } if FileTest.exists?(@modconfig[:changelog])
114
- @modconfig[:changelog][/(.*)\/(.*)/]
115
- folder = $1
116
- FileUtils.mkdir_p folder unless FileTest.exists? folder
117
- File.open(@modconfig[:changelog], 'w') { |file| file.write content }
118
- end
119
-
120
84
  def changelog
121
85
  if @modconfig[:disabled]
122
86
  log.info "Mod is tagged 'disabled' in the configuration file. Skipping..."
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.12.7
4
+ version: 0.13.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: 2009-12-24 00:00:00 +01:00
12
+ date: 2009-12-25 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.0
33
+ version: 0.3.0
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: win32-process