Method: FastlaneCore::ConfigItem#initialize
- Defined in:
- lib/fastlane_core/configuration/config_item.rb
#initialize(key: nil, env_name: nil, description: nil, short_option: nil, default_value: nil, verify_block: nil, is_string: true, type: nil, optional: nil, conflicting_options: nil, conflict_block: nil, deprecated: nil) ⇒ ConfigItem
Creates a new option
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 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fastlane_core/configuration/config_item.rb', line 20 def initialize(key: nil, env_name: nil, description: nil, short_option: nil, default_value: nil, verify_block: nil, is_string: true, type: nil, optional: nil, conflicting_options: nil, conflict_block: nil, deprecated: nil) 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 if short_option UI.user_error!("short_option must be a String of length 1") unless short_option.kind_of? String and 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") 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!] #{deprecated} - #{description}" end optional = false if optional.nil? @key = key @env_name = env_name @description = description @short_option = short_option @default_value = default_value @verify_block = verify_block @is_string = is_string @data_type = type @optional = optional @conflicting_options = @conflict_block = conflict_block @deprecated = deprecated end |