Class: Pindo::Provisioninghelper
- Inherits:
-
Object
- Object
- Pindo::Provisioninghelper
- Defined in:
- lib/pindo/module/cert/provisioninghelper.rb
Class Method Summary collapse
- .bundle_id(path, keychain_path = nil) ⇒ Object
-
.install(path, keychain_path = nil) ⇒ Object
Installs a provisioning profile for Xcode to use.
- .mac?(path, keychain_path = nil) ⇒ Boolean
-
.name(path, keychain_path = nil) ⇒ String
The Name of the given provisioning profile.
-
.parse(path, keychain_path = nil) ⇒ Hash
The hash with the data of the provisioning profile.
- .profile_extension(path, keychain_path = nil) ⇒ Object
- .profile_filename(path, keychain_path = nil) ⇒ Object
- .profiles_path ⇒ Object
-
.uuid(path, keychain_path = nil) ⇒ String
The UUID of the given provisioning profile.
Class Method Details
.bundle_id(path, keychain_path = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 49 def bundle_id(path, keychain_path = nil) profile = parse(path, keychain_path) app_id_prefix = profile["ApplicationIdentifierPrefix"].first entitlements = profile["Entitlements"] app_identifier = entitlements["application-identifier"] || entitlements["com.apple.application-identifier"] bundle_id = app_identifier.gsub("#{app_id_prefix}.", "") bundle_id rescue UI.error("Unable to extract the Bundle Id from the provided provisioning profile '#{path}'.") end |
.install(path, keychain_path = nil) ⇒ Object
Installs a provisioning profile for Xcode to use
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 88 def install(path, keychain_path = nil) destination = File.join(profiles_path, profile_filename(path, keychain_path)) # puts "Installing provisioning profile... #{destination}" if path != destination # copy to Xcode provisioning profile directory FileUtils.copy(path, destination) unless File.exist?(destination) raise Informative, "Failed installation of provisioning profile at location: '#{destination}'" end end destination end |
.mac?(path, keychain_path = nil) ⇒ Boolean
60 61 62 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 60 def mac?(path, keychain_path = nil) parse(path, keychain_path).fetch("Platform", []).include?('OSX') end |
.name(path, keychain_path = nil) ⇒ String
Returns The Name of the given provisioning profile.
45 46 47 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 45 def name(path, keychain_path = nil) parse(path, keychain_path).fetch("Name") end |
.parse(path, keychain_path = nil) ⇒ Hash
Returns The hash with the data of the provisioning profile.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 27 def parse(path, keychain_path = nil) plist = Plist.parse_xml(decode(path, keychain_path)) # puts JSON.pretty_generate(plist) if (plist || []).count > 5 plist else raise Informative, "Error parsing provisioning profile at path '#{path}'" end end |
.profile_extension(path, keychain_path = nil) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 69 def profile_extension(path, keychain_path = nil) if mac?(path, keychain_path) ".provisionprofile" else ".mobileprovision" end end |
.profile_filename(path, keychain_path = nil) ⇒ Object
64 65 66 67 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 64 def profile_filename(path, keychain_path = nil) basename = uuid(path, keychain_path) basename + profile_extension(path, keychain_path) end |
.profiles_path ⇒ Object
77 78 79 80 81 82 83 84 85 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 77 def profiles_path path = File.("~") + "/Library/MobileDevice/Provisioning Profiles/" # If the directory doesn't exist, create it first unless File.directory?(path) FileUtils.mkdir_p(path) end return path end |
.uuid(path, keychain_path = nil) ⇒ String
Returns The UUID of the given provisioning profile.
40 41 42 |
# File 'lib/pindo/module/cert/provisioninghelper.rb', line 40 def uuid(path, keychain_path = nil) parse(path, keychain_path).fetch("UUID") end |