Class: Fastlane::Actions::FlintAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FlintAction
- Defined in:
- lib/fastlane/plugin/flint/actions/flint_action.rb
Direct Known Subclasses
FlintChangePasswordAction, FlintNukeAction, FlintSetupAction
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .fetch_keystore(params: nil, app_identifier: nil, password: nil) ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
14 15 16 |
# File 'lib/fastlane/plugin/flint/actions/flint_action.rb', line 14 def self. ['Jyrno Ader <[email protected]>'] end |
.available_options ⇒ Object
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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/fastlane/plugin/flint/actions/flint_action.rb', line 115 def self. user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id) user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :git_url, env_name: "FLINT_GIT_URL", description: "URL to the git repo containing all the keystores", optional: false, short_option: "-r"), FastlaneCore::ConfigItem.new(key: :full_name, env_name: "FLINT_FULL_NAME", description: "Full name of the owner of the keystores", optional: false, is_string: true, short_option: "-n"), FastlaneCore::ConfigItem.new(key: :orgization, env_name: "FLINT_ORGANIZATION", description: "Organization of the owner of the keystores", is_string: true, short_option: "-o", default_value: ""), FastlaneCore::ConfigItem.new(key: :orgization_unit, env_name: "FLINT_ORGANIZATION_UNIT", description: "Organization unit of the owner of the keystores", is_string: true, short_option: "-u", default_value: ""), FastlaneCore::ConfigItem.new(key: :city, env_name: "FLINT_CITY", description: "City of the owner of the keystores", optional: false, is_string: true, short_option: "-c"), FastlaneCore::ConfigItem.new(key: :state, env_name: "FLINT_STATE", description: "State of the owner of the keystores", optional: false, is_string: true, short_option: "-s"), FastlaneCore::ConfigItem.new(key: :country, env_name: "FLINT_COUNTRY", description: "Country of the owner of the keystores (2 letters, e.g EE)", optional: false, is_string: true, short_option: "-x"), FastlaneCore::ConfigItem.new(key: :git_branch, env_name: "FLINT_GIT_BRANCH", description: "Specific git branch to use", default_value: 'master'), FastlaneCore::ConfigItem.new(key: :type, env_name: "FLINT_TYPE", description: "Define the profile type, can be #{Flint.environments.join(', ')}", is_string: true, short_option: "-y", default_value: 'development', verify_block: proc do |value| unless Flint.environments.include?(value) UI.user_error!("Unsupported environment #{value}, must be in #{Flint.environments.join(', ')}") end end), FastlaneCore::ConfigItem.new(key: :app_identifier, short_option: "-a", env_name: "FLINT_APP_IDENTIFIER", description: "The bundle identifier(s) of your app (comma-separated)", is_string: false, type: Array, # we actually allow String and Array here skip_type_validation: true, code_gen_sensitive: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier), default_value_dynamic: true), FastlaneCore::ConfigItem.new(key: :readonly, env_name: "FLINT_READONLY", description: "Only fetch existing keystores, don't generate new ones", is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :git_full_name, env_name: "FLINT_GIT_FULL_NAME", description: "git user full name to commit", optional: true, default_value: nil), FastlaneCore::ConfigItem.new(key: :git_user_email, env_name: "FLINT_GIT_USER_EMAIL", description: "git user email to commit", optional: true, default_value: nil), FastlaneCore::ConfigItem.new(key: :verbose, env_name: "FLINT_VERBOSE", description: "Print out extra information and all commands", is_string: false, default_value: false, verify_block: proc do |value| FastlaneCore::Globals.verbose = true if value end), FastlaneCore::ConfigItem.new(key: :keystore_properties_path, env_name: "FLINT_KEYSTORE_PROPERTIES_PATH", description: "Set target path for keystore.properties fie", default_value: "../keystore.properties"), FastlaneCore::ConfigItem.new(key: :target_dir, env_name: "FLINT_TARGET_DIR", description: "Set target dir for flint keystores", default_value: "../app/"), FastlaneCore::ConfigItem.new(key: :skip_confirmation, env_name: "FLINT_SKIP_CONFIRMATION", description: "Disables confirmation prompts during nuke, answering them with yes", is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :shallow_clone, env_name: "FLINT_SHALLOW_CLONE", description: "Make a shallow clone of the repository (truncate the history to 1 revision)", is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :clone_branch_directly, env_name: "FLINT_CLONE_BRANCH_DIRECTLY", description: "Clone just the branch specified, instead of the whole repo. This requires that the branch already exists. Otherwise the command will fail", is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :workspace, description: nil, verify_block: proc do |value| unless Helper.test? if value.start_with?("/var/folders") || value.include?("tmp/") || value.include?("temp/") # that's fine else UI.user_error!("Specify the `git_url` instead of the `path`") end end end, optional: true), FastlaneCore::ConfigItem.new(key: :skip_docs, env_name: "FLINT_SKIP_DOCS", description: "Skip generation of a README.md for the created git repository", is_string: false, default_value: false) ] end |
.description ⇒ Object
10 11 12 |
# File 'lib/fastlane/plugin/flint/actions/flint_action.rb', line 10 def self.description Flint::DESCRIPTION end |
.details ⇒ Object
18 19 20 |
# File 'lib/fastlane/plugin/flint/actions/flint_action.rb', line 18 def self.details "Easily sync your keystores across your team using git" end |
.fetch_keystore(params: nil, app_identifier: nil, password: nil) ⇒ Object
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 |
# File 'lib/fastlane/plugin/flint/actions/flint_action.rb', line 69 def self.fetch_keystore(params: nil, app_identifier: nil, password: nil) cert_type = Flint.cert_type_sym(params[:type]) files_to_commmit = [] app_identifier = app_identifier.gsub! '.', '_' alias_name = "%s-%s" % [app_identifier, cert_type.to_s] keystore_name = "%s.keystore" % [alias_name] target_path = File.join(params[:target_dir], keystore_name) certs = Dir[File.join(params[:workspace], "certs", keystore_name)] if certs.count == 0 UI.important("Couldn't find a valid keystore in the git repo for #{cert_type}... creating one for you now") UI.crash!("No code signing keystore found and can not create a new one because you enabled `readonly`") if params[:readonly] cert_path = Flint::Generator.generate_keystore(params, keystore_name, alias_name, password) files_to_commmit << cert_path # install and activate the keystore UI.verbose("Installing keystore '#{keystore_name}'") Flint::Utils.import(cert_path, target_path, keystore_name, alias_name, password) Flint::Utils.activate(keystore_name, alias_name, password, params[:keystore_properties_path]) else cert_path = certs.last UI.("Installing keystore...") if Flint::Utils.installed?(cert_path, target_path) UI.verbose("Keystore '#{File.basename(cert_path)}' is already installed on this machine") else UI.verbose("Installing keystore '#{keystore_name}'") Flint::Utils.import(cert_path, target_path, keystore_name, alias_name, password) end # Print keystore info puts("") puts(Flint::Utils.get_keystore_info(cert_path, password)) puts("") # Activate the cert Flint::Utils.activate(keystore_name, alias_name, password, params[:keystore_properties_path]) end return File.basename(cert_path).gsub(".keystore", ""), files_to_commmit end |
.is_supported?(platform) ⇒ Boolean
252 253 254 255 256 257 258 |
# File 'lib/fastlane/plugin/flint/actions/flint_action.rb', line 252 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end |
.run(params) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 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 |
# File 'lib/fastlane/plugin/flint/actions/flint_action.rb', line 22 def self.run(params) params.load_configuration_file('Flintfile') FastlaneCore::PrintTable.print_values(config: params, hide_keys: [:workspace], title: "Summary for flint #{Fastlane::VERSION}") encrypt = Flint::Encrypt.new params[:workspace] = Flint::GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs], branch: params[:git_branch], git_full_name: params[:git_full_name], git_user_email: params[:git_user_email], clone_branch_directly: params[:clone_branch_directly], encrypt: encrypt) if params[:app_identifier].kind_of?(Array) app_identifiers = params[:app_identifier] else app_identifiers = params[:app_identifier].to_s.split(/\s*,\s*/).uniq end # sometimes we get an array with arrays, this is a bug. To unblock people using flint, I suggest we flatten! # then in the future address the root cause of https://github.com/fastlane/fastlane/issues/11324 app_identifiers.flatten! # Keystore password = encrypt.password(params[:git_url]) keystore_name, files_to_commmit = fetch_keystore(params: params, app_identifier: app_identifiers[0], password: password) # Done if files_to_commmit.count > 0 && !params[:readonly] = Flint::GitHelper.(params) Flint::GitHelper.commit_changes(params[:workspace], , params[:git_url], params[:git_branch], files_to_commmit, encrypt) end # Print a summary table for each app_identifier app_identifiers.each do |app_identifier| Flint::TablePrinter.print_summary(app_identifier: app_identifier, type: params[:type], keystore_name: keystore_name) end UI.success("All required keystores are installed 🙌".green) ensure Flint::GitHelper.clear_changes end |