six-arma-builder 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ == six-arma-builder
2
+
3
+ Put appropriate LICENSE for your project here.
data/README ADDED
@@ -0,0 +1,3 @@
1
+ == six-arma-builder
2
+
3
+ You should document your project here.
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 = 'six-arma-builder'
15
+ s.version = '0.0.1'
16
+ s.has_rdoc = true
17
+ s.extra_rdoc_files = ['README', 'LICENSE']
18
+ s.summary = 'Your summary here'
19
+ s.description = s.summary
20
+ s.author = 'Sickboy'
21
+ s.email = 'sb@dev-heaven.net'
22
+ # s.executables = ['your_executable_here']
23
+ s.add_dependency('log4r', '= 1.1.2')
24
+ s.add_dependency('git', '>= 0.0.1')
25
+ s.add_dependency('six-arma-tools', '>= 0.0.1')
26
+ s.add_dependency('six-rsync', '>= 0.0.1')
27
+ s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/*/**/*.rb")
28
+ s.require_path = "lib"
29
+ s.bindir = "bin"
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 = "six-arma-builder 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,94 @@
1
+ # encoding: UTF-8
2
+
3
+ =begin
4
+ TODO: Allow Changelog to be linked with Changed folder/file, for various purposes
5
+ TODO: Allow specifying addons which always must be considered changed, even though that change is caused by external include
6
+ TODO: Support blabla
7
+ TODO: Change path objects to something smarter, with path and folder split etc
8
+ =end
9
+
10
+ require 'yaml'
11
+ gem 'log4r'
12
+ require 'log4r'
13
+ gem 'git'
14
+ require 'git'
15
+
16
+ require 'six/arma/builder/mod'
17
+
18
+ module Six
19
+ module Arma
20
+ module Builder
21
+ VERSION = '0.1.1'
22
+ COMPONENT = 'six-arma-builder'
23
+ BASE_PATH = Dir.pwd
24
+
25
+ # Create loggers
26
+ @@log = Log4r::Logger.new(COMPONENT)
27
+ format1 = Log4r::PatternFormatter.new(:pattern => "[%l] %d: %m", :date_pattern => '%H:%M:%S')
28
+ format2 = Log4r::PatternFormatter.new(:pattern => "[%l] %c %d: %m", :date_pattern => '%H:%M:%S')
29
+
30
+ if not defined?(Ocra)
31
+ # Create Outputters
32
+ o_file = Log4r::FileOutputter.new "#{COMPONENT}-file",
33
+ 'level' => 0, # All
34
+ :filename => "#{COMPONENT}.log",
35
+ 'formatter' => format2
36
+ #:maxsize => 1024
37
+
38
+ @@log.outputters << o_file
39
+
40
+ o_out = Log4r::StdoutOutputter.new "#{COMPONENT}-stdout",
41
+ 'level' => 2, # no DEBUG
42
+ 'formatter' => format1
43
+
44
+ o_err = Log4r::StderrOutputter.new "#{COMPONENT}-stderr",
45
+ 'level' => 4, # Error and Up
46
+ 'formatter' => format1
47
+
48
+ @@log.outputters << o_out << o_err
49
+ end
50
+
51
+ module_function
52
+ def initialize
53
+ log.info "ArmA Git Builder (v#{VERSION}) by Sickboy <sb_at_dev-heaven.net>"
54
+ log.info 'Run with --help for help'
55
+
56
+ @config = Hash.new unless @config
57
+ config = Hash.new
58
+
59
+ @config_file = "#{COMPONENT}.yml"
60
+ if ARGV[0]
61
+ # FIXME: This is not a very good catch..
62
+ if ARGV[0][/.*\..*/]
63
+ if FileTest.exist?(ARGV[0])
64
+ @config_file = ARGV[0]
65
+ else
66
+ log.warn "#{ARGV[0]} not found, trying #{@config_file}"
67
+ end
68
+ end
69
+ end
70
+
71
+ unless FileTest.exist?(@config_file)
72
+ log.error "ERROR: #{@config_file} config missing!"
73
+ wait
74
+ Process.exit
75
+ end
76
+
77
+ File.open(@config_file) { |file| config.merge!(YAML::load(file)) }
78
+ config.merge! @config
79
+ @config = config
80
+ FileUtils.rm_f(File.join(BASE_PATH, 'changelog.txt')) if File.exists?(File.join(BASE_PATH, 'changelog.txt'))
81
+ end
82
+
83
+ def log
84
+ @@log
85
+ end
86
+
87
+ def save
88
+ puts
89
+ log.info "Saving stats..."
90
+ File.open(File.join(BASE_PATH, @config_file), 'w') { |file| YAML.dump( @config, file ) }
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,391 @@
1
+ # encoding: UTF-8
2
+
3
+ # TODO: change to six-arma-tools
4
+ gem 'six-arma-tools'
5
+ require 'six/arma/tools/pbodll'
6
+
7
+ require 'six/rsync'
8
+ include Six::Repositories
9
+
10
+ module Six
11
+ module Arma
12
+ module Builder
13
+ ADDED, FIXED, REMOVED, CHANGED, UPDATED = /\A~ ?adde?d?[:|;]? ?/i, /\A~ ?fixe?d?[:|;]? ?/i, /\A~ ?removed?[:|;]? ?/i, /\A~ ?changed?[:|;]? ?/i, /\A~ ?updated?[:|;]? ?/i
14
+
15
+ class Mod
16
+ LOG_LIMIT = 9999
17
+
18
+ def initialize(config)
19
+ @config = config
20
+ @source = Git.open(@config[:source])
21
+ @build = 0
22
+
23
+ # FIXME: Somehow @source.status.untracked seems to behave weird
24
+ if @source.status.changed.class == Array
25
+ data = @source.status.changed + @source.status.added + @source.status.deleted
26
+ else
27
+ data = @source.status.changed.merge @source.status.added.merge @source.status.deleted
28
+ end
29
+ if data.size > 0
30
+ log.warn "WARNING: #{@config[:source]} Working folder dirty!"
31
+ end
32
+
33
+ @config[:revision][:previous] = @config[:revision][:current].clone
34
+ @config[:revision][:current] = @source.log.first.to_s
35
+
36
+ # TODO: Destination can be non git too!
37
+ @destination = Rsync.open(@config[:destination], :log => log)
38
+ @destination_changed = false
39
+ @stats = []
40
+ @config[:paths].each do |path|
41
+ stat = Hash.new
42
+ stat[:deleted], stat[:changed], stat[:changelog] = [], [], []
43
+ stat[:cl] = Hash.new
44
+ stat[:cl][:changed], stat[:cl][:fixed], stat[:cl][:added], stat[:cl][:updated], stat[:cl][:removed] = [], [], [], [], []
45
+ @stats << stat
46
+ end
47
+ rep_cfg = File.open(File.join(@config[:destination], '.rsync', '.repository.yml')) {|file| YAML::load(file)}
48
+ @build = rep_cfg[:version] + 1
49
+ end
50
+
51
+ def log
52
+ Six::Arma::Builder.log
53
+ end
54
+
55
+ def process_change(change, path, stat)#, base)
56
+ if change.path[/\A#{path[:folder]}/]
57
+ case path[:type]
58
+ when :addons
59
+ new = Hash.new
60
+ new[:type] = change.type
61
+ change.path[/\A(#{path[:folder]})\/(\w*)\/?(.*)/]
62
+ new[:base], new[:folder], new[:file] = $1, $2, $3
63
+ path = "#{new[:base]}/#{new[:folder]}"
64
+
65
+ unless stat[:changed].include?(path)
66
+ #log.info "#{change.typ} #{change.path}"
67
+ case new[:type]
68
+ when 'deleted'
69
+ if FileTest.exist?(File.join(@config[:source], new[:base], new[:folder]))
70
+ new[:type] = 'modified'
71
+ end
72
+ #when 'modified'
73
+ when 'new'
74
+ # if already existed, it was not added but modified, dont matter actually
75
+ new[:type] = 'modified'
76
+ end
77
+
78
+ case new[:type]
79
+ when 'deleted'
80
+ stat[:deleted] << path unless stat[:deleted].include?(path)
81
+ when 'modified'
82
+ stat[:changed] << path
83
+ end
84
+ end
85
+ else
86
+ # TODO: Normal folder; Process each added / modified / deleted file on a per file basis, with no extra processing
87
+ end
88
+ end
89
+ end
90
+
91
+ def process_diffs
92
+ puts
93
+ log.info "Processing Repository: #{@config[:source]}, Branch: #{@source.current_branch}, Current Rev: #{@config[:revision][:current]} Previous Rev: #{@config[:revision][:previous]}"
94
+
95
+ # Prepare stats
96
+ @stats.each do |stat|
97
+ stat[:deleted], stat[:changed] = [], []
98
+ end
99
+
100
+ # Prepare file diffs
101
+ @source.diff(@config[:revision][:previous],@config[:revision][:current]).each do |diff|
102
+ @config[:paths].each_with_index do |path,index|
103
+ process_change(diff, path, @stats[index])#, 'Addons')
104
+ end
105
+ end
106
+
107
+ # Process file and comment history
108
+ history = @source.log(LOG_LIMIT)
109
+ @config[:paths].each_with_index do |path,index|
110
+ # Process Stats
111
+ stat = @stats[index]
112
+ stat[:changed].sort!
113
+ stat[:deleted].sort!
114
+ stat[:changelog] = []
115
+ stat[:cl][:changed], stat[:cl][:fixed], stat[:cl][:added], stat[:cl][:updated], stat[:cl][:removed] = [], [], [], [], []
116
+
117
+ log.info "Changed (#{stat[:changed].size}): #{stat[:changed].join(', ')}"
118
+ log.info "Deleted (#{stat[:deleted].size}): #{stat[:deleted].join(', ')}"
119
+
120
+ # Process Comment Changelog
121
+ history.path(path[:folder])
122
+ history.between(@config[:revision][:previous], @config[:revision][:current]).each do |c|
123
+ c.message.split("\n").each do |msg|
124
+ msg = "#{msg} [#{c.author.name}]"
125
+
126
+ if msg[/\A~/] && !msg[/\A.?.?local/i]
127
+ stat[:changelog] << msg
128
+ case msg
129
+ when ADDED
130
+ stat[:cl][:added] << clean_msg(msg, ADDED)
131
+ when FIXED
132
+ stat[:cl][:fixed] << clean_msg(msg, FIXED)
133
+ when REMOVED
134
+ stat[:cl][:removed] << clean_msg(msg, REMOVED)
135
+ when CHANGED
136
+ stat[:cl][:changed] << clean_msg(msg, CHANGED)
137
+ when UPDATED
138
+ stat[:cl][:updated] << clean_msg(msg, UPDATED)
139
+ else
140
+ stat[:cl][:changed] << clean_msg(msg)
141
+ end
142
+ end
143
+ end
144
+ end
145
+
146
+ stat[:changelog].sort!
147
+ stat[:cl][:changed].sort!
148
+ stat[:cl][:fixed].sort!
149
+ stat[:cl][:added].sort!
150
+ stat[:cl][:updated].sort!
151
+ stat[:cl][:removed].sort!
152
+
153
+ # TODO: Filter and use changelog in git commit on destination or changelog.txt?
154
+ log.info "Changelog:"
155
+ stat[:changelog].each { |msg| log.info msg }
156
+ end
157
+ end
158
+
159
+ def clean_msg(msg, reg = nil)
160
+ msg = if reg
161
+ msg.gsub(reg, '')
162
+ else
163
+ msg.clone
164
+ end
165
+
166
+ msg.gsub!(/\A[\t| ]*~[\t| ]*/, '')
167
+ msg.strip!
168
+ msg[/\A(.)/]
169
+ msg.gsub!(/\A(.)/, $1.upcase)
170
+ "* #{msg}"
171
+ end
172
+
173
+ def process_files
174
+ puts
175
+ log.info "Processing Files ..."
176
+ @config[:paths].each_with_index do |path,index|
177
+ puts
178
+ log.info "Path: #{path[:folder]}"
179
+ stat = @stats[index]
180
+ case path[:type]
181
+ when :addons
182
+ stat[:packed] = []
183
+ prep_folder(path, stat)
184
+ build_changed_addons(path, stat)
185
+ #sign_changed_addons(path, stat)
186
+ # TODO: Make choice
187
+ sign_all_addons(path, stat, true)
188
+ end
189
+ end
190
+ end
191
+
192
+ def prep_folder(path, stat)
193
+ #p stat[:changed]
194
+ return unless (stat[:changed] + stat[:deleted]).size > 0
195
+ if File.exist?(File.join(@config[:source], path[:folder], "main"))
196
+ #puts "found version addon"
197
+ file = File.join(@config[:source], path[:folder], "main", "script_mod.hpp")
198
+ if File.exist?(file)
199
+ #puts "Found script_mod"
200
+ content = nil
201
+ File.open(file) do |f|
202
+ content = f.read
203
+ content.gsub!(/#define BUILD .*/, "#define BUILD #{@build}")
204
+ end
205
+ #puts content
206
+ #gets
207
+ File.open(file, 'w') {|f| f.puts content}
208
+ main = "Addons/main"
209
+ unless stat[:changed].include?(main)
210
+ stat[:changed] += [main]
211
+ end
212
+
213
+ if File.exist?(File.join(@config[:source], path[:folder], "version"))
214
+ version = "Addons/version"
215
+ unless stat[:changed].include?(version)
216
+ stat[:changed] += [version]
217
+ end
218
+ end
219
+ end
220
+ end
221
+ #puts "passed"
222
+ #gets
223
+ end
224
+
225
+ def build_changed_addons(path, stat)
226
+ stat[:deleted].each do |change|
227
+ log.info "Deleting #{change}"
228
+ change[/(.*)\/(.*)/]
229
+ folder, file = $1, $2
230
+ Dir[File.join(@config[:destination], path[:folder], "*#{file}*")].each do |file|
231
+ FileUtils.rm_f file
232
+ end
233
+ end
234
+ stat[:changed].each do |change|
235
+ log.info "Building #{change}"
236
+ file = File.join(@config[:source],change)
237
+ fol_path = File.join(@config[:destination], path[:folder])
238
+ obj = Six::Arma::Tools::Pbo.new(file, fol_path)
239
+ overriden = false
240
+ =begin
241
+ # TODO: Should work with change objects that contain the right bits?
242
+ path[:overrides].each do |exclude|
243
+ if change[/#{exclude[:folder]}\Z/]
244
+ overriden = true
245
+ log.info "Building #{change} overriden: #{exclude[:action]}"
246
+ unless exclude[:action] == :ignore
247
+ @destination_changed = true
248
+ eval "obj.#{exclude[:action]}"
249
+ end
250
+ end
251
+ end
252
+ unless overriden
253
+ =end
254
+ if File.exists?(File.join(file, "$IGNORE$"))
255
+ else
256
+ pbo = if @config[:pack_only] || File.exists?(File.join(file, "$NOBIN$"))
257
+ obj.pack
258
+ else
259
+ obj.binarize
260
+ end
261
+ stat[:packed] << pbo
262
+ @destination_changed = true
263
+ end
264
+ end
265
+ end
266
+
267
+ # FIXME: !!
268
+ def sign_changed_addons(path, stat)
269
+ if @destination_changed
270
+ if @config[:key]
271
+ puts
272
+ log.info "Signing Changed..."
273
+ Dir.chdir File.join(@config[:destination], path[:folder])
274
+ stat[:changed].each do |change|
275
+ source = File.join(@config[:source], change)
276
+ prefix = File.join(source, "$PBOPREFIX$")
277
+ change[/.*\/(.*)/]
278
+ file = "#{$1}.pbo"
279
+
280
+ if FileTest.exist?(prefix)
281
+ File.open(prefix) do |f|
282
+ content = f.read
283
+ content[/\Ax\\(\w*)\\/]
284
+ file = "#{$1}_#{file}" if $1
285
+ end
286
+ end
287
+
288
+ log.info "Signing #{file}"
289
+ file = File.join(@config[:destination], path[:folder], file)
290
+ del = "#{file}.*.bisign"
291
+ FileUtils::rm_f del if FileTest.exist?(del)
292
+ obj = Six::Arma::Tools::Pbo.new(file, File.join(@config[:destination], path[:folder]))
293
+ obj.sign({:key => @config[:key]})
294
+ end
295
+ end
296
+ end
297
+ end
298
+
299
+ def sign_all_addons(path, stat, force = false)
300
+ if @destination_changed || force
301
+ if stat[:changed].size > 0
302
+ if @config[:key]
303
+ else
304
+ key = "#{@config[:name]}_b#{@build}"
305
+ d = "C:/projects/keys"
306
+ unless File.exists?(File.join(d, "#{key}.biprivatekey"))
307
+ Dir.chdir d
308
+ system "C:/tools/dsutils/dsCreateKey #{key}"
309
+ end
310
+ Dir[File.join(@config[:destination], "keys", '*.bikey')].each do |f|
311
+ FileUtils.rm_f(f)
312
+ end
313
+ FileUtils.cp(File.join(d, "#{key}.bikey"), File.join(@config[:destination], "keys", "#{key}.bikey"))
314
+ end
315
+ puts
316
+ log.info "Signing All..."
317
+ destination = File.join(@config[:destination], path[:folder])
318
+ Dir.chdir destination
319
+ Dir[File.join(destination, "*.bisign")].each do |f|
320
+ FileUtils::rm_f f
321
+ end
322
+ Dir['*.pbo'].each do |pbo|
323
+ log.info "Signing #{pbo}"
324
+ file = File.join(@config[:destination], path[:folder], pbo)
325
+ obj = Six::Arma::Tools::Pbo.new(file, File.join(@config[:destination], path[:folder]))
326
+ obj.sign({:key => File.join(d, "#{key}.biprivatekey")})
327
+ end
328
+ @destination_changed = true
329
+ end
330
+ end
331
+ end
332
+
333
+ def commit_destination
334
+ # Combine the changelogs and everything
335
+ # Commit and optional Push?
336
+ puts
337
+ #@destination_changed = true
338
+ if @destination_changed
339
+ msgs = ["h2. #{Time.now}\n\nBuild #{@build}\nUpdated to source:@#{@config[:revision][:current]}"]
340
+ @config[:paths].each_with_index do |path,index|
341
+ stat = @stats[index]
342
+ #msgs << "Path: #{path[:folder]}"
343
+ #msgs += stat[:changelog]
344
+ msgs << "\nh3. Changed\n\n" if stat[:cl][:changed].size > 0
345
+ msgs += stat[:cl][:changed]
346
+ msgs << "\nh3. Fixed\n\n" if stat[:cl][:fixed].size > 0
347
+ msgs += stat[:cl][:fixed]
348
+ msgs << "\nh3. Added\n\n" if stat[:cl][:added].size > 0
349
+ msgs += stat[:cl][:added]
350
+ msgs << "\nh3. Updated\n\n" if stat[:cl][:updated].size > 0
351
+ msgs += stat[:cl][:updated]
352
+ msgs << "\nh3. Removed\n\n" if stat[:cl][:removed].size > 0
353
+ msgs += stat[:cl][:removed]
354
+ msgs << "\n\n"
355
+ end
356
+
357
+ changelog = nil
358
+ cl = File.join(@config[:destination], 'changelog.txt')
359
+ File.open(cl) { |file| changelog = file.read } if FileTest.exists?(cl)
360
+
361
+ File.open(File.join(@config[:destination], 'changelog.txt'), 'w') do |file|
362
+ file.puts msgs
363
+ file.puts changelog if changelog
364
+ end
365
+
366
+ File.open(File.join(BASE_PATH, "changelog.txt"), 'a') do |file|
367
+ file.puts "h2. #{@config[:name].upcase}\n\n"
368
+ file.puts msgs
369
+ end
370
+
371
+ log.info "Committing, Repacking and Pushing..."
372
+
373
+ #path = File.join(BASE_PATH, 'test')
374
+ #File.open(path, 'w') { |file| file.puts msgs.join("\n") }
375
+ # TODO: Add specifically the changes!
376
+ @destination.add
377
+ @destination.commit#_all({:path => path})
378
+ #FileUtils.rm_f path
379
+
380
+ # TODO: First repack then push or reverse?
381
+ #@destination.gc_legacy
382
+ #@destination.repack
383
+ #@destination.push
384
+ else
385
+ log.info "Nothing to commit, not pushing..."
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end
391
+ end
@@ -0,0 +1,126 @@
1
+ # encoding: UTF-8
2
+
3
+ # Docu: http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html
4
+ require 'optparse'
5
+
6
+ module Six
7
+ module Arma
8
+ module Builder
9
+ module_function
10
+ def parse_options
11
+ # FIXME: DirectCopy from Updater ;)
12
+ todo, general_todo, second_todo = [], [], []
13
+
14
+ options = Hash.new
15
+ options[:verbose] = true
16
+ OptionParser.new do |opts|
17
+ $0[/.*\/(.*)/]
18
+ opts.banner = "Usage: #{$1} [config.yml] [options]"
19
+
20
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
21
+ options[:verbose] = v
22
+ end
23
+
24
+ opts.on("-i", "--install", "Installs the mods, unless already installed") do |bool|
25
+ todo << :install if bool
26
+ end
27
+
28
+ opts.on("-d", "--uninstall", "Uninstalls the mods, unless not installed") do |bool|
29
+ todo << :uninstall if bool
30
+ end
31
+
32
+ opts.on("-u", "--update", "Updates each mod to latest version") do |bool|
33
+ todo << :update if bool
34
+ end
35
+
36
+ opts.on("-r", "--reset", "Resets the modfolders to latest commit status. All modifications lost") do |bool|
37
+ todo << :reset if bool
38
+ end
39
+
40
+ opts.on("-z", "--userconfig", "Processes the userconfigs of each mod. Makes backups of previous files") do |bool|
41
+ todo << :userconfig if bool
42
+ end
43
+
44
+ opts.on("-l", "--changelog", "Display Changelog after update") do |bool|
45
+ second_todo << :changelog if bool
46
+ end
47
+
48
+ opts.on("-c", "--cleanup", "Cleans up the modfolders git repositories") do |bool|
49
+ second_todo << :cleanup if bool
50
+ end
51
+
52
+ opts.on("-s", "--createshortcut", "Creates shortcut to run the game with the mods, in installation folder") do |bool|
53
+ general_todo << :createshortcut if bool
54
+ end
55
+
56
+ opts.on("-k", "--createdesktopshortcut", "Creates shortcut to run the game with the mods, on the desktop") do |bool|
57
+ general_todo << :createdesktopshortcut if bool
58
+ end
59
+
60
+ opts.on("-g", "--startgame", "Starts the game with #{@config[:armaparams]} -mod=#{@mods}") do |bool|
61
+ general_todo << :startgame if bool
62
+ end
63
+
64
+ opts.on("-w", "--wait", "Waits at the end for user pressing ENTER") do |bool|
65
+ options[:wait] = bool
66
+ end
67
+
68
+ opts.on("-f", "--force", "Forces to run tasks even though no changes were detected") do |bool|
69
+ options[:force] = bool
70
+ end
71
+
72
+ opts.on("--mods S", String, "Additional Mods") do |s|
73
+ options[:mods] = s
74
+ end
75
+
76
+ opts.on("--armapath S", String, "Destination folder") do |s|
77
+ options[:armapath] = s
78
+ end
79
+
80
+ opts.on("--gitpath S", String, "Git binary") do |s|
81
+ options[:gitpath] = s
82
+ end
83
+ end.parse!
84
+
85
+ default = if (todo + second_todo + general_todo).size > 0
86
+ false
87
+ else
88
+ true
89
+ end
90
+
91
+ # TODO: Move this to Updater ?
92
+ @todo = if todo.size > 0
93
+ todo
94
+ else
95
+ log.info "No parameters given, running the default"
96
+ options[:wait] = true
97
+ if default
98
+ @config[:defaultactions]
99
+ else
100
+ []
101
+ end
102
+ end
103
+ @general_todo = if general_todo.size > 0
104
+ general_todo
105
+ else
106
+ if default
107
+ @config[:defaultgeneralactions]
108
+ else
109
+ []
110
+ end
111
+ end
112
+
113
+ @second_todo = if second_todo.size > 0
114
+ second_todo
115
+ else
116
+ if default
117
+ @config[:defaultsecondactions]
118
+ else
119
+ []
120
+ end
121
+ end
122
+ @config = @config.merge(options)
123
+ end
124
+ end
125
+ end
126
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: six-arma-builder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sickboy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-12 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: log4r
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.1.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: git
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: six-arma-tools
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.0.1
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: six-rsync
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.1
54
+ version:
55
+ description: Your summary here
56
+ email: sb@dev-heaven.net
57
+ executables: []
58
+
59
+ extensions: []
60
+
61
+ extra_rdoc_files:
62
+ - README
63
+ - LICENSE
64
+ files:
65
+ - LICENSE
66
+ - README
67
+ - Rakefile
68
+ - lib/six/arma/builder/mod.rb
69
+ - lib/six/arma/builder/options.rb
70
+ - lib/six/arma/builder.rb
71
+ has_rdoc: true
72
+ homepage:
73
+ licenses: []
74
+
75
+ post_install_message:
76
+ rdoc_options: []
77
+
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ version:
92
+ requirements: []
93
+
94
+ rubyforge_project:
95
+ rubygems_version: 1.3.5
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: Your summary here
99
+ test_files: []
100
+