Class: Produce::CloudContainer
- Inherits:
-
Object
- Object
- Produce::CloudContainer
- Defined in:
- produce/lib/produce/cloud_container.rb
Instance Method Summary collapse
- #app_exists? ⇒ Boolean
- #app_identifier ⇒ Object
- #associate(_options, args) ⇒ Object
- #container_exists?(identifier) ⇒ Boolean
- #create(options, _args) ⇒ Object
- #login ⇒ Object
Instance Method Details
#app_exists? ⇒ Boolean
78 79 80 |
# File 'produce/lib/produce/cloud_container.rb', line 78 def app_exists? Spaceship.app.find(app_identifier) != nil end |
#app_identifier ⇒ Object
70 71 72 |
# File 'produce/lib/produce/cloud_container.rb', line 70 def app_identifier Produce.config[:app_identifier].to_s end |
#associate(_options, args) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'produce/lib/produce/cloud_container.rb', line 34 def associate(, args) login if !app_exists? UI.("[DevCenter] App '#{Produce.config[:app_identifier]}' does not exist, nothing to associate with the containers") else app = Spaceship.app.find(app_identifier) UI.user_error!("Something went wrong when fetching the app - it's not listed in the apps list") if app.nil? new_containers = [] UI.("Validating containers before association") args.each do |container_identifier| if !container_exists?(container_identifier) UI.("[DevCenter] iCloud Container '#{container_identifier}' does not exist, please create it first, skipping for now") else new_containers.push(Spaceship.cloud_container.find(container_identifier)) end end UI.("Finalising association with #{new_containers.count} containers") app.associate_cloud_containers(new_containers) UI.success("Done!") end return true end |
#container_exists?(identifier) ⇒ Boolean
74 75 76 |
# File 'produce/lib/produce/cloud_container.rb', line 74 def container_exists?(identifier) Spaceship.cloud_container.find(identifier) != nil end |
#create(options, _args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'produce/lib/produce/cloud_container.rb', line 6 def create(, _args) login container_identifier = .container_identifier || UI.input("iCloud Container identifier: ") if container_exists?(container_identifier) UI.success("[DevCenter] iCloud Container '#{.container_name} (#{.container_identifier})' already exists, nothing to do on the Dev Center") # Nothing to do here else container_name = .container_name || container_identifier.gsub('.', ' ') UI.success("Creating new iCloud Container '#{container_name}' with identifier '#{container_identifier}' on the Apple Dev Center") container = Spaceship.cloud_container.create!(identifier: container_identifier, name: container_name) if container.name != container_name UI.important("Your container name includes non-ASCII characters, which are not supported by the Apple Developer Portal.") UI.important("To fix this a unique (internal) name '#{container.name}' has been created for you.") end UI.("Created iCloud Container #{container.cloud_container}") UI.user_error!("Something went wrong when creating the new iCloud Container - it's not listed in the iCloud Container list") unless container_exists?(container_identifier) UI.success("Finished creating new iCloud Container '#{container_name}' on the Dev Center") end return true end |