Class: Pliney::IPA
- Inherits:
-
Object
- Object
- Pliney::IPA
- Defined in:
- lib/pliney/ipa.rb
Instance Attribute Summary collapse
-
#zipfile ⇒ Object
readonly
TODO - creating an ipa from scratch? def self.create(path) new(Zip::File.open(path, Zip::File::CREATE)) end.
Class Method Summary collapse
Instance Method Summary collapse
- #appdir ⇒ Object
- #bundle_identifier ⇒ Object
- #bundle_short_version ⇒ Object
- #bundle_version ⇒ Object
- #close ⇒ Object
- #executable_entry ⇒ Object
- #executable_path ⇒ Object
- #find_appdir ⇒ Object
- #get_entry(path) ⇒ Object
- #info_plist ⇒ Object
-
#initialize(zipfile) ⇒ IPA
constructor
A new instance of IPA.
- #ls ⇒ Object
- #parse_plist_entry(path) ⇒ Object
- #provisioning_profile ⇒ Object
- #read_path(path, *args) ⇒ Object
Constructor Details
#initialize(zipfile) ⇒ IPA
Returns a new instance of IPA.
26 27 28 |
# File 'lib/pliney/ipa.rb', line 26 def initialize(zipfile) @zipfile = zipfile end |
Instance Attribute Details
#zipfile ⇒ Object (readonly)
TODO - creating an ipa from scratch? def self.create(path)
new(Zip::File.open(path, Zip::File::CREATE))
end
24 25 26 |
# File 'lib/pliney/ipa.rb', line 24 def zipfile @zipfile end |
Class Method Details
.from_path(path) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/pliney/ipa.rb', line 8 def self.from_path(path) ipa = new(Zip::File.open(path)) if block_given? ret = yield(ipa) ipa.close return ret else return ipa end end |
Instance Method Details
#appdir ⇒ Object
30 31 32 |
# File 'lib/pliney/ipa.rb', line 30 def appdir @appdir ||= find_appdir end |
#bundle_identifier ⇒ Object
52 53 54 |
# File 'lib/pliney/ipa.rb', line 52 def bundle_identifier return info_plist["CFBundleIdentifier"] end |
#bundle_short_version ⇒ Object
60 61 62 |
# File 'lib/pliney/ipa.rb', line 60 def bundle_short_version return info_plist["CFBundleShortVersionString"] end |
#bundle_version ⇒ Object
56 57 58 |
# File 'lib/pliney/ipa.rb', line 56 def bundle_version return info_plist["CFBundleVersion"] end |
#close ⇒ Object
76 77 78 |
# File 'lib/pliney/ipa.rb', line 76 def close @zipfile.close end |
#executable_entry ⇒ Object
68 69 70 |
# File 'lib/pliney/ipa.rb', line 68 def executable_entry return get_entry(executable_path) end |
#executable_path ⇒ Object
64 65 66 |
# File 'lib/pliney/ipa.rb', line 64 def executable_path return appdir.join(info_plist["CFBundleExecutable"]) end |
#find_appdir ⇒ Object
38 39 40 41 42 |
# File 'lib/pliney/ipa.rb', line 38 def find_appdir if e = @zipfile.find{|ent| ent.directory? and ent.name =~ /^Payload\/[^\/]*\.app\/$/ } return Pathname(e.name) end end |
#get_entry(path) ⇒ Object
80 81 82 |
# File 'lib/pliney/ipa.rb', line 80 def get_entry(path) return @zipfile.find_entry(path.to_s) end |
#info_plist ⇒ Object
48 49 50 |
# File 'lib/pliney/ipa.rb', line 48 def info_plist return parse_plist_entry(appdir.join("Info.plist")) end |
#ls ⇒ Object
72 73 74 |
# File 'lib/pliney/ipa.rb', line 72 def ls return @zipfile.entries.map{|e| e.name} end |
#parse_plist_entry(path) ⇒ Object
34 35 36 |
# File 'lib/pliney/ipa.rb', line 34 def parse_plist_entry(path) Pliney.parse_plist(read_path(path)) end |
#provisioning_profile ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'lib/pliney/ipa.rb', line 84 def provisioning_profile begin profile_data = read_path(appdir.join("embedded.mobileprovision")) rescue Errno::ENOENT return nil end ProvisioningProfile.from_asn1(profile_data) end |
#read_path(path, *args) ⇒ Object
44 45 46 |
# File 'lib/pliney/ipa.rb', line 44 def read_path(path, *args) return @zipfile.get_input_stream(path.to_s){|sio| sio.read(*args)} end |