Class: Fastlane::Actions::AddAppVarAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AddAppVarAction
- Defined in:
- lib/fastlane/plugin/react_native_release/actions/add_app_var.rb
Documentation collapse
-
.app_key_for(namespace) ⇒ Object
Returns the app key for cryptex.
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.app_key_for(namespace) ⇒ Object
Returns the app key for cryptex. optionally namespaced
99 100 101 102 103 104 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 99 def self.app_key_for(namespace) default_app_key = Helper::ReactNativeReleaseHelper::APP_CRYPTEX_KEY return default_app_key if namespace.strip.empty? "#{namespace}_#{default_app_key}" end |
.authors ⇒ Object
89 90 91 92 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 89 def self. # So no one will ever forget your contribution to fastlane :) You are awesome btw! ["cball", "isaiahgrey93","cmejet"] end |
.available_options ⇒ Object
51 52 53 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 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 51 def self. [ FastlaneCore::ConfigItem.new(key: :namespace, env_name: "FL_ADD_APP_VAR_NAMESPACE", description: "What namespace should we use? (alpha, beta, release, ENTER = root)", # a short description of this parameter type: String, verify_block: lambda do |value| unless Helper::ReactNativeReleaseHelper::VALID_NAMESPACES.include?(value) UI.user_error!("Invalid namespace #{value}. Valid targets are #{Helper::ReactNativeReleaseHelper::VALID_NAMESPACES.join(', ')}") next end end), FastlaneCore::ConfigItem.new(key: :key, env_name: "FL_ADD_APP_VAR_KEY", description: "Enter the ENV name", type: String), FastlaneCore::ConfigItem.new(key: :value, env_name: "FL_ADD_APP_VAR_VALUE", description: "Enter the ENV value", type: String), FastlaneCore::ConfigItem.new(key: :skip_confirmation, env_name: "FL_ENCRYPT_APP_VARS_SKIP_CONFIRMATION", # The name of the environment variable description: "Allows commands to be run from within CLI and skip the UI.message confirmation dialog", # a short description of this parameter type: Boolean, short_option:'s', default_value: false, optional: true), ] end |
.description ⇒ Object
42 43 44 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 42 def self.description "Adds a single ENV var to the encrypted repository" end |
.details ⇒ Object
46 47 48 49 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 46 def self.details # Optional: # this is your chance to provide a more detailed description of this action end |
.is_supported?(platform) ⇒ Boolean
94 95 96 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 94 def self.is_supported?(platform) [:ios, :android].include?(platform) end |
.return_value ⇒ Object
81 82 83 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 81 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
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 33 34 35 36 |
# File 'lib/fastlane/plugin/react_native_release/actions/add_app_var.rb', line 7 def self.run(params) is_ci = ENV['CI'] === 'true' namespace = params[:namespace] key = params[:key] value = params[:value] skip_confirmation= params[:skip_confirmation] cryptex_app_key = app_key_for(namespace) existing_app_vars = {} if !is_ci && !skip_confirmation && !UI.confirm("This will add #{key}=#{value} to the #{cryptex_app_key} namespace in the encrypted context repo. Proceed?") UI.("Stepping away...") end begin existing_app_vars = other_action.cryptex( type: 'export_env', key: cryptex_app_key, ) rescue => ex # If key doesn't exist cryptex will error end other_action.cryptex( type: "import_env", key: cryptex_app_key, hash: existing_app_vars.merge({ key => value }) ) UI.success('Encrypted app ENV vars') end |