Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (doc) update CHANGELOG/nuspec
  (GH-753) Get-WebFileName Matches on Invalid Chars
  (doc) update CHANGELOG/nuspec
  (GH-356) Resolve sources by name
  (GH-732) Request/Response Timeout configurable
  (maint) formatting
  (GH-751) Use package name/version from env vars
  (GH-752) Combine Push timeout and execution timeout
  (GH-622) Remove NuGet temp folders
  (GH-622) Allow silent retries
  (GH-584) License loading occurs in DLL
  (GH-584) update licensing docs
  (doc) update CHANGELOG/nuspec
  (GH-733) Don't pass some args to dependencies
  (doc) update CHANGELOG/nuspec
  • Loading branch information
ferventcoder committed May 28, 2016
2 parents 1213a58 + 8a71af7 commit fc27200
Show file tree
Hide file tree
Showing 27 changed files with 319 additions and 104 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* Provide PowerShell tab completion for Chocolatey - see [#412](https://github.com/chocolatey/choco/issues/412)
* [Security] Sign the powershell scripts and assemblies - see [#501](https://github.com/chocolatey/choco/issues/501)
* Add a `choco info` command to show info for one package - see [#644](https://github.com/chocolatey/choco/issues/644)
* Resolve sources by name - see [#356](https://github.com/chocolatey/choco/issues/356)
* Pro/Business - Ubiquitous Install Directory Switch - see [#258](https://github.com/chocolatey/choco/issues/258)
* Pro/Business - Runtime Virus Scanning - see [virus scanning](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum/posts/1518468)
* Pro/Business - Permanent private download location - see [alternate download location](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum/posts/1479944)
* Pro/Business - Runtime Virus Scanning - see [virus scanning](https://chocolatey.org/docs/features-virus-check)
* Pro/Business - Private CDN cache for downloads - see [private CDN cache](https://chocolatey.org/docs/features-private-cdn)

### BUG FIXES

Expand Down Expand Up @@ -89,6 +90,7 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* [POSH Host] Fix - Write-Host adding multiple line breaks - see [#672](https://github.com/chocolatey/choco/issues/672)
* [POSH Host] Fix - PowerShell Host doesn't show colorization overrides - see [#674](https://github.com/chocolatey/choco/issues/674)
* [POSH Host] Fix - $profile is empty string when installing packages - does not automatically install the ChocolateyProfile - see [#667](https://github.com/chocolatey/choco/issues/667)
* [POSH Host] Fix - Getting LCID doesn't work properly with the built-in PowerShell - see [#741](https://github.com/chocolatey/choco/issues/741)
* Fix - Verbose shows in output on debug switch - see [#611](https://github.com/chocolatey/choco/issues/611)
* Fix - Get-ChocolateyUnzip captures files that don't belong to the package / Unzip should not do a full disk scan - see [#616](https://github.com/chocolatey/choco/issues/616) and [#155](https://github.com/chocolatey/choco/issues/155)
* Fix - Package succeeds but software install silently fails when Install-ChocolateyInstallPackage has the wrong arguments - see [#629](https://github.com/chocolatey/choco/issues/629)
Expand All @@ -106,6 +108,9 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* Fix - Removing environment variables sets empty environment variables - see [#724](https://github.com/chocolatey/choco/issues/724)
* Fix - Environment Variable Changes Require Reboot - see [#728](https://github.com/chocolatey/choco/issues/728)
* Fix - Get-WebFileName determines strange file name - see [#727](https://github.com/chocolatey/choco/issues/727)
* Fix - Package params are also applied to dependent package - see [#733](https://github.com/chocolatey/choco/issues/733)
* Fix - Use package name/version from environment, not parameters - see [#751](https://github.com/chocolatey/choco/issues/751)
* Fix - Get-WebFileName Does Not Match on Invalid Characters - see [#753](https://github.com/chocolatey/choco/issues/753)

### IMPROVEMENTS

Expand Down Expand Up @@ -141,6 +146,9 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* Interactively prompt with timeout on some questions - see [#710](https://github.com/chocolatey/choco/issues/710)
* [POSH Host] Exit code from PowerShell Host should be useful - see [#709](https://github.com/chocolatey/choco/issues/709)
* Update environment for scripts after setting environment variables - see [#729](https://github.com/chocolatey/choco/issues/729)
* Clean up any temp nuget folder actions after NuGet operations - see [#622](https://github.com/chocolatey/choco/issues/622)
* Ensure Web Requests and Responses Do Not Timeout - make configurable - see [#732](https://github.com/chocolatey/choco/issues/732)
* Combine timeout from push and execution timeout as one parameter - see [#752](https://github.com/chocolatey/choco/issues/752)
* Pro/Business - Also check for license in User Profile location - see [#606](https://github.com/chocolatey/choco/issues/606)
* Pro/Business - Set download cache information if available - see [#562](https://github.com/chocolatey/choco/issues/562)
* Pro/Business - Allow commands to be added - see [#583](https://github.com/chocolatey/choco/issues/583)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Please make sure you've read over and agree with the [etiquette regarding commun

## Support Chocolatey!

* Purchase [Chocolatey Professional / Chocolatey for Business](https://chocolatey.org/pricing)
* Purchase [Chocolatey Pro / Chocolatey for Business](https://chocolatey.org/compare)
* [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E8ZPVL5PNTABW)

## See Chocolatey In Action
Expand All @@ -36,9 +36,9 @@ Chocolatey FOSS install showing tab completion and `refreshenv` (a way to update

![install](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_install.gif "Wat? Tab completion and updating environment variables!")

[Chocolatey Professional](https://chocolatey.org/pricing) showing private download cache and virus scan protection:
[Chocolatey Pro](https://chocolatey.org/compare) showing private CDN download cache and virus scan protection:

![install pro](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/chocopro_install_stopped.gif "Get ready! Chocolatey Professional availability is May 2nd, 2016")
![install w/pro](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/chocopro_install_stopped.gif "Chocolatey Pro availability now! A great option for individuals looking for that community PLUS option.")

## Etiquette Regarding Communication

Expand Down
12 changes: 10 additions & 2 deletions nuget/chocolatey/chocolatey.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* Provide PowerShell tab completion for Chocolatey - see [#412](https://github.com/chocolatey/choco/issues/412)
* [Security] Sign the powershell scripts and assemblies - see [#501](https://github.com/chocolatey/choco/issues/501)
* Add a `choco info` command to show info for one package - see [#644](https://github.com/chocolatey/choco/issues/644)
* Resolve sources by name - see [#356](https://github.com/chocolatey/choco/issues/356)
* Pro/Business - Ubiquitous Install Directory Switch - see [#258](https://github.com/chocolatey/choco/issues/258)
* Pro/Business - Runtime Virus Scanning - see [virus scanning](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum/posts/1518468)
* Pro/Business - Permanent private download location - see [alternate download location](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum/posts/1479944)
* Pro/Business - Runtime Virus Scanning - see [virus scanning](https://chocolatey.org/docs/features-virus-check)
* Pro/Business - Private CDN cache for downloads - see [private CDN cache](https://chocolatey.org/docs/features-private-cdn)

### BUG FIXES

Expand Down Expand Up @@ -144,6 +145,7 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* [POSH Host] Fix - Write-Host adding multiple line breaks - see [#672](https://github.com/chocolatey/choco/issues/672)
* [POSH Host] Fix - PowerShell Host doesn't show colorization overrides - see [#674](https://github.com/chocolatey/choco/issues/674)
* [POSH Host] Fix - $profile is empty string when installing packages - does not automatically install the ChocolateyProfile - see [#667](https://github.com/chocolatey/choco/issues/667)
* [POSH Host] Fix - Getting LCID doesn't work properly with the built-in PowerShell - see [#741](https://github.com/chocolatey/choco/issues/741)
* Fix - Verbose shows in output on debug switch - see [#611](https://github.com/chocolatey/choco/issues/611)
* Fix - Get-ChocolateyUnzip captures files that don't belong to the package / Unzip should not do a full disk scan - see [#616](https://github.com/chocolatey/choco/issues/616) and [#155](https://github.com/chocolatey/choco/issues/155)
* Fix - Package succeeds but software install silently fails when Install-ChocolateyInstallPackage has the wrong arguments - see [#629](https://github.com/chocolatey/choco/issues/629)
Expand All @@ -161,6 +163,9 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* Fix - Removing environment variables sets empty environment variables - see [#724](https://github.com/chocolatey/choco/issues/724)
* Fix - Environment Variable Changes Require Reboot - see [#728](https://github.com/chocolatey/choco/issues/728)
* Fix - Get-WebFileName determines strange file name - see [#727](https://github.com/chocolatey/choco/issues/727)
* Fix - Package params are also applied to dependent package - see [#733](https://github.com/chocolatey/choco/issues/733)
* Fix - Use package name/version from environment, not parameters - see [#751](https://github.com/chocolatey/choco/issues/751)
* Fix - Get-WebFileName Does Not Match on Invalid Characters - see [#753](https://github.com/chocolatey/choco/issues/753)

### IMPROVEMENTS

Expand Down Expand Up @@ -196,6 +201,9 @@ If you need the previous behavior, be sure to disable the feature `usePackageExi
* Interactively prompt with timeout on some questions - see [#710](https://github.com/chocolatey/choco/issues/710)
* [POSH Host] Exit code from PowerShell Host should be useful - see [#709](https://github.com/chocolatey/choco/issues/709)
* Update environment for scripts after setting environment variables - see [#729](https://github.com/chocolatey/choco/issues/729)
* Clean up any temp nuget folder actions after NuGet operations - see [#622](https://github.com/chocolatey/choco/issues/622)
* Ensure Web Requests and Responses Do Not Timeout - make configurable - see [#732](https://github.com/chocolatey/choco/issues/732)
* Combine timeout from push and execution timeout as one parameter - see [#752](https://github.com/chocolatey/choco/issues/752)
* Pro/Business - Also check for license in User Profile location - see [#606](https://github.com/chocolatey/choco/issues/606)
* Pro/Business - Set download cache information if available - see [#562](https://github.com/chocolatey/choco/issues/562)
* Pro/Business - Allow commands to be added - see [#583](https://github.com/chocolatey/choco/issues/583)
Expand Down
33 changes: 2 additions & 31 deletions src/chocolatey.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ namespace chocolatey.console
using infrastructure.commandline;
using infrastructure.configuration;
using infrastructure.extractors;
using infrastructure.filesystem;
using infrastructure.information;
using infrastructure.licensing;
using infrastructure.logging;
using infrastructure.registration;
using resources;
using SimpleInjector;
using Console = System.Console;
using Environment = System.Environment;
using IFileSystem = infrastructure.filesystem.IFileSystem;

public sealed class Program
{
Expand All @@ -52,33 +50,7 @@ private static void Main(string[] args)
Log4NetAppenderConfiguration.configure(loggingLocation);
Bootstrap.initialize();
Bootstrap.startup();

var license = LicenseValidation.validate();
if (license.is_licensed_version())
{
try
{
var licensedAssembly = Assembly.LoadFile(ApplicationParameters.LicensedAssemblyLocation);
license.AssemblyLoaded = true;
license.Assembly = licensedAssembly;
license.Version = VersionInformation.get_current_informational_version(licensedAssembly);
Type licensedComponent = licensedAssembly.GetType(ApplicationParameters.LicensedComponentRegistry, throwOnError: false, ignoreCase: true);
SimpleInjectorContainer.add_component_registry_class(licensedComponent);
}
catch (Exception ex)
{
"chocolatey".Log().Error(
@"Error when attempting to load chocolatey licensed assembly. Ensure
that chocolatey.licensed.dll exists at
'{0}'.
Install with `choco install chocolatey.extension`.
The error message itself may be helpful as well:{1} {2}".format_with(
ApplicationParameters.LicensedAssemblyLocation,
Environment.NewLine,
ex.Message
));
}
}
var license = License.validate_license();
var container = SimpleInjectorContainer.Container;

var config = container.GetInstance<ChocolateyConfiguration>();
Expand Down Expand Up @@ -185,7 +157,6 @@ Install with `choco install chocolatey.extension`.
#endif
pause_execution_if_debug();
Bootstrap.shutdown();

Environment.Exit(Environment.ExitCode);
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/chocolatey.resources/helpers/functions/Get-WebFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ param(
$req.AllowAutoRedirect = $true
$req.MaximumAutomaticRedirections = 20
#$req.KeepAlive = $true
# use the default request timeout of 100000
if ($env:chocolateyRequestTimeout -ne $null -and $env:chocolateyRequestTimeout -ne '') {
$req.Timeout = $env:chocolateyRequestTimeout
}
if ($env:chocolateyResponseTimeout -ne $null -and $env:chocolateyResponseTimeout -ne '') {
$req.ReadWriteTimeout = $env:chocolateyResponseTimeout
}

#http://stackoverflow.com/questions/518181/too-many-automatic-redirections-were-attempted-error-message-when-using-a-httpw
$req.CookieContainer = New-Object System.Net.CookieContainer
Expand Down
18 changes: 12 additions & 6 deletions src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,20 @@ param(
$request.AllowAutoRedirect = $true
$request.MaximumAutomaticRedirections = 20
#$request.KeepAlive = $true
$request.Timeout = 20000
$request.Timeout = 30000
if ($env:chocolateyRequestTimeout -ne $null -and $env:chocolateyRequestTimeout -ne '') {
$request.Timeout = $env:chocolateyRequestTimeout
}
if ($env:chocolateyResponseTimeout -ne $null -and $env:chocolateyResponseTimeout -ne '') {
$request.ReadWriteTimeout = $env:chocolateyResponseTimeout
}

#http://stackoverflow.com/questions/518181/too-many-automatic-redirections-were-attempted-error-message-when-using-a-httpw
$request.CookieContainer = New-Object System.Net.CookieContainer
$request.UserAgent = $userAgent

[System.Text.RegularExpressions.Regex]$containsABadCharacter = New-Object Regex("[" + [System.Text.RegularExpressions.Regex]::Escape([System.IO.Path]::GetInvalidFileNameChars() -join '') + "\=\;]");

try
{
[System.Net.HttpWebResponse]$response = $request.GetResponse()
Expand All @@ -110,6 +118,7 @@ param(
$fileName = $header.Substring($index + $fileHeaderName.Length).Replace('"', '')
}
}
if ($containsABadCharacter.IsMatch($fileName)) { $fileName = $null }

# If empty, check location header next
if ($fileName -eq $null -or $fileName -eq '') {
Expand All @@ -118,9 +127,7 @@ param(
$fileName = [System.IO.Path]::GetFileName($headerLocation)
}
}

#$containsQuery = [System.IO.Path]::GetFileName($url).Contains('?')
#$containsEquals = [System.IO.Path]::GetFileName($url).Contains('=')
if ($containsABadCharacter.IsMatch($fileName)) { $fileName = $null }

# Next comes using the response url value
if ($fileName -eq $null -or $fileName -eq '') {
Expand All @@ -130,6 +137,7 @@ param(
$fileName = [System.IO.Path]::GetFileName($responseUrl)
}
}
if ($containsABadCharacter.IsMatch($fileName)) { $fileName = $null }

# Next comes using the request url value
if ($fileName -eq $null -or $fileName -eq '') {
Expand All @@ -141,8 +149,6 @@ param(
}
}

[System.Text.RegularExpressions.Regex]$containsABadCharacter = New-Object Regex("[" + [System.Text.RegularExpressions.Regex]::Escape([System.IO.Path]::GetInvalidFileNameChars()) + "]", [System.Text.RegularExpressions.RegexOptions]::IgnorePatternWhitespace);

# when all else fails, default the name
if ($fileName -eq $null -or $fileName -eq '' -or $containsABadCharacter.IsMatch($fileName)) {
Write-Debug "File name is null or illegal. Using $originalFileName instead."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ param(
$request.AllowAutoRedirect = $true
$request.MaximumAutomaticRedirections = 20
#$request.KeepAlive = $true
$request.Timeout = 20000
$request.Timeout = 30000
if ($env:chocolateyRequestTimeout -ne $null -and $env:chocolateyRequestTimeout -ne '') {
$request.Timeout = $env:chocolateyRequestTimeout
}
if ($env:chocolateyResponseTimeout -ne $null -and $env:chocolateyResponseTimeout -ne '') {
$request.ReadWriteTimeout = $env:chocolateyResponseTimeout
}

#http://stackoverflow.com/questions/518181/too-many-automatic-redirections-were-attempted-error-message-when-using-a-httpw
$request.CookieContainer = New-Object System.Net.CookieContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ param(
Pro / Business supports a single, ubiquitous install directory option.
Stop the hassle of determining how to pass install directory overrides
to install arguments for each package / installer type.
Check out Pro / Business - https://chocolatey.org/pricing"
Check out Pro / Business - https://chocolatey.org/compare"
"@ | Write-Warning
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ param(
Write-Debug "Running 'Install-ChocolateyPackage' for $packageName with url:`'$url`', args: `'$silentArgs`', fileType: `'$fileType`', url64bit: `'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`', validExitCodes: `'$validExitCodes`' ";

$chocTempDir = $env:TEMP
$tempDir = Join-Path $chocTempDir "$packageName"
if ($env:packageVersion -ne $null) {$tempDir = Join-Path $tempDir "$env:packageVersion"; }
$tempDir = Join-Path $chocTempDir "$($env:chocolateyPackageName)"
if ($env:chocolateyPackageVersion -ne $null) {$tempDir = Join-Path $tempDir "$($env:chocolateyPackageVersion)"; }

if (![System.IO.Directory]::Exists($tempDir)) { [System.IO.Directory]::CreateDirectory($tempDir) | Out-Null }
$file = Join-Path $tempDir "$($packageName)Install.$fileType"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ param(
$fileType = 'zip'

$chocTempDir = $env:TEMP
$tempDir = Join-Path $chocTempDir "$packageName"
if ($env:packageVersion -ne $null) {$tempDir = Join-Path $tempDir "$env:packageVersion"; }
$tempDir = Join-Path $chocTempDir "$($env:chocolateyPackageName)"
if ($env:chocolateyPackageVersion -ne $null) {$tempDir = Join-Path $tempDir "$($env:chocolateyPackageVersion)"; }

if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir) | Out-Null}
$file = Join-Path $tempDir "$($packageName)Install.$fileType"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,7 @@ public void should_add_short_version_of_apikey_to_the_option_set()
{
optionSet.Contains("k").ShouldBeTrue();
}

[Fact]
public void should_add_timeout_to_the_option_set()
{
optionSet.Contains("timeout").ShouldBeTrue();
}


[Fact]
public void should_add_short_version_of_timeout_to_the_option_set()
{
Expand Down
Loading

0 comments on commit fc27200

Please sign in to comment.