class Chef::Resource::ChocolateyInstaller
Public Instance Methods
define_resource_requirements()
click to toggle source
# File lib/chef/resource/chocolatey_installer.rb, line 94 def define_resource_requirements requirements.assert(:install, :upgrade).each do |a| a.assertion do # This is an exclusive OR - XOR - we're trying to coax an error out if one, but not both, # parameters are empty. new_resource.proxy_user.nil? != new_resource.proxy_password.nil? end a.failure_message(Chef::Exceptions::ValidationFailed, "You must specify both a proxy_user and a proxy_password") a.whyrun("Assuming that if you have configured a 'proxy_user' you must also supply a 'proxy_password'") end end
existing_version()
click to toggle source
# File lib/chef/resource/chocolatey_installer.rb, line 90 def existing_version Gem::Version.new(get_choco_version) end
get_choco_version()
click to toggle source
# File lib/chef/resource/chocolatey_installer.rb, line 86 def get_choco_version powershell_exec("choco --version").result end
is_choco_installed?()
click to toggle source
# File lib/chef/resource/chocolatey_installer.rb, line 82 def is_choco_installed? ::File.exist?("#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\bin\\choco.exe") end