Class: Fastlane::Actions::RetrieveDevicesAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::RetrieveDevicesAction
- Defined in:
- lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
96 97 98 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 96 def self. ["builtbyproxy"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 56 def self. user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id) user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :api_key_path, env_names: ["FL_RETRIEVE_DEVICES_API_KEY_PATH", "APP_STORE_CONNECT_API_KEY_PATH"], description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)", optional: true, conflicting_options: [:api_key], verify_block: proc do |value| UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :api_key, env_names: ["FL_RETRIEVE_DEVICES_API_KEY", "APP_STORE_CONNECT_API_KEY"], description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)", type: Hash, default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY], default_value_dynamic: true, optional: true, sensitive: true, conflicting_options: [:api_key_path]), FastlaneCore::ConfigItem.new(key: :username, env_name: "DELIVER_USER", description: "Optional: Your Apple ID", optional: true, default_value: user, default_value_dynamic: true) ] end |
.category ⇒ Object
104 105 106 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 104 def self.category :misc end |
.description ⇒ Object
45 46 47 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 45 def self.description "This action will retrieve a list of each device registered with Apple" end |
.details ⇒ Object
49 50 51 52 53 54 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 49 def self.details [ "This action will retrieve a list of names and UDIDs of each device registered with your Apple Certificate.", "This list is exactly the same as the list used to compare against what is/isn't registered in the `register_device/s` action." ].join("\n") end |
.is_supported?(platform) ⇒ Boolean
100 101 102 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 100 def self.is_supported?(platform) [:ios, :mac].include?(platform) end |
.output ⇒ Object
87 88 89 90 91 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 87 def self.output [ ['DEVICES_FOR_APPLE_CERTIFICATE', 'A hash with the Name and UDID of each device registered with Apple'] ] end |
.return_value ⇒ Object
93 94 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 93 def self.return_value end |
.run(params) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fastlane/plugin/retrieve_devices/actions/retrieve_devices_action.rb', line 11 def self.run(params) require 'spaceship' UI.("The retrieve_devices plugin is working!") if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path])) UI.("Creating authorization token for App Store Connect API") Spaceship::ConnectAPI.token = api_token elsif !Spaceship::ConnectAPI.token.nil? UI.("Using existing authorization token for App Store Connect API") else UI.("Login to App Store Connect (#{params[:username]})") UI.("\033[0;35mConsider using https://onetomany.dev/ to share the mobile MFA from your apple account if you are sharing an apple account\033[0m") credentials = CredentialsManager::AccountManager.new(user: params[:username]) Spaceship::ConnectAPI.login(credentials.user, credentials.password, use_portal: true, use_tunes: false) UI.("Login successful") end UI.("Fetching list of currently registered devices...") existing_devices = Spaceship::ConnectAPI::Device.all.map { |ed| { name: ed.name, udid: ed.udid } } UI.success("Successfully retrieved the following devices") existing_devices.each do |ed| UI.("UDID: #{ed[:udid]} | NAME: #{ed[:name]}") end Actions.lane_context[SharedValues::DEVICES_FOR_APPLE_CERTIFICATE] = existing_devices end |