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
- OMNITRUCK_CHANNELS =
[:stable, :current]
- ARTIFACTORY_CHANNELS =
[:unstable]
- ALL_SUPPORTED_CHANNELS =
OMNITRUCK_CHANNELS + ARTIFACTORY_CHANNELS
- 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_artifactory? ⇒ Boolean
- #for_bintray? ⇒ Boolean
- #for_omnitruck? ⇒ Boolean
- #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.
45 46 47 48 49 |
# File 'lib/mixlib/install/options.rb', line 45 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_artifactory? ⇒ Boolean
73 74 75 |
# File 'lib/mixlib/install/options.rb', line 73 def for_artifactory? ARTIFACTORY_CHANNELS.include?(channel) end |
#for_bintray? ⇒ Boolean
77 78 79 |
# File 'lib/mixlib/install/options.rb', line 77 def for_bintray? [:stable, :current].include?(channel) end |
#for_omnitruck? ⇒ Boolean
81 82 83 |
# File 'lib/mixlib/install/options.rb', line 81 def for_omnitruck? OMNITRUCK_CHANNELS.include?(channel) end |
#for_ps1? ⇒ Boolean
85 86 87 |
# File 'lib/mixlib/install/options.rb', line 85 def for_ps1? platform == "windows" || shell_type == :ps1 end |
#latest_version? ⇒ Boolean
89 90 91 |
# File 'lib/mixlib/install/options.rb', line 89 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
98 99 100 101 102 103 104 |
# File 'lib/mixlib/install/options.rb', line 98 def set_platform_info(info) [:platform] = info[:platform] [:platform_version] = info[:platform_version] [:architecture] = info[:architecture] end |
#validate! ⇒ Object
51 52 53 |
# File 'lib/mixlib/install/options.rb', line 51 def validate! end |
#validate_options! ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/mixlib/install/options.rb', line 55 def errors = [] errors << validate_product_names errors << validate_channels errors << validate_shell_type unless errors.compact.empty? raise InvalidOptions, errors.join("\n") end end |