starcitizen-tools 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,42 @@
1
+
2
+ require 'zip'
3
+ require 'fileutils'
4
+ require_relative 'config'
5
+
6
+ module StarCitizen
7
+
8
+ # A .pak file.
9
+ # Located in /CitizenClient/Data
10
+ class Pak
11
+
12
+ attr_reader :name
13
+
14
+ # @param name [String] Name of the .pak file.
15
+ def initialize name
16
+ @name = name
17
+ @path = "#{StarCitizen::Config.game_path}/CitizenClient/Data/#{name}.pak"
18
+ end
19
+
20
+ # Extract a file from the package.
21
+ # @param path [String] Path of the file inside the package.
22
+ # @option kwargs [String] :output_dir ('.') File is extracted to this directory.
23
+ # @example
24
+ # # Extract defaultProfile.xml
25
+ # package.extract 'Libs/Config/defaultProfile.xml'
26
+ def extract path, **kwargs
27
+ output_dir = kwargs.fetch :output_dir, '.'
28
+
29
+ Zip::File.open(@path) do |files|
30
+ pak_file = files.glob(path).first
31
+
32
+ FileUtils.mkdir_p output_dir
33
+ FileUtils.chdir output_dir do
34
+ filename = path.split('/').last
35
+ File.delete filename if File.exists? filename
36
+ pak_file.extract pak_file.name.split('/').last
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,4 @@
1
+
2
+ require_relative 'rake/extract_default_profile'
3
+
4
+ StarCitizen::Rake::ExtractDefaultProfile.new
@@ -0,0 +1,30 @@
1
+
2
+ require 'rake'
3
+ require 'rake/tasklib'
4
+
5
+ module StarCitizen
6
+ module Rake
7
+
8
+ # Extract defaultProfile.xml from GameData.pak
9
+ class ExtractDefaultProfile < ::Rake::TaskLib
10
+
11
+ attr_accessor :name
12
+ attr_accessor :output_dir
13
+
14
+ def initialize name = :extract_default_profile
15
+ @name = name
16
+ @output_dir = '.'
17
+ yield self if block_given?
18
+
19
+ desc "Extract defaultProfile.xml from GameData.pak"
20
+
21
+ task(name) do
22
+ require 'starcitizen-tools'
23
+ StarCitizen::Pak.new('GameData').extract 'Libs/Config/defaultProfile.xml',
24
+ output_dir: @output_dir
25
+ end
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Alex McLain
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: starcitizen-tools
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex McLain
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubyzip
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.7
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.7
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-its
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: fivemat
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rb-readline
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: A Ruby API and command-line tools for the game Star Citizen.
126
+ email:
127
+ - alex@alexmclain.com
128
+ executables:
129
+ - sct
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - README.md
134
+ - bin/sct
135
+ - doc/StarCitizen.html
136
+ - doc/StarCitizen/Config.html
137
+ - doc/StarCitizen/Pak.html
138
+ - doc/StarCitizen/Rake.html
139
+ - doc/StarCitizen/Rake/ExtractDefaultProfile.html
140
+ - doc/_index.html
141
+ - doc/class_list.html
142
+ - doc/css/common.css
143
+ - doc/css/full_list.css
144
+ - doc/css/style.css
145
+ - doc/file.README.html
146
+ - doc/file.license.html
147
+ - doc/file_list.html
148
+ - doc/frames.html
149
+ - doc/index.html
150
+ - doc/js/app.js
151
+ - doc/js/full_list.js
152
+ - doc/js/jquery.js
153
+ - doc/method_list.html
154
+ - doc/top-level-namespace.html
155
+ - lib/starcitizen-tools.rb
156
+ - lib/starcitizen/config.rb
157
+ - lib/starcitizen/pak.rb
158
+ - lib/starcitizen/rake.rb
159
+ - lib/starcitizen/rake/extract_default_profile.rb
160
+ - license.txt
161
+ homepage: https://github.com/amclain/starcitizen-tools
162
+ licenses:
163
+ - MIT
164
+ metadata: {}
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ requirements: []
180
+ rubyforge_project:
181
+ rubygems_version: 2.2.2
182
+ signing_key:
183
+ specification_version: 4
184
+ summary: A Ruby API and command-line tools for the game Star Citizen.
185
+ test_files: []
186
+ has_rdoc: