sixarma-bt 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +167 -0
- data/README +8 -0
- data/Rakefile +49 -0
- data/lib/sixarma/bt/build.rb +135 -0
- data/lib/sixarma/bt/nsis.rb +56 -0
- data/lib/sixarma/bt/options.rb +133 -0
- data/lib/sixarma/bt/sign.rb +97 -0
- data/lib/sixarma/bt/svn.rb +140 -0
- data/lib/sixarma/bt.rb +635 -0
- data/lib/sixarma-bt-cli.rb +20 -0
- metadata +82 -0
data/lib/sixarma/bt.rb
ADDED
@@ -0,0 +1,635 @@
|
|
1
|
+
=begin
|
2
|
+
6thSense.eu ArmA BuildTools (Automation Suite), by Sickboy (sb_at_6thSense.eu)
|
3
|
+
|
4
|
+
# TODO: Tweak / Clean / Merge / Split / Optimize
|
5
|
+
# TODO: log4r support per module instead of all in core?
|
6
|
+
# TODO: Implement FATAL, WARN etc loglevels?
|
7
|
+
# TODO: Convert all Config/Stats classes from CON_STANT to ConStant variation
|
8
|
+
# TODO: List:
|
9
|
+
- More sophisticated svn changes system which goes beyond "Addons" and "Dta" etc
|
10
|
+
-- CONFIG_MOD_SUBFOLDERS per mod implemented, but only active for creating addons and signing
|
11
|
+
- Think about how to resolve "Case sensitivity for paths", or should we not at all?
|
12
|
+
- Finish implementation of Time.now and processed time
|
13
|
+
- SVN Update/Commit Functions
|
14
|
+
=end
|
15
|
+
|
16
|
+
# load core modules
|
17
|
+
require 'rubygems'
|
18
|
+
|
19
|
+
gem 'sixcore'
|
20
|
+
require 'sixcore'
|
21
|
+
require 'sixcore/ftp'
|
22
|
+
require 'sixcore/nsis'
|
23
|
+
require 'sixcore/svn'
|
24
|
+
|
25
|
+
gem 'sixarma'
|
26
|
+
require 'sixarma'
|
27
|
+
require 'sixarma/pbotools'
|
28
|
+
require 'sixarma/sign'
|
29
|
+
|
30
|
+
# load program modules
|
31
|
+
require 'sixarma/bt/build'
|
32
|
+
require 'sixarma/bt/nsis'
|
33
|
+
require 'sixarma/bt/svn'
|
34
|
+
require 'sixarma/bt/sign'
|
35
|
+
|
36
|
+
# Main ArmA Module
|
37
|
+
module SixArma
|
38
|
+
# Build Tools Module
|
39
|
+
module Bt
|
40
|
+
# Main Config Structure
|
41
|
+
CONFIG = Struct.new(:title, :titlelong, :outroot, :verpath, :veraddon, :changelog, :workdir, :workbin, :workpbo, :work3rd, :work3rd_pbo,
|
42
|
+
:workdel, :listbin, :listpbo, :list3rd_pbo, :sign, :nsis, :ftp, :mods)
|
43
|
+
# Main FTP Config Structure
|
44
|
+
CONFIG_FTP = Struct.new(:host, :user, :pass, :pathfull, :pathupdate)
|
45
|
+
# Main NSIS Config Structure
|
46
|
+
CONFIG_NSIS = Struct.new(:out, :template, :output, :reg_newver, :reg_oldver, :reg_delete, :reg_type, :reg_verpath, :reg_out)
|
47
|
+
# Main Signature Config Structure
|
48
|
+
CONFIG_SIGN = Struct.new(:file, :keytype)
|
49
|
+
|
50
|
+
# Main Mod Config Structure
|
51
|
+
CONFIG_MOD = Struct.new(:changes, :lists, :path, :source, :altsource, :destination, :subfolders, :svn, :nsis)
|
52
|
+
# Mod Subfolders Config Structure
|
53
|
+
CONFIG_MOD_SUBFOLDERS = Struct.new(:name, :type)
|
54
|
+
# Mod NSIS Config Structure
|
55
|
+
CONFIG_MOD_NSIS = Struct.new(:out)
|
56
|
+
# Mod SVN Config Structure
|
57
|
+
CONFIG_MOD_SVN = Struct.new(:url, :user, :pass)
|
58
|
+
|
59
|
+
# Main Stats Structure
|
60
|
+
STATS = Struct.new(:released, :oldver, :newver, :updatefile, :fullfile, :mods)
|
61
|
+
# Main Mod Stats Structure
|
62
|
+
STATS_MOD = Struct.new(:oldrev, :newrev, :subfolders, :changelog)
|
63
|
+
# Mod Subfolders Structure
|
64
|
+
STATS_MOD_SUBFOLDERS = Struct.new(:add, :change, :del)
|
65
|
+
# Changelog Structure
|
66
|
+
STATS_MOD_CHANGELOG = Struct.new(:added, :updated, :removed, :changed, :fixed, :local)
|
67
|
+
|
68
|
+
# Main Program Class
|
69
|
+
class Builder
|
70
|
+
COMPONENT = 'SixArma::Bt::Builder'
|
71
|
+
|
72
|
+
attr_reader(:config, :stats)
|
73
|
+
attr_accessor :threads
|
74
|
+
|
75
|
+
# yaml:: Yaml configuration file
|
76
|
+
# halt:: Wait for user input every step?
|
77
|
+
def initialize(yaml, halt)
|
78
|
+
SixCore::info "Start Time: #{Time.now}"
|
79
|
+
|
80
|
+
@halt = halt
|
81
|
+
@threads = []
|
82
|
+
@stats = STATS.new()
|
83
|
+
if FileTest.exist?(yaml)
|
84
|
+
SixCore::info "Reading From Configuration File: #{yaml}"
|
85
|
+
File.open(yaml) { |yf| @config = YAML::load( yf ) }
|
86
|
+
else
|
87
|
+
SixCore::info "Yaml file not found (#{yaml})"
|
88
|
+
Process.exit
|
89
|
+
end
|
90
|
+
read_stats()
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
# Updates files from source to destination
|
95
|
+
# source:: Source path
|
96
|
+
# destination:: Destination path
|
97
|
+
def update_all(source, destination)
|
98
|
+
SixCore::infos("Update_All", COMPONENT) # TODO
|
99
|
+
SixCore::info "Updating *all* files - source: #{source} - destination: #{destination}..."
|
100
|
+
SixCore::fileupdate(
|
101
|
+
"#{@config.outroot}\\files\\#{source}\\",
|
102
|
+
"#{@config.outroot}\\files\\#{destination}\\"
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Updates signature files from source to destination
|
107
|
+
# source:: Source path
|
108
|
+
# destination:: Destination path
|
109
|
+
def update_sign(source, destination)
|
110
|
+
SixCore::infos("Update_Sign", COMPONENT) # TODO
|
111
|
+
SixCore::info "Updating *sign* files - source: #{source} - destination: #{destination}..."
|
112
|
+
SixCore::fileupdate(
|
113
|
+
"#{@config.outroot}\\files\\#{source}\\",
|
114
|
+
"#{@config.outroot}\\files\\#{destination}\\",
|
115
|
+
"/IF *.bisign *.bikey"
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Uploads with raw parameters
|
120
|
+
# host:: FTP Hostname
|
121
|
+
# user:: FTP Username
|
122
|
+
# pass:: FTP Password
|
123
|
+
# path:: FTP Path
|
124
|
+
# localpath:: Local Path
|
125
|
+
# put:: File to upload
|
126
|
+
# tmp:: Leave file as filename_tmp on ftp when finished?
|
127
|
+
def upload_raw(host, user, pass, path, localpath, put, tmp = true)
|
128
|
+
ftp = SixCore::Ftp.new(host, user, pass)
|
129
|
+
ftp.put(put, localpath, path, true, tmp)
|
130
|
+
ftp.ftp.close
|
131
|
+
end
|
132
|
+
|
133
|
+
public
|
134
|
+
# Upload file
|
135
|
+
# put:: File to upload
|
136
|
+
# type:: Type (update or full)
|
137
|
+
def upload(put, type, tmp = true)
|
138
|
+
SixCore::infos("Upload", COMPONENT)
|
139
|
+
@config.ftp.each do |f|
|
140
|
+
path = eval "f.path#{type}"
|
141
|
+
SixCore::info "Uploading #{put} to #{f.host}/#{path}..."
|
142
|
+
ftp = SixCore::Ftp.new(f.host, f.user, f.pass)
|
143
|
+
ftp.put(put, "#{@config.outroot}\\", path, true, tmp)
|
144
|
+
ftp.ftp.close
|
145
|
+
end
|
146
|
+
SixCore::info "Uploading #{put} finished!"
|
147
|
+
SixCore::halt() if @halt
|
148
|
+
end
|
149
|
+
|
150
|
+
# Uploads in seperate thread
|
151
|
+
# type:: String, update or full
|
152
|
+
def upload_thread(type)
|
153
|
+
name = eval("@stats.#{type}file")
|
154
|
+
tmp = []
|
155
|
+
@config.ftp.each do |f|
|
156
|
+
tmp << [f.host, f.user, f.pass, eval("f.path#{type}"), "#{@config.outroot}\\", name]
|
157
|
+
end
|
158
|
+
@threads << Thread.new(tmp,name) do |ftps,name|
|
159
|
+
SixCore::infos("Upload", COMPONENT)
|
160
|
+
SixCore::info "Uploading #{name}..."
|
161
|
+
ftps.each { |f| upload_raw(*f) }
|
162
|
+
SixCore::info "Uploading #{name} finished..."
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Releases uploaded update/full setup files
|
167
|
+
def release()
|
168
|
+
SixCore::info "Releasing #{@stats.newver}..."
|
169
|
+
@config.ftp.each do |f|
|
170
|
+
begin
|
171
|
+
raise 'Error' if @stats.fullfile.nil? && @stats.updatefile.nil?
|
172
|
+
ftp = SixCore::Ftp.new(f.host, f.user, f.pass)
|
173
|
+
ftp.rename("#{@stats.fullfile}_tmp", @stats.fullfile, f.pathfull) unless @stats.fullfile.nil?
|
174
|
+
ftp.rename("#{@stats.updatefile}_tmp", @stats.updatefile, f.pathupdate) unless @stats.updatefile.nil?
|
175
|
+
ftp.ftp.close
|
176
|
+
rescue
|
177
|
+
# TODO: Evaluate direct log
|
178
|
+
SixCore::log.fatal 'Renaming files on FTP; Something went wrong, please verify!'
|
179
|
+
Process.exit
|
180
|
+
ensure
|
181
|
+
ftp.ftp.close unless ftp.nil?
|
182
|
+
end
|
183
|
+
end
|
184
|
+
@stats.released = true
|
185
|
+
SixCore::info "Version Info: #{@stats.newver} Released!"
|
186
|
+
|
187
|
+
write_stats()
|
188
|
+
end
|
189
|
+
|
190
|
+
# Reads stats from yaml version file
|
191
|
+
def read_stats()
|
192
|
+
# TODO: Prettify
|
193
|
+
dir = Dir.open("#{@config.outroot}/versions").entries
|
194
|
+
if dir.size > 2
|
195
|
+
dir.reverse!
|
196
|
+
File.open("#{@config.outroot}/versions/#{dir[0]}") do |yf|
|
197
|
+
SixCore::info "Reading From Stats File: #{dir[0]}"
|
198
|
+
stats = YAML::load(yf)
|
199
|
+
if stats.released
|
200
|
+
SixCore::info "Previous version was released; New Version"
|
201
|
+
@stats = STATS.new()
|
202
|
+
@stats.mods = []
|
203
|
+
@stats.oldver = stats.newver.to_s
|
204
|
+
@stats.newver = @stats.oldver.to_f + 0.01
|
205
|
+
@stats.newver = @stats.newver.to_s
|
206
|
+
# TODO: Prettify??
|
207
|
+
@stats.newver << "0" # always append extra 0 due to floating point 0.50 --> 0.5
|
208
|
+
@stats.oldver << "0" # always append extra 0 due to floating point 0.50 --> 0.5
|
209
|
+
@stats.newver = /(.)\.(.)(.)/.match(@stats.newver).to_s
|
210
|
+
@stats.oldver = /(.)\.(.)(.)/.match(@stats.oldver).to_s
|
211
|
+
|
212
|
+
@stats.released = false
|
213
|
+
stats.mods.each do |mod|
|
214
|
+
modstats = STATS_MOD.new()
|
215
|
+
modstats.subfolders = []
|
216
|
+
mod.subfolders.each do
|
217
|
+
sf = STATS_MOD_SUBFOLDERS.new()
|
218
|
+
sf.add = []
|
219
|
+
sf.del = []
|
220
|
+
sf.change = []
|
221
|
+
modstats.subfolders << sf
|
222
|
+
end
|
223
|
+
modstats.oldrev = mod.newrev
|
224
|
+
@stats.mods << modstats
|
225
|
+
end
|
226
|
+
else
|
227
|
+
SixCore::info "Previous version wasn't released; Sticking to current version"
|
228
|
+
@stats = stats
|
229
|
+
end
|
230
|
+
end
|
231
|
+
else
|
232
|
+
info "No version yaml found in versions folder, aborting"
|
233
|
+
Process.exit
|
234
|
+
end
|
235
|
+
|
236
|
+
SixCore::info "Current Version: #{@stats.newver} | Previous Version: #{@stats.oldver}"
|
237
|
+
|
238
|
+
# update the version files
|
239
|
+
SixCore::info "Updating version.txt..."
|
240
|
+
# used by updater setup program
|
241
|
+
File.open("#{@config.outroot}/files/update/#{@config.mods[0].destination}/#{@config.verpath}/version.txt", "w") do |f|
|
242
|
+
f << @stats.newver
|
243
|
+
end
|
244
|
+
|
245
|
+
# used ingame
|
246
|
+
unless @config.veraddon.nil?
|
247
|
+
verfile = File.open(
|
248
|
+
"#{@config.mods[0].path}/#{@config.mods[0].source}/Addons/#{@config.veraddon}/version.hpp",
|
249
|
+
"w") do |f|
|
250
|
+
f.puts "VERSION = \"#{@stats.newver}\";"
|
251
|
+
f.puts "text = \"#{@config.title} v#{@stats.newver}\";"
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
@names = []
|
256
|
+
@names_c = []
|
257
|
+
|
258
|
+
#tmp
|
259
|
+
|
260
|
+
read_changelog()
|
261
|
+
# Write per mod per version changelog
|
262
|
+
write_changelog()
|
263
|
+
|
264
|
+
# Write Stats
|
265
|
+
write_stats()
|
266
|
+
|
267
|
+
# Write all in one changelog all versions and mods
|
268
|
+
write_changelog2()
|
269
|
+
SixCore::infos 'Latest Commits by:'
|
270
|
+
@names.each_with_index do |n, idx|
|
271
|
+
SixCore::info "#{n}: #{@names_c[idx]} commits"
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
# Experimental: "Replay SVN Log and Reimport"
|
276
|
+
def tmp
|
277
|
+
Dir.chdir("#{@config.outroot}/versions")
|
278
|
+
|
279
|
+
Dir.glob("*.yaml") do |f|
|
280
|
+
File.open("#{@config.outroot}/versions/#{f}") do |yf|
|
281
|
+
SixCore::info "Reading From Stats File: #{f}"
|
282
|
+
@stats = YAML::load(yf)
|
283
|
+
read_changelog(false)
|
284
|
+
write_stats()
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def read_changelog(readrev = true)
|
290
|
+
@stats.mods.each_with_index do |mod, idx|
|
291
|
+
mod.changelog = STATS_MOD_CHANGELOG.new()
|
292
|
+
mod.changelog.changed = []
|
293
|
+
mod.changelog.removed = []
|
294
|
+
mod.changelog.fixed = []
|
295
|
+
mod.changelog.added = []
|
296
|
+
mod.changelog.updated = []
|
297
|
+
mod.changelog.local = []
|
298
|
+
mod2 = @config.mods[idx]
|
299
|
+
unless mod2.svn.nil?
|
300
|
+
svn = SixCore::Svn.new("#{mod2.path}#{mod2.source}", mod2.svn.user, mod2.svn.pass)
|
301
|
+
mod.newrev = svn.read_rev() if readrev
|
302
|
+
unless mod.oldrev == mod.newrev
|
303
|
+
log_orig = svn.log_split(mod.oldrev.to_i + 1, mod.newrev)
|
304
|
+
log_orig.each do |l|
|
305
|
+
if l[1].size > 0
|
306
|
+
# TODO Pretify
|
307
|
+
name = l[0][1]
|
308
|
+
replace = [['ace_dev_', ''], ['ace_support_', ''], ['wgl_support_', ''], ['wgl_dev_', ''], ['wgl_supporter_', '']]
|
309
|
+
name = SixCore::gsub_ar(name, replace)
|
310
|
+
name.capitalize!
|
311
|
+
if @names.include?(name)
|
312
|
+
@names.each_with_index do |n, idx|
|
313
|
+
if n == name
|
314
|
+
@names_c[idx] = @names_c[idx] + 1
|
315
|
+
end
|
316
|
+
end
|
317
|
+
else
|
318
|
+
@names_c << 1
|
319
|
+
@names << name
|
320
|
+
end
|
321
|
+
l[1].each do |c|
|
322
|
+
case c
|
323
|
+
when /^[\s]*~[\s]*/
|
324
|
+
c.gsub!(/^[\s]*~[\s]*/, '')
|
325
|
+
c.strip!
|
326
|
+
c.gsub!(/[\s]+/, '')
|
327
|
+
type = c[/^([\w]+)/]
|
328
|
+
type.upcase! unless type.nil?
|
329
|
+
if ["CHANGED", "FIXED", "ADDED", "REMOVED", "UPDATED", "LOCAL",
|
330
|
+
"MOVED", "MODIFIED", "RENAMED", "REVERTED", "UPDATE",
|
331
|
+
"ADD", "MOD", "FIX", "MOV", "UPD", "DEL",
|
332
|
+
"C", "A", "R", "F"].include?(type)
|
333
|
+
c.gsub!(/^([\w]+)[\s]*/, "")
|
334
|
+
case c
|
335
|
+
when /^-* *([\w]+):/ # /^- ([\w]+):/ and /^([\w]+):/
|
336
|
+
tmp = c[/^-* *([\w]+):/]
|
337
|
+
when /^- +([\w]+) +\-/
|
338
|
+
tmp = c[/^- +([\w]+) +\-/]
|
339
|
+
when /^- ([\w]+) ([\w]+):/
|
340
|
+
tmp = c[/^- ([\w]+) ([\w]+):/]
|
341
|
+
when /^- ([\w]+) ([\w]+) ([\w]+):/
|
342
|
+
tmp = c[/^- ([\w]+) ([\w]+) ([\w]+):/]
|
343
|
+
end
|
344
|
+
|
345
|
+
unless tmp.nil?
|
346
|
+
c.gsub!(tmp, "")
|
347
|
+
c.strip!
|
348
|
+
tmp.gsub!(/[:-]/, "")
|
349
|
+
tmp.gsub!(/[\s]*-[\s]*/, "")
|
350
|
+
tmp.strip!
|
351
|
+
c = "#{c} - #{tmp}"
|
352
|
+
end
|
353
|
+
c.gsub!(/^: /, "")
|
354
|
+
c.gsub!(/^- /, "")
|
355
|
+
else
|
356
|
+
type = "CHANGED"
|
357
|
+
end
|
358
|
+
unless c.empty?
|
359
|
+
case c
|
360
|
+
when /version tag/i, /buildscripts/i, /build /i, /readme /i, /credits/i, /\.txt/i, /\.bat/i, /changelog/i, / txt /i, /this/i
|
361
|
+
type = "LOCAL"
|
362
|
+
end
|
363
|
+
# Only capitalize first word, leave rest intact
|
364
|
+
c.strip!
|
365
|
+
c.gsub!(/^[:\-\.~]\s*/, '')
|
366
|
+
# Filter :-D
|
367
|
+
c.gsub!(/penis|dildo|noob/i, '****')
|
368
|
+
f = c[/^[\w]+/]
|
369
|
+
unless f.nil?
|
370
|
+
case f
|
371
|
+
when /REMOVED/i, /DELETED/i
|
372
|
+
type = "REMOVED"
|
373
|
+
c.sub!(f, "")
|
374
|
+
c.gsub!(/^[:\-\.~]/, '')
|
375
|
+
when /TODO/i, /RESTORED/i
|
376
|
+
type = "LOCAL"
|
377
|
+
end
|
378
|
+
end
|
379
|
+
c.strip!
|
380
|
+
f = c[/^[\w]+/]
|
381
|
+
c.gsub!(/^[\w]+/, "")
|
382
|
+
unless f.nil?
|
383
|
+
f.strip!
|
384
|
+
f.capitalize!
|
385
|
+
end
|
386
|
+
entry = "#{f}#{c} [#{name}]"
|
387
|
+
entry.strip!
|
388
|
+
unless "#{f}#{c}".strip.empty?
|
389
|
+
# Add entry to appriopriate array
|
390
|
+
case type
|
391
|
+
when "CHANGED", "C", "MODIFIED", "MOD", "RENAMED"
|
392
|
+
mod.changelog.changed << entry
|
393
|
+
when "ADDED", "A", "ADD"
|
394
|
+
mod.changelog.added << entry
|
395
|
+
when "REMOVED", "R", "DEL"
|
396
|
+
mod.changelog.removed << entry
|
397
|
+
when "UPDATED", "U", "UPD", "UPDATE"
|
398
|
+
mod.changelog.updated << entry
|
399
|
+
when "FIXED", "F", "FIX"
|
400
|
+
mod.changelog.fixed << entry
|
401
|
+
when "LOCAL", "MOVED", "MOV", "REVERTED"
|
402
|
+
mod.changelog.local << entry
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
mod.changelog.changed.uniq!
|
412
|
+
mod.changelog.added.uniq!
|
413
|
+
mod.changelog.removed.uniq!
|
414
|
+
mod.changelog.updated.uniq!
|
415
|
+
mod.changelog.fixed.uniq!
|
416
|
+
mod.changelog.local.uniq!
|
417
|
+
SixCore::info "SVN #{mod2.destination} Current Rev: #{mod.newrev} | Previous Rev: #{mod.oldrev}"
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
# Writes stats to yaml version file
|
423
|
+
def write_stats()
|
424
|
+
SixCore::debugs("Writing Version Stats", COMPONENT)
|
425
|
+
SixCore::debug "Current Ver: #{@stats.newver}"
|
426
|
+
|
427
|
+
File.open("#{@config.outroot}/versions/_version_#{@stats.newver}.yaml", 'w' ) do |out|
|
428
|
+
YAML.dump( @stats, out )
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
|
433
|
+
def gen_clog()
|
434
|
+
log = []
|
435
|
+
Dir.chdir("#{@config.outroot}/versions")
|
436
|
+
ar = []
|
437
|
+
Dir.glob("*.yaml") do |f|
|
438
|
+
ar << f
|
439
|
+
end
|
440
|
+
ar.reverse!
|
441
|
+
SixCore::info "Replaying logfiles from Stats Files: #{ar.first} - #{ar.last}"
|
442
|
+
ar.each do |f|
|
443
|
+
File.open("#{@config.outroot}/versions/#{f}") do |yf|
|
444
|
+
stats = YAML::load(yf)
|
445
|
+
log << ''
|
446
|
+
log << "== v#{stats.newver} =="
|
447
|
+
stats.mods.each_with_index do |mod, idx|
|
448
|
+
mod2 = @config.mods[idx]
|
449
|
+
unless mod2.svn.nil?
|
450
|
+
nl = generate_log(mod)
|
451
|
+
unless nl.empty?
|
452
|
+
log << "* #{mod2.destination }, Revision: #{mod.newrev} - #{mod.oldrev}"
|
453
|
+
log << nl
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
return log
|
460
|
+
end
|
461
|
+
|
462
|
+
# Generates log from svn comments
|
463
|
+
# mod:: Object, Mod object
|
464
|
+
def generate_log(mod)
|
465
|
+
log = []
|
466
|
+
unless mod.oldrev == mod.newrev
|
467
|
+
if mod.changelog.added.size > 0
|
468
|
+
log << "** ADDED:"
|
469
|
+
mod.changelog.added.sort!
|
470
|
+
mod.changelog.added.each do |e|
|
471
|
+
e = "*** #{e}"
|
472
|
+
log << e
|
473
|
+
end
|
474
|
+
log << ''
|
475
|
+
end
|
476
|
+
if mod.changelog.updated.size > 0
|
477
|
+
log << "** UPDATED:"
|
478
|
+
mod.changelog.updated.sort!
|
479
|
+
mod.changelog.updated.each do |e|
|
480
|
+
e = "*** #{e}"
|
481
|
+
log << e
|
482
|
+
end
|
483
|
+
log << ''
|
484
|
+
end
|
485
|
+
if mod.changelog.removed.size > 0
|
486
|
+
log << "** REMOVED:"
|
487
|
+
mod.changelog.removed.sort!
|
488
|
+
mod.changelog.removed.each do |e|
|
489
|
+
e = "*** #{e}"
|
490
|
+
log << e
|
491
|
+
end
|
492
|
+
log << ''
|
493
|
+
end
|
494
|
+
if mod.changelog.changed.size > 0
|
495
|
+
log << "** CHANGED:"
|
496
|
+
mod.changelog.changed.sort!
|
497
|
+
mod.changelog.changed.each do |e|
|
498
|
+
e = "*** #{e}"
|
499
|
+
log << e
|
500
|
+
end
|
501
|
+
log << ''
|
502
|
+
end
|
503
|
+
if mod.changelog.fixed.size > 0
|
504
|
+
log << "** FIXED:"
|
505
|
+
mod.changelog.fixed.sort!
|
506
|
+
mod.changelog.fixed.each do |e|
|
507
|
+
e = "*** #{e}"
|
508
|
+
log << e
|
509
|
+
end
|
510
|
+
log << ''
|
511
|
+
end
|
512
|
+
end
|
513
|
+
return log
|
514
|
+
end
|
515
|
+
|
516
|
+
# Formats and writes changelog for all versions
|
517
|
+
def write_changelog2()
|
518
|
+
lf = File.new("#{@config.outroot}/files/update/#{@config.mods[0].destination}/Docs/changelog.txt", 'w')
|
519
|
+
lf.puts '= Changelog ='
|
520
|
+
#dir.reverse!
|
521
|
+
log = gen_clog()
|
522
|
+
if log.size > 0
|
523
|
+
SixCore::info 'Writing Changelog'
|
524
|
+
log.each do |l|
|
525
|
+
lf.puts(l)
|
526
|
+
end
|
527
|
+
end
|
528
|
+
Dir.chdir(SixCore::MAINDIR)
|
529
|
+
lf.close
|
530
|
+
end
|
531
|
+
|
532
|
+
# Formats and writes changelog for current version
|
533
|
+
def write_changelog()
|
534
|
+
@stats.mods.each_with_index do |mod, idx|
|
535
|
+
mod2 = @config.mods[idx]
|
536
|
+
unless mod2.svn.nil?
|
537
|
+
lf = File.new("#{@config.mods[idx].changes}/changelog.txt", 'w')
|
538
|
+
lf.puts "* #{mod2.destination} v#{@stats.newver}, Revision: #{mod.newrev} - #{mod.oldrev}"
|
539
|
+
log = generate_log(mod)
|
540
|
+
if log.size > 0
|
541
|
+
log.each do |l|
|
542
|
+
lf.puts(l)
|
543
|
+
end
|
544
|
+
end
|
545
|
+
lf.close
|
546
|
+
end
|
547
|
+
end
|
548
|
+
end
|
549
|
+
|
550
|
+
# Builds Update
|
551
|
+
# svn_do, addon_changes, sign_update
|
552
|
+
def build_update()
|
553
|
+
svn_do()
|
554
|
+
addon_changes()
|
555
|
+
sign_update()
|
556
|
+
end
|
557
|
+
|
558
|
+
# Builds Full
|
559
|
+
# svn_do, clear, addon_changes, update_all("update", "full"), sign_full
|
560
|
+
def build_full()
|
561
|
+
svn_do()
|
562
|
+
clear()
|
563
|
+
addon_changes()
|
564
|
+
update_all("update", "full")
|
565
|
+
sign_full()
|
566
|
+
end
|
567
|
+
|
568
|
+
# Creates Update
|
569
|
+
# build_full, update_sign("full", "update"), nsis_update
|
570
|
+
def create_update()
|
571
|
+
build_full()
|
572
|
+
update_sign("full", "update")
|
573
|
+
nsis_update()
|
574
|
+
end
|
575
|
+
|
576
|
+
# Creates Full
|
577
|
+
# build_full, nsis_full
|
578
|
+
def create_full()
|
579
|
+
build_full()
|
580
|
+
nsis_full()
|
581
|
+
end
|
582
|
+
|
583
|
+
# Creates Update and Full
|
584
|
+
# create_update, nsis_full
|
585
|
+
def create_all()
|
586
|
+
create_update()
|
587
|
+
nsis_full()
|
588
|
+
end
|
589
|
+
|
590
|
+
# Distributes Update
|
591
|
+
# thread:: Boolean: Uses seperate thread when set to true
|
592
|
+
def dist_update(thread = false)
|
593
|
+
if thread
|
594
|
+
upload_thread("update")
|
595
|
+
else
|
596
|
+
upload(@stats.updatefile, "update")
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
# Distributes Full
|
601
|
+
# thread:: Boolean: Uses seperate thread when set to true
|
602
|
+
def dist_full(thread = false)
|
603
|
+
if thread
|
604
|
+
upload_thread("full")
|
605
|
+
else
|
606
|
+
upload(@stats.fullfile, "full")
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
610
|
+
# Distributes Update and Full
|
611
|
+
# thread:: Boolean: Uses seperate thread when set to true
|
612
|
+
def dist_all(thread = false)
|
613
|
+
dist_update(thread)
|
614
|
+
dist_full(thread)
|
615
|
+
@threads.each { |t| t.join } if thread
|
616
|
+
end
|
617
|
+
|
618
|
+
# Executes Complete Process on Update and Full
|
619
|
+
# create_update, dist_update, nsis_full, dist_full
|
620
|
+
# thread:: Boolean: Uses seperate thread when set to true
|
621
|
+
def complete(thread = true)
|
622
|
+
create_update()
|
623
|
+
dist_update(thread)
|
624
|
+
nsis_full()
|
625
|
+
dist_full(thread)
|
626
|
+
@threads.each { |t| t.join } if thread
|
627
|
+
end
|
628
|
+
end
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
component = '6thSense.eu ArmA BuildTools'
|
633
|
+
version = '0.7.1'
|
634
|
+
SixCore::debugs "#{component} #{version} loaded"
|
635
|
+
SixCore::infos("v#{version}, by Sickboy (sb_at_6thSense.eu)", component)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
=begin
|
2
|
+
6thSense.eu ArmA BuildTools (Automation Suite), by Sickboy (sb_at_6thSense.eu)
|
3
|
+
=end
|
4
|
+
|
5
|
+
##
|
6
|
+
# load main module
|
7
|
+
require 'sixarma/bt'
|
8
|
+
require 'sixarma/bt/options'
|
9
|
+
|
10
|
+
##
|
11
|
+
# Build Program
|
12
|
+
builder = SixArma::Bt::Builder.new(
|
13
|
+
@options.configfile, # Desired Yaml Configuration File
|
14
|
+
@options.halt # True: will halt after every Major Operation waiting for user to press enter
|
15
|
+
)
|
16
|
+
|
17
|
+
SixCore::log.debug @options.todo
|
18
|
+
@options.todo.each do |t|
|
19
|
+
eval "builder.#{t}"
|
20
|
+
end
|