sixarma-bt 0.7.2 → 0.7.3

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.name = 'sixarma-bt'
15
15
  s.rubyforge_project = s.name
16
- s.version = '0.7.2'
16
+ s.version = '0.7.3'
17
17
  s.has_rdoc = true
18
18
  s.extra_rdoc_files = ['README', 'LICENSE']
19
19
  s.summary = 'BuildTools for full conversion Mods for Armed Assault'
@@ -23,8 +23,8 @@ spec = Gem::Specification.new do |s|
23
23
  s.homepage = 'http://6thsense.eu'
24
24
  # s.executables = ['your_executable_here']
25
25
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*.rb") + Dir.glob("{bin,lib,spec}/**/*.yaml")
26
- s.require_path = "lib"
27
- s.bindir = "bin"
26
+ s.require_path = 'lib'
27
+ s.bindir = 'bin'
28
28
  s.add_dependency('sixarma', '>= 0.4.0')
29
29
  s.add_dependency('sixcore', '>= 0.3.0')
30
30
  end
@@ -7,15 +7,15 @@ module SixArma
7
7
  # folder:: folder config object
8
8
  def clear_folders(mod, folder)
9
9
  case folder.type
10
- when "addons"
10
+ when 'addons'
11
11
  # Remove deleted files
12
- SixCore::info "Removing Deleted Files from Full..."
12
+ SixCore::info 'Removing Deleted Files from Full...'
13
13
  delete = File.open("#{mod.changes}/#{@config.workdel}_#{folder.name}.txt") { |file| file.readlines.map { |line| SixCore::clean(line) } }
14
14
  delete.each do |item|
15
15
  SixCore::filedel("#{@config.outroot}\\files\\full\\#{mod.destination}\\#{folder.name}\\#{item}.*")
16
16
  end
17
17
 
18
- SixCore::info "Cleaning Update folder..."
18
+ SixCore::info 'Cleaning Update folder...'
19
19
  SixCore::filedel("#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}\\*.pbo")
20
20
  SixCore::filedel("#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}\\*.bisign")
21
21
  end
@@ -27,8 +27,8 @@ module SixArma
27
27
  # folder:: folder config object
28
28
  def copy_stuff(mod, folder)
29
29
  case folder.type
30
- when "addons"
31
- SixCore::info "Copying 3rd_Party_Pbos..."
30
+ when 'addons'
31
+ SixCore::info 'Copying 3rd_Party_Pbos...'
32
32
  thirdparty_pbo = File.open("#{mod.changes}/#{@config.work3rd_pbo}_#{folder.name}.txt") { |file| file.readlines.map { |line| SixCore::clean(line) } }
33
33
  source = "#{mod.path}\\#{mod.source}\\#{folder.name}"
34
34
  dest = "#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}"
@@ -77,30 +77,30 @@ module SixArma
77
77
  dest = "#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}"
78
78
 
79
79
  # Create folders and mirror SOURCE files
80
- SixCore::info "Creating folders and mirroring source files..."
80
+ SixCore::info 'Creating folders and mirroring source files...'
81
81
  combined.each do |item|
82
82
  source = check_source(mod, folder, item)
83
- SixCore::filemirror(source, "#{@config.workdir}\\#{item}", "/XD .svn")
83
+ SixCore::filemirror(source, "#{@config.workdir}\\#{item}", '/XD .svn')
84
84
  # When using alternate prefixes, also mirror files to prefix folder name
85
- prefix = SixArma::PboTools::check_prefix(source, "__AUTO__")
86
- unless prefix == "" or prefix != prefix.gsub!("\\", "")
87
- SixCore::filemirror(source, "#{@config.workdir}\\#{prefix}", "/XD .svn")
85
+ prefix = SixArma::PboTools::check_prefix(source, '__AUTO__')
86
+ unless prefix == '' or prefix != prefix.gsub!('\\', '')
87
+ SixCore::filemirror(source, "#{@config.workdir}\\#{prefix}", '/XD .svn')
88
88
  end
89
89
  end
90
90
 
91
91
  # Build the addons
92
- SixCore::info "Binarizing..."
92
+ SixCore::info 'Binarizing...'
93
93
  binfiles.each do |item|
94
- SixArma::PboTools.binarize("#{@config.workdir}\\#{item}", dest, "__AUTO__")
94
+ SixArma::PboTools.binarize("#{@config.workdir}\\#{item}", dest, '__AUTO__')
95
95
  end
