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, ]
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
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
-
#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.
62 63 64 65 66 67 68 |
# File 'lib/mixlib/install/options.rb', line 62 def initialize() @options = map_windows_desktop_versions! if for_windows? validate! end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
28 29 30 |
# File 'lib/mixlib/install/options.rb', line 28 def @options end |
Instance Method Details
#for_ps1? ⇒ Boolean Also known as: for_windows?
94 95 96 |
# File 'lib/mixlib/install/options.rb', line 94 def for_ps1? platform == "windows" || shell_type == :ps1 end |
#include_metadata? ⇒ Boolean
103 104 105 |
# File 'lib/mixlib/install/options.rb', line 103 def .to_s == "true" end |
#latest_version? ⇒ Boolean
99 100 101 |
# File 'lib/mixlib/install/options.rb', line 99 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
112 113 114 115 116 117 118 |
# File 'lib/mixlib/install/options.rb', line 112 def set_platform_info(info) [:platform] = info[:platform] [:platform_version] = info[:platform_version] [:architecture] = info[:architecture] end |
#validate! ⇒ Object
70 71 72 |
# File 'lib/mixlib/install/options.rb', line 70 def validate! end |
#validate_options! ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/mixlib/install/options.rb', line 74 def errors = [] errors << validate_architecture errors << validate_product_names errors << validate_channels errors << validate_shell_type errors << validate_user_agent_headers unless errors.compact.empty? raise InvalidOptions, errors.join("\n") end end |