Class: ProvisionProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/ipa_utilities/parsers.rb

Instance Method Summary collapse

Constructor Details

#initialize(provision_path) ⇒ ProvisionProfile

Returns a new instance of ProvisionProfile.



54
55
56
57
# File 'lib/ipa_utilities/parsers.rb', line 54

def initialize(provision_path)
  @provision_path = provision_path
  @data = CFPropertyList.native_types(read_profile)
end

Instance Method Details

#apns_and_app_same_environment?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/ipa_utilities/parsers.rb', line 91

def apns_and_app_same_environment?
  release_build? == production_apns?
end

#apns_environmentObject



112
113
114
# File 'lib/ipa_utilities/parsers.rb', line 112

def apns_environment
  production_apns? ? "Production" : "Development (Sandbox)"
end

#apns_gatewayObject



116
117
118
# File 'lib/ipa_utilities/parsers.rb', line 116

def apns_gateway
  production_apns? ? "gateway.push.apple.com:2195" : "gateway.sandbox.push.apple.com:2195"
end

#app_store_build?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/ipa_utilities/parsers.rb', line 87

def app_store_build?
  provisioned_devices.nil?
end

#build_environmentObject



120
121
122
123
124
125
126
# File 'lib/ipa_utilities/parsers.rb', line 120

def build_environment
  if release_build?
    app_store_build? ? "Distribution" : "AdHoc"
  else
    "Development"
  end
end

#bundle_idObject



95
96
97
98
# File 'lib/ipa_utilities/parsers.rb', line 95

def bundle_id
  identifier = @data["Entitlements"]["application-identifier"]
  identifier[/#{team_identifier}\.(.*)/, 1]
end

#certificatesObject



67
68
69
# File 'lib/ipa_utilities/parsers.rb', line 67

def certificates
  @data["DeveloperCertificates"]
end

#display_nameObject



104
105
106
# File 'lib/ipa_utilities/parsers.rb', line 104

def display_name
  @data["Name"]
end

#production_apns?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/ipa_utilities/parsers.rb', line 75

def production_apns?
  @data["Entitlements"]["aps-environment"] == "production"
end

#provisioned_devicesObject



71
72
73
# File 'lib/ipa_utilities/parsers.rb', line 71

def provisioned_devices
  @data["ProvisionedDevices"]
end

#release_build?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/ipa_utilities/parsers.rb', line 79

def release_build?
  !@data["Entitlements"]["get-task-allow"]
end

#signing_entitlement(new_bundle_id) ⇒ Object



128
129
130
131
132
133
134
135
136
# File 'lib/ipa_utilities/parsers.rb', line 128

def signing_entitlement(new_bundle_id)
  bundle_to_write = "#{team_identifier}.#{new_bundle_id || bundle_id}"
  puts "Bundle identifier: #{bundle_to_write}"

  file_path = File.expand_path("#{__FILE__}/../../resources/Original.Entitlements.plist")
  file = File.read(file_path)
  file.sub!("BUNDLE_ID", bundle_to_write)
  file.sub!("GET_TASK_ALLOW", release_build? ? "false" : "true")
end

#signing_identitiesObject



63
64
65
# File 'lib/ipa_utilities/parsers.rb', line 63

def signing_identities
  certificates.map { |identity| SigningIdentity.from_base64(Base64.encode64(identity)) }
end

#task_allow?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/ipa_utilities/parsers.rb', line 83

def task_allow?
  @data["Entitlements"]["get-task-allow"]
end

#team_identifierObject



108
109
110
# File 'lib/ipa_utilities/parsers.rb', line 108

def team_identifier
  @data["Entitlements"]["com.apple.developer.team-identifier"]
end

#team_nameObject



100
101
102
# File 'lib/ipa_utilities/parsers.rb', line 100

def team_name
  @data["TeamName"]
end

#uuidObject



59
60
61
# File 'lib/ipa_utilities/parsers.rb', line 59

def uuid
  @data["UUID"]
end