Class: Provisioning

Inherits:
Object
  • Object
show all
Defined in:
lib/provisinfo/provisioning.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = nil) ⇒ Provisioning

by default, it will load the first .mobileprovision file in current directory



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/provisinfo/provisioning.rb', line 13

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

#appIDObject

Returns the value of attribute appID.



8
9
10
# File 'lib/provisinfo/provisioning.rb', line 8

def appID
  @appID
end

#filenameObject

Returns the value of attribute filename.



10
11
12
# File 'lib/provisinfo/provisioning.rb', line 10

def filename
  @filename
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/provisinfo/provisioning.rb', line 5

def name
  @name
end

#teamIDObject

Returns the value of attribute teamID.



9
10
11
# File 'lib/provisinfo/provisioning.rb', line 9

def teamID
  @teamID
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/provisinfo/provisioning.rb', line 6

def type
  @type
end

#uuidObject

Returns the value of attribute uuid.



7
8
9
# File 'lib/provisinfo/provisioning.rb', line 7

def uuid
  @uuid
end

Class Method Details

.list_filesObject



39
40
41
42
43
44
45
# File 'lib/provisinfo/provisioning.rb', line 39

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

#load_from_fileObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/provisinfo/provisioning.rb', line 28

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']
  puts xml_parsed['application-identifier']

end

#show_infoObject



47
48
49
50
51
52
53
# File 'lib/provisinfo/provisioning.rb', line 47

def show_info()
  puts "Name:"+self.name
  puts "UUDID:"+self.uuid 
  puts "AppID:"+self.appID 
  puts "TeamID:"+self.teamID
  
end