lib/match/runner.rb in match-0.2.5 vs lib/match/runner.rb in match-0.3.0

- old
+ new

@@ -72,10 +72,15 @@ profile_name = [Match::Generator.profile_type_name(prov_type), params[:app_identifier]].join("_").gsub("*", '\*') # this is important, as it shouldn't be a wildcard profiles = Dir[File.join(params[:workspace], "profiles", prov_type.to_s, "#{profile_name}.mobileprovision")] # Install the provisioning profiles profile = profiles.last + + if params[:force_for_new_devices] + params[:force] = device_count_different?(profile: profile) unless params[:force] + end + if profile.nil? or params[:force] UI.crash!("No matching provisioning profiles found and can not create a new one because you enabled `readonly`") if params[:readonly] profile = Generator.generate_provisioning_profile(params: params, prov_type: prov_type, certificate_id: certificate_id) @@ -87,8 +92,23 @@ parsed = FastlaneCore::ProvisioningProfile.parse(profile) uuid = parsed["UUID"] Utils.fill_environment(params, uuid) return uuid + end + + def device_count_different?(profile: nil) + if profile + parsed = FastlaneCore::ProvisioningProfile.parse(profile) + uuid = parsed["UUID"] + portal_profile = Spaceship.provisioning_profile.all.detect { |i| i.uuid == uuid } + + if portal_profile + profile_device_count = portal_profile.devices.count + portal_device_count = Spaceship.device.all.count + return portal_device_count != profile_device_count + end + end + return false end end end