96
96
 
97
- SixCore::info "PBOing..."
97
+ SixCore::info 'PBOing...'
98
98
  pbofiles.each do |item|
99
- SixArma::PboTools.pack("#{@config.workdir}\\#{item}", dest, "__AUTO__")
99
+ SixArma::PboTools.pack("#{@config.workdir}\\#{item}", dest, '__AUTO__')
100
100
  end
101
101
 
102
102
  # CleanUp
103
- SixCore::info "Cleaning up..."
103
+ SixCore::info 'Cleaning up...'
104
104
  SixCore::filemove("#{dest}\\*.log", "#{@config.outroot}\\log\\")
105
105
  # combined.each do |item|
106
106
  # SixCore::filemove("#{dest}\\#{item}.log", "#{@config.outroot}\\log\\")
@@ -124,7 +124,7 @@ module SixArma
124
124
  @config.mods.each do |mod|
125
125
  mod.subfolders.each do |folder|
126
126
  SixCore::infos("BuildChanges - #{mod.destination}\\#{folder.name}", COMPONENT)
127
- pbotools_build(mod, folder) if folder.type == "addons"
127
+ pbotools_build(mod, folder) if folder.type == 'addons'
128
128
  copy_stuff(mod, folder)
129
129
  end
130
130
  end
@@ -37,17 +37,17 @@ module SixArma
37
37
  end
38
38
 
39
39
  # Build NSIS Update
40
- # nsis_build("update")
40
+ # nsis_build('update')
41
41
  def nsis_update()
42
- @stats.updatefile = nsis_build("update")
42
+ @stats.updatefile = nsis_build('update')
43
43
  write_stats()
44
44
  SixCore::halt() if @halt
45
45
  end
46
46
 
47
47
  # Build NSIS Full
48
- # nsis_build("full")
48
+ # nsis_build('full')
49
49
  def nsis_full()
50
- @stats.fullfile = nsis_build("full")
50
+ @stats.fullfile = nsis_build('full')
51
51
  write_stats()
52
52
  SixCore::halt() if @halt
53
53
  end
@@ -33,14 +33,14 @@ module SixArma
33
33
  SixCore::infos("Sign Do - #{type}", COMPONENT)
34
34
 
35
35
  case @config.sign.keytype
36
- when "whole"
37
- signfiles = sign_create("full")
38
- signfiles = sign_create("update") # TODO - Lame, function copies instead of create new one, but still - need to move
36
+ when 'whole'
37
+ signfiles = sign_create('full')
38
+ signfiles = sign_create('update') # TODO - Lame, function copies instead of create new one, but still - need to move
39
39
 
40
40
  # process each destination's subfolders
41
41
  @config.mods.each do |mod|
42
42
  mod.subfolders.each do |folder|
43
- if folder.type == "addons"
43
+ if folder.type == 'addons'
44
44
  SixCore::info "Clearing signatures - #{type}\\#{mod.destination}\\#{folder.name}..."
45
45
  SixCore::filedel("#{@config.outroot}\\files\\#{type}\\#{mod.destination}\\#{folder.name}\\*.bisign")
46
46
  SixCore::info "Signing - #{mod.destination}\\#{folder.name}..."
@@ -49,24 +49,24 @@ module SixArma
49
49
  end
50
50
  end
51
51
 
52
- when "folder"
52
+ when 'folder'
53
53
  @config.mods.each_with_index do |mod, idx|
54
54
  changes = []
55
55
  @stats.mods[idx].subfolders.each do |folder|
56
- changes += (folder.add + folder.del + folder.change) # if folder.type == "addons"
56
+ changes += (folder.add + folder.del + folder.change) # if folder.type == 'addons'
57
57
  end
58
58
  unless changes.empty?
59
- #sf = mod.destination.gsub("@", "")
59
+ #sf = mod.destination.gsub('@', '')
60
60
  #sf = mod.destination if sf.nil? or sf.empty?
61
61
  # TODO: Lame update+full processing
62
62
  SixCore::filedel("#{@config.outroot}\\files\\update\\Keys\\#{@config.sign.file}_#{mod.destination}*.bikey")
63
63
  SixCore::filedel("#{@config.outroot}\\files\\full\\Keys\\#{@config.sign.file}_#{mod.destination}*.bikey")
64
64
 
