sixarma-bt 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,167 @@
1
+ == sixarma-bt
2
+
3
+ GNU LESSER GENERAL PUBLIC LICENSE
4
+ Version 3, 29 June 2007
5
+
6
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+
11
+ This version of the GNU Lesser General Public License incorporates
12
+ the terms and conditions of version 3 of the GNU General Public
13
+ License, supplemented by the additional permissions listed below.
14
+
15
+ 0. Additional Definitions.
16
+
17
+ As used herein, "this License" refers to version 3 of the GNU Lesser
18
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
19
+ General Public License.
20
+
21
+ "The Library" refers to a covered work governed by this License,
22
+ other than an Application or a Combined Work as defined below.
23
+
24
+ An "Application" is any work that makes use of an interface provided
25
+ by the Library, but which is not otherwise based on the Library.
26
+ Defining a subclass of a class defined by the Library is deemed a mode
27
+ of using an interface provided by the Library.
28
+
29
+ A "Combined Work" is a work produced by combining or linking an
30
+ Application with the Library. The particular version of the Library
31
+ with which the Combined Work was made is also called the "Linked
32
+ Version".
33
+
34
+ The "Minimal Corresponding Source" for a Combined Work means the
35
+ Corresponding Source for the Combined Work, excluding any source code
36
+ for portions of the Combined Work that, considered in isolation, are
37
+ based on the Application, and not on the Linked Version.
38
+
39
+ The "Corresponding Application Code" for a Combined Work means the
40
+ object code and/or source code for the Application, including any data
41
+ and utility programs needed for reproducing the Combined Work from the
42
+ Application, but excluding the System Libraries of the Combined Work.
43
+
44
+ 1. Exception to Section 3 of the GNU GPL.
45
+
46
+ You may convey a covered work under sections 3 and 4 of this License
47
+ without being bound by section 3 of the GNU GPL.
48
+
49
+ 2. Conveying Modified Versions.
50
+
51
+ If you modify a copy of the Library, and, in your modifications, a
52
+ facility refers to a function or data to be supplied by an Application
53
+ that uses the facility (other than as an argument passed when the
54
+ facility is invoked), then you may convey a copy of the modified
55
+ version:
56
+
57
+ a) under this License, provided that you make a good faith effort to
58
+ ensure that, in the event an Application does not supply the
59
+ function or data, the facility still operates, and performs
60
+ whatever part of its purpose remains meaningful, or
61
+
62
+ b) under the GNU GPL, with none of the additional permissions of
63
+ this License applicable to that copy.
64
+
65
+ 3. Object Code Incorporating Material from Library Header Files.
66
+
67
+ The object code form of an Application may incorporate material from
68
+ a header file that is part of the Library. You may convey such object
69
+ code under terms of your choice, provided that, if the incorporated
70
+ material is not limited to numerical parameters, data structure
71
+ layouts and accessors, or small macros, inline functions and templates
72
+ (ten or fewer lines in length), you do both of the following:
73
+
74
+ a) Give prominent notice with each copy of the object code that the
75
+ Library is used in it and that the Library and its use are
76
+ covered by this License.
77
+
78
+ b) Accompany the object code with a copy of the GNU GPL and this license
79
+ document.
80
+
81
+ 4. Combined Works.
82
+
83
+ You may convey a Combined Work under terms of your choice that,
84
+ taken together, effectively do not restrict modification of the
85
+ portions of the Library contained in the Combined Work and reverse
86
+ engineering for debugging such modifications, if you also do each of
87
+ the following:
88
+
89
+ a) Give prominent notice with each copy of the Combined Work that
90
+ the Library is used in it and that the Library and its use are
91
+ covered by this License.
92
+
93
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
94
+ document.
95
+
96
+ c) For a Combined Work that displays copyright notices during
97
+ execution, include the copyright notice for the Library among
98
+ these notices, as well as a reference directing the user to the
99
+ copies of the GNU GPL and this license document.
100
+
101
+ d) Do one of the following:
102
+
103
+ 0) Convey the Minimal Corresponding Source under the terms of this
104
+ License, and the Corresponding Application Code in a form
105
+ suitable for, and under terms that permit, the user to
106
+ recombine or relink the Application with a modified version of
107
+ the Linked Version to produce a modified Combined Work, in the
108
+ manner specified by section 6 of the GNU GPL for conveying
109
+ Corresponding Source.
110
+
111
+ 1) Use a suitable shared library mechanism for linking with the
112
+ Library. A suitable mechanism is one that (a) uses at run time
113
+ a copy of the Library already present on the user's computer
114
+ system, and (b) will operate properly with a modified version
115
+ of the Library that is interface-compatible with the Linked
116
+ Version.
117
+
118
+ e) Provide Installation Information, but only if you would otherwise
119
+ be required to provide such information under section 6 of the
120
+ GNU GPL, and only to the extent that such information is
121
+ necessary to install and execute a modified version of the
122
+ Combined Work produced by recombining or relinking the
123
+ Application with a modified version of the Linked Version. (If
124
+ you use option 4d0, the Installation Information must accompany
125
+ the Minimal Corresponding Source and Corresponding Application
126
+ Code. If you use option 4d1, you must provide the Installation
127
+ Information in the manner specified by section 6 of the GNU GPL
128
+ for conveying Corresponding Source.)
129
+
130
+ 5. Combined Libraries.
131
+
132
+ You may place library facilities that are a work based on the
133
+ Library side by side in a single library together with other library
134
+ facilities that are not Applications and are not covered by this
135
+ License, and convey such a combined library under terms of your
136
+ choice, if you do both of the following:
137
+
138
+ a) Accompany the combined library with a copy of the same work based
139
+ on the Library, uncombined with any other library facilities,
140
+ conveyed under the terms of this License.
141
+
142
+ b) Give prominent notice with the combined library that part of it
143
+ is a work based on the Library, and explaining where to find the
144
+ accompanying uncombined form of the same work.
145
+
146
+ 6. Revised Versions of the GNU Lesser General Public License.
147
+
148
+ The Free Software Foundation may publish revised and/or new versions
149
+ of the GNU Lesser General Public License from time to time. Such new
150
+ versions will be similar in spirit to the present version, but may
151
+ differ in detail to address new problems or concerns.
152
+
153
+ Each version is given a distinguishing version number. If the
154
+ Library as you received it specifies that a certain numbered version
155
+ of the GNU Lesser General Public License "or any later version"
156
+ applies to it, you have the option of following the terms and
157
+ conditions either of that published version or of any later version
158
+ published by the Free Software Foundation. If the Library as you
159
+ received it does not specify a version number of the GNU Lesser
160
+ General Public License, you may choose any version of the GNU Lesser
161
+ General Public License ever published by the Free Software Foundation.
162
+
163
+ If the Library as you received it specifies that a proxy can decide
164
+ whether future versions of the GNU Lesser General Public License shall
165
+ apply, that proxy's public statement of acceptance of any version is
166
+ permanent authorization for you to choose that version for the
167
+ Library.
data/README ADDED
@@ -0,0 +1,8 @@
1
+ == sixarma-bt
2
+ 6thSense.eu ArmA BuildTools (Automation Suite), by Sickboy (sb_at_6thSense.eu)
3
+ Documentation:
4
+ - You need at least 1 configuration and 1 previous version yaml file
5
+ - If the most recent version is tagged as released: false,
6
+ the next time you run the program it will assume that this will be the version to work with.
7
+ If released: true, then it will assume you intend to create the next version.
8
+ - run bt-cli -? for help
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ #
2
+ # To change this template, choose Tools | Templates
3
+ # and open the template in the editor.
4
+
5
+
6
+ require 'rubygems'
7
+ require 'rake'
8
+ require 'rake/clean'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/rdoctask'
11
+ require 'rake/testtask'
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.name = 'sixarma-bt'
15
+ s.rubyforge_project = s.name
16
+ s.version = '0.7.1'
17
+ s.has_rdoc = true
18
+ s.extra_rdoc_files = ['README', 'LICENSE']
19
+ s.summary = 'BuildTools for full conversion Mods for Armed Assault'
20
+ s.description = 'The program uses a few of my other libraries and tools available for the Armed Assault Game, and subversion, to automate the building process of Full Conversion Mods, while keeping flexibility and configurability in mind'
21
+ s.author = 'Sickboy'
22
+ s.email = 'sb@6thsense.eu'
23
+ s.homepage = 'http://6thsense.eu'
24
+ # s.executables = ['your_executable_here']
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"
28
+ s.add_dependency('sixarma', '>= 0.4.0')
29
+ s.add_dependency('sixcore', '>= 0.3.0')
30
+ end
31
+
32
+ Rake::GemPackageTask.new(spec) do |p|
33
+ p.gem_spec = spec
34
+ p.need_tar = true
35
+ p.need_zip = true
36
+ end
37
+
38
+ Rake::RDocTask.new do |rdoc|
39
+ files =['README', 'LICENSE', 'lib/**/*.rb']
40
+ rdoc.rdoc_files.add(files)
41
+ rdoc.main = "README" # page to start on
42
+ rdoc.title = "sixarma-bt Docs"
43
+ rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
44
+ rdoc.options << '--line-numbers'
45
+ end
46
+
47
+ Rake::TestTask.new do |t|
48
+ t.test_files = FileList['test/**/*.rb']
49
+ end
@@ -0,0 +1,135 @@
1
+ module SixArma
2
+ module Bt
3
+ class Builder
4
+ private
5
+ # Cleans folders
6
+ # mod:: mod config object
7
+ # folder:: folder config object
8
+ def clear_folders(mod, folder)
9
+ case folder.type
10
+ when "addons"
11
+ # Remove deleted files
12
+ SixCore::info "Removing Deleted Files from Full..."
13
+ delete = File.open("#{mod.changes}/#{@config.workdel}_#{folder.name}.txt") { |file| file.readlines.map { |line| SixCore::clean(line) } }
14
+ delete.each do |item|
15
+ SixCore::filedel("#{@config.outroot}\\files\\full\\#{mod.destination}\\#{folder.name}\\#{item}.*")
16
+ end
17
+
18
+ SixCore::info "Cleaning Update folder..."
19
+ SixCore::filedel("#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}\\*.pbo")
20
+ SixCore::filedel("#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}\\*.bisign")
21
+ end
22
+ end
23
+
24
+ # Copy from addon folders
25
+ # e.g: 3rd Party pbos
26
+ # mod:: mod config object
27
+ # folder:: folder config object
28
+ def copy_stuff(mod, folder)
29
+ case folder.type
30
+ when "addons"
31
+ SixCore::info "Copying 3rd_Party_Pbos..."
32
+ thirdparty_pbo = File.open("#{mod.changes}/#{@config.work3rd_pbo}_#{folder.name}.txt") { |file| file.readlines.map { |line| SixCore::clean(line) } }
33
+ source = "#{mod.path}\\#{mod.source}\\#{folder.name}"
34
+ dest = "#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}"
35
+ thirdparty_pbo.each do |item| SixCore::filecopy("#{source}\\#{item}", dest) end
36
+ end
37
+ end
38
+
39
+ # Verify if altsource exists, if not, use real source
40
+ def check_source(mod, folder, item)
41
+ source = "#{mod.path}\\#{mod.source}\\#{folder.name}\\#{item}"
42
+ unless mod.altsource.nil?
43
+ tmp = "#{mod.path}\\#{mod.altsource}\\#{folder.name}\\#{item}"
44
+ source = tmp if FileTest.directory?(tmp)
45
+ end
46
+ return source
47
+ end
48
+
49
+ # Build, Binarize, and pack PBOs
50
+ # mod:: Mod Config Object
51
+ # folder:: Folder Config Object
52
+ def pbotools_build(mod, folder)
53
+ # read files into arrays, strip newline chars
54
+ exclude = []
55
+ tmp = "#{mod.changes}/_exclude_#{folder.name}.txt"
56
+ if FileTest.exist?(tmp)
57
+ exclude = File.open(tmp) { |file| file.readlines.map { |line| SixCore::clean(line) } }
58
+ end
59
+
60
+ delete = File.open("#{mod.changes}/#{@config.workdel}_#{folder.name}.txt") { |file| file.readlines.map { |line| SixCore::clean(line) } }
61
+
62
+ tmp = File.open("#{mod.changes}/#{@config.workbin}_#{folder.name}.txt") { |file| file.readlines.map { |line| SixCore::clean(line) } }
63
+ binfiles = []
64
+ tmp.each do |e|
65
+ binfiles << e unless delete.include?(e) || exclude.include?(e)
66
+ end
67
+
68
+ tmp = File.open("#{mod.changes}/#{@config.workpbo}_#{folder.name}.txt") { |file| file.readlines.map { |line| SixCore::clean(line) } }
69
+ pbofiles = []
70
+ tmp.each do |e|
71
+ pbofiles << e unless delete.include?(e) || exclude.include?(e)
72
+ end
73
+ combined = []
74
+ combined += pbofiles
75
+ combined += binfiles
76
+
77
+ dest = "#{@config.outroot}\\files\\update\\#{mod.destination}\\#{folder.name}"
78
+
79
+ # Create folders and mirror SOURCE files
80
+ SixCore::info "Creating folders and mirroring source files..."
81
+ combined.each do |item|
82
+ source = check_source(mod, folder, item)
83
+ SixCore::filemirror(source, "#{@config.workdir}\\#{item}", "/XD .svn")
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")
88
+ end
89
+ end
90
+
91
+ # Build the addons
92
+ SixCore::info "Binarizing..."
93
+ binfiles.each do |item|
94
+ SixArma::PboTools.binarize("#{@config.workdir}\\#{item}", dest, "__AUTO__")
95
+ end
96
+
97
+ SixCore::info "PBOing..."
98
+ pbofiles.each do |item|
99
+ SixArma::PboTools.pack("#{@config.workdir}\\#{item}", dest, "__AUTO__")
100
+ end
101
+
102
+ # CleanUp
103
+ SixCore::info "Cleaning up..."
104
+ SixCore::filemove("#{dest}\\*.log", "#{@config.outroot}\\log\\")
105
+ # combined.each do |item|
106
+ # SixCore::filemove("#{dest}\\#{item}.log", "#{@config.outroot}\\log\\")
107
+ # end
108
+ end
109
+
110
+ public
111
+ # Clears all mods and their subfolders
112
+ def clear()
113
+ @config.mods.each do |mod|
114
+ mod.subfolders.each do |folder|
115
+ SixCore::infos("Clear Addon Folders - #{mod.destination}\\#{folder.name}", COMPONENT)
116
+ clear_folders(mod, folder)
117
+ end
118
+ end
119
+ SixCore::halt() if @halt
120
+ end
121
+
122
+ # Meta method that launches pbotools_build and copy_stuff on each mod and subfolder
123
+ def addon_changes()
124
+ @config.mods.each do |mod|
125
+ mod.subfolders.each do |folder|
126
+ SixCore::infos("BuildChanges - #{mod.destination}\\#{folder.name}", COMPONENT)
127
+ pbotools_build(mod, folder) if folder.type == "addons"
128
+ copy_stuff(mod, folder)
129
+ end
130
+ end
131
+ SixCore::halt() if @halt
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,56 @@
1
+ module SixArma
2
+ module Bt
3
+ class Builder
4
+ # Build an NSIS setup file
5
+ # type:: update or full
6
+ def nsis_build(type)
7
+ SixCore::infos("Nsis Build - #{type}", COMPONENT)
8
+ cfg = @config.nsis
9
+
10
+ newdelete = "";
11
+ @config.mods.each do |mod|
12
+ mod.subfolders.each do |folder|
13
+ del = File.open("#{mod.changes}/#{@config.workdel}_#{folder.name}.txt") do |file|
14
+ file.readlines.map { |line| SixCore::clean(line) }
15
+ end
16
+ del.each { |item| newdelete += "\n Delete \"#{mod.nsis.out}\\#{folder.name}\\#{item}.*\"" }
17
+ end
18
+ end
19
+
20
+ replace = [
21
+ [cfg.reg_newver, SixCore::quote(@stats.newver)],
22
+ [cfg.reg_oldver, SixCore::quote(@stats.oldver)],
23
+ [cfg.reg_verpath, @config.verpath],
24
+ [cfg.reg_out, cfg.out],
25
+ [cfg.reg_delete, newdelete],
26
+ [cfg.reg_type, type]
27
+ ]
28
+
29
+ out = "#{cfg.out}_v#{@stats.newver}#{type}.exe"
30
+ nsis = SixCore::Nsis.new("#{@config.outroot}\\#{cfg.template}", "#{@config.outroot}\\#{cfg.output}")
31
+ SixCore::info "Creating Setup File: #{out}..."
32
+ nsis.create_output(replace)
33
+ size = (File.size("#{@config.outroot}\\#{out}") / 1024) / 1024
34
+ SixCore::info "Finished Creating Setup File: #{out} (#{size}MB)..."
35
+
36
+ return out
37
+ end
38
+
39
+ # Build NSIS Update
40
+ # nsis_build("update")
41
+ def nsis_update()
42
+ @stats.updatefile = nsis_build("update")
43
+ write_stats()
44
+ SixCore::halt() if @halt
45
+ end
46
+
47
+ # Build NSIS Full
48
+ # nsis_build("full")
49
+ def nsis_full()
50
+ @stats.fullfile = nsis_build("full")
51
+ write_stats()
52
+ SixCore::halt() if @halt
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,133 @@
1
+ require 'optparse'
2
+ require 'ostruct'
3
+ require 'sixcore'
4
+
5
+
6
+ # Configuration File
7
+ @options = OpenStruct.new
8
+ @options.configfile = ''
9
+ @options.halt = false
10
+ @options.todo = []
11
+
12
+ option_parser = OptionParser.new do |opts|
13
+ opts.banner = "Usage: #{File.basename($0)} CONFIGFILE [options]"
14
+
15
+ opts.separator ''
16
+ opts.separator 'Processing the imported CONFIGFILE file:'
17
+
18
+ opts.on('-h', '--halt', 'Halt at every step') do |o|
19
+ @options.halt = o
20
+ end
21
+
22
+ opts.separator ''
23
+ opts.separator 'Programs'
24
+
25
+ opts.on('-c', '--complete', 'Run Complete Process',
26
+ 'create_all, dist_all',
27
+ '(Will however use threads after finishing Update creation)') do |o|
28
+ @options.todo << 'complete'
29
+ end
30
+
31
+ opts.on('-r', '--release', 'Run Release Process',
32
+ 'Sets release flag in version stats to true,',
33
+ 'and checks for _tmp files on ftp and renames them') do |o|
34
+ @options.todo << 'release'
35
+ end
36
+
37
+ opts.on('--create_update', 'Run Create Update Process',
38
+ 'build_full, update_sign("full", "update"), nsis_update') do |o|
39
+ @options.todo << 'create_update'
40
+ end
41
+
42
+ opts.on('--create_full', 'Run Create Full Process',
43
+ 'build_full, nsis_full') do |o|
44
+ @options.todo << 'create_full'
45
+ end
46
+
47
+ opts.on('--create_all', 'Run Create All Process',
48
+ 'create_update, nsis_full') do |o|
49
+ @options.todo << 'create_all'
50
+ end
51
+
52
+ opts.separator ''
53
+ opts.separator 'Individual Processes'
54
+
55
+ opts.on('--clear', 'Run Clear Process',
56
+ 'Removes deleted files from Full and Clears out all Addons folders in update') do |o|
57
+ @options.todo << 'clear'
58
+ end
59
+
60
+ opts.on('--svn_do', 'Run Svn Do Process',
61
+ 'Grabs SVN changes information') do |o|
62
+ @options.todo << 'svn_do'
63
+ end
64
+
65
+ opts.on('--addon_changes', 'Run Addon Changes Process',
66
+ 'Builds addon folders into update folder') do |o|
67
+ @options.todo << 'addon_changes'
68
+ end
69
+
70
+ opts.separator ''
71
+ opts.separator 'Mini Programs'
72
+
73
+ opts.on('--build_update', 'Run Build Update Process',
74
+ 'svn_do, clear, addon_changes, sign_update') do |o|
75
+ @options.todo << 'build_update'
76
+ end
77
+
78
+ opts.on('--build_full', 'Run Build Full Process',
79
+ 'svn_do, clear, addon_changes, clear_sign, sign_full') do |o|
80
+ @options.todo << 'build_full'
81
+ end
82
+
83
+ opts.on('--sign_update', 'Run Sign Update Process',
84
+ 'Sign all addons under update') do |o|
85
+ @options.todo << 'sign_update'
86
+ end
87
+
88
+ opts.on('--sign_full', 'Run Sign Full Process',
89
+ 'Sign all addons under full') do |o|
90
+ @options.todo << 'sign_full'
91
+ end
92
+
93
+ opts.on('--nsis_update', 'Run NSIS Update Process',
94
+ 'Builds an NSIS Update file') do |o|
95
+ @options.todo << 'nsis_update'
96
+ end
97
+
98
+ opts.on('--nsis_full', 'Run NSIS Full Process',
99
+ 'Builds an NSIS Full file') do |o|
100
+ @options.todo << 'nsis_full'
101
+ end
102
+
103
+ opts.on('--dist_update', 'Run Dist Update Process',
104
+ 'upload update to ftp(s), update_sign("full", "update"), nsis_update') do |o|
105
+ @options.todo << 'dist_update'
106
+ end
107
+
108
+ opts.on('--dist_full', 'Run Dist Full Process',
109
+ 'upload full to ftp(s)') do |o|
110
+ @options.todo << 'dist_full'
111
+ end
112
+
113
+ opts.on('--dist_all', 'Run Dist All Process',
114
+ 'dist_update, dist_full') do |o|
115
+ @options.todo << 'dist_all'
116
+ end
117
+
118
+ opts.separator ''
119
+ opts.separator 'Common options:'
120
+
121
+ opts.on_tail('-?', '--help', 'Display this message') do |o|
122
+ puts opts.help
123
+ end
124
+ end
125
+
126
+ option_parser.parse!
127
+
128
+ if ARGV.empty?
129
+ @options.configfile = 'docs/example.yaml'
130
+ SixCore::info 'Please use parameter -? for help'
131
+ else
132
+ @options.configfile = ARGV[0]
133
+ end
@@ -0,0 +1,97 @@
1
+ module SixArma
2
+ module Bt
3
+ class Builder
4
+ private
5
+ # Creats signature files
6
+ # type:: update or full
7
+ def sign_create(type)
8
+ cfg = @config.sign
9
+
10
+ # create the key
11
+ name = "#{cfg.file}_v#{@stats.newver}"
12
+ r = SixArma::Sign.create(name)
13
+ SixCore::filecopy("#{r[2]}\\#{r[1]}", "#{@config.outroot}\\files\\#{type}\\keys\\")
14
+ return r
15
+ end
16
+
17
+ # Alternative signature creator (per folder)
18
+ # type:: update or full
19
+ # folder:: mod folder name
20
+ def sign_create2(type, folder)
21
+ cfg = @config.sign
22
+
23
+ # create the key
24
+ name = "#{cfg.file}_#{folder}_v#{@stats.newver}"
25
+ r = SixArma::Sign.create(name)
26
+ SixCore::filecopy("#{r[2]}\\#{r[1]}", "#{@config.outroot}\\files\\#{type}\\keys\\")
27
+ return r
28
+ end
29
+
30
+ # Signs addons
31
+ # type:: update or full
32
+ def sign_do(type)
33
+ SixCore::infos("Sign Do - #{type}", COMPONENT)
34
+
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
39
+
40
+ # process each destination's subfolders
41
+ @config.mods.each do |mod|
42
+ mod.subfolders.each do |folder|
43
+ if folder.type == "addons"
44
+ SixCore::info "Clearing signatures - #{type}\\#{mod.destination}\\#{folder.name}..."
45
+ SixCore::filedel("#{@config.outroot}\\files\\#{type}\\#{mod.destination}\\#{folder.name}\\*.bisign")
46
+ SixCore::info "Signing - #{mod.destination}\\#{folder.name}..."
47
+ SixArma::Sign.sign("#{@config.outroot}\\files\\#{type}\\#{mod.destination}\\#{folder.name}", signfiles[0])
48
+ end
49
+ end
50
+ end
51
+
52
+ when "folder"
53
+ @config.mods.each_with_index do |mod, idx|
54
+ changes = []
55
+ @stats.mods[idx].subfolders.each do |folder|
56
+ changes += (folder.add + folder.del + folder.change) # if folder.type == "addons"
57
+ end
58
+ unless changes.empty?
59
+ #sf = mod.destination.gsub("@", "")
60
+ #sf = mod.destination if sf.nil? or sf.empty?
61
+ # TODO: Lame update+full processing
62
+ SixCore::filedel("#{@config.outroot}\\files\\update\\Keys\\#{@config.sign.file}_#{mod.destination}*.bikey")
63
+ SixCore::filedel("#{@config.outroot}\\files\\full\\Keys\\#{@config.sign.file}_#{mod.destination}*.bikey")
64
+
65
+ signfiles = sign_create2("full", mod.destination)
66
+ signfiles = sign_create2("update", mod.destination)
67
+
68
+ mod.subfolders.each do |folder|
69
+ if folder.type == "addons"
70
+ SixCore::info "Clearing signatures - #{type}\\#{mod.destination}\\#{folder.name}..."
71
+ SixCore::filedel("#{@config.outroot}\\files\\#{type}\\#{mod.destination}\\#{folder.name}\\*.bisign")
72
+ SixCore::info "Signing - #{mod.destination}\\#{folder.name}..."
73
+ SixArma::Sign.sign("#{@config.outroot}\\files\\#{type}\\#{mod.destination}\\#{folder.name}", signfiles[0])
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ public
82
+ # Sign Update
83
+ # sign_do("update")
84
+ def sign_update()
85
+ sign_do("update")
86
+ SixCore::halt() if @halt
87
+ end
88
+
89
+ # Sign Full
90
+ # sign_do("full")
91
+ def sign_full()
92
+ sign_do("full")
93
+ SixCore::halt() if @halt
94
+ end
95
+ end
96
+ end
97
+ end