Class: Mixlib::Install

Inherits:
Object
  • Object
show all
Defined in:
lib/mixlib/install.rb,
lib/mixlib/install/util.rb,
lib/mixlib/install/version.rb

Defined Under Namespace

Classes: Util

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)
VERSION =
"0.7.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version, powershell = false, opts = {}) ⇒ Install

Returns a new instance of Install.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/mixlib/install.rb', line 69

def initialize(version, powershell = false, opts = {})
  @version = version || "latest"
  @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

#endpointObject

Returns the value of attribute endpoint.



34
35
36
# File 'lib/mixlib/install.rb', line 34

def endpoint
  @endpoint
end

#http_proxyObject

Returns the value of attribute http_proxy.



50
51
52
# File 'lib/mixlib/install.rb', line 50

def http_proxy
  @http_proxy
end

#https_proxyObject

Returns the value of attribute https_proxy.



51
52
53
# File 'lib/mixlib/install.rb', line 51

def https_proxy
  @https_proxy
end

#install_flagsObject

Returns the value of attribute install_flags.



32
33
34
# File 'lib/mixlib/install.rb', line 32

def install_flags
  @install_flags
end

#install_msi_urlObject

Returns the value of attribute install_msi_url.



54
55
56
# File 'lib/mixlib/install.rb', line 54

def install_msi_url
  @install_msi_url
end

#nightliesObject

Returns the value of attribute nightlies.



30
31
32
# File 'lib/mixlib/install.rb', line 30

def nightlies
  @nightlies
end

#omnibus_urlObject

Returns the value of attribute omnibus_url.



53
54
55
# File 'lib/mixlib/install.rb', line 53

def omnibus_url
  @omnibus_url
end

#powershellObject

Returns the value of attribute powershell.



26
27
28
# File 'lib/mixlib/install.rb', line 26

def powershell
  @powershell
end

#prereleaseObject

Returns the value of attribute prerelease.



28
29
30
# File 'lib/mixlib/install.rb', line 28

def prerelease
  @prerelease
end

#rootObject

Returns the value of attribute root.



36
37
38
# File 'lib/mixlib/install.rb', line 36

def root
  @root
end

#sudo_commandObject

Returns the value of attribute sudo_command.



40
41
42
# File 'lib/mixlib/install.rb', line 40

def sudo_command
  @sudo_command
end

#use_sudoObject

Returns the value of attribute use_sudo.



38
39
40
# File 'lib/mixlib/install.rb', line 38

def use_sudo
  @use_sudo
end

#versionObject

Returns the value of attribute version.



24
25
26
# File 'lib/mixlib/install.rb', line 24

def version
  @version
end

Instance Method Details

#install_commandObject



91
92
93
94
95
96
97
98
# File 'lib/mixlib/install.rb', line 91

def install_command
  vars = if powershell
    install_command_vars_for_powershell
  else
    install_command_vars_for_bourne
  end
  shell_code_from_file(vars)
end