65
- signfiles = sign_create2("full", mod.destination)
66
- signfiles = sign_create2("update", mod.destination)
65
+ signfiles = sign_create2('full', mod.destination)
66
+ signfiles = sign_create2('update', mod.destination)
67
67
 
68
68
  mod.subfolders.each do |folder|
69
- if folder.type == "addons"
69
+ if folder.type == 'addons'
70
70
  SixCore::info "Clearing signatures - #{type}\\#{mod.destination}\\#{folder.name}..."
71
71
  SixCore::filedel("#{@config.outroot}\\files\\#{type}\\#{mod.destination}\\#{folder.name}\\*.bisign")
72
72
  SixCore::info "Signing - #{mod.destination}\\#{folder.name}..."
@@ -80,16 +80,16 @@ module SixArma
80
80
 
81
81
  public
82
82
  # Sign Update
83
- # sign_do("update")
83
+ # sign_do('update')
84
84
  def sign_update()
85
- sign_do("update")
85
+ sign_do('update')
86
86
  SixCore::halt() if @halt
87
87
  end
88
88
 
89
89
  # Sign Full
90
- # sign_do("full")
90
+ # sign_do('full')
91
91
  def sign_full()
92
- sign_do("full")
92
+ sign_do('full')
93
93
  SixCore::halt() if @halt
94
94
  end
95
95
  end
@@ -6,11 +6,11 @@ module SixArma
6
6
  # cfg:: Mod Config Object
7
7
  # cfg2:: Mod Stats Object
8
8
  def svn_write_list(cfg, cfg2)
9
- SixCore::info "Writing SVN Changelog..."
9
+ SixCore::info 'Writing SVN Changelog...'
10
10
  cfg.subfolders.each_with_index do |folder,idx|
11
11
  folder2 = cfg2.subfolders[idx]
12
12
  case folder.type
13
- when "addons"
13
+ when 'addons'
14
14
  t = folder2.add + folder2.change
15
15
  t.uniq!
16
16
  t.sort!
@@ -24,7 +24,7 @@ module SixArma
24
24
  file.readlines.map { |line| SixCore::clean(line) }
25
25
  }
26
26
  tmp = []
27
- File.open("#{cfg.changes}/#{@config.work3rd_pbo}_#{folder.name}.txt", "w") do |f|
27
+ File.open("#{cfg.changes}/#{@config.work3rd_pbo}_#{folder.name}.txt", 'w') do |f|
28
28
  f.flush
29
29
  t.each do |addon|
30
30
  if thirdparty_pbo.include?(addon)
@@ -36,7 +36,7 @@ module SixArma
36
36
  end
37
37
 
38
38
  tmp = []
39
- File.open("#{cfg.changes}/#{@config.workbin}_#{folder.name}.txt", "w") do |f|
39
+ File.open("#{cfg.changes}/#{@config.workbin}_#{folder.name}.txt", 'w') do |f|
40
40
  f.flush
41
41
  t.each do |addon|
42
42
  if binfiles.include?(addon)
@@ -48,7 +48,7 @@ module SixArma
48
48
  end
49
49
 
50
50
  tmp = []
51
- File.open("#{cfg.changes}/#{@config.workpbo}_#{folder.name}.txt", "w") do |f|
51
+ File.open("#{cfg.changes}/#{@config.workpbo}_#{folder.name}.txt", 'w') do |f|
52
52
  f.flush
53
53
  t.each do |addon|
54
54
  if pbofiles.include?(addon)
@@ -64,7 +64,7 @@ module SixArma
64
64
  Process.exit
65
65
  end
66
66
 
67
- File.open("#{cfg.changes}/#{@config.workdel}_#{folder.name}.txt", "w") do |f|
67
+ File.open("#{cfg.changes}/#{@config.workdel}_#{folder.name}.txt", 'w') do |f|
68
68
  f.flush
69
69
  folder2.del.each do |addon| f.puts(addon) end
70
70
  end
@@ -76,16 +76,16 @@ module SixArma
76
76
  # cfg:: Mod Config Object
77
77
  # cfg2:: Mod Stats Object
78
78
  def svn_generate(cfg, cfg2)
79
- SixCore::info "Generating SVN Changelog..."
79
+ SixCore::info 'Generating SVN Changelog...'
80
80
  svn = SixCore::Svn.new("#{cfg.path}#{cfg.source}", cfg.svn.user, cfg.svn.pass)
81
81
 
82
82
  svn.diff(cfg2.oldrev, cfg2.newrev).each do |entry|
