spaceship/lib/spaceship/portal/provisioning_profile.rb in fastlane-2.19.0.beta.20170227010016 vs spaceship/lib/spaceship/portal/provisioning_profile.rb in fastlane-2.19.0.beta.20170228010016
- old
+ new
@@ -274,11 +274,11 @@
end
return profiles if self == ProvisioningProfile
# To distinguish between AppStore and AdHoc profiles, we need to send
- # a details request (see `fetch_details`). This is an expensive operation
+ # a details request (see `profile_details`). This is an expensive operation
# which we can't do for every single provisioning profile
# Instead we'll treat App Store profiles the same way as Ad Hoc profiles
# Spaceship::ProvisioningProfile::AdHoc.all will return the same array as
# Spaceship::ProvisioningProfile::AppStore.all, containing only AppStore
# profiles. To determine if it's an Ad Hoc profile, you can use the
@@ -458,36 +458,30 @@
def tvos?
sub_platform == 'tvOS'
end
def devices
- fetch_details
-
if (@devices || []).empty?
@devices = (self.profile_details["devices"] || []).collect do |device|
Device.set_client(client).factory(device)
end
end
@devices
end
def certificates
- fetch_details
-
if (@certificates || []).empty?
@certificates = (profile_details["certificates"] || []).collect do |cert|
Certificate.set_client(client).factory(cert)
end
end
@certificates
end
def app
- fetch_details
-
App.set_client(client).new(profile_details['appId'])
end
# @return (Bool) Is this current provisioning profile adhoc?
# AppStore and AdHoc profiles are the same except that AdHoc has devices
@@ -495,15 +489,14 @@
return false unless self.kind_of?(AppStore) || self.kind_of?(AdHoc)
return devices.count > 0
end
- private
-
- def fetch_details
+ # This is an expensive operation as it triggers a new request
+ def profile_details
# Since 15th September 2016 certificates and devices are hidden behind another request
# see https://github.com/fastlane/fastlane/issues/6137 for more information
- self.profile_details ||= client.provisioning_profile_details(provisioning_profile_id: self.id, mac: mac?)
+ @profile_details ||= client.provisioning_profile_details(provisioning_profile_id: self.id, mac: mac?)
end
end
end
end