Class: Fastlane::Actions::RegisterDeviceAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::RegisterDeviceAction
- Defined in:
- fastlane/lib/fastlane/actions/register_device.rb
Constant Summary collapse
- UDID_REGEXP =
/^\h{40}$/
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_type ⇒ Object
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, deprecated_notes, lane_context, method_missing, other_action, output, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.author ⇒ Object
80 81 82 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 80 def self. "pvinis" end |
.available_options ⇒ Object
33 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 62 63 64 65 66 67 68 69 70 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 33 def self. user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id) user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :name, env_name: "FL_REGISTER_DEVICE_NAME", description: "Provide the name of the device to register as"), FastlaneCore::ConfigItem.new(key: :udid, env_name: "FL_REGISTER_DEVICE_UDID", description: "Provide the UDID of the device to register as"), FastlaneCore::ConfigItem.new(key: :team_id, env_name: "REGISTER_DEVICE_TEAM_ID", code_gen_sensitive: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id), default_value_dynamic: true, description: "The ID of your Developer Portal team if you're in multiple teams", optional: true, verify_block: proc do |value| ENV["FASTLANE_TEAM_ID"] = value.to_s end), FastlaneCore::ConfigItem.new(key: :team_name, env_name: "REGISTER_DEVICE_TEAM_NAME", description: "The name of your Developer Portal team if you're in multiple teams", optional: true, code_gen_sensitive: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_name), default_value_dynamic: true, verify_block: proc do |value| ENV["FASTLANE_TEAM_NAME"] = value.to_s end), FastlaneCore::ConfigItem.new(key: :username, env_name: "DELIVER_USER", description: "Optional: Your Apple ID", default_value: user, default_value_dynamic: true) ] end |
.category ⇒ Object
103 104 105 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 103 def self.category :code_signing end |
.description ⇒ Object
29 30 31 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 29 def self.description "Registers a new device to the Apple Dev Portal" end |
.details ⇒ Object
72 73 74 75 76 77 78 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 72 def self.details [ "This will register an iOS device with the Developer Portal so that you can include it in your provisioning profiles.", "This is an optimistic action, in that it will only ever add a device to the member center. If the device has already been registered within the member center, it will be left alone in the member center.", "The action will connect to the Apple Developer Portal using the username you specified in your `Appfile` with `apple_id`, but you can override it using the `username` option." ].join("\n") end |
.example_code ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 84 def self.example_code [ 'register_device( name: "Luka iPhone 6", udid: "1234567890123456789012345678901234567890" ) # Simply provide the name and udid of the device', 'register_device( name: "Luka iPhone 6", udid: "1234567890123456789012345678901234567890", team_id: "XXXXXXXXXX", # Optional, if you"re a member of multiple teams, then you need to pass the team ID here. username: "[email protected]" # Optional, lets you override the Apple Member Center username. )' ] end |
.is_supported?(platform) ⇒ Boolean
8 9 10 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 8 def self.is_supported?(platform) platform == :ios end |
.return_type ⇒ Object
99 100 101 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 99 def self.return_type :string end |
.run(params) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'fastlane/lib/fastlane/actions/register_device.rb', line 12 def self.run(params) require 'spaceship' name = params[:name] udid = params[:udid] credentials = CredentialsManager::AccountManager.new(user: params[:username]) Spaceship.login(credentials.user, credentials.password) Spaceship.select_team UI.user_error!("Passed invalid UDID: #{udid} for device: #{name}") unless UDID_REGEXP =~ udid Spaceship::Device.create!(name: name, udid: udid) UI.success("Successfully registered new device") return udid end |