Class: Mixlib::Install::Options
- Inherits:
-
Object
- Object
- Mixlib::Install::Options
- Defined in:
- lib/mixlib/install/options.rb
Defined Under Namespace
Classes: InvalidOptions
Constant Summary collapse
- SUPPORTED_ARCHITECTURES =
%w{ i386 powerpc ppc64 ppc64le s390x sparc x86_64 }
- SUPPORTED_CHANNELS =
[ :stable, :current, :unstable, ]
- SUPPORTED_PRODUCT_NAMES =
PRODUCT_MATRIX.products
- SUPPORTED_SHELL_TYPES =
[ :ps1, :sh, ]
- SUPPORTED_OPTIONS =
[ :architecture, :channel, :platform, :platform_version, :product_name, :product_version, :shell_type, :platform_version_compatibility_mode, :include_metadata, :user_agent_headers, ]
- SUPPORTED_WINDOWS_DESKTOP_VERSIONS =
%w{7 8 8.1 10}
- SUPPORTED_WINDOWS_NANO_VERSIONS =
%w{2016nano}
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#original_platform_version ⇒ Object
readonly
Returns the value of attribute original_platform_version.
Instance Method Summary collapse
- #for_ps1? ⇒ Boolean (also: #for_windows?)
- #include_metadata? ⇒ Boolean
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
- #latest_version? ⇒ Boolean
- #platform_info ⇒ Object
-
#resolve_platform_version_compatibility_mode! ⇒ Object
Calling this method will give queries more of an opportunity to collect compatible artifacts where there may not always be an exact match.
-
#set_platform_info(info) ⇒ Object
Set the platform info on the instance info [Hash] Hash with keys :platform, :platform_version and :architecture.
- #validate! ⇒ Object
- #validate_options! ⇒ Object
Constructor Details
#initialize(options) ⇒ Options
Returns a new instance of Options.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/mixlib/install/options.rb', line 69 def initialize() = @errors = [] # Store original platform version in cases where we must remap it @original_platform_version = [:platform_version] resolve_platform_version_compatibility_mode! map_windows_versions! validate! end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
28 29 30 |
# File 'lib/mixlib/install/options.rb', line 28 def errors @errors end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
28 29 30 |
# File 'lib/mixlib/install/options.rb', line 28 def end |
#original_platform_version ⇒ Object (readonly)
Returns the value of attribute original_platform_version.
28 29 30 |
# File 'lib/mixlib/install/options.rb', line 28 def original_platform_version @original_platform_version end |
Instance Method Details
#for_ps1? ⇒ Boolean Also known as: for_windows?
104 105 106 |
# File 'lib/mixlib/install/options.rb', line 104 def for_ps1? platform == "windows" || shell_type == :ps1 end |
#include_metadata? ⇒ Boolean
113 114 115 |
# File 'lib/mixlib/install/options.rb', line 113 def .to_s == "true" end |
#latest_version? ⇒ Boolean
109 110 111 |
# File 'lib/mixlib/install/options.rb', line 109 def latest_version? product_version.to_sym == :latest end |
#platform_info ⇒ Object
130 131 132 133 134 135 136 |
# File 'lib/mixlib/install/options.rb', line 130 def platform_info { platform: [:platform], platform_version: [:platform_version], architecture: [:architecture], } end |
#resolve_platform_version_compatibility_mode! ⇒ Object
Calling this method will give queries more of an opportunity to collect compatible artifacts where there may not always be an exact match.
This option is set to false by default.
-
In cases where no platform options are configured it will set this option to true.
-
In cases where all platform options are configured it will remain false UNLESS the option has been configured to be true.
147 148 149 150 151 |
# File 'lib/mixlib/install/options.rb', line 147 def resolve_platform_version_compatibility_mode! unless [:platform_version_compatibility_mode] [:platform_version_compatibility_mode] = true if platform_info.values.none? end end |
#set_platform_info(info) ⇒ Object
Set the platform info on the instance info [Hash]
Hash with keys :platform, :platform_version and :architecture
122 123 124 125 126 127 128 |
# File 'lib/mixlib/install/options.rb', line 122 def set_platform_info(info) [:platform] = info[:platform] [:platform_version] = info[:platform_version] [:architecture] = info[:architecture] end |
#validate! ⇒ Object
89 90 91 |
# File 'lib/mixlib/install/options.rb', line 89 def validate! end |
#validate_options! ⇒ Object
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/mixlib/install/options.rb', line 93 def validate_architecture validate_product_names validate_channels validate_shell_type validate_user_agent_headers raise InvalidOptions, errors.join("\n") unless errors.empty? end |