Class: D3MPQ::Command::Extract
- Inherits:
-
Object
- Object
- D3MPQ::Command::Extract
- Defined in:
- lib/d3_mpq/commands/extract.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #cd ⇒ Object
-
#initialize(options = {}) ⇒ Extract
constructor
A new instance of Extract.
- #logger(msg) ⇒ Object
- #mpq ⇒ Object
- #mpq_path ⇒ Object
- #patch ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Extract
Returns a new instance of Extract.
5 6 7 8 9 10 11 12 |
# File 'lib/d3_mpq/commands/extract.rb', line 5 def initialize( = {}) @options = @options[:mpq_path] += "/" unless @options[:mpq_path].end_with?("/") logger "Extracting MPQ" cmd = "#{cd} && smpq -ef #{mpq} #{patch}" logger "Performing: #{cmd}" logger `#{cmd}` end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/d3_mpq/commands/extract.rb', line 3 def @options end |
Class Method Details
.all ⇒ Object
15 16 17 |
# File 'lib/d3_mpq/commands/extract.rb', line 15 def all known_mpqs.each { |mpq| self.new(mpq) } end |
.known_mpqs ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/d3_mpq/commands/extract.rb', line 19 def known_mpqs [ "ClientData", "GameBalance", "enUS_Audio", "enUS_Cutscene", "enUS_Text", "HLSLShaders", "Sound", "Texture" ] end |
Instance Method Details
#cd ⇒ Object
33 34 35 |
# File 'lib/d3_mpq/commands/extract.rb', line 33 def cd "cd #{[:extract_path]}" end |
#logger(msg) ⇒ Object
49 50 51 |
# File 'lib/d3_mpq/commands/extract.rb', line 49 def logger(msg) puts msg end |
#mpq ⇒ Object
41 42 43 |
# File 'lib/d3_mpq/commands/extract.rb', line 41 def mpq "#{mpq_path}#{[:mpq]}.mpq" end |
#mpq_path ⇒ Object
45 46 47 |
# File 'lib/d3_mpq/commands/extract.rb', line 45 def mpq_path "../#{[:mpq_path]}" end |
#patch ⇒ Object
37 38 39 |
# File 'lib/d3_mpq/commands/extract.rb', line 37 def patch "-p #{mpq_path}base/* #{mpq_path}#{[:locale]}/* #{mpq_path}Win/*" end |