Method: FastlaneCore::ConfigItem#initialize
- Defined in:
- fastlane_core/lib/fastlane_core/configuration/config_item.rb
#initialize(key: nil, env_name: nil, env_names: nil, description: nil, short_option: nil, default_value: nil, default_value_dynamic: false, verify_block: nil, is_string: true, type: nil, skip_type_validation: false, optional: nil, conflicting_options: nil, conflict_block: nil, deprecated: nil, sensitive: nil, code_gen_sensitive: false, code_gen_default_value: nil, display_in_shell: true) ⇒ ConfigItem
Creates a new option rubocop:disable Metrics/ParameterLists rubocop:disable Metrics/PerceivedComplexity
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 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 |
# File 'fastlane_core/lib/fastlane_core/configuration/config_item.rb', line 96 def initialize(key: nil, env_name: nil, env_names: nil, description: nil, short_option: nil, default_value: nil, default_value_dynamic: false, verify_block: nil, is_string: true, type: nil, skip_type_validation: false, optional: nil, conflicting_options: nil, conflict_block: nil, deprecated: nil, sensitive: nil, code_gen_sensitive: false, code_gen_default_value: nil, display_in_shell: true) UI.user_error!("key must be a symbol") unless key.kind_of?(Symbol) UI.user_error!("env_name must be a String") unless (env_name || '').kind_of?(String) UI.user_error!("env_names must be an Array") unless (env_names || []).kind_of?(Array) (env_names || []).each do |name| UI.user_error!("env_names must only contain String") unless (name || '').kind_of?(String) end if short_option UI.user_error!("short_option for key :#{key} must of type String") unless short_option.kind_of?(String) UI.user_error!("short_option for key :#{key} must be a string of length 1") unless short_option.delete('-').length == 1 end if description UI.user_error!("Do not let descriptions end with a '.', since it's used for user inputs as well for key :#{key}") if description[-1] == '.' end if .each do |conflicting_option_key| UI.user_error!("Conflicting option key must be a symbol") unless conflicting_option_key.kind_of?(Symbol) end end if deprecated # deprecated options are automatically optional optional = true if optional.nil? UI.crash!("Deprecated option must be optional") unless optional # deprecated options are marked deprecated in their description description = deprecated_description(description, deprecated) end optional = false if optional.nil? sensitive = false if sensitive.nil? @key = key @env_name = env_name @env_names = [env_name].compact + (env_names || []) @description = description @short_option = short_option @default_value = default_value @default_value_dynamic = default_value_dynamic @verify_block = verify_block @is_string = is_string @data_type = type @data_type = String if type == :shell_string @optional = optional @conflicting_options = @conflict_block = conflict_block @deprecated = deprecated @sensitive = sensitive @code_gen_sensitive = code_gen_sensitive || sensitive @allow_shell_conversion = (type == :shell_string) @display_in_shell = display_in_shell @skip_type_validation = skip_type_validation # sometimes we allow multiple types which causes type validation failures, e.g.: export_options in gym @code_gen_default_value = code_gen_default_value update_code_gen_default_value_if_able! end |