83
83
  # only want to process folders under the given folder
84
84
  cfg.subfolders.each_with_index do |f, idx|
85
- entrymod = entry.gsub("#{svn.repos}\\#{f.name}\\", "")
85
+ entrymod = entry.gsub("#{svn.repos}\\#{f.name}\\", '')
86
86
  if entrymod != entry
87
87
  f2 = cfg2.subfolders[idx]
88
- if f.type == "addons"
88
+ if f.type == 'addons'
89
89
  folders = true
90
90
  else
91
91
  folders = false
data/lib/sixarma/bt.rb CHANGED
@@ -5,11 +5,12 @@
5
5
  # TODO: log4r support per module instead of all in core?
6
6
  # TODO: Implement FATAL, WARN etc loglevels?
7
7
  # TODO: Convert all Config/Stats classes from CON_STANT to ConStant variation
8
- # FIXME: Look at Keys Cleaning for "whole" processing
8
+ # TODO: Move Regex into Constants
9
+ # FIXME: Look at Keys Cleaning for 'whole' processing
9
10
  # TODO: List:
10
- - More sophisticated svn changes system which goes beyond "Addons" and "Dta" etc
11
+ - More sophisticated svn changes system which goes beyond 'Addons' and 'Dta' etc
11
12
  -- CONFIG_MOD_SUBFOLDERS per mod implemented, but only active for creating addons and signing
12
- - Think about how to resolve "Case sensitivity for paths", or should we not at all?
13
+ - Think about how to resolve 'Case sensitivity for paths', or should we not at all?
13
14
  - Finish implementation of Time.now and processed time
14
15
  - SVN Update/Commit Functions
15
16
  =end
@@ -66,6 +67,26 @@ module SixArma
66
67
  # Changelog Structure
67
68
  STATS_MOD_CHANGELOG = Struct.new(:added, :updated, :removed, :changed, :fixed, :local)
68
69
 
70
+ COMMENT_TYPES = [
71
+ 'CHANGED', 'CHANGE', 'C', 'MODIFIED', 'MOD',
72
+ 'ADDED', 'ADD', 'A',
73
+ 'FIXED', 'FIX', 'F',
74
+ 'UPDATED', 'UPDATE', 'UPD', 'U',
75
+ 'DELETED', 'DELETE', 'DEL', 'REMOVED',
76
+ 'LOCAL', 'MOVED', 'MOV', 'REVERTED', 'RENAMED', 'R']
77
+
78
+ # Log entries class
79
+ class LogEntries < Array
80
+ def add_entries(array, type)
81
+ unless array.empty?
82
+ push "** #{type}:"
83
+ array.each do |e|
84
+ push "*** #{e}"
85
+ end
86
+ push ''
87
+ end
88
+ end
89
+ end
69
90
  # Main Program Class
70
91
  class Builder
71
92
  COMPONENT = 'SixArma::Bt::Builder'
@@ -96,7 +117,7 @@ module SixArma
96
117
  # source:: Source path
97
118
  # destination:: Destination path
98
119
  def update_all(source, destination)
99
- SixCore::infos("Update_All", COMPONENT) # TODO
120
+ SixCore::infos('Update_All', COMPONENT) # TODO
100
121
  SixCore::info "Updating *all* files - source: #{source} - destination: #{destination}..."
