class Kitchen::Yansible::Tools::Install::Windows
Public Instance Methods
install_python()
click to toggle source
# File lib/kitchen-yansible/tools/install/windows.rb, line 76 def install_python python_version='3.7.6' base_url="https://www.python.org/ftp/python/#{python_version}" installer_name = "python-#{python_version}-amd64.exe" download_url = "#{base_url}/#{installer_name}" base_dir='C:\\python' distr_dir="#{base_dir}\\distr" install_dir="#{base_dir}\\install" install_args = [ '/passive', 'InstallAllUsers=1', 'PrependPath=1', "TargetDir=\"#{install_dir}\"", '/quiet' ] """ #{install_win_software(download_url, distr_dir, install_dir, install_args, "python")} """ end
install_ruby()
click to toggle source
# File lib/kitchen-yansible/tools/install/windows.rb, line 91 def install_ruby ruby_version='2.6.5-1' base_url="https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-#{ruby_version}" installer_name = "rubyinstaller-#{ruby_version}-x64.exe" download_url = "#{base_url}/#{installer_name}" base_dir='C:\\opscode\\chef' distr_dir="#{base_dir}\\distr" install_dir="#{base_dir}\\embedded" install_args = [ '/silent', '/lang=en', '/tasks="assocfiles,modpath"', "/dir=\"#{install_dir}\"" ] """ #{install_win_software(download_url, distr_dir, install_dir, install_args, "ruby")} """ end
install_win_software(url, distr_dir, install_dir, install_arguments, test_binary )
click to toggle source
# File lib/kitchen-yansible/tools/install/windows.rb, line 35 def install_win_software(url, distr_dir, install_dir, install_arguments, test_binary ) """ $downloadUrl = \"#{url}\" $distrDir=\"#{distr_dir}\" $installerName = \"#{File.basename(URI.parse(url).path)}\" $installDir=\"#{install_dir}\" $testBinary=\"#{test_binary}\" mkdir $distrDir -Force | out-null mkdir $installDir -Force | out-null try { $binaryInstalled = $False try { $binaryInstalled=(&{#{test_binary} --version} 2>&1 | % gettype) -ne [System.Management.Automation.ErrorRecord] } catch { echo \"#{test_binary.capitalize} is not installed.\" } if (! $binaryInstalled) { if (! (Test-Path \"${distrDir}\\${installerName}\") ) { echo \"Downloading ${installerName}\" Invoke-WebRequest -DisableKeepAlive -UseBasicParsing -Method GET -Uri \"${downloadUrl}\" -OutFile \"${distrDir}\\${installerName}\" } echo \"Installing ${installerName}\" $p = Start-Process -Wait -Passthru -FilePath \"${distrDir}\\${installerName}\" -ArgumentList #{install_arguments.join(', ')} if ($p.ExitCode -ne 0) { throw \"${installerName} installation was not successful. Received exit code $($p.ExitCode)\" } } else { echo \"#{test_binary.capitalize} installed already. Skipping.\" } } catch { Write-Error ($_ | ft -Property * | out-string) -ErrorAction Continue exit 1 } """ end
local_install()
click to toggle source
# File lib/kitchen-yansible/tools/install/windows.rb, line 106 def local_install """ $ErrorActionPreference = 'Stop' #{install_python} #{install_ruby} """ end
pip_required_packages()
click to toggle source
# File lib/kitchen-yansible/tools/install/windows.rb, line 28 def pip_required_packages [ "ansible#{pip_version(ansible_version)}", "pywinrm" ] end
remote_install()
click to toggle source
# File lib/kitchen-yansible/tools/install/windows.rb, line 115 def remote_install "echo 'Not supported'" end