sixarma 0.4.4 → 0.5.0

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'
15
15
  s.rubyforge_project = s.name
16
- s.version = '0.4.4'
16
+ s.version = '0.5.0'
17
17
  s.has_rdoc = true
18
18
  s.extra_rdoc_files = ['README', 'LICENSE']
19
19
  s.summary = 'Basic function library for the Armed Assault game by Bohemia Interactive Studios'
@@ -25,7 +25,7 @@ spec = Gem::Specification.new do |s|
25
25
  s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*.rb") + Dir.glob("{bin,lib,spec}/**/*.yaml")
26
26
  s.require_path = 'lib'
27
27
  s.bindir = 'bin'
28
- s.add_dependency('sixcore', '>= 0.3.0')
28
+ s.add_dependency('sixcore', '>= 0.4.0')
29
29
  end
30
30
 
31
31
  Rake::GemPackageTask.new(spec) do |p|
data/lib/sixarma.rb CHANGED
@@ -3,8 +3,25 @@ gem 'sixcore'
3
3
  require 'sixcore'
4
4
 
5
5
  module SixArma
6
- end
6
+ COMPONENT = 'SixArma'
7
+ TITLE = '6thSense.eu ArmA'
8
+ VERSION = '0.5.0'
9
+ @@log = Log4r::Logger.new('sixcore::sixarma')
10
+
11
+ module_function
12
+ def read_config(config, path)
13
+ obj = nil
14
+ if FileTest.exist?("config/#{config}.yaml")
15
+ File.open("config/#{config}.yaml") { |yf| obj = YAML::load( yf ) }
16
+ else
17
+ File.open("#{File.dirname(__FILE__)}/#{path}/#{config}.yaml") { |yf| obj = YAML::load( yf ) }
18
+ end
19
+ obj
20
+ end
7
21
 
8
- component = '6thSense.eu ArmA'
9
- version = '0.4.4'
10
- SixCore::debugs "#{component} #{version} loaded""
22
+ def log
23
+ @@log
24
+ end
25
+
26
+ @@log.debug "#{TITLE} #{VERSION} loaded"
27
+ end
@@ -0,0 +1,7 @@
1
+ --- !ruby/struct:SixArma::ConfigPboTools
2
+ program: C:/Program Files (x86)/Bohemia Interactive/Tools/BinPBO Personal Edition/BINPbo.exe
3
+ temppath: H:/temp/binpbo
4
+ includefile: I:/ACE/trunk/build-scripts/_include.txt
5
+ binpbo_params_bin: -BINARIZE -CLEAR -DEBUG
6
+ binpbo_params_pbo: -CLEAR -DEBUG
7
+ prefix_file: $PBOPREFIX$
@@ -0,0 +1,2 @@
1
+ --- !ruby/struct:SixArma::ConfigSign
2
+ path: L:/signing
@@ -4,8 +4,10 @@
4
4
  require 'sixcore'
5
5
  require 'sixarma'
6
6
  module SixArma
7
+ ConfigPboTools = Struct.new(:program, :temppath, :includefile, :binpbo_params_bin, :binpbo_params_pbo, :prefix_file)
8
+
7
9
  module PboTools
8
- require 'sixarma/config/pbotools'
10
+ @@config = SixArma::read_config('pbotools', 'sixarma/config')
9
11
 
10
12
  module_function
11
13
  # Checks prefix, returns read from file prefix, empty prefix, or given prefix
@@ -13,8 +15,8 @@ module SixArma
13
15
  # prefix:: String: Empty, '__AUTO__' or specific prefix can be given
14
16
  def check_prefix(source, prefix)
15
17
  return prefix unless prefix == '__AUTO__'
16
- if FileTest.exist?("#{source}\\#{PREFIX_FILE}")
17
- pf = File.open("#{source}\\#{PREFIX_FILE}") do |file|
18
+ if FileTest.exist?("#{source}/#{@@config.prefix_file}")
19
+ pf = File.open("#{source}/#{@@config.prefix_file}") do |file|
18
20
  file.readlines.map { |line| SixCore::clean(line) }
19
21
  end
20
22
  if pf[0].empty?
@@ -32,10 +34,10 @@ module SixArma
32
34
  # destination:: destination folder without addon name
33
35
  # prf:: Prefix, see check_prefix
34
36
  def binarize(source, destination, prf = '')
35
- params = BINPBOPARAMSBIN
37
+ params = "#{@@config.binpbo_params_bin} -TEMP #{@@config.temppath} -INCLUDE #{@@config.includefile}"
36
38
  prefix = check_prefix(source, prf)
37
39
  params += " -PREFIX #{prefix}" unless prefix.empty?
38
- SixCore::proc_cmd("#{BINPBO} \"#{source}\" \"#{destination}\" #{params}")
40
+ SixCore::proc_cmd("#{@@config.program} \"#{source}\" \"#{destination}\" #{params}".gsub('/', '\\'))
39
41
  end
40
42
 
41
43
  # Packs addon
@@ -43,10 +45,10 @@ module SixArma
43
45
  # destination:: destination folder without addon name
44
46
  # prf:: Prefix, see check_prefix
45
47
  def pack(source, destination, prf = "")
