Class: FIR::Parser::Ipa
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.
- #metadata ⇒ Object
- #metadata_path ⇒ Object
- #release_type ⇒ Object
Constructor Details
#initialize(path) ⇒ Ipa
Returns a new instance of Ipa.
8 9 10 |
# File 'lib/fir/util/parser.rb', line 8 def initialize(path) @path = path end |
Instance Method Details
#app ⇒ Object
12 13 14 |
# File 'lib/fir/util/parser.rb', line 12 def app @app ||= App.new(app_path) end |
#app_path ⇒ Object
16 17 18 |
# File 'lib/fir/util/parser.rb', line 16 def app_path @app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first end |
#cleanup ⇒ Object
20 21 22 23 24 |
# File 'lib/fir/util/parser.rb', line 20 def cleanup return unless @contents FileUtils.rm_rf(@contents) @contents = nil end |
#contents ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fir/util/parser.rb', line 43 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 |
#has_metadata? ⇒ Boolean
31 32 33 |
# File 'lib/fir/util/parser.rb', line 31 def File.file? end |
#metadata ⇒ Object
26 27 28 29 |
# File 'lib/fir/util/parser.rb', line 26 def return unless ||= CFPropertyList.native_types(CFPropertyList::List.new(file: ).value) end |
#metadata_path ⇒ Object
35 36 37 |
# File 'lib/fir/util/parser.rb', line 35 def ||= File.join(@contents, 'iTunesMetadata.plist') end |
#release_type ⇒ Object
39 40 41 |
# File 'lib/fir/util/parser.rb', line 39 def release_type ? 'store' : 'adhoc' end |