SilentInstall.psm1

Import-Module -Name powershell-yaml

function Get-SilentTools{
    $SilentInstall_TOOLS = if ($env:ChocolateyToolsLocation) {$env:ChocolateyToolsLocation} else {"$env:HOMEDRIVE/tools/"}
    if (!(Test-Path -Path $SilentInstall_TOOLS)) { New-Item -Path $SilentInstall_TOOLS -ItemType Directory}
    return $SilentInstall_TOOLS
}

function Import-SilentFile{
    param(
        [string] $url
    )
    # TODO: remove bad file system chars
    $name = Split-Path $url -leaf;
    $pseudoUnique = $url.GetHashCode();

    $into =  "$env:temp/$($pseudoUnique)_${name}";
    Invoke-WebRequest -Uri $url -OutFile $into;
    return $into;
}

Export-ModuleMember -Function Get-SilentTools
Export-ModuleMember -Function Import-SilentFile