46
- params = BINPBOPARAMSPBO
48
+ params = "#{@@config.binpbo_params_pbo} -TEMP #{@@config.temppath}"
47
49
  prefix = check_prefix(source, prf)
48
50
  params += " -PREFIX #{prefix}" unless prefix.empty?
49
- SixCore::proc_cmd("#{BINPBO} \"#{source}\" \"#{destination}\" #{params}")
51
+ SixCore::proc_cmd("#{BINPBO} \"#{source}\" \"#{destination}\" #{params}".gsub('/', '\\'))
50
52
  end
51
53
  end
52
54
  end
data/lib/sixarma/sign.rb CHANGED
@@ -4,8 +4,11 @@
4
4
  require 'sixarma'
5
5
 
6
6
  module SixArma
7
+ ConfigSign = Struct.new(:path)
8
+
7
9
  module Sign
8
- require 'sixarma/config/sign'
10
+ @@log = SixArma::log
11
+ @@config = SixArma::read_config('sign', 'sixarma/config')
9
12
  COMPONENT = 'SixArma::Sign'
10
13
 
11
14
  module_function
@@ -13,29 +16,31 @@ module SixArma
13
16
  # Returns created files
14
17
  # name:: String name of key
15
18
  def create(name)
16
- SixCore::debug('Creating Signature', COMPONENT, name)
19
+ @@log.debug SixCore::prep_msg('Creating Signature', :component => COMPONENT, :verbose => name, :format => 'title')
17
20
 
18
21
  # create the key
19
22
  signfile = "#{name}.biprivatekey"
20
23
  signkey = "#{name}.bikey"
21
- unless FileTest.exist?("#{SIGNPATH}\\#{signfile}")
22
- Dir.chdir(SIGNPATH)
23
- SixCore::proc_cmd("#{DSCREATE} #{name}")
24
+ unless FileTest.exist?("#{@@config.path}/#{signfile}")
25
+ Dir.chdir(@@config.path)
26
+ SixCore::proc_cmd("dscreatekey #{name}")
24
27
  Dir.chdir(SixCore::MAINDIR)
25
28
  end
26
- return [signfile, signkey, SIGNPATH]
29
+ return [signfile, signkey, @@config.path]
27
30
  end
28
31
 
29
32
  # Signs files in destination
30
33
  # destination:: Destination folder
31
34
  # signfile:: Signature file name
32
35
  def sign(destination, signfile)
33
- SixCore::debug('Signing...', COMPONENT, [destination, signfile])
36
+ @@log.debug SixCore::prep_msg('Signing...', :component => COMPONENT, :verbose => [destination, signfile], :format => 'title')
34
37
  if signfile.empty?
35
38
  return 1
36
39
  else
37
40
  Dir.chdir(destination)
38
- Dir.glob('*.pbo') { |file| SixCore::proc_cmd "#{DSSIGN} #{SIGNPATH}\\#{signfile} #{file}" }
41
+ keyfile = "#{@@config.path}/#{signfile}"
42
+ keyfile.gsub!('/', '\\')
43
+ Dir['*.pbo'].each { |file| SixCore::proc_cmd "#{@@config.path}/dssignfile #{keyfile} #{file}" }
39
44
  Dir.chdir(SixCore::MAINDIR)
40
45
  return 0
41
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixarma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sickboy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-30 00:00:00 +01:00
12
+ date: 2008-12-02 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.3.0
23
+ version: 0.4.0
24
24
  version:
25
25
  description: Basic function library for the Armed Assault game by Bohemia Interactive Studios
26
26
  email: sb@6thsense.eu
@@ -35,11 +35,11 @@ files:
35
35
  - LICENSE
36
36
  - README
37
37
  - Rakefile
38
- - lib/sixarma/config/pbotools.rb
39
- - lib/sixarma/config/sign.rb
40
38
  - lib/sixarma/pbotools.rb
41
39
  - lib/sixarma/sign.rb
42
40
  - lib/sixarma.rb
41
+ - lib/sixarma/config/pbotools.yaml
42
+ - lib/sixarma/config/sign.yaml
43
43
  has_rdoc: true
44
44
  homepage: http://6thsense.eu
45
45
  post_install_message:
@@ -1,6 +0,0 @@
1
- BINPBO = 'C:\\Program Files (x86)\\Bohemia Interactive\\Tools\\BinPBO Personal Edition\\BINPbo.exe'
2
- TEMPPATH = 'H:\\temp\\binpbo'
3
- INCLUDEFILE = 'I:\\ACE\\trunk\\build-scripts\\_include.txt'
4
- BINPBOPARAMSBIN = "-BINARIZE -CLEAR -TEMP #{TEMPPATH} -DEBUG -INCLUDE #{INCLUDEFILE}"
5
- BINPBOPARAMSPBO = "-CLEAR -TEMP #{TEMPPATH} -DEBUG"
6
- PREFIX_FILE = '$PBOPREFIX$'
@@ -1,3 +0,0 @@
1
- SIGNPATH = 'L:\\signing'
2
- DSCREATE = "#{SIGNPATH}\\dscreatekey"
3
- DSSIGN = "#{SIGNPATH}\\dssignfile"