Class: Match::ProfileIncludes
- Inherits:
-
Object
- Object
- Match::ProfileIncludes
- Defined in:
- match/lib/match/profile_includes.rb
Constant Summary collapse
- PROV_TYPES_WITH_DEVICES =
[:adhoc, :development]
- PROV_TYPES_WITH_MULTIPLE_CERTIFICATES =
[:development]
Class Method Summary collapse
- .can_force_include?(params:, notify:) ⇒ Boolean
- .can_force_include_all_certificates?(params:, notify: false) ⇒ Boolean
- .can_force_include_all_devices?(params:, notify: false) ⇒ Boolean
- .certificates_differ?(portal_profile:, platform:, cached_certificates:) ⇒ Boolean
- .devices_differ?(portal_profile:, platform:, include_mac_in_profiles:, cached_devices:) ⇒ Boolean
-
.should_force_include_all_certificates?(params:, portal_profile:, cached_certificates:) ⇒ Boolean
CERTIFICATES.
-
.should_force_include_all_devices?(params:, portal_profile:, cached_devices:) ⇒ Boolean
DEVICES.
Class Method Details
.can_force_include?(params:, notify:) ⇒ Boolean
9 10 11 12 |
# File 'match/lib/match/profile_includes.rb', line 9 def self.can_force_include?(params:, notify:) self.can_force_include_all_devices?(params: params, notify: notify) && self.can_force_include_all_certificates?(params: params, notify: notify) end |
.can_force_include_all_certificates?(params:, notify: false) ⇒ Boolean
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'match/lib/match/profile_includes.rb', line 78 def self.can_force_include_all_certificates?(params:, notify: false) return false if params[:readonly] || params[:force] return false unless params[:force_for_new_certificates] unless params[:include_all_certificates] UI.important("You specified 'force_for_new_certificates: true', but new certificates will not be added, cause 'include_all_certificates' is 'false'") if notify return false end provisioning_type = params[:type].to_sym can_force = PROV_TYPES_WITH_MULTIPLE_CERTIFICATES.include?(provisioning_type) if !can_force && notify # All other (not development) provisioning profiles don't contain # multiple certificates, thus shouldn't be renewed # if the certificates count has changed. UI.important("Warning: `force_for_new_certificates` is set but is ignored for non-'development' provisioning profiles.") UI.important("You can safely stop specifying `force_for_new_certificates` when running Match for '#{provisioning_type}' provisioning profiles.") end can_force end |
.can_force_include_all_devices?(params:, notify: false) ⇒ Boolean
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'match/lib/match/profile_includes.rb', line 28 def self.can_force_include_all_devices?(params:, notify: false) return false if params[:readonly] || params[:force] return false unless params[:force_for_new_devices] provisioning_type = params[:type].to_sym can_force = PROV_TYPES_WITH_DEVICES.include?(provisioning_type) if !can_force && notify # App Store provisioning profiles don't contain device identifiers and # thus shouldn't be renewed if the device count has changed. UI.important("Warning: `force_for_new_devices` is set but is ignored for #{provisioning_type}.") UI.important("You can safely stop specifying `force_for_new_devices` when running Match for type '#{provisioning_type}'.") end can_force end |
.certificates_differ?(portal_profile:, platform:, cached_certificates:) ⇒ Boolean
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'match/lib/match/profile_includes.rb', line 102 def self.certificates_differ?(portal_profile:, platform:, cached_certificates:) return false unless portal_profile profile_certs = portal_profile.certificates || [] portal_certs = cached_certificates portal_certs ||= Match::Portal::Fetcher.certificates(platform: platform, profile_type: portal_profile.profile_type) profile_certs_ids = profile_certs.map(&:id).sort portal_certs_ids = portal_certs.map(&:id).sort certificates_differ = profile_certs_ids != portal_certs_ids UI.important("Certificates in the profile and available on the portal differ. Recreating a profile") if certificates_differ return certificates_differ end |
.devices_differ?(portal_profile:, platform:, include_mac_in_profiles:, cached_devices:) ⇒ Boolean
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'match/lib/match/profile_includes.rb', line 46 def self.devices_differ?(portal_profile:, platform:, include_mac_in_profiles:, cached_devices:) return false unless portal_profile profile_devices = portal_profile.devices || [] portal_devices = cached_devices portal_devices ||= Match::Portal::Fetcher.devices(platform: platform, include_mac_in_profiles: include_mac_in_profiles) profile_device_ids = profile_devices.map(&:id).sort portal_devices_ids = portal_devices.map(&:id).sort devices_differs = profile_device_ids != portal_devices_ids UI.important("Devices in the profile and available on the portal differ. Recreating a profile") if devices_differs return devices_differs end |
.should_force_include_all_certificates?(params:, portal_profile:, cached_certificates:) ⇒ Boolean
CERTIFICATES
70 71 72 73 74 75 76 |
# File 'match/lib/match/profile_includes.rb', line 70 def self.should_force_include_all_certificates?(params:, portal_profile:, cached_certificates:) return false unless self.can_force_include_all_certificates?(params: params) force = certificates_differ?(portal_profile: portal_profile, platform: params[:platform], cached_certificates: cached_certificates) return force end |
.should_force_include_all_devices?(params:, portal_profile:, cached_devices:) ⇒ Boolean
DEVICES
20 21 22 23 24 25 26 |
# File 'match/lib/match/profile_includes.rb', line 20 def self.should_force_include_all_devices?(params:, portal_profile:, cached_devices:) return false unless self.can_force_include_all_devices?(params: params) force = devices_differ?(portal_profile: portal_profile, platform: params[:platform], include_mac_in_profiles: params[:include_mac_in_profiles], cached_devices: cached_devices) return force end |