Class: MooTool::Commands::IMG4
- Inherits:
-
Thor
- Object
- Thor
- MooTool::Commands::IMG4
- Defined in:
- lib/mootool/commands/img4.rb
Overview
IMG4 parsing and related commands
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mootool/commands/img4.rb', line 21 def index indexer = Models::FileIndex.new indexer.perform indexer.generate_hashes if [:generate_hashes] File.write [:save_file], JSON.pretty_generate(indexer.index) if [:save_file] ap indexer.index end |
#manifest ⇒ Object
58 59 60 |
# File 'lib/mootool/commands/img4.rb', line 58 def manifest ap Models::IOReg.create([:path]).manifests end |
#print(filename) ⇒ Object
10 11 12 13 14 |
# File 'lib/mootool/commands/img4.rb', line 10 def print(filename) Models::Digest.load_manifests([:manifest]) if [:manifest] file = Models::IMG4::File.load(filename) file.print([:friendly]) end |
#types ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mootool/commands/img4.rb', line 33 def types indexer = Models::FileIndex.new indexer.perform results = {} indexer.index.select(&:img4?).flat_map do |file| loaded = Models::IMG4::File.load(file) loaded.types.compact.map do |type| results[type] ||= [] results[type] << file.fullname end end results = results.to_h do |key, value| info = Models::IMG4.mappings[key] || {} info[:examples] = value [key, info] end ap({ unique_payload_types: results }) end |