Class: FIR::Parser::Ipa
- Includes:
- Common
- Defined in:
- lib/fir/util/parser/ipa.rb
Defined Under Namespace
Classes: App
Instance Method Summary collapse
- #app ⇒ Object
- #app_path ⇒ Object
- #cleanup ⇒ Object
- #contents ⇒ Object
- #has_metadata? ⇒ Boolean
-
#initialize(path) ⇒ Ipa
constructor
A new instance of Ipa.
- #is_stored ⇒ Object
- #metadata ⇒ Object
- #metadata_path ⇒ Object
Methods included from Common
Constructor Details
#initialize(path) ⇒ Ipa
Returns a new instance of Ipa.
10 11 12 |
# File 'lib/fir/util/parser/ipa.rb', line 10 def initialize(path) @path = path end |
Instance Method Details
#app ⇒ Object
14 15 16 |
# File 'lib/fir/util/parser/ipa.rb', line 14 def app @app ||= App.new(app_path, is_stored) end |
#app_path ⇒ Object
18 19 20 |
# File 'lib/fir/util/parser/ipa.rb', line 18 def app_path @app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first end |
#cleanup ⇒ Object
22 23 24 25 26 |
# File 'lib/fir/util/parser/ipa.rb', line 22 def cleanup return unless @contents FileUtils.rm_rf(@contents) @contents = nil end |
#contents ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fir/util/parser/ipa.rb', line 45 def contents return if @contents @contents = "#{Dir.tmpdir}/ipa_files-#{Time.now.to_i}" Zip::File.open(@path) do |zip_file| zip_file.each do |f| f_path = File.join(@contents, f.name) FileUtils.mkdir_p(File.dirname(f_path)) zip_file.extract(f, f_path) unless File.exist?(f_path) end end @contents end |
#is_stored ⇒ Object
41 42 43 |
# File 'lib/fir/util/parser/ipa.rb', line 41 def is_stored ? true : false end |
#metadata ⇒ Object
28 29 30 31 |
# File 'lib/fir/util/parser/ipa.rb', line 28 def return unless @metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: ).value) end |