Class: Fastlane::Actions::ZealotSyncDevicesAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::ZealotSyncDevicesAction
- Extended by:
- Helper::ZealotHelper
- Defined in:
- lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb
Constant Summary
Constants included from Helper::ZealotHelper
Helper::ZealotHelper::UPLOAD_APP_PARAMS_KEYS
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .example_code ⇒ Object
- .is_supported?(_) ⇒ Boolean
Class Method Summary collapse
Methods included from Helper::ZealotHelper
avialable_upload_app_params, build_app_version_check_params, build_table_data, check_app_version, detect_ci_url, detect_source, gitlab?, hidden_keys, http_request, jenkins?, make_connection, print_table, show_error, sync_deivce, upload_app, upload_app_params, upload_debug_file, upload_debug_file_params
Class Method Details
.authors ⇒ Object
137 138 139 |
# File 'lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb', line 137 def self. ['icyleaf'] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb', line 54 def self. [ FastlaneCore::ConfigItem.new(key: :endpoint, env_name: 'ZEALOT_ENDPOINT', description: 'The endpoint of zealot', type: String), FastlaneCore::ConfigItem.new(key: :token, env_name: 'ZEALOT_TOKEN', description: 'The token of user', sensitive: true, verify_block: proc do |value| UI.user_error!("No user token for Zealot given, pass using `token: 'token'`") if value.nil? || value.empty? end, type: String), FastlaneCore::ConfigItem.new(key: :username, env_name: 'DELIVER_USER', description: 'The apple id (username) of Apple Developer Portal', default_value_dynamic: true, optional: true, type: String), FastlaneCore::ConfigItem.new(key: :team_id, env_name: 'ZEALOT_APPLE_TEAM_ID', description: 'The ID of your Developer Portal team if you\'re in multiple teams', default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id), default_value_dynamic: true, optional: true, type: String, verify_block: proc do |value| ENV["FASTLANE_TEAM_ID"] = value.to_s end), FastlaneCore::ConfigItem.new(key: :team_name, env_name: 'ZEALOT_APPLE_TEAM_NAME', description: 'The name of your Developer Portal team if you\'re in multiple teams', default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id), default_value_dynamic: true, optional: true, type: String, verify_block: proc do |value| ENV["FASTLANE_TEAM_NAME"] = value.to_s end), FastlaneCore::ConfigItem.new(key: :platform, env_name: 'ZEALOT_APPLE_PLATFORM', description: 'The platform to use (optional)', optional: true, default_value: 'ios', verify_block: proc do |value| UI.user_error!('The platform can only be ios or mac') unless %('ios', 'mac').include?(value) end), FastlaneCore::ConfigItem.new(key: :verify_ssl, env_name: 'ZEALOT_VERIFY_SSL', description: 'Should verify SSL of zealot service', optional: true, default_value: true, type: Boolean), FastlaneCore::ConfigItem.new(key: :timeout, env_name: 'ZEALOT_TIMEOUT', description: 'Request timeout in seconds', type: Integer, optional: true), FastlaneCore::ConfigItem.new(key: :fail_on_error, env_name: 'ZEALOT_FAIL_ON_ERROR', description: 'Should an error http request cause a failure? (true/false)', optional: true, default_value: false, type: Boolean) ] end |
.category ⇒ Object
133 134 135 |
# File 'lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb', line 133 def self.category :beta end |
.description ⇒ Object
50 51 52 |
# File 'lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb', line 50 def self.description 'Check app version exists from Zealot' end |
.example_code ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb', line 122 def self.example_code [ 'zealot_sync_devices( endpoint: "...", token: "...", username: "...", team_id: "..." )' ] end |
.is_supported?(_) ⇒ Boolean
141 142 143 |
# File 'lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb', line 141 def self.is_supported?(_) true end |
.run(params) ⇒ Object
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 40 41 42 43 44 |
# File 'lib/fastlane/plugin/zealot/actions/zealot_sync_devices.rb', line 13 def self.run(params) require 'spaceship' credentials = CredentialsManager::AccountManager.new(user: params[:username]) Spaceship.login(credentials.user, credentials.password) Spaceship.select_team UI.('Fetching list of currently registered devices...') all_platforms = Set[params[:platform]] supported_platforms = all_platforms.select { |platform| self.is_supported?(platform.to_sym) } devices = supported_platforms.flat_map { |platform| Spaceship::Device.all(mac: platform == "mac") } print_table(build_table_data(params, devices), title: 'zealot_sync_devices') UI.verbose("Syncing devices to #{params[:endpoint]} ...") failed_devices = [] devices.each do |device| begin sync_deivce(params, device) rescue Faraday::ConnectionFailed failed_devices << {udid: device.udid, error: 'Can not connecting to Zealot'} rescue Faraday::TimeoutError failed_devices << {udid: device.udid, error: 'Timed out to Zealot'} end end failed = failed_devices.size successed = devices.size - failed UI.success "Successful Synced devices. success: #{successed}, failed: #{failed}" UI.verbose "Failed devices: #{failed_devices}" end |