Class: Provisioning
- Inherits:
-
Object
- Object
- Provisioning
- Defined in:
- lib/provisinfo/provisioning.rb
Instance Attribute Summary collapse
-
#appID ⇒ Object
Returns the value of attribute appID.
-
#expirationDate ⇒ Object
Returns the value of attribute expirationDate.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#name ⇒ Object
Returns the value of attribute name.
-
#teamID ⇒ Object
Returns the value of attribute teamID.
-
#type ⇒ Object
Returns the value of attribute type.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename = nil) ⇒ Provisioning
constructor
by default, it will load the first .mobileprovision file in current directory.
- #is_expired ⇒ Object
- #load_from_file ⇒ Object
- #show_info ⇒ Object
Constructor Details
#initialize(filename = nil) ⇒ Provisioning
by default, it will load the first .mobileprovision file in current directory
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/provisinfo/provisioning.rb', line 16 def initialize(filename = nil) if filename.nil? @filename = self.class.list_files().first else @filename = filename end if @filename self.load_from_file() else @name ="Unknown" end end |
Instance Attribute Details
#appID ⇒ Object
Returns the value of attribute appID.
10 11 12 |
# File 'lib/provisinfo/provisioning.rb', line 10 def appID @appID end |
#expirationDate ⇒ Object
Returns the value of attribute expirationDate.
13 14 15 |
# File 'lib/provisinfo/provisioning.rb', line 13 def expirationDate @expirationDate end |
#filename ⇒ Object
Returns the value of attribute filename.
12 13 14 |
# File 'lib/provisinfo/provisioning.rb', line 12 def filename @filename end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/provisinfo/provisioning.rb', line 7 def name @name end |
#teamID ⇒ Object
Returns the value of attribute teamID.
11 12 13 |
# File 'lib/provisinfo/provisioning.rb', line 11 def teamID @teamID end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/provisinfo/provisioning.rb', line 8 def type @type end |
#uuid ⇒ Object
Returns the value of attribute uuid.
9 10 11 |
# File 'lib/provisinfo/provisioning.rb', line 9 def uuid @uuid end |
Class Method Details
.list_files ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/provisinfo/provisioning.rb', line 43 def self.list_files() provisioning_file_paths = [] Dir.entries('.').each do |path| provisioning_file_paths << path if path=~ /.*\.mobileprovision$/ end provisioning_file_paths end |
Instance Method Details
#is_expired ⇒ Object
51 52 53 54 |
# File 'lib/provisinfo/provisioning.rb', line 51 def is_expired() now = DateTime.now return self.expirationDate < now end |
#load_from_file ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/provisinfo/provisioning.rb', line 31 def load_from_file() xml_raw = `security cms -D -i #{@filename}` xml_parsed = Plist::parse_xml(xml_raw) @teamID = xml_parsed['Entitlements']['com.apple.developer.team-identifier'] @name = xml_parsed['Name'] @uuid = xml_parsed['UUID'] @appID = xml_parsed['Entitlements']['application-identifier'] @expirationDate = xml_parsed['ExpirationDate'] end |
#show_info ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/provisinfo/provisioning.rb', line 56 def show_info() puts "Name:"+self.name puts "UUDID:"+self.uuid puts "AppID:"+self.appID puts "TeamID:"+self.teamID puts "ExpirationDate:"+self.expirationDate.strftime("%c") end |