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_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, ]
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #for_ps1? ⇒ Boolean
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
- #latest_version? ⇒ Boolean
-
#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.
43 44 45 46 47 |
# File 'lib/mixlib/install/options.rb', line 43 def initialize() @options = validate! end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
27 28 29 |
# File 'lib/mixlib/install/options.rb', line 27 def @options end |
Instance Method Details
#for_ps1? ⇒ Boolean
71 72 73 |
# File 'lib/mixlib/install/options.rb', line 71 def for_ps1? platform == "windows" || shell_type == :ps1 end |
#latest_version? ⇒ Boolean
75 76 77 |
# File 'lib/mixlib/install/options.rb', line 75 def latest_version? product_version.to_sym == :latest end |
#set_platform_info(info) ⇒ Object
Set the platform info on the instance info [Hash]
Hash with keys :platform, :platform_version and :architecture
84 85 86 87 88 89 90 |
# File 'lib/mixlib/install/options.rb', line 84 def set_platform_info(info) [:platform] = info[:platform] [:platform_version] = info[:platform_version] [:architecture] = info[:architecture] end |
#validate! ⇒ Object
49 50 51 |
# File 'lib/mixlib/install/options.rb', line 49 def validate! end |
#validate_options! ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mixlib/install/options.rb', line 53 def errors = [] errors << validate_product_names errors << validate_channels errors << validate_shell_type unless errors.compact.empty? raise InvalidOptions, errors.join("\n") end end |