Class: Fastlane::Actions::ModifyServicesAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::ModifyServicesAction
- Defined in:
- fastlane/lib/fastlane/actions/modify_services.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .allowed_services_description ⇒ Object
- .author ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
- .service_object ⇒ Object
- .services_mapping ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.allowed_services_description ⇒ Object
72 73 74 75 76 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 72 def self.allowed_services_description return Produce::DeveloperCenter::ALLOWED_SERVICES.map do |k, v| "#{k}: (#{v.join('|')})" end.join(", ") end |
.author ⇒ Object
145 146 147 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 145 def self. "bhimsenpadalkar" end |
.available_options ⇒ Object
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 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 88 def self. require 'produce' user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id) user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :username, short_option: "-u", env_name: "PRODUCE_USERNAME", description: "Your Apple ID Username", default_value: user, default_value_dynamic: true), FastlaneCore::ConfigItem.new(key: :app_identifier, env_name: "PRODUCE_APP_IDENTIFIER", short_option: "-a", description: "App Identifier (Bundle ID, e.g. com.krausefx.app)", code_gen_sensitive: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier), default_value_dynamic: true), FastlaneCore::ConfigItem.new(key: :services, display_in_shell: false, env_name: "PRODUCE_ENABLE_SERVICES", description: "Array with Spaceship App Services (e.g. #{allowed_services_description})", is_string: false, type: Hash, default_value: {}, verify_block: proc do |value| allowed_keys = Produce::DeveloperCenter::ALLOWED_SERVICES.keys UI.user_error!("enable_services has to be of type Hash") unless value.kind_of?(Hash) value.each do |key, v| UI.user_error!("The key: '#{key}' is not supported in `enable_services' - following keys are available: [#{allowed_keys.join(',')}]") unless allowed_keys.include?(key.to_sym) end end), FastlaneCore::ConfigItem.new(key: :team_id, short_option: "-b", env_name: "PRODUCE_TEAM_ID", description: "The ID 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_id), default_value_dynamic: true, verify_block: proc do |value| ENV["FASTLANE_TEAM_ID"] = value.to_s end), FastlaneCore::ConfigItem.new(key: :team_name, short_option: "-l", env_name: "PRODUCE_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) ] end |
.category ⇒ Object
166 167 168 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 166 def self.category :misc end |
.description ⇒ Object
78 79 80 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 78 def self.description 'Modifies the services of the app created on Developer Portal' end |
.details ⇒ Object
82 83 84 85 86 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 82 def self.details [ "The options are the same as `:enable_services` in the [produce action](https://docs.fastlane.tools/actions/produce/#parameters_1)" ].join("\n") end |
.example_code ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 153 def self.example_code [ 'modify_services( username: "[email protected]", app_identifier: "com.someorg.app", services: { push_notification: "on", associated_domains: "off" } )' ] end |
.is_supported?(platform) ⇒ Boolean
149 150 151 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 149 def self.is_supported?(platform) platform == :ios end |
.run(params) ⇒ Object
4 5 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 'fastlane/lib/fastlane/actions/modify_services.rb', line 4 def self.run(params) require 'produce' return if Helper.test? Produce.config = params Dir.chdir(FastlaneCore::FastlaneFolder.path || Dir.pwd) do require 'produce/service' services = params[:services] enabled_services = services.reject { |k, v| v == 'off' } disabled_services = services.select { |k, v| v == 'off' } enabled_services_object = self.service_object enabled_services.each do |k, v| enabled_services_object.__hash__[k] = true enabled_services_object.send("#{k}=", v) end Produce::Service.enable(enabled_services_object, nil) unless enabled_services.empty? disabled_services_object = self.service_object disabled_services.each do |k, v| disabled_services_object.__hash__[k] = true disabled_services_object.send("#{k}=", v) end Produce::Service.disable(disabled_services_object, nil) unless disabled_services.empty? end end |
.service_object ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'fastlane/lib/fastlane/actions/modify_services.rb', line 34 def self.service_object service_object = Object.new service_object.class.module_eval { attr_accessor :__hash__ } service_object.__hash__ = {} Produce::DeveloperCenter::ALLOWED_SERVICES.keys.each do |service| name = self.services_mapping[service] service_object.class.module_eval { attr_accessor :"#{name}" } end service_object end |
.services_mapping ⇒ Object
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/modify_services.rb', line 45 def self.services_mapping { app_group: 'app_group', apple_pay: 'apple_pay', associated_domains: 'associated_domains', auto_fill_credential: 'auto_fill_credential', data_protection: 'data_protection', game_center: 'game_center', health_kit: 'healthkit', home_kit: 'homekit', hotspot: 'hotspot', icloud: 'icloud', in_app_purchase: 'in_app_purchase', inter_app_audio: 'inter_app_audio', multipath: 'multipath', network_extension: 'network_extension', nfc_tag_reading: 'nfc_tag_reading', personal_vpn: 'personal_vpn', passbook: 'passbook', push_notification: 'push_notification', siri_kit: 'sirikit', vpn_configuration: 'vpn_conf', wallet: 'wallet', wireless_accessory: 'wireless_conf' } end |