Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Native provider #19

Open
wants to merge 92 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
ad03dd8
Make the provider csharp project buildable in VS22017
jirkapok Mar 23, 2018
d9d0bac
Moved old code to Obsolete folder
jirkapok Mar 23, 2018
ad577dc
Fixed .gitignore for .vs directory
jirkapok Mar 23, 2018
fc09094
Initial module manifest
jirkapok Mar 23, 2018
257cfab
Added paket dependencies
jirkapok Mar 23, 2018
6eaccb2
added initial build script to create empty module
jirkapok Mar 25, 2018
da44751
Implemented psake build scripts
jirkapok Mar 25, 2018
68b8f76
added publish task
jirkapok Mar 25, 2018
1ace9a1
Added initial module api test
jirkapok Mar 25, 2018
65f5458
Implemented most of the module manifest
jirkapok Mar 25, 2018
7717727
Implemented Get-PackageProviderName Provider function
jirkapok Mar 25, 2018
c481f7f
Adding not fully implemented Get-Feautre provider method.
jirkapok Mar 25, 2018
424d18f
added progress to the readme
jirkapok Mar 26, 2018
f5aac29
Added initialization of the Provider
jirkapok Mar 27, 2018
53f16b9
Implemented Add-PackageSource skeleton
jirkapok Mar 27, 2018
4f22632
Applied powershell coding style
jirkapok Apr 5, 2018
824e552
Extended Add-PackageSource by adding output and fixed related tests
jirkapok Apr 5, 2018
6e3b6e5
Fixed arguments handling in Add-PackageSource
jirkapok Apr 5, 2018
d8eda7f
Extracted and extended development documentation
jirkapok Apr 6, 2018
7a5113d
Reorganized readme paragraphs
jirkapok Apr 6, 2018
36863cf
Added space to readme note
jirkapok Apr 6, 2018
295d87c
Implemented Get-Features
jirkapok Apr 8, 2018
7fc0491
Extending debugging chapter in contributing guideline
jirkapok Apr 8, 2018
f7dd43e
added option to debug only selected test
jirkapok Apr 8, 2018
edf7707
added more options to add-packagesource
jirkapok Apr 8, 2018
cfa3475
Added dynamic options to the source category
jirkapok Apr 8, 2018
8add50a
Implemented usage of dynamic parameters in add-packagesource
jirkapok Apr 8, 2018
a7753b1
Added how to use dynamic options
jirkapok Apr 8, 2018
389bfb6
fixed formating in howto.md
jirkapok Apr 8, 2018
bd932e9
fixed values of parameters in howto.md
jirkapok Apr 8, 2018
fc55278
Add authentication properties to package source definition
jirkapok Apr 10, 2018
be4b737
removed helpinfouri from manifest
jirkapok Apr 10, 2018
63403a7
changed formating of progress in readme.md
jirkapok Apr 10, 2018
a363555
fixed formating of progress in readme.md
jirkapok Apr 10, 2018
be9a35d
Implemented Resolve-Package source
jirkapok Apr 11, 2018
cf01764
Extended assert in list all sources test
jirkapok Apr 11, 2018
2d0b424
Fixed typos in howto.md
jirkapok Apr 11, 2018
4b8db94
Implemented Unregister-PackageSource
jirkapok Apr 11, 2018
bdd2adc
Added documentation for offline install
jirkapok Apr 12, 2018
144db1e
Added option to find package source by location
jirkapok Apr 12, 2018
56b39de
Added test package skeleton
jirkapok Apr 12, 2018
0a2de0b
Added skeleton of Find-Package
jirkapok Apr 13, 2018
5d95d67
Added Find-Package skeleton
jirkapok Apr 13, 2018
e5c42eb
Added more test cases for Find-Package
jirkapok Apr 16, 2018
03c1a49
Added multiple package sources to Find-Package
jirkapok Apr 16, 2018
3f89911
Fixed Find-Package from all sources
jirkapok Apr 18, 2018
80e73a9
Fixed chocolatey.dll unable to reload config file to make tests indep…
jirkapok Apr 18, 2018
4b79cda
Added Helpers file
jirkapok Apr 19, 2018
6d13c78
Added function to register default chocolatey source
jirkapok Apr 19, 2018
1219a37
Added Find-Package by Tags
jirkapok Apr 19, 2018
7a8c27d
Removed debug flag in Find-Package test
jirkapok Apr 19, 2018
26fa412
Added Find-Package examples to the how to documentation, simplyfied b…
jirkapok Apr 19, 2018
1196758
Univied formating in contributing.md
jirkapok Apr 19, 2018
6fbaf28
Added helpers as nested module
jirkapok Apr 19, 2018
6396596
Implemented find-package to list all versions
jirkapok Apr 20, 2018
aeebebe
Implemented search for prerelease versions
jirkapok Apr 20, 2018
24fa67e
Split tests to separate files
jirkapok Apr 20, 2018
5671cfe
Added find-package examples to how to for allversions and prerelease …
jirkapok Apr 20, 2018
7f191c6
Fixed build.ps1 to work from any location
jirkapok Apr 20, 2018
55635cd
Implemented filtering packages by version
jirkapok Apr 20, 2018
0ff91cf
Implemented min., max. version parameters from Find-Pacakge
jirkapok Apr 21, 2018
ee05914
Added tests for min. max. versions in Find-Package
jirkapok Apr 21, 2018
1bd4d09
Fixed find all package test
jirkapok Apr 21, 2018
9ca463a
Updated progress in readme
jirkapok Apr 21, 2018
5a5181d
Implemented FastPackageReference in Find-Package
jirkapok Apr 22, 2018
fd4bebc
Implemented resolve-packagesource by not registered location
jirkapok Apr 22, 2018
e72b156
Added Install package tests
jirkapok May 17, 2018
a3fe03b
Upgrade of chocolatey.lig to 0.10.11
jirkapok May 17, 2018
469475b
Fixed resolution of packagereference for filesystem source path
jirkapok May 29, 2018
b30e033
Fixed broken Find package test
jirkapok May 29, 2018
1fd96bc
Added uninstall of test package into test setup
jirkapok May 29, 2018
d5c765d
Added reporting of installed package
jirkapok May 29, 2018
458080d
Added to check install required version
jirkapok May 30, 2018
6b60c31
Fixed searching sources
jirkapok Jun 13, 2018
281407b
Added new custom switches to install packages
jirkapok Jun 13, 2018
3bc1907
Implemented install package with multiple versions
jirkapok Jun 13, 2018
e0526c7
Added test to check, if installation arguments were used
jirkapok Jun 28, 2018
33bac0c
Fixed coding style issues and enabled static code analysis in editor
jirkapok Jul 29, 2018
ba04fd4
Implemented custom parameters ton install package
jirkapok Aug 6, 2018
d62d10b
Implemented upgrade package
jirkapok Aug 6, 2018
c87c9ed
Fixed package install scripts
jirkapok Aug 7, 2018
a084a76
Added documentation how to install package
jirkapok Aug 7, 2018
90016e2
Added test to find installed packages
jirkapok Aug 7, 2018
7724808
Replaced source command by constant
jirkapok Aug 8, 2018
99dc957
Reused find package method for local and remote scope
jirkapok Aug 8, 2018
ee9dbda
Implemented get package tests
jirkapok Aug 8, 2018
db20454
updated readme and doc for get installed package
jirkapok Aug 8, 2018
9a2de2e
Implemented uninstall package
jirkapok Aug 8, 2018
e66c567
Added uninstall documentation
jirkapok Aug 8, 2018
546cbb5
Removed obsolete C# implementation
jirkapok Aug 8, 2018
2d073d9
commented skeleton for package download
jirkapok Aug 8, 2018
c50c770
Implemented draft of save-package
jirkapok Oct 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ policheck*
*.orig.sln
*pingme*
*.GhostDoc.xml
**/.vs/ChocolateyProvider
/paket-files/
/.paket/
6 changes: 0 additions & 6 deletions .nuget/NuGet.Config