101
122
  SixCore::fileupdate(
102
123
  "#{@config.outroot}\\files\\#{source}\\",
@@ -108,12 +129,12 @@ module SixArma
108
129
  # source:: Source path
109
130
  # destination:: Destination path
110
131
  def update_sign(source, destination)
111
- SixCore::infos("Update_Sign", COMPONENT) # TODO
132
+ SixCore::infos('Update_Sign', COMPONENT) # TODO
112
133
  SixCore::info "Updating *sign* files - source: #{source} - destination: #{destination}..."
113
134
  SixCore::fileupdate(
114
135
  "#{@config.outroot}\\files\\#{source}\\",
115
136
  "#{@config.outroot}\\files\\#{destination}\\",
116
- "/IF *.bisign *.bikey"
137
+ '/IF *.bisign *.bikey'
117
138
  )
118
139
  end
119
140
 
@@ -136,7 +157,7 @@ module SixArma
136
157
  # put:: File to upload
137
158
  # type:: Type (update or full)
138
159
  def upload(put, type, tmp = true)
139
- SixCore::infos("Upload", COMPONENT)
160
+ SixCore::infos('Upload', COMPONENT)
140
161
  @config.ftp.each do |f|
141
162
  path = eval "f.path#{type}"
142
163
  SixCore::info "Uploading #{put} to #{f.host}/#{path}..."
@@ -157,7 +178,7 @@ module SixArma
157
178
  tmp << [f.host, f.user, f.pass, eval("f.path#{type}"), "#{@config.outroot}\\", name]
158
179
  end
159
180
  @threads << Thread.new(tmp,name) do |ftps,name|
160
- SixCore::infos("Upload", COMPONENT)
181
+ SixCore::infos('Upload', COMPONENT)
161
182
  SixCore::info "Uploading #{name}..."
162
183
  ftps.each { |f| upload_raw(*f) }
163
184
  SixCore::info "Uploading #{name} finished..."
@@ -198,15 +219,15 @@ module SixArma
198
219
  SixCore::info "Reading From Stats File: #{dir[0]}"
199
220
  stats = YAML::load(yf)
200
221
  if stats.released
201
- SixCore::info "Previous version was released; New Version"
222
+ SixCore::info 'Previous version was released; New Version'
202
223
  @stats = STATS.new()
203
224
  @stats.mods = []
204
225
  @stats.oldver = stats.newver.to_s
205
226
  @stats.newver = @stats.oldver.to_f + 0.01
206
227
  @stats.newver = @stats.newver.to_s
207
228
  # TODO: Prettify??
208
- @stats.newver << "0" # always append extra 0 due to floating point 0.50 --> 0.5
209
- @stats.oldver << "0" # always append extra 0 due to floating point 0.50 --> 0.5
229
+ @stats.newver << '0' # always append extra 0 due to floating point 0.50 --> 0.5
230
+ @stats.oldver << '0' # always append extra 0 due to floating point 0.50 --> 0.5
210
231
  @stats.newver = /(.)\.(.)(.)/.match(@stats.newver).to_s
211
232
  @stats.oldver = /(.)\.(.)(.)/.match(@stats.oldver).to_s
212
233
 
@@ -225,19 +246,19 @@ module SixArma
225
246
  @stats.mods << modstats
226
247
  end
227
248
  else
228
- SixCore::info "Previous version wasn't released; Sticking to current version"
249
+ SixCore::info 'Previous version wasn\'t released; Sticking to current version'
229
250
  @stats = stats
230
251
  end
231
252
  end
232
253
  else
233
- info "No version yaml found in versions folder, aborting"
254
+ info 'No version yaml found in versions folder, aborting'
234
255
  Process.exit
235
256
  end
236
257
 
237
258
  SixCore::info "Current Version: #{@stats.newver} | Previous Version: #{@stats.oldver}"
238
259
 
239
260
  # update the version files
240
- SixCore::info "Updating version.txt..."
261
+ SixCore::info 'Updating version.txt...'
241
262
  # used by updater setup program
242
263
  File.open("#{@config.outroot}/files/update/#{@config.mods[0].destination}/#{@config.verpath}/version.txt", 'w') do |f|
243
264
  f << @stats.newver
@@ -253,10 +274,8 @@ module SixArma
253
274
  end
254
275
  end
255
276
 
256
- @names = []
257
- @names_c = []
258
-
259
- # tmp
277
+ @names = Hash.new(0)
278
+ #tmp
260
279
 
261
280
  read_changelog()
262
281
  # Write per mod per version changelog
@@ -268,8 +287,8 @@ module SixArma
268
287
  # Write all in one changelog all versions and mods
269
288
  write_changelog2()
270
289
  SixCore::infos 'Latest Commits by:'
271
- @names.each_with_index do |n, idx|
272
- SixCore::info "#{n}: #{@names_c[idx]} commits"
290
+ @names.each do |k, v|
291
+ SixCore::info "#{k}: #{v} commits"
273
292
  end
274
293
  end
275
294
 
@@ -277,7 +296,7 @@ module SixArma
277
296
  def tmp
278
297
  Dir.chdir("#{@config.outroot}/versions")
279
298
 
280
- Dir.glob("*.yaml") do |f|
299
+ Dir.glob('*.yaml') do |f|
281
300
  File.open("#{@config.outroot}/versions/#{f}") do |yf|
282
301
  SixCore::info "Reading From Stats File: #{f}"
283
302
  @stats = YAML::load(yf)
@@ -306,28 +325,10 @@ module SixArma
306
325
  if l[1].size > 0
307
326
  # TODO Pretify
308
327
  name = l[0][1]
309
- replace = [['ace_dev_', ''], ['ace_support_', ''], ['wgl_support_', ''], ['wgl_dev_', ''], ['wgl_supporter_', '']]
310
- name = SixCore::gsub_ar(name, replace)
328
+ name.gsub!(/ace_dev_|ace_support_|wgl_support_|wgl_dev_|wgl_supporter_/i, '')
311
329
  name.capitalize!
312
- if @names.include?(name)
313
- @names.each_with_index do |n, idx|
314
- if n == name
315
- @names_c[idx] = @names_c[idx] + 1
316
- end
317
- end
318
- else
319
- @names_c << 1
320
- @names << name
321
- end
322
- types = [
323
- "CHANGED", "CHANGE", "C", "MODIFIED", "MOD",
324
- "ADDED", "ADD", "A",
325
- "FIXED", "FIX", "F",
326
- "UPDATED", "UPDATE", "UPD", "U",
327
- "DELETED", "DELETE", "DEL", "REMOVED",
328
- "LOCAL", "MOVED", "MOV", "REVERTED", "RENAMED", "R"
329
- ]
330
- type_pattern = types.join '|'
330
+ @names[name] =+ 1
331
+ type_pattern = COMMENT_TYPES.join '|'
331
332
  l[1].each do |c|
332
333
  if true #c =~ /^\s*~\s*/
333
334
  is_valid, type, places, comment = case c
@@ -338,8 +339,8 @@ module SixArma
338
339
  # type - place: comment
339
340
  # type - place comment
340
341
  # type - place
341
- # where "place" can be "place" or "place and place" or "place and place and place"
342
- # where "and" can be "and" or "&"
342
+ # where 'place' can be 'place' or 'place and place' or 'place and place and place'
343
+ # where 'and' can be 'and' or '&'
343
344
 
344
345
  found = [$3]
345
346
  found.push $6 unless $6.nil?
@@ -348,18 +349,18 @@ module SixArma
348
349
  [true, $1, found, $10]
349
350
 
350
351
  when /^\s*~?\s*(#{type_pattern})\s+(\w+_\w+):\s*(.+?)\s*$/i
351
- # ~ place: comment
352
- # place: comment
352
+ # ~ type place: comment
353
+ # type place: comment
353
354
  [true, $1, [$2], $3]
354
355
 
355
- when /^\s*~?\s*(#{type_pattern})\s*:\s*(.+?)\s*$/i
356
+ when /^\s*~?\s*(#{type_pattern})\s*?[\s:]\s*(.+?)\s*$/i
357
+ # ~ type comment
358
+ # type comment
356
359
  # ~ type: comment
357
360
  # type: comment
358
361
  [true, $1, [], $2]
359
362
 
360
363
  when /^\s*~?\s*(#{type_pattern})\s+(.+?)\s*$/i
361
- # ~ type comment
362
- # type comment
363
364
  [true, $1, [], $2]
364
365
 
365
366
  when /^\s*~\s*(.*?)\s*$/
@@ -371,17 +372,16 @@ module SixArma
371
372
  [true, 'LOCAL', [], $1]
372
373
 
373
374
  else
374
- [false, "", "", ""]
375
+ [false, '', '', '']
375
376
  end
376
377
 
377
378
  if is_valid
378
379
  case comment
379
-
380
380
  when /version tag|buildscripts?|build[_\s+]|readme|credits|\.txt|\.bat|changelog| txt |this/i
381
381
  type = 'LOCAL'
382
382
  end
383
383
  comment.gsub!(/penis|dildo|noob/i, '****')
384
- comment.gsub!(/^\s*([:\-\.~\,]|\**)\s*/, '')
384
+ comment.gsub!(/^\s*([:\-\.~,]|\**)\s*/, '')
385
385
  # FIXME: Shouldn't this be possible with just 1* regex?
386
386
  comment.gsub!(/^\s*([:\-\.~,]|\**)\s*/, '')
387
387
  comment.gsub!('http', 'ticket: http')
@@ -390,8 +390,8 @@ module SixArma
390
390
  unless f.nil?
391
391
  case f
392
392
  #when /REMOVED|DELETED/i
393
- # type = "REMOVED"
394
- # comment.sub!(f, "")
393
+ # type = 'REMOVED'
394
+ # comment.sub!(f, '')
395
395
  # comment.gsub!(/^[:\-\.~]/, '')
396
396
  # f = comment[/^\w+/]
397
397
  when /TODO|RESTORTED/i
@@ -424,7 +424,6 @@ module SixArma
424
424
  end
425
425
  end
426
426
  end
427
-
428
427
  end
429
428
  end
430
429
  end
@@ -451,7 +450,7 @@ module SixArma
451
450
 
452
451
  # Writes stats to yaml version file
453
452
  def write_stats()
454
- SixCore::debugs("Writing Version Stats", COMPONENT)
453
+ SixCore::debugs('Writing Version Stats', COMPONENT)
455
454
  SixCore::debug "Current Ver: #{@stats.newver}"
456
455
 
457
456
  File.open("#{@config.outroot}/versions/_version_#{@stats.newver}.yaml", 'w' ) do |out|
@@ -460,11 +459,10 @@ module SixArma
460
459
  end
461
460
 
462
461
 
463
- def gen_clog()
464
- log = []
462
+ def gen_clog(stream)
465
463
  Dir.chdir("#{@config.outroot}/versions")
466
464
  ar = []
467
- Dir.glob("*.yaml") do |f|
465
+ Dir.glob('*.yaml') do |f|
468
466
  ar << f
469
467
  end
470
468
  ar.reverse!
@@ -472,86 +470,59 @@ module SixArma
472
470
  ar.each do |f|
473
471
  File.open("#{@config.outroot}/versions/#{f}") do |yf|
474
472
  stats = YAML::load(yf)
475
- log << ''
476
- log << "== v#{stats.newver} =="
473
+ stream.puts ''
474
+ stream.puts "== v#{stats.newver} =="
477
475
  stats.mods.each_with_index do |mod, idx|
478
476
  mod2 = @config.mods[idx]
479
477
  unless mod2.svn.nil?
480
- nl = generate_log(mod)
481
- unless nl.empty?
482
- log << "* #{mod2.destination }, Revision: #{mod.newrev} - #{mod.oldrev}"
483
- log << nl
484
- end
478
+ generate_log(mod, mod2, stream, 1)
485
479
  end
486
480
  end
487
481
  end
488
482
  end
489
- return log
490
483
  end
491
484
 
492
485
  # Generates log from svn comments
493
486
  # mod:: Object, Mod object
494
- def generate_log(mod)
495
- log = []
496
- unless mod.oldrev == mod.newrev
497
- if mod.changelog.added.size > 0
498
- log << "** ADDED:"
499
- mod.changelog.added.each do |e|
500
- e = "*** #{e}"
501
- log << e
502
- end
503
- log << ''
504
- end
505
- if mod.changelog.updated.size > 0
506
- log << "** UPDATED:"
507
- mod.changelog.updated.each do |e|
508
- e = "*** #{e}"
509
- log << e
510
- end
511
- log << ''
512
- end
513
- if mod.changelog.removed.size > 0
514
- log << "** REMOVED:"
515
- mod.changelog.removed.each do |e|
516
- e = "*** #{e}"
517
- log << e
518
- end
519
- log << ''
520
- end
521
- if mod.changelog.changed.size > 0
522
- log << "** CHANGED:"
523
- mod.changelog.changed.each do |e|
524
- e = "*** #{e}"
525
- log << e
526
- end
527
- log << ''
528
- end
529
- if mod.changelog.fixed.size > 0
530
- log << "** FIXED:"
531
- mod.changelog.fixed.each do |e|
532
- e = "*** #{e}"
533
- log << e
534
- end
535
- log << ''
536
- end
487
+ def generate_log(mod, mod2, stream, type)
488
+ return if mod.oldrev == mod.newrev
489
+
490
+ changelog = mod.changelog
491
+
492
+ return if changelog.values.inject(true) { |b, a| b and a.empty? }
493
+ if type == 1
494
+ stream.puts "* #{mod2.destination}, Revision: #{mod.newrev} - #{mod.oldrev}"
495
+ elsif type == 2
496
+ stream.puts "* #{mod2.destination} v#{@stats.newver}, Revision: #{mod.newrev} - #{mod.oldrev}"
537
497
  end
538
- return log
498
+ generate_log_entries(changelog.added, 'ADDED', stream)
499
+ generate_log_entries(changelog.updated, 'UPDATED', stream)
500
+ generate_log_entries(changelog.removed, 'REMOVED', stream)
501
+ generate_log_entries(changelog.changed, 'CHANGED', stream)
502
+ generate_log_entries(changelog.fixed, 'FIXED', stream)
503
+ # etc
504
+ end
505
+
506
+ def generate_log_entries(changelog, type, stream)
507
+ return if changelog.empty?
508
+
509
+ stream.puts "** #{type}:"
510
+
511
+ changelog.each do |e|
512
+ stream.puts "*** #{e}"
513
+ end
514
+
515
+ stream.puts
539
516
  end
540
517
 
541
518
  # Formats and writes changelog for all versions
542
519
  def write_changelog2()
543
- lf = File.new("#{@config.outroot}/files/update/#{@config.mods[0].destination}/Docs/changelog.txt", 'w')
544
- lf.puts '= Changelog ='
545
- #dir.reverse!
546
- log = gen_clog()
547
- if log.size > 0
520
+ File.open("#{@config.outroot}/files/update/#{@config.mods[0].destination}/Docs/changelog.txt", 'w') do |lf|
548
521
  SixCore::info 'Writing Changelog'
549
- log.each do |l|
550
- lf.puts(l)
551
- end
522
+ lf.puts '= Changelog ='
523
+ gen_clog(lf)
524
+ Dir.chdir(SixCore::MAINDIR)
552
525
  end
553
- Dir.chdir(SixCore::MAINDIR)
554
- lf.close
555
526
  end
556
527
 
557
528
  # Formats and writes changelog for current version
@@ -559,15 +530,9 @@ module SixArma
559
530
  @stats.mods.each_with_index do |mod, idx|
560
531
  mod2 = @config.mods[idx]
561
532
  unless mod2.svn.nil?
562
- lf = File.new("#{@config.mods[idx].changes}/changelog.txt", 'w')
563
- lf.puts "* #{mod2.destination} v#{@stats.newver}, Revision: #{mod.newrev} - #{mod.oldrev}"
564
- log = generate_log(mod)
565
- if log.size > 0
566
- log.each do |l|
567
- lf.puts(l)
568
- end
533
+ File.open("#{@config.mods[idx].changes}/changelog.txt", 'w') do |lf|
534
+ generate_log(mod, mod2, lf, 2)
569
535
  end
570
- lf.close
571
536
  end
572
537
  end
573
538
  end
@@ -581,20 +546,20 @@ module SixArma
581
546
  end
582
547
 
583
548
  # Builds Full
584
- # svn_do, clear, addon_changes, update_all("update", "full"), sign_full
549
+ # svn_do, clear, addon_changes, update_all('update', 'full'), sign_full
585
550
  def build_full()
586
551
  svn_do()
587
552
  clear()
588
553
  addon_changes()
589
- update_all("update", "full")
554
+ update_all('update', 'full')
590
555
  sign_full()
591
556
  end
592
557
 
593
558
  # Creates Update
594
- # build_full, update_sign("full", "update"), nsis_update
559
+ # build_full, update_sign('full', 'update'), nsis_update
595
560
  def create_update()
596
561
  build_full()
597
- update_sign("full", "update")
562
+ update_sign('full', 'update')
598
563
  nsis_update()
599
564
  end
600
565
 
@@ -616,9 +581,9 @@ module SixArma
616
581
  # thread:: Boolean: Uses seperate thread when set to true
617
582
  def dist_update(thread = false)
618
583
  if thread
619
- upload_thread("update")
584
+ upload_thread('update')
620
585
  else
621
- upload(@stats.updatefile, "update")
586
+ upload(@stats.updatefile, 'update')
622
587
  end
623
588
  end
624
589
 
@@ -626,9 +591,9 @@ module SixArma
626
591
  # thread:: Boolean: Uses seperate thread when set to true
627
592
  def dist_full(thread = false)
628
593
  if thread
629
- upload_thread("full")
594
+ upload_thread('full')
630
595
  else
631
- upload(@stats.fullfile, "full")
596
+ upload(@stats.fullfile, 'full')
632
597
  end
633
598
  end
634
599
 
@@ -655,6 +620,6 @@ module SixArma
655
620
  end
656
621
 
657
622
  component = '6thSense.eu ArmA BuildTools'
658
- version = '0.7.2'
623
+ version = '0.7.3'
659
624
  SixCore::debugs "#{component} #{version} loaded"
660
625
  SixCore::infos("v#{version}, by Sickboy (sb_at_6thSense.eu)", component)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixarma-bt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sickboy