Class: PProf::ProvisioningProfile
- Inherits:
-
Object
- Object
- PProf::ProvisioningProfile
- Defined in:
- lib/pprof/provisioning_profile.rb
Overview
Represents the content of a Provisioning Profile file
Constant Summary collapse
- DEFAULT_DIR =
The default location where all the Provisioning Profiles are stored on a Mac
"#{ENV['HOME']}/Library/MobileDevice/Provisioning Profiles"
Instance Method Summary collapse
-
#app_id_name ⇒ String
The name of the Application Identifier associated with this Provisioning Profile.
-
#app_id_prefix ⇒ String
The AppID prefix (which is typically the ID of the team).
-
#creation_date ⇒ DateTime
The Creation date of this Provisioning Profile.
-
#developer_certificates ⇒ Array<OpenSSL::X509::Certificate>
The list of X509 Developer Certifiates associated with this profile.
-
#entitlements ⇒ Entitlements
All the entitlements associated with this Provisioning Profile.
-
#expiration_date ⇒ DateTime
The expiration date of this Provisioning Profile.
-
#initialize(file) ⇒ ProvisioningProfile
constructor
Create a new ProvisioningProfile object from a file path or UUID.
-
#name ⇒ String
The name of the Provisioning Profile.
-
#provisioned_devices ⇒ Array<String>
The list of devices provisioned with this Provisioning Profile (if any).
-
#provisions_all_devices ⇒ Bool
Indicates if this Provisioning Profile is provisioned for all devices or only for a list of some specific devices.
-
#team_ids ⇒ Array<String>
The Team IDs associated with this Provisioning Profile.
-
#team_name ⇒ String
The name of the Team associated with this Provisioning Profile.
-
#to_hash ⇒ Hash
The hash representation of this Provisioning Profile.
-
#to_s ⇒ String
The human-readable string representation of this Provisioning Profile Typically suitable for printing this Provisioning Profile information to the user.
-
#ttl ⇒ Int
The Time-To-Live of this Provisioning Profile.
-
#uuid ⇒ String
The UUID of the Provisioning Profile.
Constructor Details
#initialize(file) ⇒ ProvisioningProfile
Create a new ProvisioningProfile object from a file path or UUID
-
If the parameter given has the form of an UUID, a file named with this UUID and a ‘.mobileprovision` is searched in the default directory `DEFAULT_DIR`
-
Otherwise, the parameter is interpreted as a file path
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pprof/provisioning_profile.rb', line 21 def initialize(file) if file =~ %r/^[0-9A-F-]*$/i path = "#{PProf::ProvisioningProfile::DEFAULT_DIR}/#{file}.mobileprovision" else path = file end pkcs7 = OpenSSL::PKCS7.new(File.read(path)) pkcs7.verify([], OpenSSL::X509::Store.new) @plist = Plist::parse_xml(pkcs7.data) raise "Can'Unable to parse file #{file}." if @plist.nil? end |
Instance Method Details
#app_id_name ⇒ String
This is not the AppID itself, but rather the name you associated to that AppID in your Developer Portal
The name of the Application Identifier associated with this Provisioning Profile
53 54 55 |
# File 'lib/pprof/provisioning_profile.rb', line 53 def app_id_name @plist['AppIDName'] end |
#app_id_prefix ⇒ String
The AppID prefix (which is typically the ID of the team)
60 61 62 |
# File 'lib/pprof/provisioning_profile.rb', line 60 def app_id_prefix @plist['ApplicationIdentifierPrefix'] end |
#creation_date ⇒ DateTime
The Creation date of this Provisioning Profile
67 68 69 |
# File 'lib/pprof/provisioning_profile.rb', line 67 def creation_date @plist['CreationDate'] end |
#developer_certificates ⇒ Array<OpenSSL::X509::Certificate>
The list of X509 Developer Certifiates associated with this profile
103 104 105 106 107 |
# File 'lib/pprof/provisioning_profile.rb', line 103 def developer_certificates @plist['DeveloperCertificates'].map do |data| OpenSSL::X509::Certificate.new(data.string) end end |
#entitlements ⇒ Entitlements
All the entitlements associated with this Provisioning Profile
112 113 114 |
# File 'lib/pprof/provisioning_profile.rb', line 112 def entitlements PProf::Entitlements.new(@plist['Entitlements']) end |
#expiration_date ⇒ DateTime
The expiration date of this Provisioning Profile
74 75 76 |
# File 'lib/pprof/provisioning_profile.rb', line 74 def expiration_date @plist['ExpirationDate'] end |
#name ⇒ String
The name of the Provisioning Profile
36 37 38 |
# File 'lib/pprof/provisioning_profile.rb', line 36 def name @plist['Name'] end |
#provisioned_devices ⇒ Array<String>
The list of devices provisioned with this Provisioning Profile (if any)
119 120 121 |
# File 'lib/pprof/provisioning_profile.rb', line 119 def provisioned_devices @plist['ProvisionedDevices'] end |
#provisions_all_devices ⇒ Bool
Indicates if this Provisioning Profile is provisioned for all devices or only for a list of some specific devices
127 128 129 |
# File 'lib/pprof/provisioning_profile.rb', line 127 def provisions_all_devices @plist['ProvisionsAllDevices'] || false end |
#team_ids ⇒ Array<String>
typically Provisioning Profiles contain only one team
The Team IDs associated with this Provisioning Profile
89 90 91 |
# File 'lib/pprof/provisioning_profile.rb', line 89 def team_ids @plist['TeamIdentifier'] end |
#team_name ⇒ String
The name of the Team associated with this Provisioning Profile
96 97 98 |
# File 'lib/pprof/provisioning_profile.rb', line 96 def team_name @plist['TeamName'] end |
#to_hash ⇒ Hash
The hash representation of this Provisioning Profile
134 135 136 |
# File 'lib/pprof/provisioning_profile.rb', line 134 def to_hash @dict end |
#to_s ⇒ String
The human-readable string representation of this Provisioning Profile Typically suitable for printing this Provisioning Profile information to the user.
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/pprof/provisioning_profile.rb', line 142 def to_s lines = [:name, :uuid, :app_id_name, :app_id_prefix, :creation_date, :expiration_date, :ttl, :team_ids, :team_name].map do |key| "- #{key.to_s}: #{self.send(key.to_sym)}" end + [ "- #{developer_certificates.count} Developer Certificates", "- #{provisioned_devices.count} Provisioned Devices", "- Entitlements:" ] + entitlements.to_hasg.map { |key, value| " - #{key}: #{value}" } lines.join("\n") end |
#ttl ⇒ Int
The Time-To-Live of this Provisioning Profile
80 81 82 |
# File 'lib/pprof/provisioning_profile.rb', line 80 def ttl @plist['TimeToLive'].to_i end |
#uuid ⇒ String
The UUID of the Provisioning Profile
43 44 45 |
# File 'lib/pprof/provisioning_profile.rb', line 43 def uuid @plist['UUID'] end |