Class: Xcode::ProvisioningProfile
- Inherits:
-
Object
- Object
- Xcode::ProvisioningProfile
show all
- Includes:
- TerminalOutput
- Defined in:
- lib/xcode/provisioning_profile.rb
Constant Summary
TerminalOutput::LEVELS
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#color_output=, #color_output?, #format_lhs, included, #log_level, log_level=, #print, #print_input, #print_output, #print_system, #print_task, #puts, terminal_supports_colors?
Constructor Details
Returns a new instance of ProvisioningProfile.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/xcode/provisioning_profile.rb', line 5
def initialize(path)
raise "Provisioning profile '#{path}' does not exist" unless File.exists? path
@path = path
@identifiers = []
@devices = []
@appstore = true
@enterprise = false
uuid = nil
File.open(path, "rb") do |f|
input = f.read
if input=~/ProvisionedDevices/
@appstore = false
end
if input=~/<key>ProvisionsAllDevices<\/key>/
@enterprise = true
end
if input=~/<key>ProvisionedDevices<\/key>.*?<array>(.*?)<\/array>/im
$1.split(/<string>/).each do |id|
next if id.nil? or id.strip==""
@devices << id.gsub(/<\/string>/,'').strip
end
end
input=~/<key>UUID<\/key>.*?<string>(.*?)<\/string>/im
@uuid = $1.strip
input=~/<key>Name<\/key>.*?<string>(.*?)<\/string>/im
@name = $1.strip
input=~/<key>ApplicationIdentifierPrefix<\/key>.*?<array>(.*?)<\/array>/im
$1.split(/<string>/).each do |id|
next if id.nil? or id.strip==""
@identifiers << id.gsub(/<\/string>/,'').strip
end
end
end
|
Instance Attribute Details
#appstore ⇒ Object
Returns the value of attribute appstore.
4
5
6
|
# File 'lib/xcode/provisioning_profile.rb', line 4
def appstore
@appstore
end
|
#devices ⇒ Object
Returns the value of attribute devices.
4
5
6
|
# File 'lib/xcode/provisioning_profile.rb', line 4
def devices
@devices
end
|
#identifiers ⇒ Object
Returns the value of attribute identifiers.
4
5
6
|
# File 'lib/xcode/provisioning_profile.rb', line 4
def identifiers
@identifiers
end
|
#name ⇒ Object
Returns the value of attribute name.
4
5
6
|
# File 'lib/xcode/provisioning_profile.rb', line 4
def name
@name
end
|
#path ⇒ Object
Returns the value of attribute path.
4
5
6
|
# File 'lib/xcode/provisioning_profile.rb', line 4
def path
@path
end
|
#uuid ⇒ Object
Returns the value of attribute uuid.
4
5
6
|
# File 'lib/xcode/provisioning_profile.rb', line 4
def uuid
@uuid
end
|
Class Method Details
.find_installed_by_uuid(uuid) ⇒ Object
96
97
98
99
100
|
# File 'lib/xcode/provisioning_profile.rb', line 96
def self.find_installed_by_uuid uuid
ProvisioningProfile.installed_profiles.each do |p|
return p if p.uuid == uuid
end
end
|
.installed_profile(name) ⇒ Object
102
103
104
|
# File 'lib/xcode/provisioning_profile.rb', line 102
def self.installed_profile(name)
self.installed_profiles.select {|p| p.name == name.to_s}.first;
end
|
.installed_profiles ⇒ Object
90
91
92
93
94
|
# File 'lib/xcode/provisioning_profile.rb', line 90
def self.installed_profiles
Dir["#{self.profiles_path}/*.mobileprovision"].map do |file|
ProvisioningProfile.new(file)
end
end
|
.profiles_path ⇒ Object
58
59
60
|
# File 'lib/xcode/provisioning_profile.rb', line 58
def self.profiles_path
File.expand_path "~/Library/MobileDevice/Provisioning\\ Profiles/"
end
|
Instance Method Details
#appstore? ⇒ Boolean
50
51
52
|
# File 'lib/xcode/provisioning_profile.rb', line 50
def appstore?
@appstore
end
|
#enterprise? ⇒ Boolean
54
55
56
|
# File 'lib/xcode/provisioning_profile.rb', line 54
def enterprise?
@enterprise
end
|
#install ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/xcode/provisioning_profile.rb', line 66
def install
return if (self.path == self.install_path.gsub(/\\ /, ' '))
ProvisioningProfile.installed_profiles.each do |installed|
if installed.identifiers==self.identifiers and installed.uuid==self.uuid
installed.uninstall
end
end
cmd = Xcode::Shell::Command.new 'cp'
cmd << self.path
cmd << self.install_path
cmd.execute
end
|
#install_path ⇒ Object
62
63
64
|
# File 'lib/xcode/provisioning_profile.rb', line 62
def install_path
"#{ProvisioningProfile.profiles_path}/#{self.uuid}.mobileprovision"
end
|
#uninstall ⇒ Object
83
84
85
86
87
88
|
# File 'lib/xcode/provisioning_profile.rb', line 83
def uninstall
cmd = Xcode::Shell::Command.new 'rm'
cmd << "-f #{self.install_path}"
cmd.execute
end
|