class Kitchen::Provisioner::Chocolatey
Attributes
tmp_dir[RW]
Public Instance Methods
create_sandbox()
click to toggle source
Calls superclass method
# File lib/kitchen/provisioner/chocolatey.rb, line 39 def create_sandbox super info("Staging Chocolatey Packages for copy to the SUT") return unless config[:packages_path] info("Preparing packages") debug("Using packages from #{config[:packages_path]}") tmpdata_dir = File.join(sandbox_path, "packages") FileUtils.mkdir_p(tmpdata_dir) FileUtils.cp_r(Util.list_directory(config[:packages_path]), tmpdata_dir) end
init_command()
click to toggle source
# File lib/kitchen/provisioner/chocolatey.rb, line 35 def init_command wrap_powershell_code('choco feature enable -n allowGlobalConfirmation') end
install_command()
click to toggle source
# File lib/kitchen/provisioner/chocolatey.rb, line 25 def install_command install_chocolatey = <<-EOH if (-not (get-command choco -ea silentlycontinue)) { iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) } EOH wrap_powershell_code(install_chocolatey) end
prepare_command()
click to toggle source
# File lib/kitchen/provisioner/chocolatey.rb, line 53 def prepare_command end
run_command()
click to toggle source
# File lib/kitchen/provisioner/chocolatey.rb, line 57 def run_command command = "choco install #{config[:package_name]} -df " if config[:package_parameters] command += " --params='#{config[:package_parameters]}' " end if config[:packages_path] command += " -s #{config[:root_path]} " end wrap_powershell_code(command) end
Private Instance Methods
wrap_powershell_code(code)
click to toggle source
# File lib/kitchen/provisioner/chocolatey.rb, line 70 def wrap_powershell_code(code) wrap_shell_code(["$ProgressPreference = 'SilentlyContinue';", code].join("\n")) end