Class: Xcode::ProvisioningProfile
- Inherits:
-
Object
- Object
- Xcode::ProvisioningProfile
- Defined in:
- lib/xcode/provisioning_profile.rb
Instance Attribute Summary collapse
-
#appstore ⇒ Object
readonly
Returns the value of attribute appstore.
-
#devices ⇒ Object
readonly
Returns the value of attribute devices.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
- #appstore? ⇒ Boolean
-
#initialize(path) ⇒ ProvisioningProfile
constructor
A new instance of ProvisioningProfile.
- #install ⇒ Object
- #install_path ⇒ Object
- #uninstall ⇒ Object
Constructor Details
#initialize(path) ⇒ ProvisioningProfile
Returns a new instance of ProvisioningProfile.
4 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 |
# File 'lib/xcode/provisioning_profile.rb', line 4 def initialize(path) raise "Provisioning profile '#{path}' does not exist" unless File.exists? path @path = path @identifiers = [] @devices = [] @appstore = true # TODO: im sure this could be done in a nicer way. maybe read out the XML-like stuff and use the plist -> json converter uuid = nil File.open(path, "rb") do |f| input = f.read if input=~/ProvisionedDevices/ @appstore = false 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 (readonly)
Returns the value of attribute appstore.
3 4 5 |
# File 'lib/xcode/provisioning_profile.rb', line 3 def appstore @appstore end |
#devices ⇒ Object (readonly)
Returns the value of attribute devices.
3 4 5 |
# File 'lib/xcode/provisioning_profile.rb', line 3 def devices @devices end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
3 4 5 |
# File 'lib/xcode/provisioning_profile.rb', line 3 def identifiers @identifiers end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/xcode/provisioning_profile.rb', line 3 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/xcode/provisioning_profile.rb', line 3 def path @path end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/xcode/provisioning_profile.rb', line 3 def uuid @uuid end |
Class Method Details
.installed_profiles ⇒ Object
64 65 66 67 68 |
# File 'lib/xcode/provisioning_profile.rb', line 64 def self.installed_profiles Dir["#{self.profiles_path}/*.mobileprovision"].map do |file| ProvisioningProfile.new(file) end end |
.profiles_path ⇒ Object
48 49 50 |
# File 'lib/xcode/provisioning_profile.rb', line 48 def self.profiles_path File. "~/Library/MobileDevice/Provisioning\\ Profiles/" end |
Instance Method Details
#appstore? ⇒ Boolean
44 45 46 |
# File 'lib/xcode/provisioning_profile.rb', line 44 def appstore? @appstore end |
#install ⇒ Object
56 57 58 |
# File 'lib/xcode/provisioning_profile.rb', line 56 def install Xcode::Shell.execute("cp #{self.path} #{self.install_path}") end |
#install_path ⇒ Object
52 53 54 |
# File 'lib/xcode/provisioning_profile.rb', line 52 def install_path "#{ProvisioningProfile.profiles_path}/#{self.uuid}.mobileprovision" end |