Module: AppInfo
- Defined in:
- lib/app_info.rb,
lib/app_info/pe.rb,
lib/app_info/aab.rb,
lib/app_info/apk.rb,
lib/app_info/ipa.rb,
lib/app_info/dsym.rb,
lib/app_info/file.rb,
lib/app_info/apple.rb,
lib/app_info/const.rb,
lib/app_info/error.rb,
lib/app_info/macos.rb,
lib/app_info/shell.rb,
lib/app_info/android.rb,
lib/app_info/version.rb,
lib/app_info/proguard.rb,
lib/app_info/dsym/macho.rb,
lib/app_info/info_plist.rb,
lib/app_info/ipa/plugin.rb,
lib/app_info/certificate.rb,
lib/app_info/png_uncrush.rb,
lib/app_info/ipa/framework.rb,
lib/app_info/dsym/debug_info.rb,
lib/app_info/mobile_provision.rb,
lib/app_info/android/signature.rb,
lib/app_info/protobuf/manifest.rb,
lib/app_info/protobuf/resources.rb,
lib/app_info/core_ext/object/try.rb,
lib/app_info/android/signatures/v1.rb,
lib/app_info/android/signatures/v2.rb,
lib/app_info/android/signatures/v3.rb,
lib/app_info/android/signatures/v4.rb,
lib/app_info/android/signatures/base.rb,
lib/app_info/android/signatures/info.rb,
lib/app_info/core_ext/string/inflector.rb
Overview
Copyrights rails Copy from github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/try.rb
Defined Under Namespace
Modules: Device, Format, Helper, Manufacturer, Platform, Protobuf Classes: AAB, APK, Android, Apple, Certificate, DSYM, Error, File, Framework, IPA, InfoPlist, Macos, MobileProvision, NotFoundError, PE, Plugin, PngUncrush, Proguard, ProtobufParseError, Shell, UnknownFormatError
Constant Summary collapse
- ZIP_RETGEX =
/^\x50\x4b\x03\x04/.freeze
- PE_REGEX =
/^MZ/.freeze
- PLIST_REGEX =
/\x3C\x3F\x78\x6D\x6C/.freeze
- BPLIST_REGEX =
/^\x62\x70\x6C\x69\x73\x74/.freeze
- VERSION =
'3.0.0'
Class Attribute Summary collapse
Class Method Summary collapse
-
.file_type(file) ⇒ Object
Detect file type by read file header.
-
.parse(file) {|parser| ... } ⇒ Object
(also: dump)
Get a new parser for automatic.
- .parse?(file) ⇒ Boolean
Class Attribute Details
.logger ⇒ Object
81 82 83 |
# File 'lib/app_info.rb', line 81 def logger @logger ||= Logger.new($stdout, level: :warn) end |
Class Method Details
.file_type(file) ⇒ Object
Detect file type by read file header
TODO: This can be better solution, if anyone knows, tell me please.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/app_info.rb', line 67 def file_type(file) header_hex = ::File.read(file, 100) case header_hex when ZIP_RETGEX detect_zip_file(file) when PE_REGEX Format::PE when PLIST_REGEX, BPLIST_REGEX Format::MOBILEPROVISION else Format::UNKNOWN end end |
.parse(file) {|parser| ... } ⇒ Object Also known as: dump
Get a new parser for automatic
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/app_info.rb', line 36 def parse(file) raise NotFoundError, file unless ::File.exist?(file) parser = case file_type(file) when Format::IPA then IPA.new(file) when Format::APK then APK.new(file) when Format::AAB then AAB.new(file) when Format::MOBILEPROVISION then MobileProvision.new(file) when Format::DSYM then DSYM.new(file) when Format::PROGUARD then Proguard.new(file) when Format::MACOS then Macos.new(file) when Format::PE then PE.new(file) else raise UnknownFormatError, "Do not detect file format: #{file}" end return parser unless block_given? # call block and clear! yield parser parser.clear! end |