Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-1203) Ensure PowerShell uses CRLF
  (GH-1200) Export built-in functions early
  (maint) Update NuGet.Core
  (maint) update scenarios
  (GH-1054) Document requested execution levels
  (GH-1054) Externalize the app.manifest
  • Loading branch information
ferventcoder committed Mar 22, 2017
2 parents 3be0f1a + e210168 commit 19ecfac
Show file tree
Hide file tree
Showing 48 changed files with 1,319 additions and 1,297 deletions.
4 changes: 3 additions & 1 deletion Scenarios.md
Expand Up @@ -462,15 +462,17 @@
* should contain tags
* should not contain packages and versions with a pipe between them

### ChocolateyPackCommand [ 2 Scenario(s), 2 Observation(s) ]
### ChocolateyPackCommand [ 2 Scenario(s), 4 Observation(s) ]

#### when packing with an output directory

* generated package should be in specified output directory
* sources should be set to specified output directory

#### when packing without specifying an output directory

* generated package should be in current directory
* sources should be set to current directory

### ChocolateyPinCommand [ 9 Scenario(s), 12 Observation(s) ]

Expand Down
Binary file modified lib/NuGet-Chocolatey/NuGet.Core.dll
Binary file not shown.
1 change: 1 addition & 0 deletions src/chocolatey.console/Program.cs
Expand Up @@ -119,6 +119,7 @@ private static void Main(string[] args)

remove_old_chocolatey_exe(fileSystem);

AssemblyFileExtractor.extract_all_resources_to_relative_directory(fileSystem, Assembly.GetAssembly(typeof(Program)), ApplicationParameters.InstallLocation, new List<string>(), "chocolatey.console");
//refactor - thank goodness this is temporary, cuz manifest resource streams are dumb
IList<string> folders = new List<string>
{
Expand Down
38 changes: 0 additions & 38 deletions src/chocolatey.console/app.manifest

This file was deleted.

50 changes: 50 additions & 0 deletions src/chocolatey.console/choco.exe.manifest
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="choco.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
Specifying requestedExecutionLevel node (below) will disable file and
registry virtualization.
Set level to "asInvoker" when you want choco to run under the context
of the user invoking. This is the same as Chocolatey behavior prior
to 0.10.4.
Set level to "requireAdministrator" to only allow administrators to
run Chocolatey.
Set level to "highestAvailable" to allow non-admins to run in
non-administrative context, but require administrators to always run
with administrative privileges. This is the recommended and default
behavior of Chocolatey v0.10.4+.
NOTE: Currently you will need to make this change every time
Chocolatey is re-installed or upgraded (every new version). At least
for now - https://github.com/chocolatey/choco/issues/1206
The following is an unsupported use case: If you want to utilize File
and Registry Virtualization for backward compatibility then delete
the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 / Windows Server 2016 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
<!-- Windows 8.1 / Windows Server 2012 R2 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 / Windows Server 2012 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 / Windows Server 2008 R2 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista / Windows Server 2008 -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
</asmv1:assembly>
7 changes: 4 additions & 3 deletions src/chocolatey.console/chocolatey.console.csproj
Expand Up @@ -74,8 +74,9 @@
<PropertyGroup>
<StartupObject>chocolatey.console.Program</StartupObject>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="AlphaFS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4d31a58f7d7ad5c9, processorArchitecture=MSIL">
Expand Down Expand Up @@ -116,9 +117,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.manifest">
<EmbeddedResource Include="choco.exe.manifest">
<SubType>Designer</SubType>
</None>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="targets\Microsoft.Application.targets" />
</ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion src/chocolatey.resources/helpers/chocolateyInstaller.psm1
@@ -1,4 +1,4 @@
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# Copyright © 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,6 +42,12 @@ Get-Item $helpersPath\functions\*.ps1 |
#Export-ModuleMember -Function $_.BaseName
}

# Export built-in functions prior to loading extensions so that
# extension-specific loading behavior can be used based on built-in
# functions. This allows those overrides to be much more deterministic
# This behavior was broken from v0.9.9.5 - v0.10.3.
Export-ModuleMember -Function * -Alias * -Cmdlet *

# load extensions if they exist
$extensionsPath = Join-Path "$helpersPath" '..\extensions'
if (Test-Path($extensionsPath)) {
Expand Down
2 changes: 1 addition & 1 deletion src/chocolatey.resources/helpers/chocolateyProfile.psm1
@@ -1,4 +1,4 @@
# Copyright © 2011 - Present RealDimensions Software, LLC
# Copyright © 2011 - Present RealDimensions Software, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
@@ -1,4 +1,4 @@
param(
param(
[alias("ia","installArgs")][string] $installArguments = '',
[alias("o","override","overrideArguments","notSilent")]
[switch] $overrideArgs = $false,
Expand Down
126 changes: 63 additions & 63 deletions src/chocolatey.resources/helpers/functions/Format-FileSize.ps1
@@ -1,63 +1,63 @@
# Copyright © 2011 - Present RealDimensions Software, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Function Format-FileSize {
<#
.SYNOPSIS
DO NOT USE. Not part of the public API.
.DESCRIPTION
Formats file size into a human readable format.
.NOTES
Available in 0.9.10+.
This function is not part of the API.
.INPUTS
None
.OUTPUTS
Returns a string representation of the file size in a more friendly
format based on the passed in bytes.
.PARAMETER Size
The size of a file in bytes.
.PARAMETER IgnoredArguments
Allows splatting with arguments that do not apply. Do not use directly.
.EXAMPLE
Format-FileSize -Size $fileSizeBytes
.LINK
Get-WebFile
#>
param (
[Parameter(Mandatory=$true, Position=0)][double] $size,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)

# Do not log function call, it interrupts the single line download progress output.

Foreach ($unit in @('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB')) {
If ($size -lt 1024) {
return [string]::Format("{0:0.##} {1}", $size, $unit)
}
$size /= 1024
}

return [string]::Format("{0:0.##} YB", $size)
}
# Copyright © 2011 - Present RealDimensions Software, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Function Format-FileSize {
<#
.SYNOPSIS
DO NOT USE. Not part of the public API.
.DESCRIPTION
Formats file size into a human readable format.
.NOTES
Available in 0.9.10+.
This function is not part of the API.
.INPUTS
None
.OUTPUTS
Returns a string representation of the file size in a more friendly
format based on the passed in bytes.
.PARAMETER Size
The size of a file in bytes.
.PARAMETER IgnoredArguments
Allows splatting with arguments that do not apply. Do not use directly.
.EXAMPLE
Format-FileSize -Size $fileSizeBytes
.LINK
Get-WebFile
#>
param (
[Parameter(Mandatory=$true, Position=0)][double] $size,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)

# Do not log function call, it interrupts the single line download progress output.

Foreach ($unit in @('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB')) {
If ($size -lt 1024) {
return [string]::Format("{0:0.##} {1}", $size, $unit)
}
$size /= 1024
}

return [string]::Format("{0:0.##} YB", $size)
}
@@ -1,4 +1,4 @@
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# Copyright © 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
@@ -1,4 +1,4 @@
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# Copyright © 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 19ecfac

Please sign in to comment.