Class: Mixlib::Install::ScriptGenerator
- Inherits:
-
Object
- Object
- Mixlib::Install::ScriptGenerator
- Defined in:
- lib/mixlib/install/script_generator.rb
Constant Summary collapse
- VALID_INSTALL_OPTS =
%w{omnibus_url endpoint http_proxy https_proxy install_flags install_msi_url nightlies prerelease project root use_sudo sudo_command}
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#http_proxy ⇒ Object
Returns the value of attribute http_proxy.
-
#https_proxy ⇒ Object
Returns the value of attribute https_proxy.
-
#install_flags ⇒ Object
Returns the value of attribute install_flags.
-
#install_msi_url ⇒ Object
Returns the value of attribute install_msi_url.
-
#nightlies ⇒ Object
Returns the value of attribute nightlies.
-
#omnibus_url ⇒ Object
Returns the value of attribute omnibus_url.
-
#powershell ⇒ Object
Returns the value of attribute powershell.
-
#prerelease ⇒ Object
Returns the value of attribute prerelease.
-
#root ⇒ Object
Returns the value of attribute root.
-
#sudo_command ⇒ Object
Returns the value of attribute sudo_command.
-
#use_sudo ⇒ Object
Returns the value of attribute use_sudo.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(version, powershell = false, opts = {}) ⇒ ScriptGenerator
constructor
A new instance of ScriptGenerator.
- #install_command ⇒ Object
Constructor Details
#initialize(version, powershell = false, opts = {}) ⇒ ScriptGenerator
Returns a new instance of ScriptGenerator.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/mixlib/install/script_generator.rb', line 72 def initialize(version, powershell = false, opts = {}) @version = (version || "latest").to_s.downcase @powershell = powershell @http_proxy = nil @https_proxy = nil @install_flags = nil @prerelease = false @nightlies = false @endpoint = "metadata" @omnibus_url = "https://www.chef.io/chef/install.sh" @use_sudo = true @sudo_command = "sudo -E" @root = if powershell "$env:systemdrive\\opscode\\chef" else "/opt/chef" end parse_opts(opts) end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
37 38 39 |
# File 'lib/mixlib/install/script_generator.rb', line 37 def endpoint @endpoint end |
#http_proxy ⇒ Object
Returns the value of attribute http_proxy.
53 54 55 |
# File 'lib/mixlib/install/script_generator.rb', line 53 def http_proxy @http_proxy end |
#https_proxy ⇒ Object
Returns the value of attribute https_proxy.
54 55 56 |
# File 'lib/mixlib/install/script_generator.rb', line 54 def https_proxy @https_proxy end |
#install_flags ⇒ Object
Returns the value of attribute install_flags.
35 36 37 |
# File 'lib/mixlib/install/script_generator.rb', line 35 def install_flags @install_flags end |
#install_msi_url ⇒ Object
Returns the value of attribute install_msi_url.
57 58 59 |
# File 'lib/mixlib/install/script_generator.rb', line 57 def install_msi_url @install_msi_url end |
#nightlies ⇒ Object
Returns the value of attribute nightlies.
33 34 35 |
# File 'lib/mixlib/install/script_generator.rb', line 33 def nightlies @nightlies end |
#omnibus_url ⇒ Object
Returns the value of attribute omnibus_url.
56 57 58 |
# File 'lib/mixlib/install/script_generator.rb', line 56 def omnibus_url @omnibus_url end |
#powershell ⇒ Object
Returns the value of attribute powershell.
29 30 31 |
# File 'lib/mixlib/install/script_generator.rb', line 29 def powershell @powershell end |
#prerelease ⇒ Object
Returns the value of attribute prerelease.
31 32 33 |
# File 'lib/mixlib/install/script_generator.rb', line 31 def prerelease @prerelease end |
#root ⇒ Object
Returns the value of attribute root.
39 40 41 |
# File 'lib/mixlib/install/script_generator.rb', line 39 def root @root end |
#sudo_command ⇒ Object
Returns the value of attribute sudo_command.
43 44 45 |
# File 'lib/mixlib/install/script_generator.rb', line 43 def sudo_command @sudo_command end |
#use_sudo ⇒ Object
Returns the value of attribute use_sudo.
41 42 43 |
# File 'lib/mixlib/install/script_generator.rb', line 41 def use_sudo @use_sudo end |
#version ⇒ Object
Returns the value of attribute version.
27 28 29 |
# File 'lib/mixlib/install/script_generator.rb', line 27 def version @version end |
Instance Method Details
#install_command ⇒ Object
94 95 96 97 98 99 100 101 |
# File 'lib/mixlib/install/script_generator.rb', line 94 def install_command vars = if powershell install_command_vars_for_powershell else install_command_vars_for_bourne end shell_code_from_file(vars) end |