This file was deleted.

Binary file removed .nuget/NuGet.exe
Binary file not shown.
144 changes: 0 additions & 144 deletions .nuget/NuGet.targets

This file was deleted.

29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "Build",
"script": "Invoke-Psake",
"args": ["Build"],
"cwd": "${workspaceRoot}\\Build"
},
{
"type": "PowerShell",
"request": "launch",
"name": "Build and Test",
"script": "Invoke-Psake",
"args": [],
"cwd": "${workspaceRoot}\\Build"
},
{
"type": "PowerShell",
"request": "launch",
"name": "Test",
"script": "Invoke-Psake",
"args": ["Test"],
"cwd": "${workspaceRoot}\\Build"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"powershell.scriptAnalysis.settingsPath": "PSScriptAnalyzerSettings.psd1"
}
Binary file added Build/build.ps1
Binary file not shown.
13 changes: 13 additions & 0 deletions Build/prepareEnvironment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$InstallDir='C:\ProgramData\chocoportable'
$env:ChocolateyInstall="$InstallDir"

Set-ExecutionPolicy Bypass -Scope Process
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Testing framework
Install-Module -Name Pester -Force -SkipPublisherCheck -Scope "CurrentUser" -RequiredVersion 4.3.1
Import-Module -Name Pester
Install-Module -Name psake -Force -Scope "CurrentUser" -RequiredVersion 4.7.0
Import-Module -Name psake

choco install paket -y -version 5.133.0
106 changes: 106 additions & 0 deletions Build/psakefile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
$targetFolder = Join-Path $PSScriptRoot "Output"
$moduleName = "Chocolatey-OneGet"
$moduleFolder = Join-Path $targetFolder $moduleName
$outputRepository = "$moduleName-OutputRepository"
$installedModule = "$home\Documents\WindowsPowerShell\Modules\$moduleName"
$moduleVersion = "0.10.9"
$testsFilter = "*" # all by default
#$testsFilter = "Uninstall package"

