Class: Produce::Service
- Inherits:
-
Object
- Object
- Produce::Service
- Defined in:
- produce/lib/produce/service.rb
Class Method Summary collapse
Instance Method Summary collapse
- #app ⇒ Object
- #disable(options, _args) ⇒ Object
- #enable(options, _args) ⇒ Object
-
#update(on, app, options) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity.
- #valid_services_for(options) ⇒ Object
Class Method Details
.disable(options, args) ⇒ Object
10 11 12 |
# File 'produce/lib/produce/service.rb', line 10 def self.disable(, args) self.new.disable(, args) end |
.enable(options, args) ⇒ Object
6 7 8 |
# File 'produce/lib/produce/service.rb', line 6 def self.enable(, args) self.new.enable(, args) end |
Instance Method Details
#app ⇒ Object
308 309 310 311 312 313 314 315 316 317 |
# File 'produce/lib/produce/service.rb', line 308 def app return @app if @app UI.("Starting login with user '#{Produce.config[:username]}'") Spaceship.login(Produce.config[:username], nil) Spaceship.select_team UI.("Successfully logged in") @app ||= Spaceship.app.find(Produce.config[:app_identifier].to_s) end |
#disable(options, _args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'produce/lib/produce/service.rb', line 26 def disable(, _args) unless app UI.("[DevCenter] App '#{Produce.config[:app_identifier]}' does not exist") return end UI.success("[DevCenter] App found '#{app.name}'") UI.("Disabling services") disabled = update(false, app, ) UI.success("Done! Disabled #{disabled} services.") end |
#enable(options, _args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'produce/lib/produce/service.rb', line 14 def enable(, _args) unless app UI.("[DevCenter] App '#{Produce.config[:app_identifier]}' does not exist") return end UI.success("[DevCenter] App found '#{app.name}'") UI.("Enabling services") enabled = update(true, app, ) UI.success("Done! Enabled #{enabled} services.") end |
#update(on, app, options) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'produce/lib/produce/service.rb', line 47 def update(on, app, ) updated = valid_services_for().count if .access_wifi UI.("\tAccess WiFi") if on app.update_service(Spaceship.app_service.access_wifi.on) else app.update_service(Spaceship.app_service.access_wifi.off) end end if .app_group UI.("\tApp Groups") if on app.update_service(Spaceship.app_service.app_group.on) else app.update_service(Spaceship.app_service.app_group.off) end end if .apple_pay UI.("\tApple Pay") if on app.update_service(Spaceship.app_service.apple_pay.on) else app.update_service(Spaceship.app_service.apple_pay.off) end end if .associated_domains UI.("\tAssociated Domains") if on app.update_service(Spaceship.app_service.associated_domains.on) else app.update_service(Spaceship.app_service.associated_domains.off) end end if .auto_fill_credential UI.("\tAutoFill Credential") if on app.update_service(Spaceship.app_service.auto_fill_credential.on) else app.update_service(Spaceship.app_service.auto_fill_credential.off) end end if .data_protection UI.("\tData Protection") if on case .data_protection when "complete" app.update_service(Spaceship.app_service.data_protection.complete) when "unlessopen" app.update_service(Spaceship.app_service.data_protection.unless_open) when "untilfirstauth" app.update_service(Spaceship.app_service.data_protection.until_first_auth) else UI.user_error!("Unknown service '#{.data_protection}'. Valid values: 'complete', 'unlessopen', 'untilfirstauth'") end else app.update_service(Spaceship.app_service.data_protection.off) end end if .game_center UI.("\tGame Center") if on app.update_service(Spaceship.app_service.game_center.on) else app.update_service(Spaceship.app_service.game_center.off) end end if .healthkit UI.("\tHealthKit") if on app.update_service(Spaceship.app_service.health_kit.on) else app.update_service(Spaceship.app_service.health_kit.off) end end if .homekit UI.("\tHomeKit") if on app.update_service(Spaceship.app_service.home_kit.on) else app.update_service(Spaceship.app_service.home_kit.off) end end if .wallet UI.("\tWallet") if on app.update_service(Spaceship.app_service.wallet.on) else app.update_service(Spaceship.app_service.wallet.off) end end if .wireless_conf UI.("\tWireless Accessory Configuration") if on app.update_service(Spaceship.app_service.wireless_accessory.on) else app.update_service(Spaceship.app_service.wireless_accessory.off) end end if .icloud UI.("\tiCloud") if on case .icloud when "legacy" app.update_service(Spaceship.app_service.cloud.on) app.update_service(Spaceship.app_service.cloud_kit.xcode5_compatible) when "cloudkit" app.update_service(Spaceship.app_service.cloud.on) app.update_service(Spaceship.app_service.cloud_kit.cloud_kit) else UI.user_error!("Unknown service '#{.icloud}'. Valid values: 'legacy', 'cloudkit'") end else app.update_service(Spaceship.app_service.cloud.off) end end if .in_app_purchase UI.("\tIn-App Purchase") if on app.update_service(Spaceship.app_service.in_app_purchase.on) else app.update_service(Spaceship.app_service.in_app_purchase.off) end end if .inter_app_audio UI.("\tInter-App Audio") if on app.update_service(Spaceship.app_service.inter_app_audio.on) else app.update_service(Spaceship.app_service.inter_app_audio.off) end end if .personal_vpn UI.("\tPersonal VPN") if on app.update_service(Spaceship.app_service.personal_vpn.on) else app.update_service(Spaceship.app_service.personal_vpn.off) end end # deprecated if .passbook UI.("\tPassbook") if on app.update_service(Spaceship.app_service.passbook.on) else app.update_service(Spaceship.app_service.passbook.off) end end if .push_notification UI.("\tPush Notifications") if on # Don't enable push notifications if already enabled # Enabling push notifications when already on revokes certs # https://github.com/fastlane/fastlane/issues/15315 # https://github.com/fastlane/fastlane/issues/8883 unless app.details.enable_services.include?("push") app.update_service(Spaceship.app_service.push_notification.on) end else app.update_service(Spaceship.app_service.push_notification.off) end end if .sirikit UI.("\tSiriKit") if on app.update_service(Spaceship.app_service.siri_kit.on) else app.update_service(Spaceship.app_service.siri_kit.off) end end # deprecated if .vpn_conf UI.("\tVPN Configuration") if on app.update_service(Spaceship.app_service.vpn_configuration.on) else app.update_service(Spaceship.app_service.vpn_configuration.off) end end if .network_extension UI.("\tNetwork Extension") if on app.update_service(Spaceship.app_service.network_extension.on) else app.update_service(Spaceship.app_service.network_extension.off) end end if .hotspot UI.("\tHotspot") if on app.update_service(Spaceship.app_service.hotspot.on) else app.update_service(Spaceship.app_service.hotspot.off) end end if .multipath UI.("\tMultipath") if on app.update_service(Spaceship.app_service.multipath.on) else app.update_service(Spaceship.app_service.multipath.off) end end if .nfc_tag_reading UI.("\tNFC Tag Reading") if on app.update_service(Spaceship.app_service.nfc_tag_reading.on) else app.update_service(Spaceship.app_service.nfc_tag_reading.off) end end updated end |
#valid_services_for(options) ⇒ Object
38 39 40 41 42 43 44 |
# File 'produce/lib/produce/service.rb', line 38 def valid_services_for() allowed_keys = [:access_wifi, :app_group, :apple_pay, :associated_domains, :auto_fill_credential, :data_protection, :game_center, :healthkit, :homekit, :hotspot, :icloud, :in_app_purchase, :inter_app_audio, :multipath, :network_extension, :nfc_tag_reading, :personal_vpn, :passbook, :push_notification, :sirikit, :vpn_conf, :wallet, :wireless_conf] .__hash__.select { |key, value| allowed_keys.include?(key) } end |