Task Default -Depends `
Build,`
Test

Task Build -Depends `
Clean-OutputRepository,`
Clean,`
Restore-Packages,`
Register-OutputRepository, `
Compile, `
PublishTo-OutputRepository, `
Compile-TestPackage

Task Restore-Packages {
Exec {
paket restore
}
}

Task Clean {
Remove-Item $targetFolder -Force -Recurse -ErrorAction SilentlyContinue
# This needs to kill the Visual Studio code powershell instance, otherwise the chocolatey.dll is locked.
Remove-Item $installedModule -Force -Recurse -ErrorAction SilentlyContinue
}

Task Compile {
Copy-ToTargetFolder $moduleFolder
}

Task Clean-OutputRepository {
Unregister-PSRepository $outputRepository -ErrorAction SilentlyContinue
}

Task Register-OutputRepository {
mkdir "$targetFolder\$moduleName" | Out-Null

if((Get-PSRepository | Where-Object { $_.Name -eq $outputRepository}) -eq $null){
Register-PSRepository -Name $outputRepository -SourceLocation $targetFolder -PublishLocation $targetFolder -InstallationPolicy Trusted | Out-Null
}
}

Task Compile-TestPackage {
$testPackages = Join-Path $targetFolder "TestPackages"

if(-Not (Test-Path $testPackages)){
mkdir $testPackages | Out-Null
}

Exec {
choco pack ..\TestPackage\TestPackage.nuspec --outputdirectory $testPackages --version=1.0.1
choco pack ..\TestPackage\TestPackage.nuspec --outputdirectory $testPackages --version=1.0.2
choco pack ..\TestPackage\TestPackage.nuspec --outputdirectory $testPackages --version=1.0.3
choco pack ..\TestPackage\TestPackage.nuspec --outputdirectory $testPackages --version=1.1.0-beta1
}
}

Task Import-CompiledModule {
if((Get-Module -Name $moduleName) -eq $null){
# equivalent to: Install-Module $moduleName -Repository $outputRepository -Force -AllowClobber -Scope "CurrentUser"
$targetFolder = Join-Path $installedModule $moduleVersion
Copy-ToTargetFolder $targetFolder

Import-Module $moduleName -Force -Scope Local
}
}

Task Test -Depends Import-CompiledModule {
# Run Pester tests
$testResults = Invoke-Pester ../Tests/* -PassThru -TestName $testsFilter

if ($testResults.FailedCount -gt 0) {
Write-Error -Message 'One or more Pester tests failed!'
}
}

Task PublishTo-OutputRepository {
Publish-Module -Path $moduleFolder -Repository $outputRepository -Force
}

Task Publish {
# nugetApi key needs to be provided by chocolatey owners
Publish-Module -Path $moduleFolder -NuGetApiKey ""
}

function Copy-ToTargetFolder(){
param([String]$targetFolder)

if(-Not (Test-Path $targetFolder)){
mkdir $targetFolder | Out-Null
}

Copy-Item -Path "..\$moduleName.psd1" -Destination "$targetFolder\$moduleName.psd1" -Force
Copy-Item -Path "..\$moduleName.psm1" -Destination "$targetFolder\$moduleName.psm1" -Force
Copy-Item -Path "..\Chocolatey-Helpers.psm1" -Destination "$targetFolder\Chocolatey-Helpers.psm1" -Force
Copy-Item -Path "..\packages\chocolatey.lib\lib\chocolatey.dll" -Destination "$targetFolder\chocolatey.dll" -Force
Copy-Item -Path "..\packages\log4net\lib\net40-client\log4net.dll" -Destination "$targetFolder\log4net.dll" -Force
}
19 changes: 19 additions & 0 deletions Chocolatey-Helpers.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function IsChocolateyInstalled() {
$script:chocolateyDir = $null
if ($null -ne $env:ChocolateyInstall) {
$script:chocolateyDir = $env:ChocolateyInstall;
}
elseif (Test-Path (Join-Path $env:SYSTEMDRIVE Chocolatey)) {
$script:chocolateyDir = Join-Path $env:SYSTEMDRIVE Chocolatey;
}
elseif (Test-Path (Join-Path ([Environment]::GetFolderPath("CommonApplicationData")) Chocolatey)) {
$script:chocolateyDir = Join-Path ([Environment]::GetFolderPath("CommonApplicationData")) Chocolatey;
}

Test-Path -Path $script:chocolateyDir;
}

function Register-ChocoDefaultSource(){
# choco source add -n=choco -s=https://chocolatey.org/api/v2/
Register-PackageSource -ProviderName chocolatey-oneget -Name choco -Location https://chocolatey.org/api/v2/
}
Binary file added Chocolatey-OneGet.psd1
Binary file not shown.
Loading