diff --git a/.build.custom/analyzers/opencover.cover.post.step b/.build.custom/analyzers/opencover.cover.post.step deleted file mode 100644 index 00a3d97757..0000000000 --- a/.build.custom/analyzers/opencover.cover.post.step +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/bdddoc.build b/.build.custom/bdddoc.build deleted file mode 100644 index a2e7478d12..0000000000 --- a/.build.custom/bdddoc.build +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.build.custom/codeSign.step b/.build.custom/codeSign.step deleted file mode 100644 index 0296ee88ba..0000000000 --- a/.build.custom/codeSign.step +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/compile.pre.step b/.build.custom/compile.pre.step deleted file mode 100644 index 015ba3c53b..0000000000 --- a/.build.custom/compile.pre.step +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/ilmerge.post.build b/.build.custom/ilmerge.post.build deleted file mode 100644 index 52bcd1d2db..0000000000 --- a/.build.custom/ilmerge.post.build +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/ilmerge.pre.build b/.build.custom/ilmerge.pre.build deleted file mode 100644 index f37df99663..0000000000 --- a/.build.custom/ilmerge.pre.build +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/ilmerge.replace.build b/.build.custom/ilmerge.replace.build deleted file mode 100644 index d22a82aaa4..0000000000 --- a/.build.custom/ilmerge.replace.build +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/ilmergeDLL.build b/.build.custom/ilmergeDLL.build deleted file mode 100644 index d44b7356c6..0000000000 --- a/.build.custom/ilmergeDLL.build +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/nugetBuild.post.step b/.build.custom/nugetBuild.post.step deleted file mode 100644 index e8c805ef84..0000000000 --- a/.build.custom/nugetBuild.post.step +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/nugetPrepare.post.step b/.build.custom/nugetPrepare.post.step deleted file mode 100644 index f20f6f7b7b..0000000000 --- a/.build.custom/nugetPrepare.post.step +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build.custom/package.post.step b/.build.custom/package.post.step deleted file mode 100644 index fe3f45418e..0000000000 --- a/.build.custom/package.post.step +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/Castle.Core.dll b/.build/Castle.Core.dll deleted file mode 100644 index 8e86a7c689..0000000000 Binary files a/.build/Castle.Core.dll and /dev/null differ diff --git a/.build/Castle.Windsor.dll b/.build/Castle.Windsor.dll deleted file mode 100644 index 49c20a3174..0000000000 Binary files a/.build/Castle.Windsor.dll and /dev/null differ diff --git a/.build/UppercuT.xml b/.build/UppercuT.xml deleted file mode 100644 index 38e16b3884..0000000000 --- a/.build/UppercuT.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - 1.4.2.0 - diff --git a/.build/analyze.step b/.build/analyze.step deleted file mode 100644 index ffa4d7c706..0000000000 --- a/.build/analyze.step +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/cover.step b/.build/analyzers/cover.step deleted file mode 100644 index 2f1081cf08..0000000000 --- a/.build/analyzers/cover.step +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/fxcop.step b/.build/analyzers/fxcop.step deleted file mode 100644 index e8a55f1e3e..0000000000 --- a/.build/analyzers/fxcop.step +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/gallio.test.step b/.build/analyzers/gallio.test.step deleted file mode 100644 index e4c7edbf6f..0000000000 --- a/.build/analyzers/gallio.test.step +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/mbunit2.test.step b/.build/analyzers/mbunit2.test.step deleted file mode 100644 index abedfa43c6..0000000000 --- a/.build/analyzers/mbunit2.test.step +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/metrics.step b/.build/analyzers/metrics.step deleted file mode 100644 index 5c4c57d46b..0000000000 --- a/.build/analyzers/metrics.step +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - s - - - - - - - diff --git a/.build/analyzers/moma.step b/.build/analyzers/moma.step deleted file mode 100644 index 7f62672720..0000000000 --- a/.build/analyzers/moma.step +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/ncover.cover.step b/.build/analyzers/ncover.cover.step deleted file mode 100644 index 084fa71dd0..0000000000 --- a/.build/analyzers/ncover.cover.step +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/ndepend.step b/.build/analyzers/ndepend.step deleted file mode 100644 index 7721594d05..0000000000 --- a/.build/analyzers/ndepend.step +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/nitriq.step b/.build/analyzers/nitriq.step deleted file mode 100644 index bc3867c67c..0000000000 --- a/.build/analyzers/nitriq.step +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/nunit.test.step b/.build/analyzers/nunit.test.step deleted file mode 100644 index aadb346ab4..0000000000 --- a/.build/analyzers/nunit.test.step +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/opencover.cover.step b/.build/analyzers/opencover.cover.step deleted file mode 100644 index bd4e247672..0000000000 --- a/.build/analyzers/opencover.cover.step +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/test.step b/.build/analyzers/test.step deleted file mode 100644 index 7d0640a010..0000000000 --- a/.build/analyzers/test.step +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/analyzers/xunit.test.step b/.build/analyzers/xunit.test.step deleted file mode 100644 index eed46fd222..0000000000 --- a/.build/analyzers/xunit.test.step +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/compile.step b/.build/compile.step deleted file mode 100644 index 49888ddb06..0000000000 --- a/.build/compile.step +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/csharp.functions b/.build/csharp.functions deleted file mode 100644 index 6e2ab24481..0000000000 --- a/.build/csharp.functions +++ /dev/null @@ -1,83 +0,0 @@ - - - - diff --git a/.build/customize.bat b/.build/customize.bat deleted file mode 100644 index e76f84e76e..0000000000 --- a/.build/customize.bat +++ /dev/null @@ -1,42 +0,0 @@ -@echo on - -::Project UppercuT - http://uppercut.googlecode.com -::No edits to this file are required - http://uppercut.pbwiki.com - -if '%1' == '' goto usage -if '%2' == '' goto usage -if '%3' NEQ '' goto usage -if '%1' == '/?' goto usage -if '%1' == '-?' goto usage -if '%1' == '?' goto usage -if '%1' == '/help' goto usage - -SET step.name=%1 -SET step.type=%2 - - -SET DIR=%cd% -SET BUILD_DIR=%~d0%~p0% -SET NANT="%DIR%\lib\Nant\nant.exe" -SET build.config.settings="%DIR%\.uppercut" - -%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%customize.build" -D:build.config.settings=%build.config.settings% -D:customize.step.name=%step.name% -D:customize.step.type=%step.type% - -if %ERRORLEVEL% NEQ 0 goto errors - -goto finish - -:usage -echo. -echo Usage: .build\customize.bat stepName customizeType -echo stepName is the name of the item -echo customizeType is "pre" "post" or "replace" -echo . -echo Example: customize package.step post -echo. -goto finish - -:errors -EXIT /B %ERRORLEVEL% - -:finish diff --git a/.build/customize.build b/.build/customize.build deleted file mode 100644 index 274379ccb5..0000000000 --- a/.build/customize.build +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/customizers/item.template b/.build/customizers/item.template deleted file mode 100644 index 6b3cc15f57..0000000000 --- a/.build/customizers/item.template +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/default.build b/.build/default.build deleted file mode 100644 index 78456d108a..0000000000 --- a/.build/default.build +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/default.build.settings b/.build/default.build.settings deleted file mode 100644 index db137862e2..0000000000 --- a/.build/default.build.settings +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/deploymentBuilder.step b/.build/deploymentBuilder.step deleted file mode 100644 index 20db18ab78..0000000000 --- a/.build/deploymentBuilder.step +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/environmentBuilder.step b/.build/environmentBuilder.step deleted file mode 100644 index 600d3b5469..0000000000 --- a/.build/environmentBuilder.step +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/gemsBuild.step b/.build/gemsBuild.step deleted file mode 100644 index 429241eb8e..0000000000 --- a/.build/gemsBuild.step +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/gemsPrepare.step b/.build/gemsPrepare.step deleted file mode 100644 index a157b85c88..0000000000 --- a/.build/gemsPrepare.step +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${assembly.version.full}${version.gem.suffix} - - ${assembly.version.full}.${gem.build.date}${version.gem.suffix} - - - diff --git a/.build/generateBuildInfo.step b/.build/generateBuildInfo.step deleted file mode 100644 index 2d0b2bc30d..0000000000 --- a/.build/generateBuildInfo.step +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${project.name} - ${string::replace(string::replace(company.name,'&','&'),'&','&')} - ${version.major} - ${version.minor} - ${version.patch} - ${version.build} - ${version.revision} - ${version.hash} - ${assembly.version.full} - ${version.product} - ${repository.path} - ${microsoft.framework} - ${msbuild.configuration} - ${msbuild.platform} - UppercuT v. ${version.uppercut} -]]> - - - - diff --git a/.build/ilmerge.build b/.build/ilmerge.build deleted file mode 100644 index 509b5d3265..0000000000 --- a/.build/ilmerge.build +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/manifestBuilder.step b/.build/manifestBuilder.step deleted file mode 100644 index 790b3bd5bf..0000000000 --- a/.build/manifestBuilder.step +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/nugetBuild.step b/.build/nugetBuild.step deleted file mode 100644 index 71b5417451..0000000000 --- a/.build/nugetBuild.step +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/nugetPrepare.step b/.build/nugetPrepare.step deleted file mode 100644 index c90421fcd9..0000000000 --- a/.build/nugetPrepare.step +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${assembly.version.full} -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/obfuscate.step b/.build/obfuscate.step deleted file mode 100644 index cd4195da45..0000000000 --- a/.build/obfuscate.step +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/open.build b/.build/open.build deleted file mode 100644 index 2f4b0f49d5..0000000000 --- a/.build/open.build +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/package.step b/.build/package.step deleted file mode 100644 index b7e034f1ab..0000000000 --- a/.build/package.step +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/policyChecks.step b/.build/policyChecks.step deleted file mode 100644 index 98a2b78a00..0000000000 --- a/.build/policyChecks.step +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/uc.exe b/.build/uc.exe deleted file mode 100644 index f5023c1756..0000000000 Binary files a/.build/uc.exe and /dev/null differ diff --git a/.build/uc.exe.config b/.build/uc.exe.config deleted file mode 100644 index 15bb50b1ee..0000000000 --- a/.build/uc.exe.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.build/updateAssemblies.build b/.build/updateAssemblies.build deleted file mode 100644 index f1bd483e08..0000000000 --- a/.build/updateAssemblies.build +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/uppercut.dll b/.build/uppercut.dll deleted file mode 100644 index d831a96966..0000000000 Binary files a/.build/uppercut.dll and /dev/null differ diff --git a/.build/uppercut.tasks.dll b/.build/uppercut.tasks.dll deleted file mode 100644 index 3680ef7dea..0000000000 Binary files a/.build/uppercut.tasks.dll and /dev/null differ diff --git a/.build/versionBuilder.step b/.build/versionBuilder.step deleted file mode 100644 index 2aa5a55865..0000000000 --- a/.build/versionBuilder.step +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/versioners/git.step b/.build/versioners/git.step deleted file mode 100644 index 1285c0d779..0000000000 --- a/.build/versioners/git.step +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/versioners/hg.step b/.build/versioners/hg.step deleted file mode 100644 index 876dda4d63..0000000000 --- a/.build/versioners/hg.step +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/versioners/svn.step b/.build/versioners/svn.step deleted file mode 100644 index c05b2e9473..0000000000 --- a/.build/versioners/svn.step +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/versioners/tfs.step b/.build/versioners/tfs.step deleted file mode 100644 index eef96bddc8..0000000000 --- a/.build/versioners/tfs.step +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.build/zip.build b/.build/zip.build deleted file mode 100644 index 8ccb60decd..0000000000 --- a/.build/zip.build +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.editorconfig b/.editorconfig index aade7bcae2..28fe36d4e7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,4 +8,4 @@ end_of_line = CRLF [*.ps1] indent_style = space -indent_size = 2 +indent_size = 4 diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000000..6993b5eb0e --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,480 @@ +#(maint) Remove trailing whitespace +2456459bfd2094f4b32cb9267ad7eb7d2cb3eec0 + +#(maint) Add trailing newline to files +4b6656b10102acee4b7c958adc066571d9f04dd4 + +#(maint) Add BOM +a374d52a9f5cd3d48687ea25e0b7c059dfeb7d3f + +#(maint) Fix line endings +8face0175ac571d47ee405254dc0962d0ef1783c + +#(#2261) Updates License Headers Copyright to 2021 +3ac4e4e924de7302a6851096ffba091b2b1175f6 + +#(maint) Add 2018 to copyright year +0a86d5e5e78747f0ae00b5eb04916c19a0e7ba86 + +#(GH-1209) Add Chocolatey Software to copyright +8dc774eb615a760581b49913402bc3956d354205 + +#(maint) Corrected whitespace +44558390a70614440bc9c113e5c7da4576cfeaa4 + +#(maint) Corrected whitespace +57f966ff5b51cf43a56e9aa56f844384326ae0a1 + +#(maint) Corrected whitespace +fd81fcd6c48688c67e8f8e3a9cd2dd08126870b3 + +#(maint) Corrected whitespace +6cc246eb3d71d8f01e4a6f5e608fc836348ad19e + +#(maint) Corrected whitespace +f8b0c6abe5cae1ba8025e0556d8d7dc9d105e4cb + +#(maint) Whitespace changes +7c9e4405477449890cc12ad757df503ffc006e61 + +#(maint) Whitespace changes +00025cbc6df2640cb967d3539fdec1b259f77d45 + +#(maint) Whitespace changes +d7b2544b7fb627b9b4d2bead9c117e97ca85facd + +#(maint) Whitespace changes +22284f0f31358eee8100b91a19a4ec6d101f17bf + +#(maint) Whitespace changes +dc49f717c6c2f2ade3df292850c648028cd69f61 + +#(maint) Remove unnecessary whitespace +a7b1d03f37ede4e771e8ca45fd73717303a1a76b + +#(maint) Remove unnecessary whitespace +de61b1d1a19a7edd8e9b38921b3b29e54d55ac15 + +#(maint) Remove unnecessary whitespace +53694495ec6f0ff266c4a22b7329be1d770adc03 + +#(maint) Remove unnecessary whitespace +50a21c48e50c444a436b1be4dd5688c19fab9eac + +#(maint) Correct whitespace +9d4dd65a1fcfacf07fe4ccd9c63f69b4a3506f7c + +#(maint) Remove unnecessary whitespace +2a99e3873b1535060a2de8418c52854976552002 + +#(maint) Remove unnecessary whitespace +32461370879f26c1595083aeed8b49c73f6aaeb5 + +#(maint) Remove unnecessary whitespace +eb30cef11038767da4ac456c2372d66d09080c81 + +#(maint) Remove unnecessary whitespace +0d419905ce06cee00ade0f0ebf4ce1eb33b38240 + +#(maint) Remove whitespace +aab0406f70a46212bbb5d023e53a41c786a95ede + +#(maint) whitespace +6b4d50bf294f0cdb05ece1664a1e33d3095f9d5e + +#(maint) Correct whitespace +ba3c10b544d919ab39e21c558fed64008f835c34 + +#(maint) Corrected whitespace +44558390a70614440bc9c113e5c7da4576cfeaa4 + +#(maint) Correct whitespace +b2f54e3e66b919284c168509fce4e6e56f799218 + +#(maint) Correct whitespace +d91bf41319d4ca2ee48263eb46eca37ea09f210f + +#(maint) whitespace +968a84a9ebbe08c9b728799bed337ed561ddb4bf + +#(maint) Remove unnecessary whitespace +1a20a2e2e90d07e058887c397ec9a88e3c87279e + +#(maint) Formatting + whitespace fix +99fd2c2c9d714972bda8cfcf0748d4b27d3584e2 + +#(maint) Remove unnecessary whitespace +cf2862201e62edbfbfdf06c454b18ddd1e81e045 + +#(maint) Remove whitespace and fix formatting +d7b2d08232977971e55aa4ed851345880dc07517 + +#(maint) Whitespace +0efabf0b8309e9301e742441c20a12bbe3e5074c + +#(maint) Whitespace and formatting fix +ed46ca7fae1b8afd720bd6dc612cfdefb2a04edf + +#(maint) Remove unnecessary whitespace +742dacca1f32dea0723b16660faeef6dbdcf39a4 + +#(maint) Fix whitespace and formatting +0c4025b48aa62be48fd221918b785ac4ed73e07f + +#(maint) Formatting +f701feabf7f1deccaba335f486f3ca3a4056cccf + +#(maint) Formatting +9315a9ec54f0f24770f3184d8cbc1b4493607470 + +#(maint) Formatting + whitespace fix +99fd2c2c9d714972bda8cfcf0748d4b27d3584e2 + +#(maint) formatting +38edf1efd9d73e7a5f0502e898e917dd8ecaf242 + +#(maint) Formatting and whitespace changes +2bf2bcd88d9c9b33f2dd092884863365b3fcc55a + +#(maint) Formatting and whitespace changes +1007d8c760d75a63df23521bae612c9f6183c822 + +#(maint) formatting +179f0f32b4a5f646e5ada6401935627e91be6a98 + +#(maint) formatting +0d840334bb4cad0432089e11096769b6353e5c8e + +#(maint) formatting +3837ffdc36812fdbb030e938032517c3a5cd8ffc + +#(maint) formatting +0fe09728612a1ef29317aecf9d9cfa041817d3d8 + +#(maint) formatting +e0c753fc4da00c5863ff5d6b25b332d29f83f11f + +#(maint) formatting / order +1675a19d8b1c8ad6e3efb11a4202ff4dffe8557c + +#(maint) formatting +c8c28093ac68cff6aa59728ac1d1065996b96a13 + +#(maint) formatting +bca094debb96735e793468a6fcc0d59acf6734cd + +#(maint) formatting +d32982a22703e13b2e4708373b755c02211852d7 + +#(maint) formatting +fd63e4a8807bb352bd8b7c31f5aa43ed35278171 + +#(maint) formatting +865d7477f24e5dc81add0c1d3a587bd1374c4a76 + +#(maint) formatting +f5798180e7fd26fb9c3da343d2bdba6ed2798af0 + +#(maint) formatting +f9e586d12fcca2f2e42e43abd329fb4eb97626bc + +#(maint) formatting +5dcd104ccb9d38fe5e4977ab0c1382cc8703fc77 + +#(maint) formatting +68de28f738dbc2a6537a9c304a199ca5809bc18a + +#(maint) formatting/wording +75e8063ee322db789dae05ee65af97a22c86c21d + +#(maint) formatting +8bd20a0f6aeb577b48af6c4638de5896021532bb + +#(maint) formatting +3a0ee21a669656f56d661bec487085c422990f70 + +#(maint) formatting +1bcd6dc600542f42237779f2213d484a39d66f93 + +#(maint) formatting +939afa30b87728762f5409a6073f9b68bf50d5f0 + +#(maint) formatting +d25ef6dcd5f18852160912f47b460af56611eb62 + +#(maint) formatting +3da47609824464780f0707868a28c521dc9efdba + +#(maint) formatting +260c872954782cc987ee9cbfa3f55ce7e809e500 + +#(maint) formatting +48e668dc1e8ddc75d6135fb6721b00f7326af9bc + +#(maint) formatting +581db0177e43d6e2b9dd1852a6cef9f25df878dc + +#(maint) formatting +c51f9d301fb52cf6fd93a51cac1a55a84d36c1d7 + +#(maint) formatting +d12c94c799cd7c1904c14546f81e001fae44161f + +#(maint) formatting +728deda7ba4a4a46be371aa8da352a1bc597bb90 + +#(maint) formatting +70a6120723a0ffe8505ee238fbf1024f5bca3505 + +#(maint) formatting +1a9aa99f2c34c2ef4c9eed4a37ad213f75a92965 + +#(maint) formatting +e63773b5ab1aea63f8b514e30df9921847cbf55c + +#(maint) formatting +12230d4acafe72da79f3e0761e292440a5783bb6 + +#(maint) formatting +77be5d8192dc57c9523daf59f70da85cfdda876c + +#(maint) formatting +43b139c332bc664700963a0fd6d28e0349c10b47 + +#(maint) formatting methods / parameters in calls +0666e26fcfe1b95b7685cdcd0ff4bd9e9e51cda3 + +#(maint) formatting +186f9c739ff4654363ce675cfcd71ac7722a24a4 + +#(maint) formatting +74af77d178d0750c55262fd09d2ba1fcb5842b84 + +#(maint) formatting +ff97904b5c398349b738e16e643fc996c33c73f2 + +#(maint) formatting +f4ae1c9845cddbc83d75f09706b9c0b5e00d32f6 + +#(maint) formatting +0513e70ef2104f8f345e514f86b3202884a849ae + +#(maint) formatting +be903e4e5585f551aebde1e09f93b46612283b25 + +#(maint) formatting +e2fa59116b8e42ef44f611b9b14362d51db6c5ba + +#(maint) formatting / add message consistency +2854c5ae8e6aa3fbe6f5b5fe51a59190c886cc72 + +#(maint) formatting +c3ae26769cd7a023cea0e3c0561752bedd05e5da + +#(maint) formatting +d51e259d38312c28ea6e5954ebf7ca4311820699 + +#(maint) formatting +7709753f8804df22d615398f4cc3d975734af34f + +#(maint) formatting +31db2695841501784d0a05530d16ec6a7397dc4a + +#(maint) formatting +e5726d7340a07e0c9127f3518ad95f7d506a5392 + +#(maint) formatting +a7d92f53263acf6205965b65bfafa4282563a8cf + +#(maint) formatting +c819d7bf07b8e576a22b92ecb448b1497b8ab094 + +#(maint) formatting +727879cab1a647af92b701146c26f263b11a78ae + +#(maint) formatting +252f7c5152cd6c8c254a67d036cd6ea350ba747a + +#(maint) formatting +40095903aebcbe5304c9bc82196cd68f437c547c + +#(maint) formatting +4643bab03d187a381e3a7c2f6d206dda215afae6 + +#(maint) formatting +b74dbec14fbf5d11f6575542976ce85030c75558 + +#(maint) formatting +4f3454295d332f4b41ad84224d0e5b5dc6e20eb8 + +#(maint) formatting +5f6439a974db86a729ea449d6d72b295a4ced72d + +#(maint) formatting +69f3466674907be27b2929173ac09bee0b8a10ca + +#(maint) formatting +09765f6626458f5fb491f43bc24f0755531d9c88 + +#(maint) formatting +8906ea82aa689e0557e03bb6348f3aa4688d37a7 + +#(maint) formatting +da4cb2a646c35c0c976085f6d8362c43af696fd8 + +#(maint) formatting +b09644e00c925d6c17ad01a578fb726d07ccb4a4 + +#(maint) formatting +7ae1939f734615357247c6a518c52a76a9869077 + +#(maint) formatting +5601e2db63aefa02411b7c40aadd789942e81e7a + +#(maint) formatting +c8d9630c8698f9738b423198d9119d1aac8b2aed + +#(maint) formatting +763ac498364ecd6b9ac6240d70c57ccccca62849 + +#(maint) formatting +b7c619f10e42a8dd57b6f42c59b735d74e1890c3 + +#(maint) formatting +9c1bfe1d30e958e4113289bafbd8b1954ad8c3f8 + +#(maint) formatting +1dffc0a958a5d85fb0b1ec2506052a88190c01a7 + +#(maint) formatting +c8bec4424243adf6d4201fb8f6e940e468d00b0b + +#(maint) formatting +998bc44116cb3054ac5717fcd4547bcb03db55d6 + +#(maint) formatting +346c050025dc4c51800cc8cd4985d81710c40ebb + +#(maint) formatting +cd98ee0053aae1c29485bd5f269fcdff7aaa370c + +#(maint) formatting +e5ea5a6ca3f58062a2ba9e04a2b616ee036b6cc1 + +#(maint) formatting/comment +231ac31dfab285e740b50ab583feaf376d3ccd9c + +#(maint) formatting +580a66467783c436fcdd3cdb74a4ee8e94b73fb1 + +#(maint) formatting +855b4abc3e348f669091704c3951d7f5c7970956 + +#(maint) formatting +5765e5e80d1dcd31d55c671e145037d919509015 + +#(maint) formatting +9945cd0bafd3983bc10903d0ec9b01d48210afdd + +#(maint) formatting +e6ad7e7f90fa28417602ec22349add8750aa50ac + +#(maint) formatting +87c8c5b1676131b3bf2823142921cb1c828e83b0 + +#(maint) formatting +2b68dae5efb93699dbbc65e6761fd1d5f7a362a2 + +#(maint) formatting +e4f145e4bcc16d2d0e3360a4e4b253175483fe7b + +#(maint) formatting +016c6914335198e78305db0691ae9b800d14e13c + +#(maint) formatting +309f33ecc8d454d12d3398cdccba77a3658ba106 + +#(maint) formatting +35c98096055d3c034848ffa54fbbc0d284d0e037 + +#(maint) formatting +e199c22c2b304215835b27778dbbcc63a14b529a + +#(maint) formatting +abdea1856bcb370d3b1ffe782922d793ba9ecb3e + +#(maint) formatting +f10c55d3fc860b66f7892930b493eda2953e0419 + +#(maint) formatting +3ff7adb0ecb1b85da9340693f11d9699ae2d50c3 + +#(maint) formatting +4f39b7439e045ed2b65fe72741b753afb3b4d33d + +#(maint) formatting +f1df436680acac307d489a8402390891d8c32573 + +#(maint) formatting +ddf8d2f3692a9f1de472965aa1f5f619acb23c50 + +#(maint) formatting +cee189ccdd0e0a4169044a1d847d0fb8226d4c67 + +#(maint) formatting/spacing +32dc4420f35a55375da9d253e2ee591b4d72a674 + +#(maint) formatting +67fbbcf5b4f2828e7c3910730e042b90181e0415 + +#(maint) formatting +13451a7a841f353365953454f91503b0af79392d + +#(maint) formatting +26447f974f5853866d73e46f71af378a7834bdac + +#(maint) formatting +a808f2f2e07cbbbcac021de7e4c74d90c63d523c + +#(maint) formatting +a2a6eb98e7add1c9646e9f86a4614ee22a78f950 + +#(maint) formatting +a2d026d4ef173d68132c2e51c8abbea408eb9f3e + +#(maint) formatting +fea75e87f0ef7d64eb823f4a091f958594c4fe4e + +#(maint) formatting +e3d3a9fc2c3bf3d54273bd51991fd44eca9bae24 + +#(maint) formatting +e387053ab1502088e92ad4a72f65f6da88f4cae4 + +#(maint) formatting +ebc811ae6e10693e07b8bab406bcf7f76711209a + +#(maint) formatting +18b33736da35bde7419e8a2b2a631aafd0a3ba36 + +#(maint) formatting +785f1e970ca2d43de6d5e5181dddc8c9c233fdc6 + +#(maint) formatting +97458f8877f07c6cea87d2702b98ccb9f36cb712 + +#(maint) formatting +5e29a252b52ef4c5c5324844d7796845b00db2d8 + +#(maint) formatting +b19c8c24b08d3b4a8d2b2b88d46edead71d0e31a + +#(maint) formatting +e9515c247972ecf22ece68e080ae96ef0e8ebd6c + +#(maint) formatting of xml comments +5e7bdb4143e89605ce887543b4ba74f6af488e3c + +#(maint) formatting +f6393c625416250e87294bb4f20b94495a1ed923 + diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 2bfa507794..0000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,51 +0,0 @@ - - -### What You Are Seeing? - -### What is Expected? - -### How Did You Get This To Happen? (Steps to Reproduce) - -### Output Log - - -GIST LINK - Please create a gist and link to that gist here - -OR - -~~~sh -PLACE LOG CONTENT HERE -~~~ - - diff --git a/.github/ISSUE_TEMPLATE/AskQuestion.md b/.github/ISSUE_TEMPLATE/AskQuestion.md deleted file mode 100644 index a2c10d7513..0000000000 --- a/.github/ISSUE_TEMPLATE/AskQuestion.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ask Question -about: Do you have a question? ---- - -STOP RIGHT HERE - DO NOT CREATE A TICKET FOR A QUESTION ON THIS REPOSITORY - -1. Start with https://docs.chocolatey.org/en-us/troubleshooting (Troubleshooting) and https://docs.chocolatey.org/en-us/faqs (FAQs) to see if your question or issue already has an answer. You can also explore https://docs.chocolatey.org/en-us/ (which are pretty comprehensive, but not always the most searchable). -2. If not found or resolved, please see https://chocolatey.org/support to see what avenues are available to you based on whether you are an open source user or a licensed customer (have a commercial edition). - - -The best routes for getting questions answered when the documentation doesn't serve what you need is the mailing list or in chat: -- email - http://groups.google.com/group/chocolatey -- chat - https://gitter.im/chocolatey/choco - - - -NOTE: Keep in mind we have an etiquette regarding communication that we expect folks to observe when they are looking for support in the Chocolatey community. https://github.com/chocolatey/choco/blob/master/README.md#etiquette-regarding-communication \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/ReportGUIIssue.md b/.github/ISSUE_TEMPLATE/ReportGUIIssue.md deleted file mode 100644 index e7622490b1..0000000000 --- a/.github/ISSUE_TEMPLATE/ReportGUIIssue.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: Chocolatey GUI - Report Issue / Suggest Feature -about: Did you find unexpected behavior? ---- - -STOP RIGHT HERE - DO NOT CREATE A TICKET FOR Chocolatey GUI ON THIS REPOSITORY - -This is the repository for choco.exe, the command line interface for Chocolatey, and issues/feature suggestions should be limited to only choco. - -For Chocolatey GUI, you will need to head over to https://github.com/chocolatey/ChocolateyGUI and file a ticket there. - - - -NOTE: Keep in mind we have an etiquette regarding communication that we expect folks to observe when they are looking for support in the Chocolatey community. https://github.com/chocolatey/choco/blob/master/README.md#etiquette-regarding-communication \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/ReportPackageIssue.md b/.github/ISSUE_TEMPLATE/ReportPackageIssue.md deleted file mode 100644 index ddf94ac11e..0000000000 --- a/.github/ISSUE_TEMPLATE/ReportPackageIssue.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Package - Report Issue / Suggest Missing Package / Package Outdated -about: Something went wrong with an installation? Want a package to be added to the community repository? ---- - -STOP RIGHT HERE - DO NOT CREATE A TICKET FOR PACKAGES ON THIS REPOSITORY - -This is the repository for choco.exe, the command line interface for Chocolatey, and issues/feature suggestions should be limited to only choco. For a package failure, typically you would be reporting an issue with a package on the community package repository, which is not what this repository represents. In fact, the community repository and all of its packages represents about 5% of the packages in existence and less than half of the usage of choco itself. - - In other words Chocolatey != Chocolatey.org Packages. - -For all things packages, you have two routes: - -1. If you are having issue with a package or you want to see an enhancement, please see https://docs.chocolatey.org/en-us/community-repository/users/package-triage-process (Package Triage Process / Becoming a maintainer of existing packages). -2. If you are looking for packages to be added to the community package repository (aka https://community.chocolatey.org/packages), please see https://docs.chocolatey.org/en-us/community-repository/users/package-triage-process#package-request-package-missing (Package Requests). - - - -NOTE: Keep in mind we have an etiquette regarding communication that we expect folks to observe when they are looking for support in the Chocolatey community. https://github.com/chocolatey/choco/blob/master/README.md#etiquette-regarding-communication \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/ReportWebsiteIssue.md b/.github/ISSUE_TEMPLATE/ReportWebsiteIssue.md deleted file mode 100644 index fa551b2019..0000000000 --- a/.github/ISSUE_TEMPLATE/ReportWebsiteIssue.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: Website - Report Issue / Suggest Feature -about: Something weird about https://community.chocolatey.org or do you want to suggest a feature? ---- - -STOP RIGHT HERE - DO NOT CREATE A TICKET FOR THE WEBSITE ON THIS REPOSITORY - -This is the repository for choco.exe, the command line interface for Chocolatey, and issues/feature suggestions should be limited to only choco. - -For Chocolatey Gallery aka Chocolatey Community Package Repository, you will need to head over to https://github.com/chocolatey/home and file a ticket there. - - - -NOTE: Keep in mind we have an etiquette regarding communication that we expect folks to observe when they are looking for support in the Chocolatey community. https://github.com/chocolatey/choco/blob/master/README.md#etiquette-regarding-communication \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/zChocoFeatureRequest.md b/.github/ISSUE_TEMPLATE/zChocoFeatureRequest.md deleted file mode 100644 index e5057702ca..0000000000 --- a/.github/ISSUE_TEMPLATE/zChocoFeatureRequest.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Choco.exe - Enhancement / Feature Request -about: How can we make Chocolatey work better for you? Is there additional functionality you would love us to consider? ---- - - diff --git a/.github/ISSUE_TEMPLATE/zChocoReportIssue.md b/.github/ISSUE_TEMPLATE/zChocoReportIssue.md deleted file mode 100644 index 635a787ea7..0000000000 --- a/.github/ISSUE_TEMPLATE/zChocoReportIssue.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -name: Choco.exe - Report Issue -about: Did you find unexpected behavior? ---- - - - -### What You Are Seeing? - -### What is Expected? - -### How Did You Get This To Happen? (Steps to Reproduce) - -### Output Log - - - -
-Full Log Output - -

- -~~~sh -PLACE LOG CONTENT HERE - WE NEED _ALL_ DETAILED OUTPUT BASED ON THE ABOVE TO BE ABLE TO PROVIDE SUPPORT (YOU WILL FIND THAT IN THE $env:ChocolateyInstall\logs\chocolatey.log between the `=====`) -~~~ - -

- -
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 0875438635..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index 43998ec9bb..0000000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,6 +0,0 @@ -# Security Policies and Procedures - -Security reports should never start out in the open. Please follow up directly -with the team if you have a contact. If not you can always start with the -information at https://docs.chocolatey.org/en-us/information/security to see -instructions on how to provide the disclosure. Thank you! diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aeea32f4e1..14fbb73b6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,15 +1,9 @@ name: Chocolatey Builds on: - # Trigger on pushes to master and stable, or with pull requests + # Trigger on pushes and on pull requests push: - branches: - - master - - stable pull_request: - branches: - - master - - stable # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -20,44 +14,129 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Cache Tools + uses: actions/cache@v2.1.6 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} - name: Build with Mono run: | chmod +x build.sh - $GITHUB_WORKSPACE//build.sh -v + $GITHUB_WORKSPACE//build.sh --verbosity=diagnostic --target=CI + - name: Upload Ubuntu build results + uses: actions/upload-artifact@v2 + # Always upload build results + if: ${{ always() }} + with: + name: ubuntu-build-results + path: | + code_drop/TestResults/issues-report.html + code_drop/TestResults/NUnit/TestResult.xml + code_drop/Packages/NuGet/*.nupkg + code_drop/MsBuild.log # Build on Windows windows-build: - runs-on: windows-latest + runs-on: windows-2019 steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Cache Tools + uses: actions/cache@v2.1.6 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} - name: Build with .Net Framework - run: .\build.bat -v + run: ./build.ps1 --verbosity=diagnostic --target=CI + - name: Upload Windows build results + uses: actions/upload-artifact@v2 + # Always upload build results + if: ${{ always() }} + with: + name: windows-build-results + path: | + code_drop\TestResults\issues-report.html + code_drop\TestResults\NUnit\TestResult.xml + code_drop\TestCoverage\lcov.info + code_drop\TestCoverage\OpenCover.xml + code_drop\ilmerge-chocoexe.log + code_drop\ilmerge-chocolateydll.log + code_drop\Packages\NuGet\*.nupkg + code_drop\Packages\Chocolatey\*.nupkg + code_drop\MsBuild.log + - uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: | + code_drop\TestCoverage\lcov.info + flag-name: run-${{ matrix.os }} + parallel: true # Build using mono on MacOS macos-build: runs-on: macos-latest steps: - - uses: actions/checkout@v2 - - name: Build with Mono - run: | - chmod +x build.sh - $GITHUB_WORKSPACE//build.sh -v + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Cache Tools + uses: actions/cache@v2.1.6 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} + - name: Build with Mono + run: | + chmod +x build.sh + $GITHUB_WORKSPACE//build.sh --verbosity=diagnostic --target=CI + - name: Upload MacOS build results + uses: actions/upload-artifact@v2 + # Always upload build results + if: ${{ always() }} + with: + name: macos-build-results + path: | + code_drop/TestResults/issues-report.html + code_drop/TestResults/NUnit/TestResult.xml + code_drop/Packages/NuGet/*.nupkg + code_drop/MsBuild.log # Build using Mono in Docker on Ubuntu docker-build: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v2 - - - name: Set up QEMU + with: + fetch-depth: 0 + - name: Cache Tools + uses: actions/cache@v2.1.6 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} + - name: Set up QEMU uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - - name: Build and push + - name: Build and push uses: docker/build-push-action@v2 with: context: . file: docker/Dockerfile.linux push: false - tags: chocolatey/choco:latest \ No newline at end of file + tags: chocolatey/choco:latest + build-args: | + "github_actions=true" + "github_ref=${{ github.ref }}" + "github_repository=${{ github.repository }}" + "github_base_ref=${{ github.base_ref }}" + "github_head_ref=${{ github.head_ref }}" + "github_run_number=${{ github.run_number }}" + upload-code-coverage-results: + needs: [ubuntu-build, windows-build, macos-build] + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..fe5ce3850f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,89 @@ +name: Chocolatey Integration Tests + +on: + schedule: + # Run at 10:47pm, at a random minute to reduce load on GH Actions + - cron: '47 22 * * *' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + # Build and test using mono on Ubuntu + ubuntu-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Cache Tools + uses: actions/cache@v2.1.6 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} + - name: Test with NUnit on Mono + run: | + chmod +x build.sh + $GITHUB_WORKSPACE//build.sh --verbosity=diagnostic --target=test --testExecutionType=all + - name: Upload Ubuntu build results + uses: actions/upload-artifact@v2 + # Always upload build results + if: ${{ always() }} + with: + name: ubuntu-build-results + path: | + code_drop/TestResults/issues-report.html + code_drop/TestResults/NUnit/TestResult.xml + code_drop/MsBuild.log + # Build and test on Windows + windows-build: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Cache Tools + uses: actions/cache@v2.1.6 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} + - name: Test with NUnit on .Net Framework + run: .\build.bat --verbosity=diagnostic --target=test --testExecutionType=all --shouldRunOpenCover=false + - name: Upload Windows build results + uses: actions/upload-artifact@v2 + # Always upload build results + if: ${{ always() }} + with: + name: windows-build-results + path: | + code_drop\TestResults\issues-report.html + code_drop\TestResults\NUnit\TestResult.xml + code_drop\TestCoverage\lcov.info + code_drop\TestCoverage\OpenCover.xml + code_drop\MsBuild.log + # Build and test using mono on MacOS + macos-build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Cache Tools + uses: actions/cache@v2.1.6 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} + - name: Test with NUnit on Mono + run: | + chmod +x build.sh + $GITHUB_WORKSPACE//build.sh --verbosity=diagnostic --target=test --testExecutionType=all + - name: Upload MacOS build results + uses: actions/upload-artifact@v2 + # Always upload build results + if: ${{ always() }} + with: + name: macos-build-results + path: | + code_drop/TestResults/issues-report.html + code_drop/TestResults/NUnit/TestResult.xml + code_drop/MsBuild.log \ No newline at end of file diff --git a/.gitignore b/.gitignore index 32976f4a68..4aeebf21f0 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,18 @@ src/_dotCover.chocolatey/ src/_dotTrace.chocolatey/ src/chocolatey.sln.GhostDoc.xml -docs/generated \ No newline at end of file +chocolatey.official.snk + +docs/generated + +# Testing related +.vagrant +buildOutput.txt + +# Build related +tools/** +!tools/packages.config +!tools/Addins/packages.config +!tools/Modules/packages.config +BuildArtifacts/ +code_drop/ \ No newline at end of file diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config deleted file mode 100644 index 6a318ad9b7..0000000000 --- a/.nuget/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe deleted file mode 100644 index 79482f60d3..0000000000 Binary files a/.nuget/NuGet.exe and /dev/null differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets deleted file mode 100644 index e470f19f5e..0000000000 --- a/.nuget/NuGet.targets +++ /dev/null @@ -1,71 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - - - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) - $([System.IO.Path]::Combine($(SolutionDir), "packages")) - - - $(SolutionDir).nuget - packages.config - $(SolutionDir)packages - - - $(NuGetToolsPath)\nuget.exe - "$(NuGetExePath)" - mono --runtime=v4.0.30319 $(NuGetExePath) - - $(TargetDir.Trim('\\')) - - - "" - - - false - - - false - - - $(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)" - $(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(BuildDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.nuget/packages.config b/.nuget/packages.config deleted file mode 100644 index 44cd628c77..0000000000 --- a/.nuget/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml new file mode 100644 index 0000000000..d51e03b8ae --- /dev/null +++ b/.teamcity/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + Chocolatey Config DSL Script + Chocolatey + Chocolatey_dsl + 1.0-SNAPSHOT + + + org.jetbrains.teamcity + configs-dsl-kotlin-parent + 1.0-SNAPSHOT + + + + + jetbrains-all + https://download.jetbrains.com/teamcity-repository + + true + + + + teamcity-server + https://teamcityserver/app/dsl-plugins-repository + + true + + + + + + + JetBrains + https://download.jetbrains.com/teamcity-repository + + + + + ${basedir} + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + org.jetbrains.teamcity + teamcity-configs-maven-plugin + ${teamcity.dsl.version} + + kotlin + target/generated-configs + + + + + + + + org.jetbrains.teamcity + configs-dsl-kotlin + ${teamcity.dsl.version} + compile + + + org.jetbrains.teamcity + configs-dsl-kotlin-plugins + 1.0-SNAPSHOT + pom + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + compile + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + compile + + + \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts new file mode 100644 index 0000000000..c12ca2ae95 --- /dev/null +++ b/.teamcity/settings.kts @@ -0,0 +1,77 @@ +import jetbrains.buildServer.configs.kotlin.v2019_2.* +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.powerShell +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs +import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot + +version = "2021.2" + +project { + buildType(Chocolatey) +} + +object Chocolatey : BuildType({ + id = AbsoluteId("Chocolatey") + name = "Build" + + artifactRules = """ + """.trimIndent() + + params { + param("env.vcsroot.branch", "%vcsroot.branch%") + param("env.Git_Branch", "%teamcity.build.vcs.branch.Chocolatey_ChocolateyVcsRoot%") + param("teamcity.git.fetchAllHeads", "true") + password("env.GITHUB_PAT", "%system.GitHubPAT%", display = ParameterDisplay.HIDDEN, readOnly = true) + } + + vcs { + root(DslContext.settingsRoot) + + branchFilter = """ + +:* + """.trimIndent() + } + + steps { + powerShell { + name = "Prerequisites" + scriptMode = script { + content = """ + if ((Get-WindowsFeature -Name NET-Framework-Features).InstallState -ne 'Installed') { + Install-WindowsFeature -Name NET-Framework-Features + } + + choco install windows-sdk-7.1 netfx-4.0.3-devpack --confirm --no-progress + exit ${'$'}LastExitCode + """.trimIndent() + } + } + + step { + name = "Include Signing Keys" + type = "PrepareSigningEnvironment" + } + + script { + name = "Call Cake" + scriptContent = "call build.official.bat --verbosity=diagnostic --target=CI" + } + } + + triggers { + vcs { + branchFilter = "" + } + } + + features { + pullRequests { + provider = github { + authType = token { + token = "%system.GitHubPAT%" + } + } + } + } +}) \ No newline at end of file diff --git a/.templates/default/create/footer.sbn b/.templates/default/create/footer.sbn new file mode 100644 index 0000000000..f6ba18ef53 --- /dev/null +++ b/.templates/default/create/footer.sbn @@ -0,0 +1,10 @@ +{{ if config.create.include_footer }} + +### {{ config.create.footer_heading }} + +{{ if config.create.milestone_replace_text + replace_milestone_title config.create.footer_content config.create.milestone_replace_text milestone.target.title + else + config.create.footer_content + end +end }} diff --git a/.templates/default/index.sbn b/.templates/default/index.sbn new file mode 100644 index 0000000000..ff7eac8337 --- /dev/null +++ b/.templates/default/index.sbn @@ -0,0 +1,10 @@ +{{- + include 'release-info' + if milestone.target.description + include 'milestone' + end + include 'issues' | string.rstrip + if template_kind == "CREATE" + include 'create/footer' + end +~}} diff --git a/.templates/default/issue-details.sbn b/.templates/default/issue-details.sbn new file mode 100644 index 0000000000..9fa3cce0d4 --- /dev/null +++ b/.templates/default/issue-details.sbn @@ -0,0 +1,5 @@ +### {{ issue_label }} + +{{ for issue in issues.items[issue_label] + include 'issue-note' +end }} diff --git a/.templates/default/issue-note.sbn b/.templates/default/issue-note.sbn new file mode 100644 index 0000000000..dbc4cf0548 --- /dev/null +++ b/.templates/default/issue-note.sbn @@ -0,0 +1 @@ +- {{ issue.title }} - see [#{{ issue.number }}]({{ issue.html_url }}) diff --git a/.templates/default/issues.sbn b/.templates/default/issues.sbn new file mode 100644 index 0000000000..33e5201a63 --- /dev/null +++ b/.templates/default/issues.sbn @@ -0,0 +1,4 @@ + +{{ for issue_label in issue_labels + include 'issue-details' +end }} diff --git a/.templates/default/milestone.sbn b/.templates/default/milestone.sbn new file mode 100644 index 0000000000..a3349b2c73 --- /dev/null +++ b/.templates/default/milestone.sbn @@ -0,0 +1,2 @@ + +{{ milestone.target.description }} diff --git a/.templates/default/release-info.sbn b/.templates/default/release-info.sbn new file mode 100644 index 0000000000..8410ca5ad4 --- /dev/null +++ b/.templates/default/release-info.sbn @@ -0,0 +1,10 @@ +{{ + if issues.count > 0 + if commits.count > 0 +}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}) which resulted in [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) being closed. +{{ else +}}As part of this release we had [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) closed. +{{ end + else if commits.count > 0 +}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}). +{{ end -}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e1f2471ade..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: csharp -dist: bionic -mono: - - 6.12.0 -install: - - sudo apt-get install mono-devel - - nuget restore src/chocolatey.sln -before_script: - - chmod +x build.sh -script: - - ./build.sh -v -notifications: - email: - - chocolatey-build-status@googlegroups.com - webhooks: - urls: - - https://webhooks.gitter.im/e/bd7909ec077be3f8873e - on_success: change - on_failure: always - on_start: false diff --git a/.uppercut b/.uppercut deleted file mode 100644 index 5869ef0230..0000000000 --- a/.uppercut +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CHANGELOG.md b/CHANGELOG.md index a9fb907c5e..37e45cc603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1540 +1,3 @@ # Chocolatey Open Source CHANGELOG -This covers changes for the "chocolatey" and "chocolatey.lib" packages, which are available as FOSS. -**NOTE**: If you have a licensed edition of Chocolatey ("chocolatey.extension"), refer to this in tandem with [Chocolatey Licensed CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG_LICENSED.md). - -## [0.10.15](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.15+is%3Aclosed) (June 3, 2019) -### BUG FIXES - * Fix - list/search/info - searching with --exact or info results in Object reference not set to an instance of an object - see [#1837](https://github.com/chocolatey/choco/issues/1837) - - -## [0.10.14](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.14+is%3Aclosed) (May 30, 2019) -### BUG FIXES - * Fix - feature - Turn off Enhanced Exit Codes by default - see [#1784](https://github.com/chocolatey/choco/issues/1784) - * Fix - Reboot - Pending File Rename Operations check returns true, even after reboot - see [#1768](https://github.com/chocolatey/choco/issues/1768) - * Fix - ".registry.bad" files are created for actually valid registry snapshots - see [#1581](https://github.com/chocolatey/choco/issues/1581) - * Fix - repositories - Azure DevOps NuGet v2 endpoints don't provide metadata in Packages() queries - fails on "Authors is required." - see [#1771](https://github.com/chocolatey/choco/issues/1771) - * Fix - install/upgrade - Chocolatey still fails on failing source repositories - see [#1774](https://github.com/chocolatey/choco/issues/1774) - * Fix - Chocolatey remembers --forceX86 value with subsequent packages - see [#1772](https://github.com/chocolatey/choco/issues/1772) - * Fix - Get-ChocolateyUnzip / Start-ChocolateyProcessAsAdmin - can fail running a process when working directory is a UNC path - see [#1781](https://github.com/chocolatey/choco/issues/1781) - * Fix - Get-UninstallRegistryKey errors when registry keys have bracket characters(`[]`) - see [#1788](https://github.com/chocolatey/choco/issues/1788) - * Fix - push - Fix exception message "There was an internal server error, which might mean the package already exists on a Simple OData Server" / OutOfMemoryException - see [#1786](https://github.com/chocolatey/choco/issues/1786) - -### IMPROVEMENTS - * info/search/list - apply query optimizations when searching by package id - see [#1831](https://github.com/chocolatey/choco/issues/1831) - * feature - usePackageRepositoryOptimizations to control install/upgrade for repositories that don't handle the newer optimizations well - optimizations break LaGet / NuGet Simple Server (PHP) / PHPNuget / Gemfury - see [#1770](https://github.com/chocolatey/choco/issues/1770) - * install/upgrade/uninstall - allow confirming for remaining installs (aka Yes to All) - see [#53](https://github.com/chocolatey/choco/issues/53) - * Config: Setting to exempt packages from upgrade all - see [#1433](https://github.com/chocolatey/choco/issues/1433) - * Support ARM64 Win32 32bit emulation - see [#1800](https://github.com/chocolatey/choco/issues/1800) - * outdated - Add --pre to outdated command - see [#1804](https://github.com/chocolatey/choco/issues/1804) - * Update tab completion options - see [#1834](https://github.com/chocolatey/choco/issues/1834) - - -## [0.10.13](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.13+is%3Aclosed) - (March 15, 2019) -### BUG FIXES - * Fix - Licensed - Licensed code failing when using licensed PowerShell functions - see [#1767](https://github.com/chocolatey/choco/issues/1767) - - -## [0.10.12](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.12+is%3Aclosed) - (March 14, 2019) -We are pretty excited to finally share a new Chocolatey release! And this release won't disappoint. Loads of bug fixes, enhanced exit codes for search, list, info and outdated when results are returned versus nothing being returned, and some really nice improvements. - -Perhaps the biggest addition this release is the ability to halt installation if a reboot is detected ([#1038](https://github.com/chocolatey/choco/issues/1038)). Once you turn this feature on, if you are installing some packages and somewhere in the middle of that there is a need for a reboot, Chocolatey will stop and exit with either exit code 350 (pending reboot prior to anything) or 1604 (install incomplete), indicating a reboot is needed to continue. It won't reboot for you, as it is just a package manager - but it will stop execution so nothing that may error on install is attemtped. You'll need to opt into this feature, so see [#1038](https://github.com/chocolatey/choco/issues/1038) for details. - -If you've long hated the default console colors, we've spent quite a bit of time detecting the background console color and adjusting the colorization output of Chocolatey for this release ([#1131](https://github.com/chocolatey/choco/issues/1131)). You might give that a whirl and see if you can turn back on console colors for good. - -We've added the ability to validate the configuration and system state at a global level ([#1746](https://github.com/chocolatey/choco/issues/1746)). It's early, but expect that we'll do a lot more to really provide good experiences in this area. - -A bug that is worth noting as fixed is having choco exit when a source fails instead of ignoring it ([#612](https://github.com/chocolatey/choco/issues/612)). This is now fixed! - -The last thing worth noting in the summary is Enhanced Exit Codes, or providing more intentional exit codes that mean something instead of just 0 or 1 ([#1758](https://github.com/chocolatey/choco/issues/1758)). In this release, outdated and search commands will have additional exit codes that mean something. This is noted in the next section, so please read over and see how to shut off this behavior if you see it breaking any integration you might be using (including your own scripts). - -### BREAKING CHANGES - * outdated - Exit 2 when there are packages out of date - see [#1602](https://github.com/chocolatey/choco/issues/1602) - * search/list/info - Exit 2 when no results are returned - see [#1724](https://github.com/chocolatey/choco/issues/1724) - -We've listed these as breaking changes as it may affect tools that are integrating with Chocolatey and interpreting the output of the exit code. In these cases, it would likely temporarily break those tools until they've had a chance to release new versions of their tools. If you run into this, you simply need to turn off the feature "useEnhancedExitCodes". That is as simple as `choco feature disable --name="'useEnhancedExitCodes'"` ([#1758](https://github.com/chocolatey/choco/issues/1758)). - -### FEATURES - * Exit when reboot is detected - w/350 for pending & w/1604 on dependency package requiring reboot - see [#1038](https://github.com/chocolatey/choco/issues/1038) - -### BUG FIXES - * [Security] Fix - upgrade - remove automation scripts prior to upgrade even if changed - see [#1689](https://github.com/chocolatey/choco/issues/1689) - * [Security] Fix - scripts - Digitally sign the init.ps1 PowerShell file as well - see [#1665](https://github.com/chocolatey/choco/issues/1665) - * Fix - When a source fails, choco exits instead of moving to next source - see [#612](https://github.com/chocolatey/choco/issues/612) - * Fix - Upgrade all reuses overridden package parameters when useRememberedArgumentsForUpgrades feature is turned on - see [#1443](https://github.com/chocolatey/choco/issues/1443) - * Fix - Passing `--execution-timeout=0` doesn't override the default execution timeout in the configuration - see [#1747](https://github.com/chocolatey/choco/issues/1747) - * Fix - ChocolateyLastPathUpdate environment variable stores date as locale-specific - see [#1604](https://github.com/chocolatey/choco/issues/1604) - * [POSH Host] Fix - install/upgrade/uninstall - PowerShell host should exit with 1 instead of -1 if there is a package error - see [#1734](https://github.com/chocolatey/choco/issues/1734) - * Fix - Logging - warnings for ".registry.bad." files are emitted with "-r" switch - see [#1580](https://github.com/chocolatey/choco/issues/1580) - * Fix - Logging - ".registry.bad" files are created for actually valid registry snapshots - see [#1581](https://github.com/chocolatey/choco/issues/1746) - * Fix - list/search - Listing local packages fails if no sources are enabled - see [#661](https://github.com/chocolatey/choco/issues/661) - * Fix - uninstall - Object reference exception when there are no sources - see [#1584](https://github.com/chocolatey/choco/issues/1584) - * Fix - Logging - self-service errors attempting to write to the config when using Chocolatey GUI - see [#1649](https://github.com/chocolatey/choco/issues/1649) - * Fix - source list - running with -r fails to escape pipe (|) char - see [#1614](https://github.com/chocolatey/choco/issues/1614) - * Fix - source add - Adding a source allows an empty url - see [#1582](https://github.com/chocolatey/choco/issues/1582) - * Fix - Get-ChocolateyWebFile - Ensure PSVersionTable is used for PowerShell Version - see [#1623](https://github.com/chocolatey/choco/issues/1623) - * Fix - Install-ChocolateyShortcut - Don't create a folder if environment variable is used - see [#1687](https://github.com/chocolatey/choco/issues/1687) - * Fix - `choco --version` includes warnings, breaks version parsing - see [#1562](https://github.com/chocolatey/choco/issues/1562) - * Fix - Uninstall-ChocolateyZipPackage failing with Path error - see [#1550](https://github.com/chocolatey/choco/issues/1550) - * Fix - Uninstall-ChocolateyZipPackage fails from null passed to Test-Path - see [#1546](https://github.com/chocolatey/choco/issues/1546) - * Fix - Get-ChocolateyUnzip - Ensure 7z cmd window is hidden - see [#1642](https://github.com/chocolatey/choco/issues/1642) - * [API] Fix - Resolve assemblies globally without locking - see [#1735](https://github.com/chocolatey/choco/issues/1735) - -### IMPROVEMENTS - * [Security] tools - Update 7z to 18.06 - see [#1704](https://github.com/chocolatey/choco/issues/1704) - * [Security] Refreshenv script leaves temporary file behind - see [#1549](https://github.com/chocolatey/choco/issues/1549) - * Control enhanced exit codes with a feature switch - see [#1758](https://github.com/chocolatey/choco/issues/1758) - * Logging - better default colors - see [#1131](https://github.com/chocolatey/choco/issues/1131) - * Validate config / system state across everything - see [#1746](https://github.com/chocolatey/choco/issues/1746) - * upgrade - switch for not installing if not installed - see [#1646](https://github.com/chocolatey/choco/issues/1646) - * outdated - improve performance of `choco outdated` - see [#1397](https://github.com/chocolatey/choco/issues/1397) - * search/list - Add alias "find" for search - see [#1744](https://github.com/chocolatey/choco/issues/1744) - * apikey - Enable removal of API key via CLI - see [#1301](https://github.com/chocolatey/choco/issues/1301) - * Logging - Choco --log-file option should create log files relative to current directory - see [#1603](https://github.com/chocolatey/choco/issues/1603) - * Logging - Don't suggest installing separate "checksum" tool - see [#981](https://github.com/chocolatey/choco/issues/981) - * template - Add notes to uninstaller file string on how to correctly parse the value from the registry - see [#1644](https://github.com/chocolatey/choco/issues/1644) - * Pro/Business - license - If license is found in top-level folder or named wrong, choco should warn - see [#1503](https://github.com/chocolatey/choco/issues/1503) - * [API] Allow verifying DI Container in release build - see [#1738](https://github.com/chocolatey/choco/issues/1738) - * [API] ability to get consistent hash of ConfigFileSettings class - see [#1612](https://github.com/chocolatey/choco/issues/1612) - - -## [0.10.11](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.11+is%3Aclosed) (May 4, 2018) -### BUG FIXES - * Fix - AutoUninstaller - Captures registry snapshot escaping quotes - unable to find path for uninstall - see [#1540](https://github.com/chocolatey/choco/issues/1540) - * Fix - Installation/Setup - Use of Write-Host in Install-ChocolateyPath.ps1 prevents non-interactive installation of Chocolatey itself - see [#1560](https://github.com/chocolatey/choco/issues/1560) - * Fix - Logging - GUID in software name: "Chocolatey had an error formatting string" - see [#1543](https://github.com/chocolatey/choco/issues/1543) - -### IMPROVEMENTS - * [Security] RAR Extraction with older 7zip uses uninitialized memory (CVE-2018-10115) - see [#1557](https://github.com/chocolatey/choco/issues/1557) - * Tab Completion - Modify profile if file exists but is empty - see [#991](https://github.com/chocolatey/choco/issues/991) - - -## [0.10.10](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.10+is%3Aclosed) (April 12, 2018) -### BUG FIXES - * Fix - Installing Chocolatey 0.10.9 results in an exit code of 1 - see [#1529](https://github.com/chocolatey/choco/issues/1529) - * Fix - Proxy bypass list with "*" will return regex quantifier parsing errors - see [#1532](https://github.com/chocolatey/choco/issues/1532) - * Fix - NuGet cache folders - choco should always attempt to remove and should find in the cacheLocation when set - see [#1527](https://github.com/chocolatey/choco/issues/1527) - -### IMPROVEMENTS - * Logging - Exclusive File Lock on Non-Essential Logs - see [#1531](https://github.com/chocolatey/choco/issues/1531) - - -## [0.10.9](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.9+is%3Aclosed) (March 25, 2018) -The vendored 7Zip had a couple of security findings that necessitated a release. There is also a lot of goodness going into this release as well. We've fixed XDT transforms not to keep extra data around (requiring manual fixes). We've resolved some issues surrounding compatibility with Get-PackageParameters in the chocolatey-core.extension package and what's now built into Chocolatey. That should now work appropriately, and the built-in method should be preferred, so if you are using `--package-parameters-sensitive`, those will be added as well when you do have the chocolatey-core.extension package also installed. - -We've also brought in the long desired logging with no colorization. You can set that as a switch or globally with a feature flipper. With outdated/upgrade, you can now ignore unfound packages along with already skipping pinned packages. That will help you reduce your output to only the things it finds upgrades for that can be upgraded. - -### BUG FIXES - * [Security] Fix - Pro/Business - Logging - Get-PackageParameters should not log sensitive params - see [#1460](https://github.com/chocolatey/choco/issues/1460) - * Fix - XDT transform causes xml file to have extra data in it (unusable until manually fixed) - see [#1482](https://github.com/chocolatey/choco/issues/1482) - * Fix - Escape package registry information to reduce unreadable files - see [#1505](https://github.com/chocolatey/choco/issues/1505) - * Fix - Uninstall-ChocolateyZipPackage is unable to find zip contents file - see [#1415](https://github.com/chocolatey/choco/issues/1415) - * Fix - Get-PackageParameters - Resolve differences between chocolatey.core-extension and built-in method - see [#1490](https://github.com/chocolatey/choco/issues/1490) - * Fix - Get-PackageParameters - force built-in method to be preferred over chocolatey-core.extension method - see [#1476](https://github.com/chocolatey/choco/issues/1476) - * Fix - Get-PackageParameters should handle urls - see [#1459](https://github.com/chocolatey/choco/issues/1459) - * Fix - Setting output directory with proper quoting can result in "The given path's format is not supported." - see [#1517](https://github.com/chocolatey/choco/issues/1517) - * Fix - Logging - PowerShell script contents logging should not error if they have contents mistaken for log formatting - see [#1489](https://github.com/chocolatey/choco/issues/1489) - * Fix - Incorrect documentation for Install-ChocolateyInstallPackage - see [#1416](https://github.com/chocolatey/choco/issues/1416) - * [API] Fix - Logging - Loggers should always be checked for initialization - see [#1447](https://github.com/chocolatey/choco/issues/1447) - * Fix - Pro/Business - Expired licenses should not cause Chocolatey errors - see [#1500](https://github.com/chocolatey/choco/issues/1500) - -### IMPROVEMENTS - * [Security] RAR extraction with older 7zip can cause memory corruption (CVE-2018-5996) / ZIP Shrink vulnerability (CVE-2017-17969) - see [#1478](https://github.com/chocolatey/choco/issues/1478) - * Provide friendly error messages on well-known exit codes - see [#1526](https://github.com/chocolatey/choco/issues/1526) - * Capture password securely during validation when only the user name has been provided - see [#1524](https://github.com/chocolatey/choco/issues/1524) - * Outdated/Upgrade - Option/feature to ignore unfound packages - see [#1398](https://github.com/chocolatey/choco/issues/1398) - * Installation/Setup: run choco once to initialize the config file - see [#1401](https://github.com/chocolatey/choco/issues/1401) - * Logging - Log access denied for config file to log file only - see [#1445](https://github.com/chocolatey/choco/issues/1445) - * Ability to pick x64/x86 runtime binaries for shimming by architecture without needing PowerShell scripts - see [#1365](https://github.com/chocolatey/choco/issues/1365) - * Logging - Add '--no-color' as a global option and 'logWithoutColor' feature - see [#100](https://github.com/chocolatey/choco/issues/100) - * Reset colors after abnormal exit - see [#474](https://github.com/chocolatey/choco/issues/474) - * [API] Logging - Set logging levels debug/verbose/trace - see [#1448](https://github.com/chocolatey/choco/issues/1448) - * [API] Logging - Sync already logged items when setting custom logging - see [#1446](https://github.com/chocolatey/choco/issues/1446) - * [API] Fix - Ensure one instantiation of GetChocolatey at a time - see [#1400](https://github.com/chocolatey/choco/issues/1400) - * Pro/Business - Uninstall - Keep stored package information by default - see [#1399](https://github.com/chocolatey/choco/issues/1399) - * Pro/Business - Logging - See licensing logging output - see [#1488](https://github.com/chocolatey/choco/issues/1488) - - -## [0.10.8](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.8+is%3Aclosed) (August 30, 2017) -With this release, Package Parameters are fully supported from both the user side and the packaging side. Check out [the documentation](https://docs.chocolatey.org/en-us/create/functions/get-packageparameters) and check out the [walkthrough](https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument) on how to use package parameters in your packaging. Note if you are pushing packages to the community repository, you must continue to take a dependency on the `chocolatey-core.extension` as a polyfill for older versions until at least six months after a new feature is released. - -What you can do with logging has greatly increased your ability to have more power over how it works and deeper output to determine errors (we've expanded `--trace` [#1379](https://github.com/chocolatey/choco/issues/1379)). This release also gives packagers and users more power when working with the AutoUninstaller - opt-out ([#1257](https://github.com/chocolatey/choco/issues/1257)) and passing arguments to the uninstaller ([#1133](https://github.com/chocolatey/choco/issues/1133)). - -Another noteworthy addition is the ability to pass custom properties to Choco like you would do with `nuget pack`, allowing better integration with packages you manage in Visual Studio ([#1313](https://github.com/chocolatey/choco/issues/1313)). - -### FEATURES - * Function - Get-PackageParameters - see [#1393](https://github.com/chocolatey/choco/issues/1393) - -### BUG FIXES - * Fix - "Value cannot be null" running choco outdated - see [#1383](https://github.com/chocolatey/choco/issues/1383) - * Fix - Package parameters are ignored on when install directly points to nupkg/nuspec - see [#1155](https://github.com/chocolatey/choco/issues/1155) - * Fix - Logging - log4net Logger location (the code location logging) is incorrect - see [#1377](https://github.com/chocolatey/choco/issues/1377) - * [API] Fix - GetConfiguration() sets the configuration for other calls - see [#1347](https://github.com/chocolatey/choco/issues/1347) - * [API] Fix - Pro/Business - Self-Service information not returned for sources - see [#1394](https://github.com/chocolatey/choco/issues/1394) - * [API] Fix - Config output is being set to Regular Output - see [#1396](https://github.com/chocolatey/choco/issues/1396) - -### IMPROVEMENTS - * [Security][POSH Host] Implement Read-Host -AsSecureString- see [#1335](https://github.com/chocolatey/choco/issues/1335) - * AutoUninstaller - Opt-out from packages - see [#1257](https://github.com/chocolatey/choco/issues/1257) - * AutoUninstaller - Use Uninstall Arguments and Override Arguments if provided - see [#1133](https://github.com/chocolatey/choco/issues/1133) - * pack - Pass arbitrary properties like nuget pack - see [#1313](https://github.com/chocolatey/choco/issues/1313) - * list - Sub-command should not require admin access (and not prompt) - see [#1353](https://github.com/chocolatey/choco/issues/1353) - * new - Package Templates - Do not treat binaries in template as text files - see [#1385](https://github.com/chocolatey/choco/issues/1385) - * new - Package Templates - Add more helpful items, like a todo list to the default template - see [#1386](https://github.com/chocolatey/choco/issues/1386) - * Document how to pass multiple sources on CLI - see [#1331](https://github.com/chocolatey/choco/issues/1331) - * Logging - Trace output should provide deep logging information - see [#1379](https://github.com/chocolatey/choco/issues/1379) - * Logging - Allow external log4net config file - see [#1378](https://github.com/chocolatey/choco/issues/1378) - * Logging - Allow capturing output to an additional log file - see [#1376](https://github.com/chocolatey/choco/issues/1376) - * [API] Make log4net dependency less restrictive - see [#1395](https://github.com/chocolatey/choco/issues/1395) - * Pro/Business - source/list - Support for Admin Only Sources - Limit non-admin list to self service only - see [#1265](https://github.com/chocolatey/choco/issues/1265) - - -## [0.10.7](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.7+is%3Aclosed) (June 8, 2017) -### BREAKING CHANGES - * Set requested execution level back to asInvoker while determining more advanced elevated scenarios - see [#1324](https://github.com/chocolatey/choco/issues/1324) - - After much deliberation with the community, we're moving execution policy back to the default of `asInvoker` to make it work like it did prior to 0.10.4. However we are leaving it open for you to change it to whatever execution level you want by keeping the manifest external from choco.exe. We will be looking more at advanced scenarios - the discussion is at [#1307](https://github.com/chocolatey/choco/issues/1307). If you don't have a GitHub account, feel free to start a thread on the mailing list (and if you are a customer, you have private channels to voice your opinions on this change). - - Moving to "asInvoker" means that Chocolatey will not ask for elevated privileges prior to execution, so you will need to remember to do that yourself. If you go to `$env:ChocolateyInstall`, you will find `choco.exe.manifest`, and you have freedom to adjust the execution level as you see fit. There is one catch, you will need to do it on every install/upgrade of Chocolatey until [#1206](https://github.com/chocolatey/choco/issues/1206) is implemented. - -### BUG FIXES - * Fix - Add file/file64 not as aliases, but use them to set url/url64 if empty - see [#1323](https://github.com/chocolatey/choco/issues/1323) - * Fix - Automatic Uninstaller doesn't split multiple paths - see [#1327](https://github.com/chocolatey/choco/issues/1327) - * Fix - choco list / search / info - fails with local directory source - see [#1325](https://github.com/chocolatey/choco/issues/1325) - * Fix - When version is four digits, Chocolatey version heading is not shown - see [#1326](https://github.com/chocolatey/choco/issues/1326) - * Fix - search / list - page/page-size not honored for exact search in 0.10.6 - see [#1322](https://github.com/chocolatey/choco/issues/1322) - * Fix - Deserializing failures on package info files should not fail the choco run - see [#1328](https://github.com/chocolatey/choco/issues/1328) - -### IMPROVEMENTS - * Use `$packageArgs` in default template for uninstall script - see [#1330](https://github.com/chocolatey/choco/issues/1330) - - -## [0.10.6.1](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.6.1+is%3Aclosed) (June 3, 2017) -### BUG FIXES - * Fix - shimgen fails with unrecognized option: '/errorendlocation' in .NET 4.0 only environments - see [#1321](https://github.com/chocolatey/choco/issues/1321) - * Fix - Do not fail extracting resources at runtime - see [#1318](https://github.com/chocolatey/choco/issues/1318) - * Fix - Silently fail when deleting choco.exe.old - see [#1319](https://github.com/chocolatey/choco/issues/1319) - - -## [0.10.6](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.6+is%3Aclosed) (June 1, 2017) - -This release includes fixes and adjustments to the API to make it more usable. Search / List has also been improved with the data that it returns when verbose/detailed, along with info always returning a package with information instead of erroring sometimes. The search results from the community package repository now match what you see on the website. - -### BUG FIXES - * Fix - choco.exe.manifest is ignored because it is extracted AFTER first choco.exe access - see [#1292](https://github.com/chocolatey/choco/issues/1292) - * Fix - Chocolatey config changes in 0.10.4+ - The process cannot access the file because it is being used by another process - see [#1241](https://github.com/chocolatey/choco/issues/1241) - * Fix - PowerShell sees authenticode hash as changed in scripts that are UTF8 (w/out BOM) that contain unicode characters - see [#1225](https://github.com/chocolatey/choco/issues/1225) - * Fix - Chocolatey timed out immediately when execution timeout was infinite (0) - see [#1224](https://github.com/chocolatey/choco/issues/1224) - * Fix - Multiple authenticated sources with same base url fail when authentication is different - see [#1248](https://github.com/chocolatey/choco/issues/1248) - * Fix - choco list / search / info - Some packages can't be found - see [#1004](https://github.com/chocolatey/choco/issues/1004) - * Fix - chocolatey.config gets corrupted when multiple processes access simultaneously - see [#1258](https://github.com/chocolatey/choco/issues/1258) - * Fix - Update ShimGen to 0.8.x to address some issues - see [#1243](https://github.com/chocolatey/choco/issues/1243) - * Fix - AutoUninstaller should skip uninstall keys if they are empty - see [#1315](https://github.com/chocolatey/choco/issues/1315) - * Fix - Trace logging should only occur on when trace is enabled - see [#1309](https://github.com/chocolatey/choco/issues/1309) - * Fix - RefreshEnv.cmd doesn't set the correct PATH - see [#1227](https://github.com/chocolatey/choco/issues/1227) - * Fix - choco new generates uninstall template with wrong use of registry key variable - see [#1304](https://github.com/chocolatey/choco/issues/1304) - * [API] Fix- chocolatey.lib nuget package has incorrect documentation xml - see [#1247](https://github.com/chocolatey/choco/issues/1247) - * [API] Fix - Chocolatey file cache still adds a 'chocolatey' directory on each install - see [#1231](https://github.com/chocolatey/choco/issues/1231) - * [API] Fix - List and Count should implement similar functionality as run - see [#1298](https://github.com/chocolatey/choco/issues/1298) - * Pro/Business - [API] Fix - Ensure DLL can work with licensed code - see [#1287](https://github.com/chocolatey/choco/issues/1287) - -### IMPROVEMENTS - * Default package push url now uses push subdomain - see [#1285](https://github.com/chocolatey/choco/issues/1285) - * Report process id in the log files - see [#1239](https://github.com/chocolatey/choco/issues/1239) - * choco info / list / search - Include summary on detailed view - see [#1253](https://github.com/chocolatey/choco/issues/1253) - * choco info / list /search - Include release notes on detailed view - see [#1263](https://github.com/chocolatey/choco/issues/1263) - * choco list / search - Option to list packages only by name - see [#1237](https://github.com/chocolatey/choco/issues/1237) - * choco list / search - Allow sorting package results by relevance - see [#1101](https://github.com/chocolatey/choco/issues/1101) - * choco list / search - Search by tags only - see [#1033](https://github.com/chocolatey/choco/issues/1033) - * choco outdated - Option to leave out pinned packages - see [#994](https://github.com/chocolatey/choco/issues/994) - * Install-ChocolateyPackage and other functions should alias File/File64 - see [#1284](https://github.com/chocolatey/choco/issues/1284) - * Install-ChocolateyPowerShellCommand should alias File/FileFullPath for PsFileFullPath - see [#1311](https://github.com/chocolatey/choco/issues/1311) - * Logging - capture more information about a user (user name, domain, remote?, system?) - see [#615](https://github.com/chocolatey/choco/issues/615) - * Stop saying "0 packages failed." - see [#1259](https://github.com/chocolatey/choco/issues/1259) - * [API] provide a way to see ChocolateyConfiguration - see [#1267](https://github.com/chocolatey/choco/issues/1267) - * [API] Attempt to get ChocolateyInstall environment variable prior to extraction - see [#1297](https://github.com/chocolatey/choco/issues/1297) - * [API] Expose Container directly - see [#1294](https://github.com/chocolatey/choco/issues/1294) - * Pro/Business - Support for Package Audit (who installed packages) - see [#1238](https://github.com/chocolatey/choco/issues/1238) - * Pro/Business - [API] Ensure configuration retains base info between uses - see [#1296](https://github.com/chocolatey/choco/issues/1296) - - -## [0.10.5](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.5+is%3Aclosed) (March 30, 2017) -### BUG FIXES - * Fix - Start-ChocolateyProcessAsAdmin errors when running PowerShell scripts - see [#1220](https://github.com/chocolatey/choco/issues/1220) - -### IMPROVEMENTS - * Show machine readable output with `choco outdated -r` - see [#1222](https://github.com/chocolatey/choco/issues/1222) - - -## [0.10.4](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.4+is%3Aclosed) (March 30, 2017) - -We're dubbing this the "10-4 good buddy" release. We've added some major functionality and fixes we think you are going to find top notch - dare we say as smooth as really expensive chocolate? A lot of work for this release has been provided by the community. Remember that Chocolatey is only as good as the support that comes from the community! Be sure to thank other community members for the awesome that is Chocolatey and Chocolatey 10-4. We've closed over 30 bugs and added over 40 enhancements (75 tickets in total)! - -Proxy support just got some major enhancements with the ability to not only [specify proxy information at runtime](https://github.com/chocolatey/choco/issues/1173), but also to [set bypass lists and bypassing on local connections](https://github.com/chocolatey/choco/issues/1165) and [configure source repositories to bypass proxies](https://github.com/chocolatey/choco/issues/262). A major issue with [changing command execution timeout](https://github.com/chocolatey/choco/issues/1059) was just fixed. And there used to be a tiny chance you might [corrupt the choco config when running multiple choco processes](https://github.com/chocolatey/choco/issues/1047) -but now that is much better handled. - -We've also made [package itself display download progress](https://github.com/chocolatey/choco/issues/1134), which is great when software binaries are embedded in packages. For you folks looking to remove any progress (like when using Vagrant), now you can use [`--no-progress`](https://github.com/chocolatey/choco/issues/917). When NuGet.Core has issues, those issues will have more visibility into why things are failing without needing a debugging log. Speaking of some extreme visibility, see network traffic with [`--trace`](https://github.com/chocolatey/choco/issues/1182). - -We've got a few possible breaking changes that could affect you, see what we've written about them below. - -This also marks the first release that uses the [Chocolatey Software digital certificate for signing](https://github.com/chocolatey/choco/issues/1214) instead of the RealDimensions Software, LLC certificate. - -Another major feature released in preview is [using remembered arguments on upgrade](https://github.com/chocolatey/choco/issues/797). This is in preview in 0.10.4 and will be turned to 'on' automatically in a future release. We are going to be continually making it better and won't turn it on by default until it is ready. If you want to turn it on and start using it, once you have 0.10.4 installed, run `choco feature enable -n useRememberedArgumentsForUpgrades`. You can also do this per command with `--use-remembered-arguments`. You can also turn it off per command with `--ignore-remembered-arguments`. We've also really described a lot of important considerations and thoughts related to using this so there are no surprises. Please do read the issue notes at length if you plan to use this feature to reduce confusion. - -### BREAKING CHANGES - * Run with highestAvailable Execution Level by default - see [#1054](https://github.com/chocolatey/choco/issues/1054) - - One longstanding request with Chocolatey was to have it always request admin privileges before running. This has been a hope that it would cut down on the accidental runs of Chocolatey in a command shell that is not elevated and needing to open one that is elevated. This UAC (User account control) setting is handled by something called an application manifest (app.manifest). We had it set to "asInvoker", or run with the context of the user that ran the command. We've moved this to "highestAvailable", which means if you are a non-admin, it will just run under your context, but if you are an admin in a non-elevated shell, it will ask for elevated permissions to run. There is also "requireAdministrator", which locks execution down to administrators only. - - Moving to "highestAvailable" allows for that asking of privileges that you are used to, up front before it runs. However one additional thing we did here was give you more control over this setting now. We used to embed the app manifest into choco.exe. We now set it next to choco.exe (base install under `$env:ChocolateyInstall`, you will find `choco.exe.manifest`) so you have more freedom to adjust those execution levels as you see fit. There is one catch, you will need to do it on every install/upgrade of Chocolatey until [#1206](https://github.com/chocolatey/choco/issues/1206) is implemented. - - * When a prerelease is installed, it should upgrade to latest prerelease unless excluded - typically seen in choco upgrade all - see [#686](https://github.com/chocolatey/choco/issues/686) - - When you run `choco upgrade all`, it never catches the prereleases. However if you run `choco upgrade all --pre`, it may upgrade some of your stable installs to prereleases. Neither of these situations are desirable. So by default, we've made it so that `choco upgrade all` just does the right thing, which is to upgrade your stable releases to the latest stable release and your prerelease packages will upgrade to the absolute latest available, whether that be stable or prerelease. If you need to change the behavior back to the old way for upgrade all, simply add the `--exclude-prerelease` option. - - * Fix - Passing Allow Downgrade To upgrade against a prerelease may downgrade it to last stable version - see [#1212](https://github.com/chocolatey/choco/issues/1212) - - This is a bug fix that was allowing a prerelease to be downgraded accidentally to the last stable version if you ran `choco upgrade somepackage --allow-downgrade` without a particular version and without `--pre`. Now while this would be less affected with #686 above, it could still happen. It's a bug. The only reason this was marked as breaking change is that someone could be depending on the buggy behavior. So heads up, this bug is now fixed. If you are attempting to downgrade, make sure you specify the version you want it to go down to. - -### FEATURES - * [Security][Preview] Use Remembered Arguments for a Package During Upgrades - You must opt in for this to work - see [#797](https://github.com/chocolatey/choco/issues/797) - * Show download progress for the packages themselves - see [#1134](https://github.com/chocolatey/choco/issues/1134) - * Set Explicit Proxy Bypass List / Bypass On Local - see [#1165](https://github.com/chocolatey/choco/issues/1165) - * Option/feature to stop installation when a package fails - see [#1151](https://github.com/chocolatey/choco/issues/1151) - * Add File64 to Install-ChocolateyInstallPackage and Get-ChocolateyUnzip - see [#1187](https://github.com/chocolatey/choco/issues/1187) - -### BUG FIXES - * [Security] Fix - PowerShell sees authenticode hash as changed in scripts that were signed with Unix Line Endings (`LF`) - unable to use `AllSigned` - see [#1203](https://github.com/chocolatey/choco/issues/1203) - * [Security] Fix - chocolatey setup - Use https for downloading .NET Framework 4x if not installed - see [#1112](https://github.com/chocolatey/choco/issues/1112) - * Fix - chocolatey.config gets corrupted when multiple processes access simultaneously - see [#1047](https://github.com/chocolatey/choco/issues/1047) - * Fix - "commandExecutionTimeoutSeconds" always reverts to 2700 when deprecated config setting is 0 - see [#1059](https://github.com/chocolatey/choco/issues/1059) - * Fix - Allow Chocolatey version check with FIPS - see [#1193](https://github.com/chocolatey/choco/issues/1193) - * Fix - Chocolatey doesn't always decompress downloads appropriately (support automatic decompression) - see [#1056](https://github.com/chocolatey/choco/issues/1056) - * Fix - Load built-in Chocolatey functions, then load extensions - see [#1200](https://github.com/chocolatey/choco/issues/1200) - * Fix - Use provided checksum type - see [#1018](https://github.com/chocolatey/choco/issues/1018) - * Fix - MSU fails to install with space in path - see [#1177](https://github.com/chocolatey/choco/issues/1177) - * Fix - Unable to disable failOnInvalidOrMissingLicense feature - see [#1069](https://github.com/chocolatey/choco/issues/1069) - * Fix - PowerShell (Start-ChocolateyProcessAsAdmin) should only import the installerModule and not the profile - see [#1013](https://github.com/chocolatey/choco/issues/1013) - * Fix - Automatic Uninstaller should skip when uninstaller executable does not exist - see [#1035](https://github.com/chocolatey/choco/issues/1035) - * Fix - Package installation often fails with ERROR: You cannot call a method on a null-valued expression - see [#1141](https://github.com/chocolatey/choco/issues/1141) - * Fix - Text file determination fails to throw an error because it catches it - see [#1010](https://github.com/chocolatey/choco/issues/1010) - * Fix - Delete the .istext file before the content-type check - see [#1012](https://github.com/chocolatey/choco/issues/1012) - * Fix - new command - don't add unparsed options as the name - see [#1085](https://github.com/chocolatey/choco/issues/1085) - * Fix - Proxy settings ignored for local connections - see [#497](https://github.com/chocolatey/choco/issues/497) - * Fix - RefreshEnv / Update-SessionEnvironment changes current user to SYSTEM - see [#902](https://github.com/chocolatey/choco/issues/902) - * Fix - Set-EnvironmentVariable writes an error when installing Chocolatey as SYSTEM - see [#1043](https://github.com/chocolatey/choco/issues/1043) - * Fix - Get-FtpFile fails with integer overflow when downloading file more than 2gb in size - see [#1098](https://github.com/chocolatey/choco/issues/1098) - * Fix - Uninstall-ChocolateyPackage prints out warning if the passed file path starts and ends with quotes - see [#1039](https://github.com/chocolatey/choco/issues/1039) - * Fix - Get-UninstallRegistryKey fixes/improvements - see [#815](https://github.com/chocolatey/choco/issues/815) - * Fix - Unzip specific folder feature is broken after introducing 7zip - see [#676](https://github.com/chocolatey/choco/issues/676) - * Fix - Join-Path error when installing Chocolatey as SYSTEM - see [#1042](https://github.com/chocolatey/choco/issues/1042) - * Fix - `$env:OS_NAME` is 'Windows' for Windows 10 - see [#1178](https://github.com/chocolatey/choco/issues/1178) - * Fix - choco install relativepath/to/some.nuspec fails - see [#906](https://github.com/chocolatey/choco/issues/906) - * Fix - When pointing to a nupkg, choco should use only that nupkg to install and not a newer version in the same directory - see [#523](https://github.com/chocolatey/choco/issues/523) - * Fix - Automatic uninstaller should split by quotes when necessary - see [#1208](https://github.com/chocolatey/choco/issues/1208) - * [API] Fix - lib should merge the AlphaFS dependency - see [#1148](https://github.com/chocolatey/choco/issues/1148) - * [API] Fix - don't reset loggers on setting custom automatically - see [#1121](https://github.com/chocolatey/choco/issues/1121) - * [API] Fix - Chocolatey file cache adds a 'chocolatey' directory on each install - see [#1210](https://github.com/chocolatey/choco/issues/1210) - * [API] Fix - Getting Local List of Package may leave config in undesirable state - see [#1213](https://github.com/chocolatey/choco/issues/1213) - * Fix - Pro/Business - Chocolatey Licensed Feed May Show Up More Than Once - see [#1166](https://github.com/chocolatey/choco/issues/1166) - * Fix - Pro/Business - Synchronized packages with DLLs are attempted to be imported by Chocolatey's PowerShell Extensions Loader - see [#1041](https://github.com/chocolatey/choco/issues/1041) - -### IMPROVEMENTS - * [Security] Username and password for `choco apikey` not encrypted in output - see [#1106](https://github.com/chocolatey/choco/issues/1106) - * [Security] Sign Binaries / Authenticode Signatures with Chocolatey Software digital certificate - see [#1214](https://github.com/chocolatey/choco/issues/1214) - * Setting commandExecutionTimeout to 0 means never time out - see [#1202](https://github.com/chocolatey/choco/issues/1202) - * Configure sources to skip proxy - see [#262](https://github.com/chocolatey/choco/issues/262) - * Set proxy information at runtime - see [#1173](https://github.com/chocolatey/choco/issues/1173) - * Start-ChocolateyProcessAsAdmin should not elevate when already elevated - see [#1126](https://github.com/chocolatey/choco/issues/1126) - * Add `--no-progress` cli switch for hidding progress bars - see [#917](https://github.com/chocolatey/choco/issues/917) - * Note web status errors on package install failures - see [#1172](https://github.com/chocolatey/choco/issues/1172) - * Always let Nuget.Core log - see [#1095](https://github.com/chocolatey/choco/issues/1095) - * Make choco get its proxy settings also from environment variables - see [#605](https://github.com/chocolatey/choco/issues/605) - * Remove quotes in process passed to Start-ChocolateyProcessAsAdmin / CommandExecutor - see [#1167](https://github.com/chocolatey/choco/issues/1167) - * Increase download buffer size in Get-FtpFile to speed up downloads - see [#1099](https://github.com/chocolatey/choco/issues/1099) - * Trace network traffic - see [#1182](https://github.com/chocolatey/choco/issues/1182) - * Upgrade 7Zip to 16.04 - see [#1184](https://github.com/chocolatey/choco/issues/1184) - * Do not create .ignore file if outside of Chocolatey location - see [#1180](https://github.com/chocolatey/choco/issues/1180) - * Help should exit zero if called with the help switch, otherwise non-zero on bad commands - see [#473](https://github.com/chocolatey/choco/issues/473) - * "Licensed messages" may address users in a somewhat unprofessional manner - see [#1111](https://github.com/chocolatey/choco/issues/1111) - * Show the entire text to turn on the allowGlobalConfirmation flag - see [#1053](https://github.com/chocolatey/choco/issues/1053) - * Running `choco` should produce name/version and further instructions - see [#1083](https://github.com/chocolatey/choco/issues/1083) - * Typo in Install-ChocolateyPowershellCommand - see [#1088](https://github.com/chocolatey/choco/issues/1088) - * Update `choco new pkg` template to give example of handling nested quoted paths - see [#1067](https://github.com/chocolatey/choco/issues/1067) - * Add Aliases for Install-ChocolateyVsixPackage - see [#1146](https://github.com/chocolatey/choco/issues/1146) - * Add Chocolatey Software to copyright - see [#1209](https://github.com/chocolatey/choco/issues/1209) - * Pro/Business - Feature to Disable Non-Elevated Warnings - see [#1118](https://github.com/chocolatey/choco/issues/1118) - * Pro/Business - Package Throttle - Bitrate limit packages and downloads (support) - see [#454](https://github.com/chocolatey/choco/issues/454) - * Pro/Business - Allow version overrides for local packages - see [#942](https://github.com/chocolatey/choco/issues/942) - * Pro/Business - List include programs should not show items from Package Synchronizer's Programs and Features Package Sync - see [#1205](https://github.com/chocolatey/choco/issues/1205) - * Pro/Business - Show better messaging when unable to load licensed assembly - see [#1145](https://github.com/chocolatey/choco/issues/1145) - * Pro/Business - PowerShell Functions should allow overriding urls - see [#1117](https://github.com/chocolatey/choco/issues/1117) - * Pro/Business - Automatic Uninstaller - allow remove directly - see [#1119](https://github.com/chocolatey/choco/issues/1119) - * Pro/Business - Add Chocolatey Architect edition license SKU - see [#1075](https://github.com/chocolatey/choco/issues/1075) - * Pro/Business - Ensure sync command can be machine parseable - quiet logging - see [#1147](https://github.com/chocolatey/choco/issues/1147) - * Pro/Business - Configure a source to be allowed for self-service - see [#1181](https://github.com/chocolatey/choco/issues/1181) - - -## [0.10.3](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.3+is%3Aclosed) (October 7, 2016) -### BREAKING CHANGES - * Fix - Do Not Check `$LastExitCode` - Only error a package install if script errors or set a different exit code when it is specifically set - see [#1000](https://github.com/chocolatey/choco/issues/1000) - - Starting in v0.9.10, Chocolatey started checking `$LASTEXITCODE` in addition to the script command success as a way to be more helpful in determining package failures. This meant it offered the ability to capture when a script exited with `Exit 1` and handle that accordingly. However that really has never been a recommended scenario for returning errors from scripts and is not seen in the wild anywhere so it is believed that those that may be affected are very few. - - Checking `$LastExitCode` checks the last executable's exit code when the script specifically does not call `Exit` (which is . This can lead to very perplexing failures, such as running a successful xcopy that exits with `2` and seeing package failures without understanding why. Since it is not typically recommended to call `Exit` to return a value from PowerShell because of issues with different hosts, it's less of a concern to only look at explicit failures. For folks that may need it, allow failing a package again by the last external command exit code or `exit` from a PowerShell script. Note that it is not recommended to use exit with a number to return from PowerShell scripts. Instead you should use `$env:ChocolateyExitCode` or `Set-PowerShellExitCode` (first available in v0.9.10) to ensure proper setting of the exit code. - - If you need the prior behavior, please turn on the feature `scriptsCheckLastExitCode`. - -### BUG FIXES - * Fix - chocolateybeforemodify runs after modifying (moving) chocolatey lib package files - see [#995](https://github.com/chocolatey/choco/issues/995) - * Fix - The refreshenv command throws an error about Write-FunctionCallLogMessage when ran in PowerShell on 0.10.2 - see [#996](https://github.com/chocolatey/choco/issues/996) - - -## [0.10.2](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.2+is%3Aclosed) (September 30, 2016) -We're dubbing this the "Every Joe" release in honor of a friend that just lost his fight with brain cancer. If you want to help further research, please make a donation to a cancer research association of your choosing (e.g. the [American Brain Tumor Assocation](http://www.abta.org/thank-you.html)). - -A couple of important fixes/enhancements in this release. Most of the improvements are about providing better feedback to you and fixing minor issues. The big one surrounds when packages set a download path for a file using `$env:TEMP`, choco will ensure that the file can still be found for later use. - -### BUG FIXES - * Fix - Downloaded file is at old `$env:TEMP\chocolatey\chocolatey` location, but install calls with just `$env:TEMP\chocolatey\` location - see [#969](https://github.com/chocolatey/choco/issues/969) - * Fix - [Pro/Business] UseOriginalLocation fails when there is no 64bit file - see [#972](https://github.com/chocolatey/choco/issues/972) - * Fix - Do not use unparsed options as package names - see [#983](https://github.com/chocolatey/choco/issues/983) - -### IMPROVEMENTS - * Start-ChocolateyProcessAsAdmin enhancements - see [#977](https://github.com/chocolatey/choco/issues/977) - * Log PowerShell function calls better - see [#976](https://github.com/chocolatey/choco/issues/976) - * Allow environment variables in some config settings - see [#971](https://github.com/chocolatey/choco/issues/971) - * [Pro/Business] Provide license type to environment variables - see [#968](https://github.com/chocolatey/choco/issues/968) - * Note that chocolateyUninstall.ps1 may no longer required in template - see [#982](https://github.com/chocolatey/choco/issues/982) - * Provide guidance when licensed only options are passed to FOSS - see [#984](https://github.com/chocolatey/choco/issues/984) - * Rollback automatically when a user cancels an operation - see [#985](https://github.com/chocolatey/choco/issues/985) - * Explain how to workaround a failing uninstall - see [#573](https://github.com/chocolatey/choco/issues/573) - * Remove extra forward slashes in url - see [#986](https://github.com/chocolatey/choco/issues/986) - * Side by side uninstall enhancements - see [#992](https://github.com/chocolatey/choco/issues/992) - - -## [0.10.1](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.1+is%3Aclosed) (September 19, 2016) -We're dubbing this the "Shhh! Keep that secret please" release. We've found that when passing in passwords and other sensitive arguments, those items can end up in the logs in clear text. We've addressed this in [#948](https://github.com/chocolatey/choco/issues/948) and [#953](https://github.com/chocolatey/choco/issues/953). When it comes to passing sensitive arguments through to native installers, you can set up environment variables with those sensitive args and pass those arguments directly through to `Start-ChocolateyProcessAsAdmin`. If you prefer a better experience, the licensed version allows passing sensitive options directly through choco.exe as `--install-arguments-sensitive` and `--package-parameters-sensitive`. Read more in the [Licensed CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG_LICENSED.md). - -Perhaps the biggest improvement in this release is that Chocolatey will automatically look to see if it can download binaries over HTTPS when provided an HTTP url. If so, Chocolatey will switch to downloading the binaries over SSL. This provides better security in downloading and knowing you are getting the binary from the source location instead of a possible man in the middle location, especially when the package does not provide checksums for verification. - -Another improvement you may not even notice, but we think you will love is that Chocolatey now supports TLS v1.2 transport which presents a nice transparent increase in security. You will need to have at least .NET Framework 4.5 installed to take advantage of this feature. - -### FEATURES - * [Security] Support TLS v1.2 - see [#458](https://github.com/chocolatey/choco/issues/458) - * [Security] Attempt to download packages via HTTPS connection - see [#746](https://github.com/chocolatey/choco/issues/746) - * [Security] Pro/Business - Pass sensitive arguments to installers - see [#948](https://github.com/chocolatey/choco/issues/948) - * Search (and info) by version - see [#935](https://github.com/chocolatey/choco/issues/935) - -### BUG FIXES - * [Security] Fix - Passwords in command line options are logged in clear text - see [#953](https://github.com/chocolatey/choco/issues/953) - * [Security] Fix - For PowerShell v2 - if switch down to SSLv3 protocol fails, go back to original protocol - see [#958](https://github.com/chocolatey/choco/issues/958) - * Fix - Unzipping to ProgramFiles/System32 is Subject to File System Redirection - see [#960](https://github.com/chocolatey/choco/issues/960) - * Fix - Run without login - see [#945](https://github.com/chocolatey/choco/issues/945) - * Fix - Support Long Paths - see [#934](https://github.com/chocolatey/choco/issues/934) - * Fix - help should not issue warning about elevated command shell - see [#893](https://github.com/chocolatey/choco/issues/893) - * Fix - Licensed Feed cannot be disabled - see [#959](https://github.com/chocolatey/choco/issues/959) - * Fix - Choco with unknown command should show help menu - see [#938](https://github.com/chocolatey/choco/issues/938) - * Fix - Get-FtpFile error when file is missing (called through Get-ChocolateyWebFile) - see [#920](https://github.com/chocolatey/choco/issues/920) - * Fix - Skip Get-WebFileName for FTP - see [#957](https://github.com/chocolatey/choco/issues/957) - * Fix - Chocolatey-InstallChocolateyPackage fix for double chocolatey folder name is not also applied to the passed in file name - see [#908](https://github.com/chocolatey/choco/issues/908) - * Fix - Start-ProcessAsAdmin - working directory should be from the location of the executable - see [#937](https://github.com/chocolatey/choco/issues/937) - * [POSH Host] Fix - PowerShell Host - Package scripts setting values can affect packages that depend on them - see [#719](https://github.com/chocolatey/choco/issues/719) - * Fix - Transactional install - pending check may fail if the lib folder doesn't exist - see [#954](https://github.com/chocolatey/choco/issues/954) - * Fix - Start-ChocolateyProcessAsAdmin Module Import for PowerShell causes errors - see [#901](https://github.com/chocolatey/choco/issues/901) - -### IMPROVEMENTS - * Transactional Install - Improve concurrent operations (pending) - see [#943](https://github.com/chocolatey/choco/issues/943) - * Uninstall-ChocolateyPackage should set unrecognized fileType to exe - see [#964](https://github.com/chocolatey/choco/issues/964) - * Powershell functions - Allow access to package title, not only ID - see [#925](https://github.com/chocolatey/choco/issues/925) - * Option to apply package parameters / install arguments to dependent packages - see [#839](https://github.com/chocolatey/choco/issues/839) - * Get-ChocolateyWebFile download check enhancements - see [#952](https://github.com/chocolatey/choco/issues/952) - * Do not treat unknown checksum types as MD5 - see [#932](https://github.com/chocolatey/choco/issues/932) - * Pro/Business - Install-ChocolateyPackage - UseOriginalLocation - see [#950](https://github.com/chocolatey/choco/issues/950) - * Auto determine checksum type - see [#922](https://github.com/chocolatey/choco/issues/922) - * Ensure PowerShell functions have parameter name parity - see [#941](https://github.com/chocolatey/choco/issues/941) - * Output from installer should go to verbose log - see [#940](https://github.com/chocolatey/choco/issues/940) - - -## [0.10.0](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.0+is%3Aclosed) (August 11, 2016) -What was planned for 0.9.10.4 is now 0.10.0. This is due partly to a breaking change we are making for security purposes and a move to provide better a better versioning scheme for the remainder of the sub-v1 versions of Chocolatey. Instead of 0.y.z.0 being considered where major verions occur in the sub 1 series, 0.y.0 will now be considered where those major versions occur. We also are moving right along towards v1 (and hope to be there in 2017). - -0.10.0 carries the fixes for 0.9.10.4 and includes a major security enhancement (checksum requirement). - -### BREAKING CHANGES - * [Security] Checksum requirement and enhancements - see [#112](https://github.com/chocolatey/choco/issues/112) - -Checksums in package scripts are meant as a measure to validate the originally intended downloaded resources used in the creation of a package are the same files that are received at a future date. This also ensures that the same files that are checked by all parts of moderation (if applicable) are the same files that are received by users for a package. This is seen mostly on the community repository because it is public and packages are subject to copyright laws (distribution rights), which typically requires the package scripts to download software from the official distribution locations. The Chocolatey framework has had the ability to use checksums in package scripts since [July 2014](https://community.chocolatey.org/packages/chocolatey/0.9.8.24#releasenotes). - -**What is the requirement?** choco will now fail if a package download resources from HTTP/FTP and does not use checksums to verify those downloaded resources. The requirement for HTTP/FTP is [#112](https://github.com/chocolatey/choco/issues/112). We are considering also requiring it for [HTTPS (#895)](https://github.com/chocolatey/choco/issues/895) as well. You can optionally set a feature (`allowEmptyChecksumsSecure`) to ensure packages using HTTPS also use checksums. - -**How does this protect the community anymore than before?** During moderation review, there is a check of these downloaded binaries against VirusTotal (which verifies these binaries against 50-60+ different virus scanners). The binaries are also verified for installation purposes against a test computer. With an independent 3rd party checksum in the package itself, it guarantees that the files received by a user from those remote sources are the exact same files that were used in the verification process. - -**Why the requirement, and why now?** This is a measure of protection for the Chocolatey community. HTTP is easy to hack with both DNS poisoning and MITM (man in the middle) attacks. Without independent verification of the integrity of the downloaded resources, users can be left susceptible to these issues. We've been planning a move to require checksums for awhile now, with a planned longer and smoother transition for package maintainers to get packages updated to reduce breakages. Unfortunately there was a recent event with [FOSSHub getting hacked](http://www.audacityteam.org/compromised-download-partner/) (the [community repository had 8 possibly affected packages](http://us8.campaign-archive1.com/?u=86a6d80146a0da7f2223712e4&id=f2fe8dbe6b) and [we quickly took action](http://us8.campaign-archive1.com/?u=86a6d80146a0da7f2223712e4&id=2cbe87d486)), which necessitated a need for us to move in a much swifter fashion to ensure the protection of the community sooner, rather than later. The changes in Chocolatey represented by the checksum changes are a major step in the process to ensure protection. Requiring for HTTPS as well will mitigate any future compromises of software distribution sites that are used with Chocolatey packages. - -**Can I shut this behavior off or opt out per package?** -You can shut off the checksum requirement by enabling the feature `allowEmptyChecksums`. This will return Chocolatey to previous behavior. We strongly recommend against it. - -You can shut it off or turn it per package install/upgrade with `--allow-empty-checksums` and `--require-checksums`, respectively. See https://docs.chocolatey.org/en-us/choco/commands/install / https://docs.chocolatey.org/en-us/choco/commands/upgrade. - -You can also disable the feature `allowEmptyChecksumsSecure` to enforce checksums for packages that download from secure locations (HTTPS). - -**Other things I should know?** Users also now have the ability to pass their own checksums and checksumtypes into the install. See https://docs.chocolatey.org/en-us/choco/commands/install / https://docs.chocolatey.org/en-us/choco/commands/upgrade. - -### KNOWN ISSUES - * [Known Issues](https://github.com/chocolatey/choco/labels/Bug) - -### FEATURES - * Pro/Business - Download a package without installing it - see [#108](https://github.com/chocolatey/choco/issues/108) - -### BUG FIXES - * Fix - Installing choco on Windows 10 Vagrant box stops Vagrant from being able to manage the box - see [#834](https://github.com/chocolatey/choco/issues/834) - * Fix - 64bit 7z.exe on 32bit system in chocolatey\tools - see [#836](https://github.com/chocolatey/choco/issues/836) - * Fix - [POSH Host] PowerShell exit code does not reset between packages in a single run - see [#854](https://github.com/chocolatey/choco/issues/854) - * Fix - Uninstall-ChocolateyZipPackage is failing - see [#871](https://github.com/chocolatey/choco/issues/871) - * Fix - "C:\Program Files\WindowsPowerShell\Modules" is missing in PSModulePath for cmd.exe [#830](https://github.com/chocolatey/choco/issues/830) - * Fix - Environment variables update fixes [#840](https://github.com/chocolatey/choco/issues/840) - * Fix - Handle null items better - see [#853](https://github.com/chocolatey/choco/issues/853) - * Fix - HKCU may not have Environment (Install of Chocolatey) - see [#375](https://github.com/chocolatey/choco/issues/375) - * Fix - Progress of download does not clear the whole output line - see [#875](https://github.com/chocolatey/choco/issues/875) - * Fix - Wrong download progress reported during package upgrade - see [#872](https://github.com/chocolatey/choco/issues/872) - * Fix - Uninstall not supporting side-by-side => ChocolateyUninstall.ps1 not run - see [#862](https://github.com/chocolatey/choco/issues/862) - * Fix - Uninstall ignores the version parameter - see [#861](https://github.com/chocolatey/choco/issues/861) - * Fix - Search by exact or by id only is case sensitive for remote sources - see [#889](https://github.com/chocolatey/choco/issues/889) - * Fix - Deprecated links inserted in .nuspec files created by `choco new ...` - see [#870](https://github.com/chocolatey/choco/issues/870) - * Fix - Get-OSArchitectureWidth doesn't do what it says it does - see [#828](https://github.com/chocolatey/choco/issues/828) - * Fix - When Choco fails to get a package from NuGet Core, fail the package with exit code 1 - see [#867](https://github.com/chocolatey/choco/issues/867) - * Fix - Illegal characters in path - see [#857](https://github.com/chocolatey/choco/issues/857) - * Fix - Get-OSArchitectureWidth doesn't do what it says it does - see [#828](https://github.com/chocolatey/choco/issues/828) - * Fix - Pro/Business - Choco install config file fails on licensed assembly - see [#866](https://github.com/chocolatey/choco/issues/866) - * Fix - DISM /all doesn't run anywhere but Windows 6.2 -- no dependencies get installed - see [#897](https://github.com/chocolatey/choco/issues/897) - -### IMPROVEMENTS - * Do not install tab completion (edit of profile) under certain conditions - see [#833](https://github.com/chocolatey/choco/issues/833) - * Choco install with packages.config should print out the packages to install - see [#878](https://github.com/chocolatey/choco/issues/878) - * Larger default log file size and retention - see [#852](https://github.com/chocolatey/choco/issues/852) - * Allow getting installer type to be overridden - see [#885](https://github.com/chocolatey/choco/issues/885) - * Pack - Add optional output folder option - see [#598](https://github.com/chocolatey/choco/issues/598) - * Little command name correction on init.ps1 - see [#595](https://github.com/chocolatey/choco/issues/595) - * Tab completion - don't query if there is a file in the folder that meets completion - see [#847](https://github.com/chocolatey/choco/issues/847) - - -## [0.9.10.3](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10.3+is%3Aclosed) (June 23, 2016) -### BUG FIXES - * Fix - Ignore ValidPackage Exit Codes for Real - see [#827](https://github.com/chocolatey/choco/issues/827) - * Fix - Cache folder running under SYSTEM account should be C:\Windows\TEMP - see [#826](https://github.com/chocolatey/choco/issues/826) - * Fix - Built-in 7zip doesn't behave properly - see [#775](https://github.com/chocolatey/choco/issues/775) - * Fix - Successful installer exit codes not recognized by choco should return 0 - see [#821](https://github.com/chocolatey/choco/issues/821) - * Fix - NotSilent fails with "Cannot bind argument to parameter statements because it is an empty string" - see [#819](https://github.com/chocolatey/choco/issues/819) - * Fix - Silent Args being passed as a string array cause package failure - see [#808](https://github.com/chocolatey/choco/issues/808) - -### IMPROVEMENTS - * Hold pending check for 10 seconds / provide means of explicitly overriding the transactional install cleanup - see [#822](https://github.com/chocolatey/choco/issues/822) - * Pro/Business - Add runtime skip option to allow skipping the virus scanner - see [#786](https://github.com/chocolatey/choco/issues/786) - - -## [0.9.10.2](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10.2+is%3Aclosed) (June 19, 2016) -### BUG FIXES - * Fix - Chocolatey Licensed is unable to find 0.9.10.x (only 0.9.10.0) - see [#814](https://github.com/chocolatey/choco/issues/814) - * Fix - Logging is broken in some packages due to new TEMP directory - see [#813](https://github.com/chocolatey/choco/issues/813) - * [API] Fix - When performing an Install/Uninstall/Upgrade operation through the API, an error is throw for "chocolatey.resources" - see [#811](https://github.com/chocolatey/choco/issues/811) - -### IMPROVEMENTS - * Ensure log file path exists - and fix the log file arguments if necessary - see [#758](https://github.com/chocolatey/choco/issues/758) - - -## [0.9.10.1](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10.1+is%3Aclosed) (June 18, 2016) -### BUG FIXES - * Fix - Cannot bind argument to parameter 'exitCode' because it is null - see [#810](https://github.com/chocolatey/choco/issues/810) - -### IMPROVEMENTS - * [Security] Upgrade to 7zip 16.02 to overcome CVE-2016-2334/CVE-2016-2335 - see [#812](https://github.com/chocolatey/choco/issues/812) - - -## [0.9.10](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10+is%3Aclosed) (June 17, 2016) - -![Chocolatey Logo](https://rawcdn.githack.com/chocolatey/choco/14a627932c78c8baaba6bef5f749ebfa1957d28d/docs/logo/chocolateyicon.gif "Chocolatey") - -The "I got 99 problems, but a package manager ain't one" release. With the release of 0.9.10 (or if you prefer 0.9.10.0), we're about to make everything 100% better in your Windows package management world. We've addressed over 100 features and bugs in this release. We looked at how we could improve PowerShell and we've come out with a [competely internal host](https://github.com/chocolatey/choco/issues/8) that can Prompt and Read-Host in a way that times out and selects default values after a period of time. Speaking of PowerShell, how about some tab completion `choco <tab>` to `choco install node<tab>`? How about never having to [close and reopen your shell again](https://github.com/chocolatey/choco/issues/664)? - -Alternative sources (`-source webpi`, `-s windowsfeature`, etc) are back! I mean, am I right?! Have you heard of auto uninstaller? If Chocolatey has installed something that works with Programs and Features, Chocolatey knows how to uninstall it without an uninstall script about 90+% of the time. This feature was in beta for the 0.9.9 series, it is on by default in 0.9.10 (unless you disabled it after trying it, you will need to reenable it, see `choco feature` for more details). - -Here's one you probably never knew existed - extensions. Chocolatey has had the ability to extend itself by adding PowerShell modules for years, and most folks either didn't know it existed or have never used them. We've enhanced them a bit in preparation for the licensed version of Chocolatey. - -We redesigned our `choco new` default packaging template and we've made managing templates as easy as managing packages. - -`choco search`/`choco list` has so many enhancements, you may not need to visit dot org again. [See it in action](https://docs.chocolatey.org/en-us/choco/commands/list#see-it-in-action). -* [search -v provides moderation related information and a world of nuspec information](https://github.com/chocolatey/choco/issues/493) -* [search by id only](https://github.com/chocolatey/choco/issues/663) -* [search by id exact](https://github.com/chocolatey/choco/issues/453) -* [search by approved only, not broken, and/or by download cache](https://github.com/chocolatey/choco/issues/670) -* [sort by version](https://github.com/chocolatey/choco/issues/668) -* [search with paging](https://github.com/chocolatey/choco/issues/427) - -There are 150 tickets closed for this release! We've included remediation steps for when a breaking change affects you. Mostly if you have been using Chocolatey in a recommended way, you won't even notice any adverse changes. There are a number of things we thought to highlight, and quite a few security enhancements coming in this release (look for the [Security] tag on the ticket summary). - -### BREAKING CHANGES - * Only fail automation scripts (chocolateyInstall.ps1) if the script returns non-zero exit code - see [#445](https://github.com/chocolatey/choco/issues/445) - -The 0.9.8 series would only fail a package with terminating errors. The 0.9.9 series took that a bit further and started failing packages if anything wrote to stderr. It turns out that is a bad idea. Only when PowerShell exits with non-zero (which comes with terminating errors) should the package fail due to this. If you need the old behavior of the 0.9.9 series, you can get it back with a switch (`--fail-on-standard-error` and its aliases) and/or a feature flip (`failOnStandardError`). - - * Fix - Force reinstall, force upgrade, and uninstall should delete the download cache - see [#590](https://github.com/chocolatey/choco/issues/590) - -If you set a custom cache directory for downloads, it will no longer use a "chocolatey" subdirectory under that. You may need to make any adjustments if this is going to affect you. - - * Exit with the same exit code as the software being installed - see [#512](https://github.com/chocolatey/choco/issues/512) - -There are more exit codes from Chocolatey now that indicate success -`0`, `1605`, `1614`, `1641`, and `3010`. You may need to adjust anything you were using that would only check for 0 and nonzero. -If you need the previous behavior, be sure to disable the feature `usePackageExitCodes` or use the `--ignore-package-exit-codes` switch in your choco commands. - - * PowerShell module functions adjusted for automatic documentation - see [#697](https://github.com/chocolatey/choco/issues/697) - -If you were using any of the functions in a non-recommended way or not compliant with the examples, you are going to find breakages in the functions as some of the things that were called out as non-optional are now enforced. This shouldn't affect most folks. - - * [Security] Explicit permissions - remove inheritance/lock down to admins - see [#398](https://github.com/chocolatey/choco/issues/398) - -This further restricts the default installation location by removing all permissions and inheritance of permissions, explicitly giving Administrator/LocalSystem to Full access, and Users are granted Read and Execute. In prior installations, we ensured Modify access to the installing user, but that has been removed for security reasons. Should you need the previous behavior, set `$env:ChocolateyInstallAllowCurrentUser="true"`. - -### KNOWN ISSUES - * [Known Issues](https://github.com/chocolatey/choco/labels/Bug) - -### FEATURES - * Alternative Sources - see [#14](https://github.com/chocolatey/choco/issues/14) - * [POSH Host] Use Internal PowerShell Host - see [#8](https://github.com/chocolatey/choco/issues/8) - * Run a script before uninstall/upgrade (chocolateyBeforeModify.ps1) to allow for things like services to shutdown - see [#268](https://github.com/chocolatey/choco/issues/268) - * Manage package templates with a specially named package and special package folder - see [#542](https://github.com/chocolatey/choco/issues/542) - * Support for custom headers - see [#332](https://github.com/chocolatey/choco/issues/332) - * [Security] Show moderation-related information in search results - see [#493](https://github.com/chocolatey/choco/issues/493) - * New Helper - Get-ToolsLocation helper (replacement for Get-BinRoot) - see [#631](https://github.com/chocolatey/choco/issues/631) - * Choco list/search should have exact filter search - see [#453](https://github.com/chocolatey/choco/issues/453) - * RefreshEnv (Refresh Environment Variables) Should also work in PowerShell - see [#664](https://github.com/chocolatey/choco/issues/664) - * 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) - * Mark packages pending until install completes successfully - see [#198](https://github.com/chocolatey/choco/issues/198) - * Resolve sources by name - see [#356](https://github.com/chocolatey/choco/issues/356) - * Uninstall-ChocolateyEnvironmentVariable function - see [#772](https://github.com/chocolatey/choco/issues/772) - * Get-UninstallRegistryKey function - see [#739](https://github.com/chocolatey/choco/issues/739) - * Pro/Business - Ubiquitous Install Directory Switch - see [#258](https://github.com/chocolatey/choco/issues/258) - * Pro/Business - Runtime Virus Scanning - see [virus scanning](https://docs.chocolatey.org/en-us/features/virus-check) - * Pro/Business - Private CDN cache for downloads - see [private CDN cache](https://docs.chocolatey.org/en-us/features/private-cdn) - * Pro/Business - Sync "choco installed status" with "Windows installed status" - see [#567](https://github.com/chocolatey/choco/issues/567) - -### BUG FIXES - * [Security] Fix - Only load the Chocolatey PowerShell module from a known location - see [#560](https://github.com/chocolatey/choco/issues/560) - * [Security] Fix - Package source authentication at http://location/path doesn't also use http://location/ (base url) - see [#466](https://github.com/chocolatey/choco/issues/466) - * [Security] Fix - When defining a proxy without credentials - proxy password is shown in plain text - see [#503](https://github.com/chocolatey/choco/issues/503) - * [Security] Fix - Fully qualify shutdown command - see [#702](https://github.com/chocolatey/choco/issues/702) - * [Security] Fix - MSI packages fail install with `Could not find 'msiexec'` - see [#723](https://github.com/chocolatey/choco/issues/723) - * Fix - Force should set allow-downgrade to true - see [#585](https://github.com/chocolatey/choco/issues/585) - * Fix - Do not use NuGet package cache - see [#479](https://github.com/chocolatey/choco/issues/479) - * Fix - Pack doesn't include chocolatey-specific metadata - see [#607](https://github.com/chocolatey/choco/issues/607) - * Fix - TEMP environment variable is 8.3 Path on some systems - see [#532](https://github.com/chocolatey/choco/issues/532) - * Fix - `$packageName` should be present for zip uninstalls in uninstall script template - see [#534](https://github.com/chocolatey/choco/issues/534) - * Fix - Debug/Verbose messages not logged in automation scripts (chocolateyInstall.ps1) - see [#520](https://github.com/chocolatey/choco/issues/520) - * Fix - Escape log output for variables that have data from external sources - see [#565](https://github.com/chocolatey/choco/issues/565) - * Fix - Choco new silentargs can't pass in args in the param=value format - see [#510](https://github.com/chocolatey/choco/issues/510) - * Fix - Exception if no source is enabled - see [#490](https://github.com/chocolatey/choco/issues/490) - * Fix - Chocolatey command help output written to standard error instead of standard out - see [#468](https://github.com/chocolatey/choco/issues/468) - * Fix - Logger doesn't clear cached NullLoggers - see [#516](https://github.com/chocolatey/choco/issues/516) - * Fix - DISM "/All" argument in the wrong position - see [#480](https://github.com/chocolatey/choco/issues/480) - * Fix - Pro/Business - Installing/uninstalling extensions should rename files in use - see [#594](https://github.com/chocolatey/choco/issues/594) - * Fix - Running Get-WebFileName in PowerShell 5 fails and sometimes causes package errors - see [#603](https://github.com/chocolatey/choco/issues/603) - * Fix - Merging assemblies on a machine running .Net 4.5 or higher produces binaries incompatible with .Net 4 - see [#392](https://github.com/chocolatey/choco/issues/392) - * Fix - [API] - Incorrect log4net version in chocolatey.lib dependencies - see [#390](https://github.com/chocolatey/choco/issues/390) - * [POSH Host] Fix - Message after Download progress is on the same line sometimes - see [#525](https://github.com/chocolatey/choco/issues/525) - * [POSH Host] Fix - PowerShell internal process - "The handle is invalid." - see [#526](https://github.com/chocolatey/choco/issues/526) - * [POSH Host] Fix - The handle is invalid - when output is being redirected and a package attempts to write to a filestream - see [#572](https://github.com/chocolatey/choco/issues/572) - * [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) - * [POSH Host] Fix - Host.Version should return actual PowerShell version - see [#708](https://github.com/chocolatey/choco/issues/708) - * 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) - * Fix - ShimGen handling of spaces and arguments that have shimgen in them - see [#647](https://github.com/chocolatey/choco/issues/647) - * Fix - PowerShell v2 - Choco installer messages can't actually be warnings (causes FileStream errors) - see [#666](https://github.com/chocolatey/choco/issues/666) - * Fix - Installing chocolatey removes $env:PSModulePath changes for current PowerShell session - see [#295](https://github.com/chocolatey/choco/issues/295) - * Fix - Notice for Get-BinRoot deprecation won't be displayed - see [#673](https://github.com/chocolatey/choco/issues/673) - * Fix - choco new creates a bad ChocolateyUninstall.ps1 script which does not work. - see [#460](https://github.com/chocolatey/choco/issues/460) - * Fix - ShimGen fails when file metadata has strings that need literals - see [#677](https://github.com/chocolatey/choco/issues/677) - * Fix - Install-ChocolateyPath Expands Variables in PATH, Overwriting Preexisting Variables - see [#303](https://github.com/chocolatey/choco/issues/303) - * Fix - Install-ChocolateyShortcut gives invalid warning when target is a web url - see [#592](https://github.com/chocolatey/choco/issues/592) - * Fix - Argument Parsing failures should be reported as warnings and not debug messages - see [#571](https://github.com/chocolatey/choco/issues/571) - * Fix - choco pack returns zero exit code when Nuget.Core validation errors - see [#469](https://github.com/chocolatey/choco/issues/469) - * Fix - `Install-ChocolateyPath` updates `PATH` to `REG_SZ`, which may break using Windows dir and system32 tools - see [#699](https://github.com/chocolatey/choco/issues/699) - * 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) - * Fix - `choco new` cannot introduce multistage folder hierarchy template - see [#706](https://github.com/chocolatey/choco/issues/706) - * Fix - Empty $env:ChocolateyToolsLocation combine error - see [#756](https://github.com/chocolatey/choco/issues/756) - * Fix - Installing chocolatey removes $env:PSModulePath changes for current powershell session - see [#295](https://github.com/chocolatey/choco/issues/295) - * Fix - Some environment variables are set too early for options/switches to have an effect - see [#620](https://github.com/chocolatey/choco/issues/620) - * [API] Fix - Issue when attempting to execute run command through API - see [#769](https://github.com/chocolatey/choco/issues/769) - * Fix - Logging of upgrade messages - placement of some messages is incorrect - see [#557](https://github.com/chocolatey/choco/issues/557) - * Fix - Get-WebFile fails with - The term '//continue' is not recognized as the name of a cmdlet - see [#789](https://github.com/chocolatey/choco/issues/789) - * Fix - Unable to read registry snapshot file - see [#487](https://github.com/chocolatey/choco/issues/487) - * Fix - Pro/Business - Licensed version has an incorrect dependency on PowerShell assemblies and will only load v3 and above - see [#799](https://github.com/chocolatey/choco/issues/799) - * Fix - Exit codes in package scripts should work - see [#802](https://github.com/chocolatey/choco/issues/802) - * Fix - Running choco new creates a bad nuspec - see [#801](https://github.com/chocolatey/choco/issues/801) - -### IMPROVEMENTS - * AutoUninstaller is on by default - see [#308](https://github.com/chocolatey/choco/issues/308) - * Use the actual download file name instead of providing one - see [#435](https://github.com/chocolatey/choco/issues/435) - * Unset Configuration Values - see [#551](https://github.com/chocolatey/choco/issues/551) - * Ability to run "choco upgrade all" ignoring specific packages - see [#293](https://github.com/chocolatey/choco/issues/293) - * Extensions enhancements - see [#588](https://github.com/chocolatey/choco/issues/588) - * Show human-readable file sizes when downloading - see [#363](https://github.com/chocolatey/choco/issues/363) - * [Security] Warn about environment changes - see [#563](https://github.com/chocolatey/choco/issues/563) - * Warn when execution timeout has elapsed - see [#561](https://github.com/chocolatey/choco/issues/561) - * Update nuspec to make it easier to get started - see [#535](https://github.com/chocolatey/choco/issues/535) - * Suppress verbose output to verbose - like with 7-zip - see [#476](https://github.com/chocolatey/choco/issues/476) - * Choco push moderation message only on push to dot org - see [#601](https://github.com/chocolatey/choco/issues/601) - * Allow tools/bin root to be root of the drive again - see [#628](https://github.com/chocolatey/choco/issues/628) - * File description of ShimGen shims should match original as closely as possible - see [#374](https://github.com/chocolatey/choco/issues/374) - * Shim Generation should automatically detect GUI - see [#634](https://github.com/chocolatey/choco/issues/634) - * Don't show 32 bit wording unless there is explicitly both versions available - see [#642](https://github.com/chocolatey/choco/issues/642) - * Allow passing arbitrary key/value arguments to new command when generating packages from templates - see [#658](https://github.com/chocolatey/choco/issues/658) - * Choco search/list should be able to search just by Id - see [#663](https://github.com/chocolatey/choco/issues/663) - * Search by approved, by not broken, by download cache - see [#670](https://github.com/chocolatey/choco/issues/670) - * Save nuspec files with package installs - see [#623](https://github.com/chocolatey/choco/issues/623) - * Show a prompt character when asking a multiple choice question - see [#184](https://github.com/chocolatey/choco/issues/184) - * When prompting for a user yes/no answer, use a short [y/n] representation - see [#181](https://github.com/chocolatey/choco/issues/181) - * Default package template should include LICENSE.txt and VERIFICATION.txt for packages with binaries - see [#675](https://github.com/chocolatey/choco/issues/675) - * choco list/search aliases for -v - '-detail' and '-detailed' - see [#646](https://github.com/chocolatey/choco/issues/646) - * Log normal output to a secondary log - see [#682](https://github.com/chocolatey/choco/issues/682) - * Display Package test status information on install/upgrade - see [#696](https://github.com/chocolatey/choco/issues/696) - * Report when reboots are necessary from package installs - see [#712](https://github.com/chocolatey/choco/issues/712) - * Report loaded extensions - see [#715](https://github.com/chocolatey/choco/issues/715) - * Exit with specific codes on certain actions - see [#707](https://github.com/chocolatey/choco/issues/707) - * Determine if Downloaded File is HTML or Plain Text - see [#649](https://github.com/chocolatey/choco/issues/649) - * 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) - * Override autouninstaller / failonautouninstaller fail with switches for uninstall - see [#515](https://github.com/chocolatey/choco/issues/515) - * Offer to remove actual package (*.install/*.portable) when removing meta/virtual package - see [#735](https://github.com/chocolatey/choco/issues/735) - * Provide more info in package summary - see [#455](https://github.com/chocolatey/choco/issues/455) - * Report install location - see [#689](https://github.com/chocolatey/choco/issues/689) - * Track MSI Information Better - see [#755](https://github.com/chocolatey/choco/issues/755) - * Support for client certificates - see [#399](https://github.com/chocolatey/choco/issues/399) - * choco feature list formatting enhancements - see [#742](https://github.com/chocolatey/choco/issues/742) - * choco new --original-template - see [#737](https://github.com/chocolatey/choco/issues/737) - * Update Get-FtpFile with fixes for Get-WebFile - see [#765](https://github.com/chocolatey/choco/issues/765) - * Rename Get-ProcessorBits as a more appropriately named Get-OSArchitectureWidth - see [#713](https://github.com/chocolatey/choco/issues/713) - * Allow passing no 32-bit url and fail the package on 32-bit systems - see [#527](https://github.com/chocolatey/choco/issues/527) - * Enhance Install-ChocolateyShortcut to support WindowStyle, Pin to Taskbar and Run As Administrator checkbox - see [#519](https://github.com/chocolatey/choco/issues/519) - * [Security] Allow hashing files for checksums with FIPS compliant algorithms - see [#446](https://github.com/chocolatey/choco/issues/446) - * After upgrading provide summary of upgraded packages - see [#759](https://github.com/chocolatey/choco/issues/759) - * Web functions - Check for local file and return early - see [#781](https://github.com/chocolatey/choco/issues/781) - * Refresh environment variables after each install - see [#439](https://github.com/chocolatey/choco/issues/439) - * Capture Arguments for a Package during Install/Upgrade - see [#358](https://github.com/chocolatey/choco/issues/358) - * If config update fails, log to debug instead of warn - see [#793](https://github.com/chocolatey/choco/issues/793) - * Remove extra empty lines when doing choco upgrade all - see [#796](https://github.com/chocolatey/choco/issues/796) - * Mention required permissions if user has no access - see [#794](https://github.com/chocolatey/choco/issues/794) - * 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) - * Pro/Business - Load/Provide hooks for licensed version - see [#584](https://github.com/chocolatey/choco/issues/584) - * Pro/Business - On valid license, add pro/business source automatically - see [#604](https://github.com/chocolatey/choco/issues/604) - * Pro/Business - Add switch to fail on invalid or missing license - see [#596](https://github.com/chocolatey/choco/issues/596) - * Pro/Business - add ignore invalid switches/parameters - see [#586](https://github.com/chocolatey/choco/issues/586) - * Pro/Business - Don't prompt to upload file for virus scanning if it is too large - see [#695](https://github.com/chocolatey/choco/issues/695) - * Pro/Business - add 'support' command - see [#745](https://github.com/chocolatey/choco/issues/745) - * Pro/Business - Adjust environment settings warning to suggest upgrade - see [#795](https://github.com/chocolatey/choco/issues/795) - * API - Add the ability to retrieve package count for a Source - see [#431](https://github.com/chocolatey/choco/issues/431) - * API - Chocolatey Lib still marks vital package information as internal - see [#433](https://github.com/chocolatey/choco/issues/433) - * API - Add paging to list command - see [#427](https://github.com/chocolatey/choco/issues/427) - * API - Choco search should sort by version - see [#668](https://github.com/chocolatey/choco/issues/668) - * API - Switch dll to .NET Client Profile - see [#680](https://github.com/chocolatey/choco/issues/680) - - -## [0.9.9.12](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.12+is%3Aclosed) (March 18, 2016) -### BUG FIXES - * Fix - PowerShell "Collection is read-only" - see [#659](https://github.com/chocolatey/choco/issues/659) - - -## [0.9.9.11](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.11+is%3Aclosed) (October 6, 2015) -### BUG FIXES - * Fix - Pin list is broken - see [#452](https://github.com/chocolatey/choco/issues/452) - - -## [0.9.9.10](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.10+is%3Aclosed) (October 3, 2015) - -Not to be confused with 0.9.10 (this is not that version). This fixes a small but extremely significant issue with relation to configuration managers and other tools that use choco. - -### BUG FIXES - * Fix - List output for other tools messed up in 0.9.9.9 (pipe separator missing) - see [#450](https://github.com/chocolatey/choco/issues/450) - * Fix - accidentally escaped characters in "new" -help - see [#447](https://github.com/chocolatey/choco/issues/447) - - -## [0.9.9.9](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.9+is%3Aclosed) (October 2, 2015) - -With this release you can completely configure choco from the command line (including the priority of sources). Choco now allows you to create [custom package templates](https://github.com/chocolatey/choco/issues/76). Choco has [proper proxy support](https://github.com/chocolatey/choco/issues/243) now. We also squashed up some bugs, like the infinite download loop that happens if the connection is lost. We've also improved the installation experience of Chocolatey itself, [unpacking all of the required setup files in the chocolatey package](https://github.com/chocolatey/choco/issues/347) and improving the messaging output during the bootstrapping process. Chocolatey also [doesn't try to write config updates every command](https://github.com/chocolatey/choco/issues/364), unless something actually changes in the config file. And last but not least for mentions, the issue of [choco not recognizing itself as needing upgraded after being installed by the bootstrapper](https://github.com/chocolatey/choco/issues/414) is now fixed. - -### FEATURES - * Config Command - see [#417](https://github.com/chocolatey/choco/issues/417) - * Create Custom Package Templates - see [#76](https://github.com/chocolatey/choco/issues/76) - * Proxy Support - see [#243](https://github.com/chocolatey/choco/issues/243) - -### BUG FIXES - * Fix - [Security] Remove rollback should validate it exists in choco install backup directory - see [#387](https://github.com/chocolatey/choco/issues/387) - * Fix - Ensure chocolatey is installed into the lib folder during initial install - see [#414](https://github.com/chocolatey/choco/issues/414) - * Fix - Infinite loop downloading files if connection is lost - see [#285](https://github.com/chocolatey/choco/issues/285) - * Fix - list / search results blocking until completion instead of streaming output - see [#143](https://github.com/chocolatey/choco/issues/143) - * Fix - default template install script for MSI silentArgs are bad - see [#354](https://github.com/chocolatey/choco/issues/354) - * Fix - Deleting read-only files fails - see [#338](https://github.com/chocolatey/choco/issues/338) and [#263](https://github.com/chocolatey/choco/issues/263) - * Fix - If the package uses $packageParameters instead of $env:PackageParameters, quotes are removed - see [#406](https://github.com/chocolatey/choco/issues/406) - * Fix - Choco upgrade not downloading new installer if current installer is the same size - see [#405](https://github.com/chocolatey/choco/issues/405) - * Fix - Exit with non-zero code if install/upgrade version and a newer version is installed - see [#365](https://github.com/chocolatey/choco/issues/365) - * Fix - Chocolately can permanently corrupt the config file if an operation is interrupted - see [#355](https://github.com/chocolatey/choco/issues/355) - * Fix - Handle PowerShell's `InitializeDefaultDrives` Error (that should just be a warning) - see [#349](https://github.com/chocolatey/choco/issues/349) - * Fix - Checksumming can not be turned off by the feature flag - see [#33](https://github.com/chocolatey/choco/issues/33) - * Fix - Process with an id of is not running errors on 0.9.9.8 - see [#346](https://github.com/chocolatey/choco/issues/346) - * Fix - Export cmdlets for automation scripts - see [#422](https://github.com/chocolatey/choco/issues/422) - -### IMPROVEMENTS - * [Security] Add SHA-2 (sha256 / sha512) to checksum - see [#113](https://github.com/chocolatey/choco/issues/113) - * Sources should have explicit priority order- see [#71](https://github.com/chocolatey/choco/issues/71) - * Unpack the powershell files just before packaging up the nupkg (Installing chocolatey meta) - see [#347](https://github.com/chocolatey/choco/issues/347) - * API - List --localonly not working by default - see [#223](https://github.com/chocolatey/choco/issues/223) - * API - Expose package results - see [#132](https://github.com/chocolatey/choco/issues/132) - * API - Externalize IPackage and its interfaces - see [#353](https://github.com/chocolatey/choco/issues/353) - * Enhance "Access to path is denied" message on no admin rights - see [#177](https://github.com/chocolatey/choco/issues/177) - * Only update chocolatey.config if there are changes - see [#364](https://github.com/chocolatey/choco/issues/364) - * Modify source when attempting to add a source with same name but different URL - see [#88](https://github.com/chocolatey/choco/issues/88) - * Features should contain description - see [#416](https://github.com/chocolatey/choco/issues/416) - * Chocolatey Installer - removing modules not loaded - see [#442](https://github.com/chocolatey/choco/issues/442) - * Chocolatey Installer - Don't use Write-Host - see [#444](https://github.com/chocolatey/choco/issues/444) - * Set environment variables once configuration is complete - see [#420](https://github.com/chocolatey/choco/issues/420) - * Enhance Package Template for 0.9.9.9 - see [#366](https://github.com/chocolatey/choco/issues/366) - - -## [0.9.9.8](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.8+is%3Aclosed) (June 26, 2015) -### BUG FIXES - * Fix - [Security] choco install -y C: deletes all files - see [#341](https://github.com/chocolatey/choco/issues/341) - * Fix - Read-Host halts scripts rather than prompt for input - see [#219](https://github.com/chocolatey/choco/issues/219) - -### IMPROVEMENTS - * Download Progress Bar is Missing - see [#56](https://github.com/chocolatey/choco/issues/56) - - -## [0.9.9.7](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.7+is%3Aclosed) (June 20, 2015) - -"Fix Everything. Fix All The Things" - There have been some things bugging us for a long time related to limitations with NuGet, so we decided to fix that. Like [nuspec enhancements](https://github.com/chocolatey/choco/issues/205), that crazy [content folder restriction](https://github.com/chocolatey/choco/issues/290) has been removed (I know, right?!), and we're working around [badly](https://github.com/chocolatey/choco/issues/316) [behaved](https://github.com/chocolatey/choco/issues/326) packages quite a bit more to bring you more feature parity. - -Let's talk about a couple of big, like really big, BIG features just added with this release. No more packages rebooting Windows. We fixed ([#304](https://github.com/chocolatey/choco/issues/304) / [#323](https://github.com/chocolatey/choco/issues/323)) and [enhanced](https://github.com/chocolatey/choco/issues/305) up the Auto Uninstaller Service quite a bit to ensure things are working like you would expect (It goes on by default in 0.9.10 - we'll start documenting more about it soon). But wait, there's more! I haven't even told you about the big features yet - -The first big feature is enhancing the nuspec. I mentioned this I know, but *now* you can use `packageSourceUrl` in the nuspec to tell folks where you are storing the source for the package! We also added `projectSourceUrl`, `docsUrl`, `mailingListUrl`, and `bugTrackerUrl`. What's even better is that the community feed has already been enhanced to look for these values. So have the templates from `choco new`. And it's backwards compatible, meaning you can still install packages that have these added nuspec enhancements without issue (but we will need to provide a fix for Nuget Package Explorer). - -The second is Xml Document Transformations (XDT), which I think many folks are aware of but may not realize what it can provide. [NuGet has allowed transformations for quite awhile](https://docs.nuget.org/Create/Configuration-File-and-Source-Code-Transformations) to allow you to make changes to an `app.config`/`web.config` on install/uninstall. We are following in similar footsteps to allow you to do similar when installing/upgrading packages. We will look for `*.install.xdt` files in the package (doesn't matter where) and they will apply to configuration files with the same name in the package. This means that during upgrades we won't overwrite configuration files during upgrades that have opted into this feature. It allows you to give users a better experience during upgrades because they won't need to keep making the same changes to the xml config files each time they upgrade your package. - -### FEATURES - * Allow XDT Configuration Transforms - see [#331](https://github.com/chocolatey/choco/issues/331) - * Prevent reboots - see [#316](https://github.com/chocolatey/choco/issues/316) - * Enhance the nuspec - first wave - see [#205](https://github.com/chocolatey/choco/issues/205) - * Uninstaller Service Enhancements - see [#305](https://github.com/chocolatey/choco/issues/305) - -### BUG FIXES - * When uninstall fails, do not continue removing files - see [#315](https://github.com/chocolatey/choco/issues/315) - * Do not run autouninstaller if the package result is already a failure - see [#323](https://github.com/chocolatey/choco/issues/323) - * Fix - Auto Uninstaller can fail if chocolateyUninstall.ps1 uninstalls prior to it running - see [#304](https://github.com/chocolatey/choco/issues/304) - * Fix - Packages with content folders cannot have a dependency without also having a content folder - see [#290](https://github.com/chocolatey/choco/issues/290) - * Remove ShimGen director files on upgrade/uninstall - see [#326](https://github.com/chocolatey/choco/issues/326) - * If feature doesn't exist, throw an error - see [#317](https://github.com/chocolatey/choco/issues/317) - * Fix - The operation completed successfully on stderr - see [#249](https://github.com/chocolatey/choco/issues/249) - * Fix - When specific nuget version is needed by a package it is the chocolatey version that is used - see [#194](https://github.com/chocolatey/choco/issues/194) - * When installing with *.nupkg, need to get package name from package, not file name - see [#90](https://github.com/chocolatey/choco/issues/90) - * Fix - Choco pin list is not returning a list - see [#302](https://github.com/chocolatey/choco/issues/302) - * Fix - A pin is not created for existing installations (prior to new choco) - see [#60](https://github.com/chocolatey/choco/issues/60) - -### IMPROVEMENTS - * Allow upgrade to always install missing packages - see [#300](https://github.com/chocolatey/choco/issues/300) - * Enhance Templates - see [#296](https://github.com/chocolatey/choco/issues/296) - * Always log debug output to the log file - see [#319](https://github.com/chocolatey/choco/issues/319) - * Warn when unable to snapshot locked files - see [#313](https://github.com/chocolatey/choco/issues/313) - * Use %systemroot% in place of %windir%. PATH exceed 2048 breaks choco - see [#252](https://github.com/chocolatey/choco/issues/252) - * Add fault tolerance to registry snapshot checks - see [#337](https://github.com/chocolatey/choco/issues/337) - - -## [0.9.9.6](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.6+is%3Aclosed) (May 16, 2015) - -Some really large fixes this release, especially removing all files that are installed to the package directory if they haven't changed, including ensuring that the nupkg file is always removed on successful uninstalls. The really big add some folks are going to like is the new outdated command. Some more variables that were misused have been brought back, which allows some packages (like Atom) to be installed again without issue. If you can believe some people never read these, we decided to add a note to the installer prompt to let people know about -y. - -### FEATURES - * Outdated Command - Use `choco outdated` to see outdated packages - see [#170](https://github.com/chocolatey/choco/issues/170) - -### BUG FIXES - * Fix - NotSilent Switch Not Working - see [#281](https://github.com/chocolatey/choco/issues/281) - * Fix - Silent installation of choco without admin is not possible - see [#274](https://github.com/chocolatey/choco/issues/274) - * Fix - Package resolves to latest version from any source - see [#279](https://github.com/chocolatey/choco/issues/279) - * Fix - Install fails when shortcut creation fails - see [#264](https://github.com/chocolatey/choco/issues/264) - * Fix - Error deserializing response of type Registry - see [#257](https://github.com/chocolatey/choco/issues/257) - * Fix - Auto uninstaller should not depend on optional InstallLocation value - see [#255](https://github.com/chocolatey/choco/issues/255) - * Fix - Nupkg is left but reported as successfully uninstalled by NuGet - see [#254](https://github.com/chocolatey/choco/issues/254) - * Fix - SHA1 checksum compared as MD5 for Install-ChocolateyZipPackage - see [#253](https://github.com/chocolatey/choco/issues/253) - * Fix - Auto uninstaller strips off "/" and "-" in arguments - see [#212](https://github.com/chocolatey/choco/issues/212) - -### IMPROVEMENTS - * Uninstall removes all installed files if unchanged - see [#121](https://github.com/chocolatey/choco/issues/121) - * Auto uninstaller should convert /I to /X for Msi Uninstalls - see [#271](https://github.com/chocolatey/choco/issues/271) - * Bring back more variables for feature parity - see [#267](https://github.com/chocolatey/choco/issues/267) - * Mention -y in the prompt - see [#265](https://github.com/chocolatey/choco/issues/265) - - -## [0.9.9.5](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.5+is%3Aclosed) (April 20, 2015) -### BREAKING CHANGES - * Renamed short option `p` to `i` for list --include-programs so that `p` could be ubiquitous for password across commands that optionally can pass a password - see [#240](https://github.com/chocolatey/choco/issues/240) - -### BUG FIXES - * Fix - Secure Sources Not Working - see [#240](https://github.com/chocolatey/choco/issues/240) - * Fix - Generate-BinFile / Remove-BinFile - see [#230](https://github.com/chocolatey/choco/issues/230) - * Fix - cpack should only include files from nuspec - see [#232](https://github.com/chocolatey/choco/issues/232) - * Fix - cpack should leave nupkg in current directory - see [#231](https://github.com/chocolatey/choco/issues/231) - * Fix - Install-PowerShellCommand uses incorrect path - see [#241](https://github.com/chocolatey/choco/issues/241) - * Fix - choco list source with redirects does not resolve - see [#171](https://github.com/chocolatey/choco/issues/171) - * Fix - choco tried to resolve disabled repo - see [#169](https://github.com/chocolatey/choco/issues/169) - * Fix - cpack nuspec results in "The path is not of a legal form" - see [#164](https://github.com/chocolatey/choco/issues/164) - * Fix - cpack hangs on security related issue - see [#160](https://github.com/chocolatey/choco/issues/160) - * Fix - spelling error in "package has been upgradeed successfully" - see [#64](https://github.com/chocolatey/choco/issues/64) - -### IMPROVEMENTS - * Api Key and Source matching could be more intuitive - see [#228](https://github.com/chocolatey/choco/issues/238) - * Remove warning about allowGlobalConfirmation being enabled - see [#237](https://github.com/chocolatey/choco/issues/237) - * Include log file path when saying 'See the log for details' - see [#187](https://github.com/chocolatey/choco/issues/187) - * Uninstall prompts for version when there is only one installed - see [#186](https://github.com/chocolatey/choco/issues/186) - * Do not offer a default option when prompting for a user choice - see [#185](https://github.com/chocolatey/choco/issues/185) - * Remove the warning note about skipping, and instead show the warning when selecting skip - see [#183](https://github.com/chocolatey/choco/issues/183) - * Do not print PowerShell install/update scripts by default - see [#182](https://github.com/chocolatey/choco/issues/182) - - -## [0.9.9.4](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.4+is%3Aclosed) (March 30, 2015) -### BUG FIXES - * Fix - The term 'false' is not recognized as the name of a cmdlet - see [#215](https://github.com/chocolatey/choco/issues/215) - -### IMPROVEMENTS - * Some packages use non-API variables like $installArguments - see [#207](https://github.com/chocolatey/choco/issues/207) - - -## [0.9.9.3](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.3+is%3Aclosed) (March 29, 2015) -### BUG FIXES - * Fix - Install .NET Framework immediately during install - see [#168](https://github.com/chocolatey/choco/issues/168) - * Fix - Do not error on Set-Acl during install/upgrade - see [#163](https://github.com/chocolatey/choco/issues/163) - * Fix - Do not escape curly braces in powershell script - see [#208](https://github.com/chocolatey/choco/issues/208) - * Fix - Formatting issues on --noop command logging - see [#202](https://github.com/chocolatey/choco/issues/202) - * Fix - Uninstaller check doesn't find 32-bit registry keys - see [#197](https://github.com/chocolatey/choco/issues/197) - * Fix - Uninstaller errors on short path to msiexec - see [#211](https://github.com/chocolatey/choco/issues/211) - -### IMPROVEMENTS - * Some packages use non-API variables like $installArguments - see [#207](https://github.com/chocolatey/choco/issues/207) - * Add Generate-BinFile to Helpers (widely used but never part of API) - see [#145](https://github.com/chocolatey/choco/issues/145) - * Add Remove-BinFile to Helpers - see [#195](https://github.com/chocolatey/choco/issues/195) - * Get-ChocolateyWebFile should create path if it doesn't exist - see [#167](https://github.com/chocolatey/choco/issues/167) - - -## [0.9.9.2](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.2+is%3Aclosed) (March 6, 2015) -### BUG FIXES - * Fix - Allow passing install arguments again (regression in 0.9.9 series) - see [#150](https://github.com/chocolatey/choco/issues/150) - * Fix - Allow apostrophes to be used as quotes - quoting style that worked with previous client - see [#141](https://github.com/chocolatey/choco/issues/141) - * Fix - Shims write errors to stderr - see [#142](https://github.com/chocolatey/choco/issues/142) and [ShimGen #14](https://github.com/chocolatey/shimgen/issues/14) - -### IMPROVEMENTS - * Upgrade `-r` should always return a value - see [#153](https://github.com/chocolatey/choco/issues/153) - - -## [0.9.9.1](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9.1+is%3Aclosed) (March 3, 2015) -### BUG FIXES - * Fix - Get-BinRoot broken - see [#144](https://github.com/chocolatey/choco/issues/144) - - -## [0.9.9](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.9+is%3Aclosed) (March 3, 2015) - -This also includes issues that were being tracked in the old Chocolatey repository: [Chocolatey 0.9.9](https://github.com/chocolatey/chocolatey/issues?q=is%3Aclosed+label%3Av0.9.9). - -The two links above will not capture everything that has changed, since this is a complete rewrite. We broke everything. If this were a v1+, it would be a major release. But we are less than v1, so 0.9.9 it is! ;) - -Okay, so we didn't really break everything. We have maintained nearly full compatibility with how you pass options into choco, although the output may be a bit different (but better, we hope) and in at least one case, additional switches (or a feature setting) is/are required - we limited this to security related changes only. - -We also fixed and improved a bunch of things, so we feel the trade off is well worth the changes. - -We'll try to capture everything here that you should know about. Please call `choco -?` or `choco.exe -h` to get started. - -### KNOWN ISSUES - * [Known Issues](https://github.com/chocolatey/choco/labels/Bug) - * TEMPORARY `install all` is missing - this is expected to be back in 0.9.10 - see [#23](https://github.com/chocolatey/choco/issues/23) - * Alternative sources (`webpi`,`ruby`,`python`,`cygwin`, `windowsfeature`) do not work yet. This is expected to be fixed in 0.9.10 - see [#14](https://github.com/chocolatey/choco/issues/14) - * Progress bar is missing when downloading until we are using internal posh components for Packages - see [#56](https://github.com/chocolatey/choco/issues/56) - * See [Feature Parity](https://github.com/chocolatey/choco/labels/FeatureParity) for items not yet reimplemented from older PowerShell Chocolatey client (v0.9.8.32 and below). - -### BREAKING CHANGES - * [Security] **Prompt for confirmation**: For security reasons, we now stop for confirmation before changing the state of the system on most commands. You can pass `-y` to confirm any prompts or set a value in the config that will globally confirm - see [#52](https://github.com/chocolatey/choco/issues/52) (**NOTE**: This is one of those additional switches we were talking about) - * [Security] If your default installation is still at `c:\Chocolatey`, this version will force a move to ProgramData and update the environment settings - see [#7](https://github.com/chocolatey/choco/issues/7) - * **Configuration Breaking Changes:** - 1. You now have one config file to interact with in %ChocolateyInstall%\config - your user config is no longer valid and can be removed once you migrate settings to the config. - 2. The config will no longer be overwritten on upgrade. - 3. Choco no longer interacts with NuGet's config file at all. You will need to reset all of your apiKeys (see features for `apikey`). On the plus side, the keys will work for all users of the machine, unlike NuGet's apiKeys (only work for the user that sets them). - 4. This also means you can no longer use `useNugetForSources`. It has been removed as a config setting. - * **Packaging Changes:** - 1. Choco now installs packages without version numbers on folders. This means quite a few things... - 2. Upgrading packages doesn't install a new version next to an old version, it actually upgrades. - 3. Dependencies resolve at highest available version, not the minimum version as before - see [Chocolatey #415](https://github.com/chocolatey/chocolatey/issues/415) - * **Package Maintenance Changes**: - 1. Read the above about apikey changes - 2. Read above about dependency resolution changes. - * **Deprecated/Removed Commands:** - 1. `installmissing` and 'cinstm' have been removed. They were deprecated awhile ago, so this should not be a surprise. For equivalent functionality see the plain install/cinst commands. - 2. `choco version` has been deprecated and will be removed in v1. Use `choco upgrade pkgName --noop` or `choco upgrade pkgName -whatif` instead. - 3. `Write-ChocolateySuccess`, `Write-ChocolateyFailure` have been deprecated. - 4. `update` is now `upgrade`. `update` has been deprecated and will be removed/replaced in v1. Update will be reincarnated later for a different purpose. **Hint**: It rhymes with smackage pindexes. - -### FEATURES - * In app documentation! Use `choco -?`, `choco -h` or `choco commandName -?` to learn about each command, complete with examples! - * WhatIf/Noop mode for all commands (`--noop` can also be specified as `-whatif`) - see [Chocolatey #263](https://github.com/chocolatey/chocolatey/issues/263) and [Default Options and Switches](https://docs.chocolatey.org/en-us/choco/commands#how-to-pass-options-switches) - * Performs like a package manager, expect to see queries failing because of unmet dependency issues. - * **New Commands:** - 1. `pin` - Suppress upgrades. This allows you to 'pin' an install to a particular version - see [#1](https://github.com/chocolatey/choco/issues/1), [Chocolatey #5](https://github.com/chocolatey/chocolatey/issues/5) and [Pin Command](https://docs.chocolatey.org/en-us/choco/commands/pin) - 2. `apikey` - see [ApiKey Command](https://docs.chocolatey.org/en-us/create/commands/api-key) - 3. `new` - see [New Command](https://docs.chocolatey.org/en-us/create/commands/new) and [Chocolatey #157](https://github.com/chocolatey/chocolatey/issues/157) - * New ways to pass arguments! See [How to Pass Options/Switches](https://docs.chocolatey.org/en-us/choco/commands#how-to-pass-options-switches) - * Did we mention there is a help menu that is actually helpful now? Shiny! - * AutoUninstaller!!!! But it is not enabled by default this version. See [#15](https://github.com/chocolatey/choco/issues/15), [#9](https://github.com/chocolatey/choco/issues/9) and [Chocolatey #6](https://github.com/chocolatey/chocolatey/issues/6) - * **New Helpers:** - 1. `Install-ChocolateyShortcut` - see [Chocolatey #238](https://github.com/chocolatey/chocolatey/pull/238), [Chocolatey #235](https://github.com/chocolatey/chocolatey/issues/235) and [Chocolatey #218](https://github.com/chocolatey/chocolatey/issues/218) - -### BUG FIXES -Probably a lot of bug fixes that may not make it here, but here are the ones we know about. - - * Fix - Cannot upgrade from prerelease to same version released - see [Chocolatey #122](https://github.com/chocolatey/chocolatey/issues/122) - * Fix - install `--force` should not use cache - see [Chocolatey #199](https://github.com/chocolatey/chocolatey/issues/199) - * Fix - force dependencies as well - see [--force-dependencies](https://docs.chocolatey.org/en-us/choco/commands/install) and [Chocolatey #199](https://github.com/chocolatey/chocolatey/issues/199) - * Fix - Chocolatey should not stop on error - see [Chocolatey #192](https://github.com/chocolatey/chocolatey/issues/192) - * Fix - Upgrading does not remove previous version - see [Chocolatey #259](https://github.com/chocolatey/chocolatey/issues/259) - * Fix - Non-elevated shell message spills errors - see [Chocolatey #540](https://github.com/chocolatey/chocolatey/issues/540) - * Fix - Package names are case sensitive for some sources - see [Chocolatey #589](https://github.com/chocolatey/chocolatey/issues/589) - * Fix - Install-ChocolateyVsixPackage doesn't check for correct VS 2012 path - see [Chocolatey #601](https://github.com/chocolatey/chocolatey/issues/601) - * Fix - Chocolatey behaves strangely after ctrl+c - see [Chocolatey #608](https://github.com/chocolatey/chocolatey/issues/608) - * Fix - Uninstall doesn't respect version setting - see [Chocolatey #612](https://github.com/chocolatey/chocolatey/issues/612) - * Fix - No update after download error - see [Chocolatey #637](https://github.com/chocolatey/chocolatey/issues/637) - * Fix - cup ends silently on error - see [Chocolatey #312](https://github.com/chocolatey/chocolatey/issues/312) - * Fix - cpack silently fails when dependency .NET 4.0+ is not met - see [Chocolatey #270](https://github.com/chocolatey/chocolatey/issues/270) - * Fix - Regression in cver all in 0.9.8.27 - see [Chocolatey #530](https://github.com/chocolatey/chocolatey/issues/530) - * Fix - Certain installs and updates fail with a "process with an Id of xxxx is not running" error - see [Chocolatey #603](https://github.com/chocolatey/chocolatey/issues/603) - -### IMPROVEMENTS - * [Security] Allow keeping `c:\chocolatey` install directory with environment variable - see [#17](https://github.com/chocolatey/choco/issues/17) - * [Security] Require switch on unofficial build - see [#36](https://github.com/chocolatey/choco/issues/36) - * Install script updates - see [#7](https://github.com/chocolatey/choco/issues/7) - * Ensure Chocolatey pkg is installed properly in lib folder - This means you can take a dependency on a minimum version of Chocolatey (we didn't like that before) - see [#19](https://github.com/chocolatey/choco/issues/19) - * Uninstall - allow abort - see [#43](https://github.com/chocolatey/choco/issues/43) - * Support for HTTPS basic authorization - see [Chocolatey #128](https://github.com/chocolatey/chocolatey/issues/128) - * Smooth out success/failure logging - see [Chocolatey #154](https://github.com/chocolatey/chocolatey/issues/154) - * Add $env:CHOCOLATEY_VERSION - see [Chocolatey #251](https://github.com/chocolatey/chocolatey/issues/251) - * Replace ascii cue with visual cues - see [Chocolatey #376](https://github.com/chocolatey/chocolatey/pull/376) - * Uninstall all versions of an app - see [Chocolatey #389](https://github.com/chocolatey/chocolatey/issues/389) - * Add parameters in packages.config files - see [Packages.config](https://docs.chocolatey.org/en-us/choco/commands/install#packages.config), [Chocolatey #472](https://github.com/chocolatey/chocolatey/issues/472), and [#10](https://github.com/chocolatey/choco/issues/10) - * Choco pack should support `-version` - see [Chocolatey #526](https://github.com/chocolatey/chocolatey/issues/526) - * Enhancements to Start-ChocolateyProcessAsAdmin - see [Chocolatey #564](https://github.com/chocolatey/chocolatey/pull/564) - * Install-ChocolateyFileAssociation - add label to new file types - see [Chocolatey #564](https://github.com/chocolatey/chocolatey/pull/564) - * Clean up the verobsity of Chocolatey - see [Chocolatey #374](https://github.com/chocolatey/chocolatey/issues/374) - * Compact choco upgrade --noop option - see [Chocolatey #414](https://github.com/chocolatey/chocolatey/issues/414) - * Remove references to the Chocolatey gods - see [Chocolatey #669](https://github.com/chocolatey/chocolatey/issues/669) - * Shims now have noop (`--shimgen-noop`) and help (`--shimgen-help`) switches - see [ShimGen #8](https://github.com/chocolatey/shimgen/issues/8) and [ShimGen #10](https://github.com/chocolatey/shimgen/issues/10) - * Shims will terminate underlying process on termination signal - see [ShimGen #11](https://github.com/chocolatey/shimgen/issues/11) - * Shims now have gui (`--shimgen-gui`) and exit (`--shimgen-exit`) switches - see [ShimGen #13](https://github.com/chocolatey/shimgen/issues/13) and [ShimGen #12](https://github.com/chocolatey/shimgen/issues/12) - * Dat help menu tho. I mean srsly guise - see [Chocolatey #641](https://github.com/chocolatey/chocolatey/issues/641) - - -## [0.9.8.33](https://github.com/chocolatey/chocolatey/issues?q=label%3Av0.9.8.33+is%3Aclosed) (Feb 11, 2015) -### FEATURES - * Dynamically export helpers (this fixes helpers that were not visible before) - [#628](https://github.com/chocolatey/chocolatey/pull/628) - -### IMPROVEMENTS - * Accept `-y` as a parameter, Add warning about -y for 0.9.9. - * Company name misspelled in shims - [#673](https://github.com/chocolatey/chocolatey/issues/673) and [shimgen #9](https://github.com/chocolatey/shimgen/issues/9) - - -## [0.9.8.32](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.32&page=1&state=closed) (January 22, 2015) -### BUG FIXES - * Fix - Chocolatey-Install should return non-zero exit code if chocolateyInstall.ps1 fails - [#568](https://github.com/chocolatey/chocolatey/issues/568) & [#658](https://github.com/chocolatey/chocolatey/pull/658) - - -## [0.9.8.31](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.31&page=1&state=closed) (January 7, 2015) -### BUG FIXES - * Fix - Shim doesn't always shift off the first argument - [#655](https://github.com/chocolatey/chocolatey/issues/655) & [ShimGen #7](https://github.com/chocolatey/shimgen/issues/7) - * Fix - If executable isn't available, fallback to default icon - [#579](https://github.com/chocolatey/chocolatey/issues/579) - - -## [0.9.8.30](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.30&page=1&state=closed) (January 6, 2015) -### FEATURES - * Use icon of the executable with generated shim - [#579](https://github.com/chocolatey/chocolatey/issues/579) & [ShimGen #2](https://github.com/chocolatey/shimgen/issues/2) - -### BUG FIXES - * Fix - Shims don't correctly handle spaces in path to shim - [#654](https://github.com/chocolatey/chocolatey/issues/654) & [ShimGen #5](https://github.com/chocolatey/shimgen/issues/5) - - -## [0.9.8.29](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.29&page=1&state=closed) (January 2, 2015) -### FEATURES - * Use icon of the executable with generated shim - [#579](https://github.com/chocolatey/chocolatey/issues/579) & [ShimGen #2](https://github.com/chocolatey/shimgen/issues/2) - * Allow setting custom temp download location - [#307](https://github.com/chocolatey/chocolatey/issues/307) - -### IMPROVEMENTS - * Don't assume $env:TEMP or $env:UserProfile are set - [#647](https://github.com/chocolatey/chocolatey/issues/647) - * Remove Kickstarter message. - - -## [0.9.8.28](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.28&page=1&state=closed) (November 4, 2014) -### BREAKING CHANGES - * You may need to update your saved API key for chocolatey, due to [#599](https://github.com/chocolatey/chocolatey/issues/599) we have switched push to ensure https. - -### BUG FIXES - * Fix - Shim argument parsing needs fixed for quoting - [ShimGen #1](https://github.com/chocolatey/shimgen/issues/1) - * Fix - Forcing x86 does not use 32bit checksum - [#535](https://github.com/chocolatey/chocolatey/issues/535) - * Fix - Powershell v2 fails to download SSLv3 files - [#531](https://github.com/chocolatey/chocolatey/issues/531) - * Fix - Get-ChocolateyUnzip fails due to Wait-Process exception - [#571](https://github.com/chocolatey/chocolatey/issues/571) - -### IMPROVEMENTS - * Use default credentials for internet if available - [#577](https://github.com/chocolatey/chocolatey/issues/577) - * Add moderation message on push - [#600](https://github.com/chocolatey/chocolatey/issues/600) - * Restrict all calls to chocolatey.org to HTTPS - [#599](https://github.com/chocolatey/chocolatey/issues/599) - * Batch fallback should quote path for spaces - [#558](https://github.com/chocolatey/chocolatey/issues/558) - -## [0.9.8.27](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.27&page=1&state=closed) (July 13, 2014) -### BUG FIXES - * Fix - Posh v3+ Ignores -Wait when run from cmd.exe - [#516](https://github.com/chocolatey/chocolatey/pull/516) - - -## [0.9.8.26](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.26&page=1&state=closed) (July 12, 2014) -### BUG FIXES - * Fix - Allow spaces in arguments to chocolatey again - Regenerate chocolatey included shims to take advantage of shimgen fixes - [#507](https://github.com/chocolatey/chocolatey/issues/507) - * Fix - Default path has changed, causing running without closing shell to have issues again - [#510](https://github.com/chocolatey/chocolatey/issues/510) - * Fix - Working directory of shimgen generated files points to path target executable is in (GUI apps only) - [#508](https://github.com/chocolatey/chocolatey/issues/508) - * Fix - cpack/cpush returns zero exit code even when error occurs - [#256](https://github.com/chocolatey/chocolatey/issues/256) & [#384](https://github.com/chocolatey/chocolatey/issues/384) - * Fix - Install error throws another error due to true instead of $true - [#514](https://github.com/chocolatey/chocolatey/pull/514) - * Fix - Posh v3+ Ignores -Wait when run from cmd.exe - [#516](https://github.com/chocolatey/chocolatey/pull/516) - -### IMPROVEMENTS - * Allow to pass shimgen specific parameters - [#509](https://github.com/chocolatey/chocolatey/issues/509) - * Issue warning if user is not running an elevated shell - [#519](https://github.com/chocolatey/chocolatey/issues/519) - - -## [0.9.8.25](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.25&page=1&state=closed) (July 7, 2014) -### BUG FIXES - * Fix - Shims that require admin may fail on UAC enforced machines (System.ComponentModel.Win32Exception: The requested operation requires elevation) - [#505](https://github.com/chocolatey/chocolatey/issues/505) - * Fix - Do not check content-length if there isn't a content-length returned from Get-WebHeaders - [#504](https://github.com/chocolatey/chocolatey/issues/504) - - -## [0.9.8.24](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.24&page=1&state=closed) (July 3, 2014) -### BREAKING CHANGES - * Enhancement - Default install to C:\ProgramData\chocolatey - [#452](https://github.com/chocolatey/chocolatey/issues/452) & [#494](https://github.com/chocolatey/chocolatey/issues/494) - * Don't allow $binroot to be set to c:\ - [#434](https://github.com/chocolatey/chocolatey/issues/434) - this is meant to be temporary while other pieces are fixed. - -### FEATURES - * Checksum downloaded files - [#427](https://github.com/chocolatey/chocolatey/issues/427) - * Replace Batch Redirector with Shims - [#372](https://github.com/chocolatey/chocolatey/issues/372) - * New Helper - Get-UACEnabled - [#451](https://github.com/chocolatey/chocolatey/issues/451) - * Enhancement - Install to Machine environment variable - [#453](https://github.com/chocolatey/chocolatey/issues/453) - * Enhancement - Install the .NET framework 4.0 requirement - [#255](https://github.com/chocolatey/chocolatey/issues/255) - * Update environment using command (RefreshEnv) - [#134](https://github.com/chocolatey/chocolatey/issues/134) - * `-quiet` parameter that silences almost all output / allow shutting off real write-host - [#416](https://github.com/chocolatey/chocolatey/pull/416) & [#411](https://github.com/chocolatey/chocolatey/issues/411) - * New Helpers - Test-ProcessAdminRights, Get-EnvironmentVariableNames, Get-EnvironmentVariable, Set-EnvironmentVariable - [#486](https://github.com/chocolatey/chocolatey/pull/486) - -### BUG FIXES - * Fix - Cannot bind argument to parameter 'Path' because it is an empty string - [#371](https://github.com/chocolatey/chocolatey/issues/371) - * Fix - clist -source webpi doesn't prompt for admin access - [#293](https://github.com/chocolatey/chocolatey/issues/293) - * Fix - Get-ChocolateyUnzip silently fails due to incorrect usage of System32 (File System Redirector Issues) - [#476](https://github.com/chocolatey/chocolatey/pull/476) & [#455](https://github.com/chocolatey/chocolatey/issues/455) - * Fix - 7za.exe is subject to UAC file virtualization - [#454](https://github.com/chocolatey/chocolatey/issues/454) - * Fix - "You cannot call a method on a null-valued expression" introduced somewhere. - [#430](https://github.com/chocolatey/chocolatey/issues/430) - * Fix - Get-BinRoot defaulted to "C:\" instead of "C:\tools" - [#421](https://github.com/chocolatey/chocolatey/pull/421) - * Fix - Get-ProcessorBits doesn't return the bitness of the OperatingSystem - [#396](https://github.com/chocolatey/chocolatey/pull/396) - * Fix - Fix Invoke for Install All from a Feed (DEPRECATED by #446 - in improvements below) - [#381](https://github.com/chocolatey/chocolatey/issues/381) - * Fix - Upgrade to 0.9.8.24 produces cannot find Update-SessionEnvironment when using cmd.exe - [#459](https://github.com/chocolatey/chocolatey/issues/459) - * Fix - Package depending on newer chocolatey version is installed using existing version of chocolatey - [#460](https://github.com/chocolatey/chocolatey/issues/460) - * Fix - Bash improvements - [#383](https://github.com/chocolatey/chocolatey/pull/383) - * Fix - Resolve issue with DISM "missing" or with the 32-bit DISM being called on a 64-bit system - [#393](https://github.com/chocolatey/chocolatey/pull/393) - * Fix - Do NOT throw if missing a chocolateyuninstall.ps1 - [#499](https://github.com/chocolatey/chocolatey/issues/499) - -### IMPROVEMENTS - * Do not download if file already cached - [#428](https://github.com/chocolatey/chocolatey/issues/428) & [#109](https://github.com/chocolatey/chocolatey/pull/109) - * If *.ignore file failes to create, do not fail the process - [#380](https://github.com/chocolatey/chocolatey/issues/380) - * Validate downloaded file is the right size - [#429](https://github.com/chocolatey/chocolatey/issues/429) - * Add perf to Chocolatey-List & allow to return as object - [#426](https://github.com/chocolatey/chocolatey/issues/426) - * Chocolatey-List LocalOnly performance improvements - [#425](https://github.com/chocolatey/chocolatey/pull/425) - * Chocolatey-Version Improvements - [#445](https://github.com/chocolatey/chocolatey/issues/445) - * Remove Invoke-Chocolatey Function to improve handling - [#446](https://github.com/chocolatey/chocolatey/issues/446) - * Don't create a window during Run-Nuget.ps1 - [#450](https://github.com/chocolatey/chocolatey/pull/450) - * Generate _env.cmd file instead of bat file for consistency - [#469](https://github.com/chocolatey/chocolatey/pull/469) - * Remove-BinFile removes shim.exes when installing a package - [#449](https://github.com/chocolatey/chocolatey/pull/449) - * Remove annoying "Reading environment variables from registry. Please wait..." - [#440](https://github.com/chocolatey/chocolatey/pull/440) - * Replace ascii cue to visual cue for "installing package" - [#376](https://github.com/chocolatey/chocolatey/pull/376) - * Clean up the verbosity of chocolatey - [#374](https://github.com/chocolatey/chocolatey/issues/374) - * Improve chocolatey setup as administrator - [#486](https://github.com/chocolatey/chocolatey/pull/486) - * Simplify Chocolatey-Update - [#493](https://github.com/chocolatey/chocolatey/issues/493) - * Update to Nuget.exe 2.8.2 - [#379](https://github.com/chocolatey/chocolatey/issues/379) - - -## [0.9.8.23](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.23&page=1&state=closed) (November 11, 2013) -### BUG FIXES - * Fix - Chocolatey 0.9.8.22 incorrectly reports version as alpha1 [#368](https://github.com/chocolatey/chocolatey/issues/368) - * Fix - Some chocolatey commands with no arguments error [#369](https://github.com/chocolatey/chocolatey/issues/369) - - -## [0.9.8.22](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.22&page=1&state=closed) (November 10, 2013) -### BREAKING CHANGES - * To use spaces and quotes, one should now use single quotation marks. It works best in both powershell and cmd. - -### FEATURES - * Enhancement - Add switch to force x86 when packages have both versions - [#365](https://github.com/chocolatey/chocolatey/issues/365) - * Enhancement - Allow passing parameters to packages - [#159](https://github.com/chocolatey/chocolatey/issues/159) - -### BUG FIXES - * Fix - Chocolatey 0.9.8.21 errors when using spaces or quotes with chocolatey or with batch redirect files. - [#367](https://github.com/chocolatey/chocolatey/issues/367) - - -## [0.9.8.21](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.21&page=1&state=closed) (November 7, 2013) -### BREAKING CHANGES - * Enhancement - For local package searching, use choco list -lo or choco search -lo. The execution speed is greatly increased. cver for local has been deprecated. - [#276](https://github.com/chocolatey/chocolatey/issues/276) - * Breaking - Chocolatey default source no longer includes Nuget official feed. This will help improve response time and greatly increase relevant results. - [#349](https://github.com/chocolatey/chocolatey/issues/349) - -### FEATURES - * Enhancement - Support for Server Core - [#59](https://github.com/chocolatey/chocolatey/issues/59) - * Enhancement - Add a switch for ignoring dependencies on install `-ignoredependencies` - [#131](https://github.com/chocolatey/chocolatey/issues/131) - * Command - `choco` is now a default term - * Command - search is now a command (aliases list) - `choco search something [-localonly]` - * Function - `Get-ProcessorBits` - tells you whether a processor is x86 or x64. This functionality was in chocolatey already but has been globalized for easy access. - [#231](https://github.com/chocolatey/chocolatey/issues/231) & [#229](https://github.com/chocolatey/chocolatey/issues/229) - * Function - `Get-BinRoot` - Gives package maintainers the ability to call one command that gets them the tools/bin root. This gives you the location where folks want certain packages installed. - [#359](https://github.com/chocolatey/chocolatey/pull/359) - -### IMPROVEMENTS - * Enhancement - Install multiple packages by specifying them all on the same line - [#191](https://github.com/chocolatey/chocolatey/issues/191) - * Enhancement - Install .NET Framework 4.0 requirement if not already installed - [#255](https://github.com/chocolatey/chocolatey/issues/255) - * Enhancement - Refresh command line PATH after installs - partial to [#134](https://github.com/chocolatey/chocolatey/issues/134) - Previously we were just doing it in chocolatey with [#158](https://github.com/chocolatey/chocolatey/issues/158) - * Enhancement - Allow chocolatey to install when zip shell extensions are disabled - [#297](https://github.com/chocolatey/chocolatey/issues/297) - * Enhancement - Support for bash and similar shells - [#347](https://github.com/chocolatey/chocolatey/issues/347) & [#258](https://github.com/chocolatey/chocolatey/issues/258) - * Enhancement - Allow file uri to be used when downloading files - [#322](https://github.com/chocolatey/chocolatey/issues/322) - * Enhancement - Chocolatey version all versions returned for specific local package. - [#260](https://github.com/chocolatey/chocolatey/issues/260) - * Enhancement - Exit codes return appropriately - [#210](https://github.com/chocolatey/chocolatey/issues/210) - * Enhancement - Better logging support - [#208](https://github.com/chocolatey/chocolatey/issues/208) - * Enhancement - Pass through exit codes from binned batch files - https://github.com/chocolatey/chocolatey/issues/360 - * Enhancement - Support MSU file type - https://github.com/chocolatey/chocolatey/pull/348 - -### BUG FIXES - * Fix - Treat installation failures appropriately - [#10](https://github.com/chocolatey/chocolatey/issues/10) - * Fix - Using newer versions of nuget breaks chocolatey - [#303](https://github.com/chocolatey/chocolatey/issues/303) - * Fix - Chocolatey incorrectly reports 64 bit urls when downloading anything - [#331](https://github.com/chocolatey/chocolatey/issues/331) - * Fix - Executing `cuninst` without parameters shouldn't do anything - [#267](https://github.com/chocolatey/chocolatey/issues/267) & [#265](https://github.com/chocolatey/chocolatey/issues/265) - * Fix - VSIX installer helper is finding the wrong Visual Studio version - [#262](https://github.com/chocolatey/chocolatey/issues/262) - * Fix - Renaming logs appending `.old` results in error - [#225](https://github.com/chocolatey/chocolatey/issues/225) - * Fix - Minor typo in uninstall script "uninINstalling" - [#247](https://github.com/chocolatey/chocolatey/issues/247) - * Fix - Bug in Get-ChocolateyUnzip throws issues sometimes [#244](https://github.com/chocolatey/chocolatey/issues/244) & [#242](https://github.com/chocolatey/chocolatey/issues/242) - * Fix - Minor typo "succesfully" - [#241](https://github.com/chocolatey/chocolatey/issues/241) - - -## [0.9.8.20](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.20&page=1&state=closed) (December 11, 2012) -### FEATURES - * Command - Windows Feature feed - [#150](https://github.com/chocolatey/chocolatey/pull/150) - * Function - Add function to install environment variables - [#149](https://github.com/chocolatey/chocolatey/pull/149) - * Function - Function to associate file extensions with installed executables - [#146](https://github.com/chocolatey/chocolatey/pull/146) - * Function - Helper function to create explorer context menu items - [#144](https://github.com/chocolatey/chocolatey/pull/144) - * Function - Helper function for pinning items to task bar - [#143](https://github.com/chocolatey/chocolatey/pull/143) & [#141](https://github.com/chocolatey/chocolatey/pull/141) - * Command - Sources command - [#138](https://github.com/chocolatey/chocolatey/pull/138) - * Command - Provide a way to list all the installed packages - [#125](https://github.com/chocolatey/chocolatey/issues/125) - -### IMPROVEMENTS - * Enhancement - Added FTP support for the chocolatey file downloader. - [#137](https://github.com/chocolatey/chocolatey/pull/137) - * Enhancement - Block installer exe from being "bin"-ed - [#174](https://github.com/chocolatey/chocolatey/issues/174) - * Enhancement - Making the unzip process silent - [#180](https://github.com/chocolatey/chocolatey/pull/180) - * Enhancement - Makes install args more explicit - [#179](https://github.com/chocolatey/chocolatey/pull/179) - * Enhancement - Update Write-Progress every 5000 iterations instead of every iteration - [#177](https://github.com/chocolatey/chocolatey/pull/177) - * Enhancement - Codeplex Support - [#176](https://github.com/chocolatey/chocolatey/issues/176) - * Enhancement - Fix downloads greater than 2GB - [#173](https://github.com/chocolatey/chocolatey/pull/173) - * Enhancement - Add -verbose switch for clist support to see package description - [#166](https://github.com/chocolatey/chocolatey/pull/166) - * Enhancement - Refresh env vars after Install - [#158](https://github.com/chocolatey/chocolatey/pull/158) & [#153](https://github.com/chocolatey/chocolatey/issues/153) - * Enhancement - Add EditorConfig file denoting coding style. - [#123](https://github.com/chocolatey/chocolatey/pull/123) - * Enhancement - Chocolatey-Version Remote Check - [#119](https://github.com/chocolatey/chocolatey/pull/119) - * Enhancement - Write every unzip path/file to a text file - [#114](https://github.com/chocolatey/chocolatey/pull/114) - -### BUG FIXES - * Fix - "Execution of NuGet not detected" error. - [#151](https://github.com/chocolatey/chocolatey/pull/151) - * Fix - chocolatey.bat can't find chocolatey.cmd - [#152](https://github.com/chocolatey/chocolatey/issues/152) - * Fix - `chocolatey version all` prints only the last package's information - [#183](https://github.com/chocolatey/chocolatey/pull/183) - * Fix - Issue with $processor.addresswidth var - [#121](https://github.com/chocolatey/chocolatey/pull/121) - - -## [0.9.8.19](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.19&page=1&state=closed) (July 2, 2012) -### FEATURES - * Enhancement - Allow community extensions - [#115](https://github.com/chocolatey/chocolatey/issues/115) - -### BUG FIXES - * Fix - PowerShell v3 doesn't like foreach loop (prefers ForEach-Object) - [#116](https://github.com/chocolatey/chocolatey/pull/116) - * Fix - Cannot install Python packages on Windows 8 - [#117](https://github.com/chocolatey/chocolatey/issues/117) - - -## [0.9.8.18](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.18&sort=created&direction=desc&state=closed&page=1) (June 16, 2012) -### BUG FIXES - * Fix - 0.9.8.17 installer doesn't create chocolatey folder if it doesn't exist - [#112](https://github.com/chocolatey/chocolatey/issues/112) - - -## [0.9.8.17](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.17&sort=created&direction=desc&state=closed&page=1) (June 15, 2012) -### FEATURES - * Enhancement - Support for naive uninstall - [#96](https://github.com/chocolatey/chocolatey/issues/96) - -### IMPROVEMENTS - * Enhancement - Sources specified through config (or nuget.config) - [#101](https://github.com/chocolatey/chocolatey/pull/101) - * Enhancement - Chocolatey should support multiple sources - [#82](https://github.com/chocolatey/chocolatey/issues/82) - * Enhancement - Use Cygwin as a package source - [#93](https://github.com/chocolatey/chocolatey/pull/93) - * Enhancement - Use Python as a package source (uses easy_install) - [#100](https://github.com/chocolatey/chocolatey/issues/100) - * Enhancement - Use Default Credentials before Get-Credentials when using proxy on web call - [#83](https://github.com/chocolatey/chocolatey/pull/83) - * Enhancement - Reduce the verbosity of running chocolatey - [#84](https://github.com/chocolatey/chocolatey/issues/84) - * Enhancement - Support opening links to "GUI" type applications in a different way than the console apps - [#76](https://github.com/chocolatey/chocolatey/issues/76) - * Enhancement - Do not create batch redirects for certain executables in package folder - [#106](https://github.com/chocolatey/chocolatey/issues/106) - * Enhancement - Add a -debug switch - [#85](https://github.com/chocolatey/chocolatey/issues/85) - * Enhancement - Improve pipelining of cver by returning an object - [#94](https://github.com/chocolatey/chocolatey/pull/94) - -### BUG FIXES - * Fix - Packages.config source now uses chocolatey/nuget sources by default instead of empty - [#79](https://github.com/chocolatey/chocolatey/issues/79) - * Fix - Executable batch links not created for "prerelease" versions - [#88](https://github.com/chocolatey/chocolatey/issues/88) - * Fix - Issue where latest version is not returned - [#92](https://github.com/chocolatey/chocolatey/pull/92) - * Fix - Prerelease versions now broken out as separate versions - [#90](https://github.com/chocolatey/chocolatey/issues/90) - * Fix - During install PowerShell session gets bad $env:ChocolateyInstall variable - [#80](https://github.com/chocolatey/chocolatey/issues/80) - * Fix - Build path with spaces now works - [#102](https://github.com/chocolatey/chocolatey/pull/102) - - -## [0.9.8.16](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.16&sort=created&direction=desc&state=closed&page=1) (February 27, 2012) -### BUG FIXES - * Small fix to installer for upgrade issues from 0.9.8.15 - - -## [0.9.8.15](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.15&sort=created&direction=desc&state=closed&page=1) (February 27, 2012) -### BREAKING CHANGES - * Enhancement - Chocolatey's default folder is now C:\Chocolatey (and no longer C:\NuGet) - [#58](https://github.com/chocolatey/chocolatey/issues/58) - * Enhancement - Use -force to reinstall existing packages - [#45](https://github.com/chocolatey/chocolatey/issues/45) - -### FEATURES - * Enhancement - Install now supports **all** with a custom package source to install every package from a source! - [#46](https://github.com/chocolatey/chocolatey/issues/46) - -### IMPROVEMENTS - * Enhancement - Support Prerelease flag for Install - [#71](https://github.com/chocolatey/chocolatey/issues/71) - * Enhancement - Support Prerelease flag for Update/Version - [#72](https://github.com/chocolatey/chocolatey/issues/72) - * Enhancement - Support Prerelease flag in List - [#74](https://github.com/chocolatey/chocolatey/issues/74) - -### BUG FIXES - * Fix - Parsing the wrong version when trying to update - [#73](https://github.com/chocolatey/chocolatey/issues/73) - - -## [0.9.8.14](https://github.com/chocolatey/chocolatey/issues?labels=v0.9.8.14&sort=created&direction=desc&state=closed&page=1) (February 6, 2012) -### IMPROVEMENTS - * Enhancement - Pass ValidExitCodes to Install Helpers - [#54](https://github.com/chocolatey/chocolatey/issues/54) - * Enhancement - Add 64-bit url to Install-ChocolateyZipPackage - [#48](https://github.com/chocolatey/chocolatey/issues/48) - * Enhancement - Add 64-bit url to Install-ChocolateyPowershellCommand - [#57](https://github.com/chocolatey/chocolatey/issues/57) - * Enhancement - Make the main helpers work with files not coming over HTTP - [#51](https://github.com/chocolatey/chocolatey/issues/51) - * Enhancement - Upgrade NuGet.exe to 1.6.0 to take advantage of prerelease packaging - [#64](https://github.com/chocolatey/chocolatey/issues/64) - -### BUG FIXES - * Fix - The packages.config feature has broken naming packages with '.config' - [#56](https://github.com/chocolatey/chocolatey/issues/56) - * Fix - CList includes all versions without adding the switch - [#60](https://github.com/chocolatey/chocolatey/issues/60) - * Fix - When NuGet.exe failes to run due to .NET Framework 4.0 not installed, chocolatey should report that. - [#65](https://github.com/chocolatey/chocolatey/issues/65) - - -## [0.9.8.13](https://github.com/chocolatey/chocolatey/issues?labels=0.9.8.13&sort=created&direction=desc&state=closed&page=1) (January 8, 2012) -### FEATURES - * New Command! Enhancement - Integration with Ruby Gems (`cgem packageName` or `cinst packageName -source ruby`) - [#29](https://github.com/chocolatey/chocolatey/issues/29) - * New Command! Enhancement - Integration with Web PI (`cwebpi packageName` or `cinst packageName -source webpi`) - [#28](https://github.com/chocolatey/chocolatey/issues/28) - * Enhancement - Call chocolatey install with packages.config file (thanks AnthonyMastrean!) - [#31](https://github.com/chocolatey/chocolatey/issues/31) and [#43](https://github.com/chocolatey/chocolatey/pull/43) and [#50](https://github.com/chocolatey/chocolatey/issues/50) - * New Command! Enhancement - Chocolatey Push (`chocolatey push packageName.nupkg` or `cpush packageName.nupkg`) - [#36](https://github.com/chocolatey/chocolatey/issues/36) - * New Command! Enhancement - Chocolatey Pack (`chocolatey pack [packageName.nuspec]` or `cpack [packageName.nuspec]`) - [#35](https://github.com/chocolatey/chocolatey/issues/35) - -### IMPROVEMENTS - * Enhancement - @datachomp feature - Override Installer Arguments `chocolatey install packageName -installArgs "args to override" -override` or `cinst packageName -ia "args to override" -o`) - [#40](https://github.com/chocolatey/chocolatey/issues/40) - * Enhancement - @datachomp feature - Append Installer Arguments (`chocolatey install packageName -installArgs "args to append"` or `cinst packageName -ia "args to append"`) - [#39](https://github.com/chocolatey/chocolatey/issues/39) - * Enhancement - Run installer in not silent mode (`chocolatey install packageName -notSilent` or `cinst packageName -notSilent`) - [#42](https://github.com/chocolatey/chocolatey/issues/42) - * Enhancement - List available Web PI packages (`clist -source webpi`) - [#37](https://github.com/chocolatey/chocolatey/issues/37) - * Enhancement - List command should allow the All or AllVersions switch - [#38](https://github.com/chocolatey/chocolatey/issues/38) - * Enhancement - Any install will create the ChocolateyInstall environment variable so that installers can take advantage of it - [#30](https://github.com/chocolatey/chocolatey/issues/30) - -### BUG FIXES - * Fixing an issue on proxy display message (Thanks jasonmueller!) - [#44](https://github.com/chocolatey/chocolatey/pull/44) - * Fixing the source path to allow for spaces (where chocolatey is installed) - [#33](https://github.com/chocolatey/chocolatey/issues/33) - * Fixing the culture to InvariantCulture to eliminate the turkish "I" issue - [#22](https://github.com/chocolatey/chocolatey/issues/22) - - -## 0.9.8.12 (November 20, 2011) -### IMPROVEMENTS - * Enhancement - Reducing the number of window pop ups - [#25](https://github.com/chocolatey/chocolatey/issues/25) - -### BUG FIXES - * Fixed an issue with write-host and write-error overrides that happens in the next version of powershell - [#24](https://github.com/chocolatey/chocolatey/pull/24) - * Fixing an issue that happens when powershell is not on the path - [#23](https://github.com/chocolatey/chocolatey/issues/23) - * Fixing the replacement of capital ".EXE" in addition to lowercase ".exe" when creating batch redirects - [#26](https://github.com/chocolatey/chocolatey/issues/26) - - -## 0.9.8.11 (October 4, 2011) -### BUG FIXES - * Fixing an update issue if the package only exists on chocolatey.org - [#16](https://github.com/chocolatey/chocolatey/issues/16) - * Fixing an issue with install missing if the package never existed - [#13](https://github.com/chocolatey/chocolatey/issues/13) - - -## 0.9.8.10 (September 17, 2011) -### FEATURES - * New Helper! Install-ChocolateyPowershellCommand - install a powershell script as a command - [#11](https://github.com/chocolatey/chocolatey/issues/11) - - -## 0.9.8.9 (September 10, 2011) -### BUG FIXES - * Reinstalls an existing package if -version is passed (first surfaced in 0.9.8.7 w/NuGet 1.5) - [#9](https://github.com/chocolatey/chocolatey/issues/9) - - -## 0.9.8.8 (September 10, 2011) -### BUG FIXES - * Fixing version comparison - [#4](https://github.com/chocolatey/chocolatey/issues/4) - * Fixed package selector to not select like named packages (i.e. ruby.devkit when getting information about ruby) - [#3](https://github.com/chocolatey/chocolatey/issues/3) - - -## 0.9.8.7 (September 2, 2011) -### IMPROVEMENTS - * Added proxy support based on [#1](https://github.com/chocolatey/chocolatey/issues/1) - * Updated to work with NuGet 1.5 - [#2](https://github.com/chocolatey/chocolatey/issues/2) - - -## 0.9.8.6 (July 27, 2011) -### BUG FIXES - * Fixed a bug introduced in 0.9.8.5 - Start-ChocolateyProcessAsAdmin erroring out when setting machine path as a result of trying to log the message. - - -## 0.9.8.5 (July 27, 2011) -### IMPROVEMENTS - * Improving Run-ChocolateyProcessAsAdmin to allow for running entire functions as administrator by importing helpers to that command if using PowerShell. - * Updating some of the notes. - -### BUG FIXES - * Fixed bug in installer when User Environment Path is null. - - -## 0.9.8.4 (July 27, 2011) -### BUG FIXES - * Fixed a small issue with the Install-ChocolateyDesktopLink - - -## 0.9.8.3 (July 7, 2011) -### BREAKING CHANGES - * Chocolatey no longer runs the entire powershell script as an administrator. With the addition of the Start-ChocolateyProcessAsAdmin, this is how you will get to administrative tasks outside of the helpers. - -### FEATURES - * New chocolatey command! InstallMissing allows you to install a package only if it is not already installed. Shortcut is 'cinstm'. - * New Helper! Install-ChocolateyPath - give it a path for out of band items that are not imported to path with chocolatey - * New Helper! Start-ChocolateyProcessAsAdmin - this allows you to run processes as administrator - * New Helper! Install-ChocolateyDesktopLink - put shortcuts on the desktop - -### IMPROVEMENTS - * NuGet updated to v1.4 - * Much of the error handling is improved. There are two new Helpers to call (ChocolateySuccess and Write-ChocolateyFailure). - * Chocolatey no longer needs administrative rights to install itself. - - -## 0.9.8.2 (May 21, 2011) -### FEATURES - * You now have the option of a custom installation folder. Thanks Jason Jarrett! - - -## 0.9.8.1 (May 18, 2011) -### BUG FIXES - * General fix to bad character in file. Fixed selection for update as well. - - -## 0.9.8 (May 4, 2011) -### BREAKING CHANGES - * A dependency will not reinstall once it has been installed. To have it reinstall, you can install it directly (or delete it from the repository and run the core package). - -### IMPROVEMENTS - * Shortcuts have been added: 'cup' for 'chocolatey update', 'cver' for 'chocolatey version', and 'clist' for 'chocolatey list'. - * Update only runs if newer version detected. - * Calling update with no arguments will update chocolatey. - * Calling update with all will update your entire chocolatey repository. - - -## 0.9.7.3 (April 30, 2011) -### BUG FIXES - * Fixing Install-ChocolateyZipPackage so that it works again. - - -## 0.9.7.2 (April 29, 2011) -### BUG FIXES - * Fixing an underlying issue with not having silent arguments for exe files. - - -## 0.9.7.1 (April 29, 2011) -### BUG FIXES - * Fixing an introduced bug where the downloader didn't get the file name passed to it. - - -## 0.9.7 (April 29, 2011) -### FEATURES - * New helper added Install-ChocolateyInstallPackage - this was previously part of the download & install and has been broken out. - * New chocolatey command! Version allows you to see if a package you have installed is the most up to date. Leave out package and it will check for chocolatey itself. - -### IMPROVEMENTS - * The powershell module is automatically loaded, so packages no longer need to import the module. This means one line chocolateyInstall.ps1 files! - * Error handling is improved. - * Silent installer override for msi has been removed to allow for additional arguments that need to be passed. - - -## 0.9.6.4 (April 26, 2011) -### IMPROVEMENTS - * Remove powershell execution timeout. - - -## 0.9.6.3 (April 25, 2011) -### FEATURES - * New Helper added Install-ChocolateyZipPackage - this wraps the two upper commands into one smaller command and addresses the file name bug. - - -## 0.9.6.2 (April 25, 2011) -### BUG FIXES - * Addressed a small bug in getting back the file name from the helper. - - -## 0.9.6.1 (April 23, 2011) -### IMPROVEMENTS - * Adding in ability to find a dependency when the version doesn't exist. - - -## 0.9.6 (April 23, 2011) -### IMPROVEMENTS - * Can execute powershell and chocolatey without having to change execution rights to powershell system wide. - -### FEATURES - * New Helper added - Get-ChocolateyWebFile - downloads a file from a url and gives you back the location of the file once complete. - * New Helper added - Get-ChocolateyZipContents - unzips a file to a directory of your choosing. - - -## 0.9.5 (April 21, 2011) -### FEATURES - * Helper for native installer added (Install-ChocolateyPackage). Reduces the amount of powershell necessary to download and install a native package to two lines from over 25. - -### IMPROVEMENTS - * Helper outputs progress during download. - * Dependency runner is complete. - - -## 0.9.4 (April 10, 2011) -### IMPROVEMENTS - * List command has a filter. - * Package license acceptance terms notated. - - -## 0.9.3 (April 4, 2011) -### IMPROVEMENTS - * You can now pass -source and -version to install command. - - -## 0.9.2 (April 4, 2011) -### FEATURES - * List command added. - - -## 0.9.1 (March 30, 2011) -### IMPROVEMENTS - * Shortcut for 'chocolatey install' - 'cinst' now available. +See all - https://docs.chocolatey.org/en-us/choco/release-notes \ No newline at end of file diff --git a/CHANGELOG_LICENSED.md b/CHANGELOG_LICENSED.md index 7354b9c3e4..06ef8ee287 100644 --- a/CHANGELOG_LICENSED.md +++ b/CHANGELOG_LICENSED.md @@ -1,738 +1,3 @@ # Chocolatey Licensed CHANGELOG -This covers changes for the "chocolatey.extension" package, where the licensed editions of Chocolatey get their enhanced functionality. - -**NOTE**: If you have a licensed edition of Chocolatey, refer to this in tandem with [Chocolatey Open source CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG.md). - -## 2.0.0 (March 14, 2019) -### FEATURES - * Chocolatey Central Management tie in - Brings Central Management client configuration to Chocolatey. Requires Chocolatey v0.10.12 along with Chocolatey Agent v0.9.0 to allow communication with Central Maangement. - * [Security] Self-Service - allow uninstalls of ONLY packages installed by a user. Allows restricting what a user can uninstall to only what they have installed - see [licensed #2](https://github.com/chocolatey/chocolatey-licensed-issues/issues/2) - -### BUG FIXES - * Self-Service / Background Mode: - * Fix - Package arguments not being passed from Agent to choco.exe properly (client side fixes) - see [licensed #60](https://github.com/chocolatey/chocolatey-licensed-issues/issues/60) - * Fix - Background Service does not pass the exit code back to the console (client side) - see [licensed #51](https://github.com/chocolatey/chocolatey-licensed-issues/issues/51) - * Package Internalizer (Choco Download): - * Fix - PackageInternalizer - UseOriginalLocation switch being appended inappropriately when line continuation is used with no arguments on first line - see [licensed #64](https://github.com/chocolatey/chocolatey-licensed-issues/issues/64) - * Package Upload UI: - * Fix - Package Uploader is unable to push to a non https source - see [licensed #49](https://github.com/chocolatey/chocolatey-licensed-issues/issues/49) - * Package Builder (Choco New): - * Fix - Nuspec files section should not be commented out as it doesn't allow subdirectories - * Fix - Ensure Architect and MSP are able to use Package Builder - * Fix - Escape XML characters in generated nuspec file - * Windows Service Management Functions: - * Fix - When shutting down a Windows service it may hold a lock on a file for a second after it shuts down - * Fix - Type detection holds file locks if it times out - see [licensed #59](https://github.com/chocolatey/chocolatey-licensed-issues/issues/59) - * Fix - Ensure Architect edition has all features set appropriately - -### IMPROVEMENTS - * Package Builder - Remove "v" as part of "Name v2.2.23" In product names - * Package Upload UI - Ability to auto populate Source dropdown list - see [licensed #50](https://github.com/chocolatey/chocolatey-licensed-issues/issues/50) - * Package Internalizer - Allow downloading all installed packages with `--installed-packages` - * PowerShell - Cmdlets for Getting/Setting encrypted values in JSON files - - -## 1.12.12 (June 12, 2018) -### FEATURES - * Package Upload UI - Ability to right click on a nupkg, and access UI for selecting where package is pushed to - -### BUG FIXES - * Package Synchronizer (Choco Sync): - * Fix - Do not sync out packages that were Chocolatey-managed packages - * Windows Service Management Functions: - * Fix - Adding domain user to Administrators fails with "A member could not be added to or removed from the local group because the member does not exist" - * Fix - Expired Chocolatey License causes error on package installations - * Fix - Incorrectly setting UserAgent property - * Package Internalizer (Choco Download): - * Fix - Append Original Location not capturing params when on last line - * Fix - Output directory option does not remove surrounding quotes - * Fix - Incorrect version number is used to generate dependent packages when `--version` is passed to internalizer - * Package Builder UI: - * Fix - Generate button is not enabled for MSP License - -### IMPROVEMENTS - * Countdown - Allow turning off warnings with a feature - * Self-Service / Background Mode: - * Do not show ChocolateyLocalAdmin user on logon screen - * Ensure captured password at runtime makes it to the background service - * Add Package Internalizer (download) to available commands - - -## 1.12.11 (February 1, 2018) -**NOTE**: We've identified an issue with Self-Service interactive and UAC - we are working on a fix. Please see [#36](https://github.com/chocolatey/chocolatey-licensed-issues/issues/36) and subscribe for details. - -A few nice things going into this release with Package Reducer/Optimize coming out of preview, Package Internalizer allowing you to specify variable overrides - -### BREAKING CHANGES - * Package Reducer is now on by default - -When we first released package reducer, it was in a preview mode to allow for folks to opt in to test it and find issues. Now we are turning it on by default. If you should experience issues with it, please contact support to file an issue (provide a zipped log as well). To turn it off should you not want to use it, you can just run `choco feature disable --name=reduceInstalledPackageSpaceUsage`. - -### BUG FIXES - * Self-Service / Background Mode: - * Fix - Work with empty sessions. Self-service users were incorrectly bypassing background service when their active session doesn't have a name, which has become common with Windows 10. - * Fix - Allow self-service to work when the current working directory is different from system drive or a mapped drive. Also allow it to be set to locations where any user would not have a permissions error. - * Package Internalizer (Choco Download): - * Fix - When a variable is set to the contents of a file, work with that appropriately. A good example of this is `$data` variable in [dotnetcore-runtime](https://github.com/dotnetcore-chocolatey/dotnetcore-chocolateypackages/blob/d5960c11dda388cc7f7ab6438eee8984774f7662/dotnetcore-runtime.install/tools/ChocolateyInstall.ps1#L4) package. - * Fix - Allow setting variable when there is a comment on the same line following the set. An example of this is in the [Firefox](https://github.com/chocolatey/chocolatey-coreteampackages/blob/91f4e51f5c8503ca962c22a2f087b96d22ae0e9f/automatic/firefox/tools/chocolateyInstall.ps1#L26) package. - * Package Builder (Choco New): - * Fix - Package Builder UI should recognize Architect and MSP editions and correctly set the UI for use with them. - * Fix - Extract icon from the proper location for the file. - -### IMPROVEMENTS - * Package Internalizer (Choco Download): - * Override variables in the installation script. When you see something like `$locale` being set and you want to override it to your own value for internalization, you can pass that variable name and value as a key value pair. As an example, try `choco download thunderbird --internalize locale=en-US` versus `choco download thunderbird --internalize locale=es-ES`. - * Package Reducer - `choco optimize` command out of preview. - * Package Builder (Choco New): - * Extract icons from MSIs as well. - * Package Builder UI logo animzation should match chocolatey website. - - -## 1.12.10 (December 18, 2017) -### FEATURES - * Run background service interactively - sometimes you install applications that are unattended but cannot be silent. - -If you want self-service to interactively manage installations, run `choco feature enable --name=useBackgroundServiceInteractively`. This requires that you use the `ChocolateyLocalAdmin` account with the Chocolatey-managed password as passwords are not stored and the service would need to produce that at runtime. There are some security considerations and why this is not turned on by default. Please see [interactive self-service consideration](https://docs.chocolatey.org/en-us/features/self-service-anywhere#interactive-self-service-consideration). - -### BUG FIXES - * Windows Service Management Functions: - * Fix - Adding user to Administrators no longer fails with "Network path was not found" when there are domain users and local users in the administrators group. - * Package Builder (Choco New): - * Fix - Create packages from non-admin (instead of access denied error). - * Fix - Don't attempt to generate an icon unless a file for that icon exists. - -### IMPROVEMENTS - * Package Builder (Choco New): - * Right click create package w/out GUI should pause on error. This allows a user to see any errors instead of closing quickly. - * Do not generate template files if not using the default template. - - -## 1.12.9 (November 10, 2017) -### BUG FIXES - * Fix: Changes in 1.12.7 restrict some install/upgrade licensed functionality from loading. - * Windows Service Management Functions: - * Fix - Domain Users should be found by domain context. - * Fix - Throw Error if unable to ensure user or administrators membership. - * Fix - Domain Users should not attempt to generate password. - * Package Synchronizer (Choco Sync): - * Fix - syncing new items use "sync" as user name when capturing information for Package Audit. - * Package Builder (Choco New): - * Fix - additional directories from programs and features not cleared each time. - -### IMPROVEMENTS - * Package Builder (Choco New): - * Show Install Arguments in Nuspec with MSI Properties. - * Extract icon from Programs and Features. - * Extract icon from exe files. - - -## 1.12.8 (October 25, 2017) -### BUG FIXES - * Fix - "The registered delegate for type IEnumerable threw an exception. Unable to find suitable location for change.exe." - - -## 1.12.7 (October 25, 2017) -### BUG FIXES - * Fix - "ERROR: The term 'Invoke-ChocolateyProcessCmdlet' is not recognized as the name of a cmdlet, function, script file, or operable program" on upgrade all. - - -## 1.12.6 (October 24, 2017) -### BUG FIXES - * Fix - `change.exe` could not be found when running Chocolatey GUI over RDP (Terminal Services). - * Self-Service / Background Mode: - * Fix - Set USER_CONTEXT environment variable to contain the user context information. - -### IMPROVEMENTS - * `Install-ChocolateyInstallPackage` - pass in answer file (`-AnswerFile`) to provide to stdin. - - -## 1.12.5 (September 28, 2017) -### BUG FIXES - * Windows Service Management Functions: - * Fix - Do not save created user prior to setting complex password. - - -## 1.12.4 (September 27, 2017) -### BUG FIXES - * Self-Service / Background Mode: - * Fix - Ensure that it configures and works appropriately with Chocolatey API (and the Chocolatey GUI). - -### IMPROVEMENTS - * Self-Service / Background Mode: - * Allow commands to be configurable. Covered in more detail at https://docs.chocolatey.org/en-us/features/self-service-anywhere#setup. - - -## 1.12.3 (September 8, 2017) -### BUG FIXES - * [Security] Fix - Hide admin only repositories from non-administrators with all Chocolatey commands. - * Windows Service Management Functions: - * Fix - Empty username causes errors. Will now set to what the configuration of Chocolatey is determining. - * Package Internalizer (Choco Download): - * Fix - Pass multiple package names to download/internalize (`choco download pkg1 pkg2 pkgN`). - * Self-Service / Background Mode: - * Fix - Don't display background services messages when background mode is not configured. - * Package Reducer: - * Fix - Package reducer fails the install when there is no package information. - -### IMPROVEMENTS - * choco sync is now out of preview. - - -## 1.12.2 (August 31, 2017) -### FEATURES - * [Security] choco source/list - Administrator only visible repositories. Hide repositories from non-administrators who are using Chocolatey (C4B). - * choco pin - Provide a reason when pinning to be seen in outdated by others (C4B). - -### BUG FIXES - * Package Synchronizer (Automatic Sync): - * Fix - Ignore HKCU pkg on sync when different user instead of removing the package. - * Package Builder (Choco New): - * Fix - remove "rel[ease]" next to version when building package id. - * Fix - remove 'self-installing' when building package id. - * Fix - Logging - log sync messages directly to log file when using limit output (`-r`). - * Fix - Download CDN Cache - If original url was switch to TLS/SSL by choco, the cache check doesn't override for the file on the CDN. - -### IMPROVEMENTS - * [Security] Runtime - Allow locking down all Chocolatey use to Administrators only (don't allow non-admins to run choco at all) - added as feature flip (see `choco feature list`). - * Package Internalizer (Choco Download): - * Pass multiple package names to download/internalize (`choco download pkg1 pkg2 pkgN`). - * Downloaded resources will use download CDN cache if available. - * Windows Service Management Functions: - * Allow upgrading services without a restart - pass `-DoNotReinstallService` to `Install-ChocolateyWindowsService`. - * Package Synchronizer (Choco Sync): - * Specify package name when syncing by id (`--id="'Display Name*'" --package-id=package-id`). - * Installation - Disable install of context menus with `--params "'/NoContextMenu'"`. Currently only new installs (removal on upgrade will come in a future release). - * Package Builder (Choco New): - * When an MSI has external files, ensure to copy those into the packaging as well. Requires same folder structure that would be used at install time successfully. - * Package Reducer: - * Treat MST files as removable binaries. - - -## 1.12.1 (July 13, 2017) -Among the bug fixes, we've brought Package Internalizer to the MSP edition of Chocolatey. - -### BUG FIXES - * Fix - Configuration item is not serialized, causing issues with installs with packages.config and ChocolateyGUI. - * Package Synchronizer (Choco Sync): - * Fix - syncing new items should capture audit information for Package Audit. - * Self-Service / Background Mode - * Fix - timeout should be near infinite when execution timeout is 0. - * Fix - loading commands over PowerShell remoting can fail. - * Fix - do not configure background service unless it applies. - -### IMPROVEMENTS - * Package Internalizer is now available for MSP edition as well. - - -## 1.12.0 (July 10, 2017) -### FEATURES - * Package Reducer / Optimize (All licensed editions) - Reduce Space Usage for Chocolatey Installations - - If you have a significant number of Chocolatey packages you manage, you may notice that you also may have a pretty significant space usage under the Chocolatey lib directory. Package reducer automatically decreases the size of nupkg files to around 5KB and removes installers and zips automatically from your package install directories. This may allow you to save GBs of usage for a large amount of packages being managed. - - To learn more about Package Reducer and `choco optimize`, please see https://docs.chocolatey.org/en-us/features/package-reducer. - - * Package Audit (C4B) - Learn Who and When - - Reporting is very important, and auditing not only when your installations occurred but who installed them can be critical. There is nothing that presents this kind of information as easily as you will be able to gather it with Chocolatey for Business (C4B) and Package Audit. - - To learn more about Package Audit, please see https://docs.chocolatey.org/en-us/features/package-audit. - -### IMPROVEMENTS - * Package Internalizer (Choco Download): - * Option (`--internalize-all-urls`) to internalize any url in a package (not just if the package scripts contain known-compatible known functions). - * Self-Service / Background Mode: - * Added `useBackgroundServiceWithNonAdministratorsOnly` feature switch to skip background mode for administrators. - * Windows Service Management Functions: - * Added `useLocalSystemForServiceInstalls` feature switch to disable using LocalSystem as the user for services by default. - * Added config settings to provide local user / password. - * If the password is empty or not provided, Chocolatey will manage the password securely. - * If the user doesn't exist, the account will be created - * Accounts are ensured to be administrators - * Accounts are ensured to have Log on as service and batch rights. - - -## 1.11.0 (June 27, 2017) -### BUG FIXES - * Self-Service / Background Mode - * Fix - Use a URI with WCF named pipes that doesn't exclusively hold a lock on the root (blocking other services). Fallback to old URI for versions of chocolatey-agent less than 0.7.0+. - see [#12](https://github.com/chocolatey/chocolatey-licensed-issues/issues/12). - * Fix - Ensure chocolatey.lib can send arguments through and not just choco.exe. - -### IMPROVEMENTS - * Package Synchronizer - update registry links when software updates - - -## 1.10.0 (June 9, 2017) -This release brings Package Throttle, Package Synchronizer's "Show All Packages in Programs and Features", and Direct Installer (aka Package-less Install) to Chocolatey. There are also numerous improvements to Package Builder, fixes and improvements to Package Internalizer and Self-Service. Package Throttle is in all licensed editions, allowing Pro, MSP, and C4B customers the ability to slow down Chocolatey as it downloads packages and any resources the packages are downloading. See more details each section below. - -### BREAKING CHANGES - * [Security] Self-Service / Background Mode - support background mode with self-service sources only by default - - If you are using self-service functionality, when you upgrade to v1.10, you will need to go to those sources that you allow to be self-service and ensure they are selected to allow self-service (`choco source list`). Otherwise by default users are going to be locked out of using those sources. The move to opt-in is best from a security standpoint and we want to give you the ability to have folks opt-in to the better behavior. - - To change this behavior back to the way it was previously, simply run `choco disable -n useBackgroundServiceWithSelfServiceSourcesOnly`. For more details see `choco feature list` or https://docs.chocolatey.org/en-us/configuration#self-service-background-mode - -### FEATURES - * Package Throttle - Throttle Bandwidth / Rate Limit Download Speeds - - By default, Chocolatey downloads packages and resources as fast as it can. Package Throttle gives you a way to slow down Chocolatey so it doesn't overwhelm any bandwidth restrictions you may have. This is done as both a setting and per package install/upgrade. This is in bits per second (not bytes, bits is what most network traffic is measured in). When adding at runtime, simply add `--bps=VALUE`. To set the value in the configuration, call `choco config set maximumDownloadRateBitsPerSecond VALUE`. For more details see https://docs.chocolatey.org/en-us/features/package-reducer. - - * Package Synchronizer's Show All Packages In Programs and Features - - This means packages that do not have an underlying installation can still show up in Programs and Features and be managed there as well, which allows for legacy inventory reporting systems to see all the software that is installed in the same way that Chocolatey is able to. A picture can probably best explain this feature, check out [All Package In Programs and Features](https://raw.githubusercontent.com/chocolatey/choco-wiki/e619d5d25018f9362d50749ee86554ebc4f4f04d/images/features/features_packages_in_programs_and_features.png) - - To turn this feature on, simply run the following command `choco feature enable -n showAllPackagesInProgramsAndFeatures`. For more details on the feature, see https://docs.chocolatey.org/en-us/configuration#package-synchronizer and https://docs.chocolatey.org/en-us/features/package-synchronization/packages-to-programs. This does require one additional run of `choco` to take affect (same when disabling the feature), hopefully we can remove that in the future. - - * Package-less Install / Direct Installer - Install and upgrade directly from installers (MSIs, EXEs, etc)! - - If Package Builder can create a fully unattended package for an installer, you don't even need a package first. You can simply call `choco install nameoffile.msi` or `choco upgrade nameoffile.exe` and Chocolatey will generate packaging on the fly and install/upgrade the package! - -### BUG FIXES - * Fix - choco new generates uninstall template with wrong use of registry key variable - see [#1304](https://github.com/chocolatey/choco/issues/1304) - * Package Internalizer (Choco Download): - * Fix - Append UseOriginalLocation for multiline so that it adds a continuation and not a hanging parameter on a new line - * Fix - Variable replacement wasn't working for `${value}` and `$($value)` - * Fix - Find and replace the original url in the script - -### IMPROVEMENTS - * [Security] Allow locking down new/download commands to admin only - added as feature flip switches (see `choco feature list`) - * Self-Service / Background Mode: - * Provide the user context to Chocolatey on install / upgrade (user context is original user requesting action) - * Package Builder (Choco New): - * Find MSI Properties in CustomActions and in Properties table listed in Properties ending in "Properties" - * Show possible silent options when installer type is not determinable or is found to be custom - * General template improvements - * Package Internalizer (Choco Download): - * Rewrite any scripts that `chocolateyInstall.ps1` uses into the `chocolateyInstall.ps1` file - - -## 1.9.8 (March 25, 2017) -### BUG FIXES - * Fix - Ensure Chocolatey Licensed is compatible with Chocolatey v0.10.4. - * Fix - AutoUninstaller - ensure uninstallExe is split by quotes when necessary - see [#1208](https://github.com/chocolatey/choco/issues/1208) - * Package Synchronizer (Choco Sync): - * Fix - Ensure template properties are cleared, even when skipping due to errors - * Package Builder (Choco New): - * Fix - Ensure authors is never empty - * Fix - Before setting properties from registry, ensure they have a value. - * Fix - Replace invalid ".-" in package id - - -## 1.9.7 (March 20, 2017) -### BUG FIXES - * Fix - Support automatic decompression on downloads - see [#1056](https://github.com/chocolatey/choco/issues/1056) - * Fix - Package Builder - Restrict Get-UninstallRegistryKey params in chocolateyUninstall.ps1 - * Fix - Package Internalizer - exit non-zero when variable replacement fails - -### IMPROVEMENTS - * Ensure PowerShell scripts use CRLF so authenticode verification doesn't fail - * Install Directory should see `INSTALLFOLDER` MSI Property - * Virus Scanner - provide context for other answers (No/Skip) - * Allow both 32bit and 64bit file parameters with Install-ChocolateyInstallPackage - see [#1187](https://github.com/chocolatey/choco/issues/1187) - - -## 1.9.6 (March 3, 2017) -### BUG FIXES - * Fix - Ensure silent args in logs are escaped - * Fix - Package Internalizer - use console adapter for downloading - -### IMPROVEMENTS - * Ensure proxy values are used with Chocolatey v0.10.4+ - see [#1141](https://github.com/chocolatey/choco/issues/1141) and [#1165](https://github.com/chocolatey/choco/issues/1165) - * Install - do not create a `.ignore` file outside Chocolatey directories - same as [#1180](https://github.com/chocolatey/choco/issues/1180) - * Package Synchronizer (Choco Sync): - * Use local directory for outputting created packages by default. - * Specify output directory for created packages. - - -## 1.9.5 (January 31, 2017) -### BUG FIXES - * Fix - Error when running Install-ChocolateyInstallPackage without specifying silent arguments - * Remove *.istext file before the content-type check that creates file - see [#1012](https://github.com/chocolatey/choco/issues/1012) - -### IMPROVEMENTS - * Package Builder (Choco New): - * Right click - create a package without bringing up the GUI. - * Package Internalizer (Choco Download): - * Don't delete the download directory unless `--force` - * Set user modes for terminal services (`change user /install` | `change user /execute`) - - -## 1.9.4 (January 19, 2017) -### BUG FIXES - * Fix - enabling preview features has no effect. - - -## 1.9.3 (January 17, 2017) -### BUG FIXES - * Fix - trial users unable to use Business version of Package Builder UI. - - -## 1.9.2 (January 17, 2017) -### BUG FIXES - * Fix - virus scanner not working properly - - -## 1.9.1 (January 16, 2017) -### BUG FIXES - * Fix - Ensure Pro users can call Package Builder from the command line ("packagebuilder") after install - * Fix - Correct title of package to "Chocolatey Licensed Edition" - - -## 1.9.0 (January 15, 2017) -This release brings the coveted PackageBuilder UI to the Pro+ license (minus auto detection) and adds a tabbed interface that allows you to fill out the entire nuspec. Package Synchronizer now has `choco sync` to compliment the automatic synchronization. The sync command brings all unmanaged software in Programs and Features under Chocolatey management. - -### FEATURES - * Package Synchronizer v2 - `choco sync` to associate existing packages with unmanaged software - see https://docs.chocolatey.org/en-us/features/package-synchronization/sync-command#sync-command - * Package Builder UI: - * Starts at Professional edition (minus autodetection) - * Tabbed interface - * Tab for entire Nuspec - * [Business] Tab to generate from Programs and Features - -### BUG FIXES - * Self-Service / Background Mode: - * Fix - Add a line after progress is complete - * Fix - Automatic creation of ignore file in Install-ChocolateyInstallPackage throws errors when it fails - see [#380](https://github.com/chocolatey/chocolatey/issues/380) for original issue. - * Package Builder (Choco New): - * Fix - remove "version/ver" if next to version number in DisplayName - * Fix - todo / logging need to escape curly braces to properly format - * Fix - continue on error - -### IMPROVEMENTS - * User can turn on Preview Features - `choco feature enable -n allowPreviewFeatures` - * InstallDirectory switch added to Install-ChocolateyInstallPackage - * Package Internalizer (Choco Download) - * option to ignore dependencies `--ignore-dependencies` - * Package Builder (Choco New) - * Generates package arguments with install directory override - * Add optional scripts - beforeModify/uninstall - * Add other template files - * Remove any version number from package id - * allow for quiet logging - * auto detection fills out more fields for MSIs - * Self-Service / Background Mode Enhancements - * Do not warn if command is `choco feature` - * Provide user context when background service not available - - -## 1.8.4 (January 5, 2017) -### FEATURES - * Support Self-Service Install / Background Mode - see https://docs.chocolatey.org/en-us/features/self-service-anywhere - * Manage Windows Services - - We've introduced some service management functions to the business edition. `Install-ChocolateyWindowsService`, `Uninstall-ChocolateyWindowsService`, `Start-ChocolateyWindowsService`, and `Stop-ChocolateyWindowsService`. Those will be documented soon enough. For now some example code should suffice. - -~~~powershell -$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -$serviceExe = Join-Path $toolsDir 'service\chocolatey-agent.exe' - -$packageArgs = @{ - Name = 'chocolatey-agent' - DisplayName = 'Chocolatey Agent' - Description = 'Chocolatey Agent is a backgound service for Chocolatey.' - StartupType = 'Automatic' - ServiceExecutablePath = $serviceExe -} - -#Username, Password, -DoNotStartService are also considered - -Install-ChocolateyWindowsService @packageArgs - -# The other three methods simply take the service name. -Start-ChocolateyWindowsService -Name 'chocolatey-agent' -Stop-ChocolateyWindowsService -Name 'chocolatey-agent' -Uninstall-ChocolateyWindowsService -Name 'chocolatey-agent' -~~~ - -### BUG FIXES - * Package Synchronizer - Do not run automatic sync when non-elevated. It fails in weird ways - * Package Builder (Choco New): - * Fix - fix "(Install)" - append space in nuspec Title. - -### IMPROVEMENTS - * Downloading remote files - don't show bytes, only formatted values - * Authenticode sign licensed binaries - - -## 1.8.3 (December 21, 2016) -### FEATURES - * Package Downloader/Internalizer (Choco Download): - * Internalize package dependencies - * Allow download to separate location than where package will edit for internal resources (`--download-location`) - -### BUG FIXES - * Fix - Directory Override - ensure override switch is passed to .install/.portable package when passing switch to meta package. - * Fix - Ensure web requests don't time out / are configurable - see [#732](https://github.com/chocolatey/choco/issues/732) - * Package Builder (Choco New): - * Fix - Cannot bind parameter because parameter 'fileType' is specified more than once for `--keep-remote` - * Fix - UNC paths with `--use-original-location` should not use `Install-ChocolateyPackage` - * Fix - Escape double quotes in PowerShell strings - * Package Downloader/Internalizer (Choco Download): - * Fix - Ignore commented out urls - * Fix - Do not download from a url more than once even if a package has it listed more than once - * Fix - Do not timeout for larger files - -### IMPROVEMENTS - * Directory Override - if MSI properties include INSTALLDIR or INSTALLLOCATION, use that instead of TARGETDIR - * Package Builder (Choco New): - * MSI Properties generated are cleaned up, duplicates removed from chocolateyInstall.ps1 comments - * Generate from Programs and Features is faster, does not repeat for Uninstaller keys in both 32bit/64bit registry hives - * Show downloaded file progress - * Package Downloader/Internalizer (Choco Download): - * When chocolateyInstall.ps1 uses other ps1 files, ensure those are loaded for token replacement - * Show downloaded file progress - - -## 1.8.2 (December 12, 2016) -### BUG FIXES - * Package Builder (Choco New): - * Fix - Ignore first argument for name if not a name. This will also be fixed in Chocolatey v0.10.4 with [#1085](https://github.com/chocolatey/choco/issues/1085) - * Fix - PackageBuilder UI will request administrative permissions when run by admin. - * Fix - Urls should be set when using original location. - * Package Downloader/Internalizer (Choco Download): - * Fix - Do not use unparsed options as package names. Similar to [#983](https://github.com/chocolatey/choco/issues/983). - * Countdown days counting in incorrect direction - -### IMPROVEMENTS - * Package Builder (Choco New): - * version - add TODO if version is 0.0.0.0 - * outputdirectory option has more aliases. - - -## 1.8.1 (November 27, 2016) -### BUG FIXES - * AutoUninstaller - Fix - do not fail on auto-detection of type when uninstall executable is not in the correct format. - * Package Builder (Choco New): - * Fix - Programs and Features - do not fail on auto-detection of type based on uninstall string - -### IMPROVEMENTS - * Package Builder (Choco New): - * version - always set to 3 segments (x.y.z) - * version - remove extra version segments when more than 4 segments are returned - - -## 1.8.0 (November 16, 2016) -Package Builder has some major improvements in this release, including a new UI! See https://blog.chocolatey.org/2016/11/package-builder-announcements/ for details! While building some of the features for the enhancements for this release, we've made quite a few tweaks and fixes to Package Builder and we think you are going to like the results. Being able to generate packages from the installed software on a reference system is huge (`choco new --from-programs-and-features`)! - -Pro users now have the ability to download packages (minus internalization). This is fantastic if you want to pull down a lot of packages quickly from a remote source. Or pull down packages and push them up to an internal source. - -### FEATURES - * Package Downloader comes to Pro+ Licenses - minus internalizer, you can now download a package using an easy command `choco download`. - * Package Builder (Choco New): - * Package Builder now has a UI - see https://youtu.be/qJNKR_PEQqY for details. - * Right click on an exe, msi, zip (or other supported types) and click "Create Package..." - * Package Builder - generate packages from installed software (Programs and Features) - see https://youtu.be/Mw_ReipnskI for details. - -### BUG FIXES - * Package Builder (Choco New): - * Fix - silent arguments for MSU/MSP should not include the file itself. - * Fix - remove comma if found. - * Fix - remove trailing period. - * Fix - Remove the entire word surrounding a version. - * Package Internalizer (Choco Download): - * Fix - mixed line endings were causing "Index was outside the bounds of the array" errors. - * Package Synchronizer: - * Fix - sync location should not be in the extensions folder, causes extension loading issues - a similar fix will be in open source to ignore the old sync location in v0.10.4 (see [#1041](https://github.com/chocolatey/choco/issues/1041)). - * Fix - sync over an existing synced package without error. - -### IMPROVEMENTS - * Uninstall - Uninstall software not managed with Chocolatey. Use something like `choco uninstall 7-zip* --from-programs-and-features` to ensure removal from Programs and Features directly. Also requires Chocolatey v0.10.4. - * VirusTotal - When a user cancels a virus check, set the proper exit code so that rollback occurs automatically - see [#985](https://github.com/chocolatey/choco/issues/985). - * Package Builder (Choco New): - * Return a TODO list when there are more things to do to finish packaging. - * Set values to replace if they are not set. - * Use company name for nuspec copyright if copyright is not available. - * Provide more verbose logging when necessary. - * Remove more installer wording - "setup", "remove only". - * If we exhaust all other options for determining name and version, use the file name and split version from name. - * Add or remove architecture from the package id - `choco new --include-architecture-in-name` and `choco new --remove-architecture-from-name`, respectively. - * Package Synchronizer: - * Synchronize to a new location per package version. - - -## 1.7.0 (Sep 22, 2016) -### BUG FIXES - * Package Builder (Choco New) - Removed `fileFullPath` from install template - add back in when local zip only. Fixes an error as `file` and `fileFullPath` are aliases starting in 0.10.1. - * Package Internalizer (Choco Download) - ensure logging does not incur log format exceptions - * install/upgrade - Look for downloaded file at old path if replaced 'chocolatey\chocolatey' path does not exist - see [#969](https://github.com/chocolatey/choco/issues/969) - -### IMPROVEMENTS - * Package Builder (Choco New): - * `--build-package` to build a package after Package Builder creates the package all in one go. - * `--pause-on-error` to pause the output when there are errors for closer inspection (useful when run from a batch file). - * Specify checksum and type - checksum will be verified against files/downloaded files. - * Loads of improvements in how package id and title are determined and cleaned up. - * Product versions and portions of product versions are removed from package id/title. - * Package Internalizer (Choco Download): - * Add `--internalize` as alias to `--recompile`. - * Warn of issue with `-UseOriginalLocation` when only using one file. - * Add `--append-useoriginallocation` and feature internalizeAppendUseOriginalLocation that makes the determination to add to the end of `Install-ChocolateyPackage` when using local resources. - - -## 1.6.3 (Sep 20, 2016) -### BUG FIXES - * Require Chocolatey be upgraded to at least 0.10.1 due to internal incompatibilities that affect this extension. - - -## 1.6.2 (Sep 19, 2016 - pulled) -### BUG FIXES - * Recompiled to work with 0.10.1. There were some internal changes that appear to affect the virus scanner and PackageBuilder. - -### IMPROVEMENTS - * Install/upgrade - support MSP (patch files) - * PackageBuilder - support MSU/MSP files - - -## 1.6.1 (Sep 8, 2016) -### BUG FIXES - * Package Builder (Choco New): - * Fix - Do not error on missing appsearch table in MSI. - * Fix - Do not add similarly named items from AppSearch table to template properties more than once. - - -## 1.6.0 (Sep 8, 2016) -Some really big improvements are now available in v1.6.0. We are excited to share them with you! - -### FEATURES - * Licensed Enhancements: - * install/upgrade - pass sensitive arguments that are not shown/logged in Chocolatey to an installer - useful when you want to pass passwords but don't want them logged. Need Chocolatey v0.10.1+. - * AutoUninstaller - determine type from original executable when FOSS is not able to detect installer type. - * Package Builder (Choco New): - * Now supports downloading from url/url64 and determining whether to keep those files remote. - * Switch to use original file location instead of copying into package - * Specify both 32-bit/64-bit file - * Work with zip files - -### BUG FIXES - * Fix - changes related to working directory fixes for [#937](https://github.com/chocolatey/choco/issues/937) - * Fix - double chocolatey folder name is not also applied to the passed in file name - see [#908](https://github.com/chocolatey/choco/issues/908) - * Package Builder (Choco New): - * Fix - remove parentheses from package names - * Fix - keep template updated - * Package Internalizer (Choco Download): - * Fix - handle downloaded files with the same name Sometimes the file name is the same when the architecture is different. Handle that by using the url counter for all additional files with the same name. - -### IMPROVEMENTS - * Remind About Upcoming Expiration - when the license is expiring within a month's time, remind the user about renewal - * Package Builder (Choco New): - * Handle -forcex86 with package creation - * Add shimgen ignore for exes - * Use ProductVersion when version 0.0.0.0 - * Remove the word "installer" from package name - * Allow specifying name of the package - * Allow template override with warning - * Show MSI properties in install script (commented) - * Ensure `ALLUSERS=1` when an MSI is set to per user by default - * Automatically checksum files - * Allow files to stay remote - use remote helpers when files stay remote - * Package Internalizer (Choco Download): - * handle variables in urls set like ${word} - * Append `-UseOriginalLocation` to the end of the arguments passed to Install-ChocolateyPackage. Work with splatting properly as well - - -## 1.5.1 (Aug 9, 2016) -### BUG FIXES - * Fix - Valid Exit Codes do not support values bigger than Int32.MaxValue. - see [#900](https://github.com/chocolatey/choco/issues/900) - -### IMPROVEMENTS - * Package Internalizer (Choco Download) - specify resources location (when not embedding into package) - - -## 1.5.0 (July 21, 2016) -### FEATURES - * [Business] Recompiled packages support aka Package Internalizer - Download a package and all remote resources, recompiling the package to use local resources instead. - * Synchronize w/Programs and Features - Chocolatey synchronizes manually uninstalled software with package state. - -### BUG FIXES - * Fix - Silent Args being passed as a string array cause package failure - see [#808](https://github.com/chocolatey/choco/issues/808) - -### IMPROVEMENTS - * VirusTotal - allow skipping check entirely - [#786](https://github.com/chocolatey/choco/issues/786) - * Trial allows more features to work, but in a way that is not automatable. - - -## 1.4.2 (June 20, 2016) -### BUG FIXES - * Fix - Logging is broken in some packages due to new TEMP directory - [#813](https://github.com/chocolatey/choco/issues/813) - -### IMPROVEMENTS - * Ensure log file path exists - [#758](https://github.com/chocolatey/choco/issues/758) - - -## 1.4.1 (June 14, 2016) -### BUG FIXES - * PowerShell v2 assembly was not loading. There was a dependency on an incorrect version of PowerShell assemblies, causing it to only attempt to load System.Management.Automation v3 and above - [#799](https://github.com/chocolatey/choco/issues/799) - - -## 1.4.0 (June 13, 2016) -### FEATURES - * BETA Testers - Recompiled packages support - Download a package and all remote resources, recompiling the package to use local resources instead. - * BETA Testers - Synchronize w/Programs and Features - Chocolatey synchronizes manually uninstalled software with package state. - * [Business] Create Packages from Installers aka Package Builder! Create packages directly from software installers in seconds! **Chocolatey for Business can automatically create packages for all the software your organization uses in under 5 minutes!** - * New Command! choco support - quickly see how you can contact support - [#745](https://github.com/chocolatey/choco/issues/745) - * Web functions for local files support - [#781](https://github.com/chocolatey/choco/issues/781) - -### IMPROVEMENTS - * Support FIPS compliant algorithms [#446](https://github.com/chocolatey/choco/issues/446) - - -## 1.3.2 (May 28, 2016) -### BUG FIXES - * Get-WebFile name changes related to [#753](https://github.com/chocolatey/choco/issues/753) - -### IMPROVEMENTS - * Clarified options with version and better messaging. - - -## 1.3.1 (May 9, 2016) -### BUG FIXES - * Get-WebFile name changes related to [#727](https://github.com/chocolatey/choco/issues/727) - -### IMPROVEMENTS - * Report directory switch override. - - -## 1.3.0 (May 2, 2016) -### FEATURES - * Ubiquitous Install Directory Switch! When working with properly formed packages that use Install-ChocolateyPackage (or Install-ChocolateyInstallPackage), Chocolatey is able to override the native installer's directory from one single option you provide to Chocolatey. You no longer need to know what the installer type is and provide that through install arguments. See `choco install -?` and `--install-directory` option for details. - * Generic Virus Scanner - for organizations that don't want to run checks using VirusTotal, we've provided a way for organizations to use their own virus scanner. See `choco config list` for details. - -### BUG FIXES -* Fix - Content Length check may error if original location is changed. This means the permanent download location will not error on other checks. -* Fix - Original remote file name can be affected if original url has changed or is unavailable. - -### IMPROVEMENTS - * Virus Scanner exits as soon as possible on files too big for the scanner. If the file is over 500MB, the scanner cannot upload the file, so it should not ask whether it can try to upload prior to failing on the size check (previous behavior). - - -## 1.2.0 (March 14, 2016) -### FEATURES - * Virus scanning for Pro users! See the [post](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum/posts/1518468) for details! - - -## 1.1.0 (February 12, 2016) -### IMPROVEMENTS - * License can now be in user profile (like `c:\Users\yourname\chocolatey.license.xml`). This is great for roaming user profiles and in multiple machine usage scenarios. - * Download cache can be controlled with a feature flag and/or a command option. See `choco feature` and `choco install -h` for more details. - -### For BETA Testers - * Virus Check improvements - * Throw if virus check has not been done before. - * Messaging is clarified - * Skip or run virus check with command options - see `choco install -h` for details. - - -## 1.0.2 (February 5, 2016) -### BUG FIXES -* Fix - PowerShell 5 respects Cmdlet aliases, causing overrides on functions not ready (Install-ChocolateyPackage). See the [post](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum/posts/1484093) for details. - - -## 1.0.1 (February 2, 2016) -### BUG FIXES -* Fix - License location validation is incorrect. - - -## 1.0.0 (February 1, 2016) -### FEATURES -* Alternate Permanent Download Location - see the [post](https://www.kickstarter.com/projects/ferventcoder/chocolatey-the-alternative-windows-store-like-yum/posts/1479944) for details. +See all - https://docs.chocolatey.org/en-us/licensed-extension/release-notes \ No newline at end of file diff --git a/COMMITTERS.md b/COMMITTERS.md index ed8cad8fb0..a57979dade 100644 --- a/COMMITTERS.md +++ b/COMMITTERS.md @@ -12,24 +12,91 @@ Committers - [Review the Code](#review-the-code) - [Accepting a PR](#accepting-a-pr) - [Merging](#merging) - - [Merge Retargeting to Stable](#merge-retargeting-to-stable) + - [Pull Request Retargeting](#pull-request-retargeting) -## Branch Targeting -* Stable currently targeting 0.10.x -* Master currently targeting 0.11.x +## Branching Strategy -**NOTE:** The above may be out of date. The best way to determine what branch is being targeted for stable is to run `git describe`. Stable and master are typically different on minor version (`x.y.z` - the `y`). +This repository uses the following branching strategy: -Depending on where your fix/enhancement goes, please target the proper branch. Community members always target master, but committers should know where the fix they are presenting goes. It makes it much easier to push the shiny green button on a pull request. If you are not sure where to target, ask. +![Branching Strategy](docs/images/branching-strategy.png "Branching Strategy") + +Depending on where your fix/enhancement goes, please target the proper branch. Community members always target develop, but committers should know where the fix they are presenting goes. It makes it much easier to push the shiny green button on a pull request. If you are not sure where to target, ask. + +### Features + +#### Creating a feature branch + +```bash +git checkout -b myfeature develop +``` + +#### Finishing a feature branch + +```bash +git checkout develop +git merge --no-ff myfeature +git branch -d myfeature +git push origin --delete myfeature # if feature branch pushed to fork repository +git push upstream develop +git push origin develop +``` + +### Releases + +#### Creating a release branch + +```bash +git checkout -b release/0.2.0 develop +``` + +#### Finishing a release branch + +```bash +git checkout master +git merge --no-ff release/0.2.0 +git tag -a 0.2.0 -m "version 0.2.0" +git checkout develop +git merge master +git branch -d release/0.2.0 +git push upstream --delete release/0.2.0 # if release branch pushed to main repository +git push upstream master +git push upstream develop +git push origin master +git push origin develop +``` + +### Hotfixes + +#### Creating a hotfix branch + +```bash +git checkout -b hotfix/0.1.1 master +``` + +#### Finishing a hotfix branch + +```bash +git checkout master +git merge --no-ff hotfix/0.1.1 +git tag -a 0.1.1 -m "version 0.1.1" +git checkout develop +git merge master +git branch -d hotfix/0.1.1 +git push upstream --delete hotfix/0.1.1 # if hotfix branch pushed to main repository +git push upstream master +git push upstream develop +git push origin master +git push origin develop +``` ## Summary We like to see folks contributing to Chocolatey. If you are a committer, we'd like to see you help from time to time with triage and the pull request process. In all cases politeness goes a long way. Please thank folks for contributions - they are going out of their way to help make the code base better, or adding something they may personally feel is necessary for the code base. -Please be VERY familiar with [CONTRIBUTING](https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md) and follow the process as well. +Please be VERY familiar with [CONTRIBUTING](https://github.com/chocolatey/choco/blob/develop/CONTRIBUTING.md) and follow the process as well. ## Terminology **Contributor** - A person who makes a change to the code base and submits a change set in the form of a pull request. @@ -40,16 +107,16 @@ Please be VERY familiar with [CONTRIBUTING](https://github.com/chocolatey/choco/ ## Review Process #### Receive new PR (pull request) - * A contributor sends a pull request (usually against master). + * A contributor sends a pull request (usually against develop). * A committer typically reviews it within a week or less to determine the feasibility of the changes. #### Initial PR Review * Has the user signed the Contributor License Agreement (CLA)? - * Did the user create a branch with these changes? If it is on their master, please ask them to review [CONTRIBUTING](https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md). + * Did the user create a branch with these changes? If it is on their default branch (i.e. develop), please ask them to review [CONTRIBUTING](https://github.com/chocolatey/choco/blob/develop/CONTRIBUTING.md). * Did the user reformat files and they should not have? Was is just white-space? You can try adding [?w=1](https://github.com/blog/967-github-secrets) to the URL on GitHub. - * Are there tests? We really want any new contributions to contain tests so unless the committer believes this code really needs to be in the code base and is willing to write the tests, then we need to ask the contributor to make a good faith effort in adding test cases. Ask them to review the [contributing document](https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md) and provide tests. **Note:** Some commits may be refactoring which wouldn't necessarily add additional test sets. - * Is the code documented properly? Does this additional set of changes require changes to the [wiki](https://github.com/chocolatey/choco/wiki)? - * Was this code warranted? Did the contributor follow the process of gaining approval for big change sets? If not please have them review the [contributing document](https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md) and ask that they follow up with a case for putting the code into the code base on the mailing list. + * Are there tests? We really want any new contributions to contain tests so unless the committer believes this code really needs to be in the code base and is willing to write the tests, then we need to ask the contributor to make a good faith effort in adding test cases. Ask them to review the [contributing document](https://github.com/chocolatey/choco/blob/develop/CONTRIBUTING.md) and provide tests. **Note:** Some commits may be refactoring which wouldn't necessarily add additional test sets. + * Is the code documented properly? Does this additional set of changes require changes to the [documentation](https://docs.chocolatey.org)? + * Was this code warranted? Did the contributor follow the process of gaining approval for big change sets? If not please have them review the [contributing document](https://github.com/chocolatey/choco/blob/develop/CONTRIBUTING.md) and ask that they follow up with a case for putting the code into the code base on the mailing list. #### Review the Code * Does the code meet the naming conventions and formatting (need link)? @@ -59,31 +126,29 @@ Please be VERY familiar with [CONTRIBUTING](https://github.com/chocolatey/choco/ #### Accepting a PR Once you have reviewed the initial items, and are not waiting for additional feedback or work by the contributor, give the thumbs up that it is ready for the next part of the process (merging). -Unless there is something wrong with the code, we don't ask contributors to rebase against master. They did the work to create the patch in the first place, asking them to unnecessarily come back and try to keep their code synced up with master is not an acceptable process. +Unless there is something wrong with the code, we don't ask contributors to rebase against develop. They did the work to create the patch in the first place, asking them to unnecessarily come back and try to keep their code synced up with develop is not an acceptable process. ## Merging Once you have reviewed the change set and determined it is ready for merge, the next steps are to bring it local and evaluate the code further by actually working with it, running the tests locally and adding any additional commits or fix-ups that are necessary in a local branch. -When merging the user's contribution, it should be done with `git merge --log --no-ff` to create a merge commit so that in case there is an issue it becomes easier to revert later, and so that we can see where the code came from should we ever need to go find it later (more information on this can be found [here](https://www.kernel.org/pub/software/scm/git/docs/git-merge.html) and also a discussion on why this is a good idea [here](https://differential.com/insights/best-way-to-merge-a-github-pull-request/)). +When merging the user's contribution, it should be done with `git merge --log --no-ff` to create a merge commit so that in case there is an issue it becomes easier to revert later, and so that we can see where the code came from should we ever need to go find it later (more information on this can be found [here](https://www.kernel.org/pub/software/scm/git/docs/git-merge.html) and also a discussion on why this is a good idea [here](https://web.archive.org/web/20190529002804/https://differential.com/insights/best-way-to-merge-a-github-pull-request/)). -### Merge Retargeting to Stable -Because we ask contributors to target master, sometimes a fix/enhancement may need to be retargeted to stable. This process is somewhat easy thanks to git. In most cases you won't even need to ask the user to do this for you. +### Pull Request Retargeting +Because we ask contributors to target develop, sometimes a fix/enhancement may need to be retargeted to a hotfix, or release, branch. This process is somewhat easy thanks to git. In most cases you won't even need to ask the user to do this for you. * `git fetch upstream pull//head:pr` - `upstream` is `git@github.com:chocolatey/choco.git` * `git checkout pr` - * `git rebase --onto stable master` - this uses the local branch, starts with latest stable and reapplies the commits from the branch to it, removing all commits that were only on the master. + * `git rebase --onto hotfix/0.2.2 develop` - this uses the local branch, starts with latest hotfix/0.2.2 and reapplies the commits from the branch to it, removing all commits that were only on the develop. **NOTE:** This is just an example, you should use the name of the hotfix/release branch that is currently being used. * `build.bat` - build and test * Any additional changes or testing here. - * `git checkout stable` - * `git fetch upstream` - if this pulls anything, make sure to also run `git rebase upstream/stable` prior to merging or you will lose the merge commit. + * `git checkout hotfix/0.2.2` + * `git fetch upstream` - if this pulls anything, make sure to also run `git rebase upstream/hotfix/0.22` prior to merging or you will lose the merge commit. * `git merge pr --log --no-ff` * `git branch -d pr` - * `git checkout master` - * `git merge stable` * Make any last checks to ensure the git logs look good. The next step sets the commits in stone and unable to be changed. * `git push upstream` References - * http://pivotallabs.com/git-rebase-onto/ + * [http://pivotallabs.com/git-rebase-onto/ (Archive)](https://web.archive.org/web/20150709101404/http://pivotallabs.com:80/git-rebase-onto/) * http://git-scm.com/book/ch3-6.html diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 721513a3c2..dacee223c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ Please follow these decision criteria to see if you are in the right location or ### Reporting an Issue/Bug? ![submitting issues](https://cloud.githubusercontent.com/assets/63502/12534440/fc223b74-c21e-11e5-9a41-1ffc1c9af48f.png) -Submitting an Issue (or a Bug)? See the **[Submitting Issues](https://github.com/chocolatey/choco#submitting-issues) section** in the [README](https://github.com/chocolatey/choco/blob/master/README.md#submitting-issues). +Submitting an Issue (or a Bug)? See the **[Submitting Issues](https://github.com/chocolatey/choco#submitting-issues) section** in the [README](https://github.com/chocolatey/choco/blob/develop/README.md#submitting-issues). #### SolutionVersion.cs Do not submit issues for missing `SolutionVersion.cs`. Please see [Compiling / Building Source](https://github.com/chocolatey/choco#compiling--building-source). @@ -97,8 +97,8 @@ If you work for an organization that does not allow you to contribute without at Start with [Prerequisites](#prerequisites) and make sure you can sign the Contributor License Agreement (CLA). ### Get Buyoff Or Find Open Community Issues/Features - * Through a Github issue (preferred), through the [mailing list](https://groups.google.com/forum/#!forum/chocolatey), or through [Gitter](https://gitter.im/chocolatey/choco), talk about a feature you would like to see (or a bug fix), and why it should be in Chocolatey. - * If approved through the mailing list or in Gitter chat, ensure the accompanying GitHub issue is created with information and a link back to the mailing list discussion (or the Gitter conversation). + * Through a GitHub issue (preferred), through the [mailing list](https://groups.google.com/forum/#!forum/chocolatey), or through [Community Chat](https://ch0.co/community-support), talk about a feature you would like to see (or a bug fix), and why it should be in Chocolatey. + * If approved through the mailing list or in Community chat, ensure the accompanying GitHub issue is created with information and a link back to the mailing list discussion (or the Community Chat conversation). * Once you get a nod from one of the [Chocolatey Team](https://github.com/chocolatey?tab=members), you can start on the feature. * Alternatively, if a feature is on the issues list with the [Up For Grabs](https://github.com/chocolatey/choco/issues?q=is%3Aopen+is%3Aissue+label%3A%22Up+For+Grabs%22) label, it is open for a community member (contributor) to patch. You should comment that you are signing up for it on the issue so someone else doesn't also sign up for the work. @@ -117,6 +117,7 @@ Start with [Prerequisites](#prerequisites) and make sure you can sign the Contri * `git config merge.ff false` * `git config merge.log true` * `git config fetch.prune true` + * `git config blame.ignoreRevsFile .git-blame-ignore-revs --local` 1. From there you create a branch named specific to the feature. 1. In the branch you do work specific to the feature. 1. For committing the code, please see [Prepare Commits](#prepare-commits). @@ -127,7 +128,7 @@ Start with [Prerequisites](#prerequisites) and make sure you can sign the Contri * More covered below in the [**Prepare commits**](#prepare-commits) section. * Test your changes and please help us out by updating and implementing some automated tests. It is recommended that all contributors spend some time looking over the tests in the source code. You can't go wrong emulating one of the existing tests and then changing it specific to the behavior you are testing. * While not an absolute requirement, automated tests will help reviewers feel comfortable about your changes, which gets your contributions accepted faster. - * Please do not update your branch from the master unless we ask you to. See the responding to feedback section below. + * Please do not update your branch from the develop unless we ask you to. See the responding to feedback section below. ### Code Format / Design #### CSharp @@ -254,7 +255,7 @@ Prerequisites: Submitting PR: - * Once you feel it is ready, submit the pull request to the `chocolatey/choco` repository against the `master` branch ([more information on this can be found here](https://help.github.com/articles/creating-a-pull-request)) unless specifically requested to submit it against another branch (usually `stable` in these instances). + * Once you feel it is ready, submit the pull request to the `chocolatey/choco` repository against the `develop` branch ([more information on this can be found here](https://help.github.com/articles/creating-a-pull-request)) unless specifically requested to submit it against another branch (for example, a `hotfix` or `release` branch). * In the case of a larger change that is going to require more discussion, please submit a PR sooner. Waiting until you are ready may mean more changes than you are interested in if the changes are taking things in a direction the committers do not want to go. * In the pull request, outline what you did and point to specific conversations (as in URLs) and issues that you are are resolving. This is a tremendous help for us in evaluation and acceptance. * Once the pull request is in, please do not delete the branch or close the pull request (unless something is wrong with it). @@ -268,10 +269,10 @@ If we have comments or questions when we do evaluate it and receive no response, Sometimes we may need you to rebase your commit against the latest code before we can review it further. If this happens, you can do the following: * `git fetch upstream` (upstream would be the mainstream repo or `chocolatey/choco` in this case) - * `git checkout master` - * `git rebase upstream/master` + * `git checkout develop` + * `git rebase upstream/develop` * `git checkout your-branch` - * `git rebase master` + * `git rebase develop` * Fix any merge conflicts * `git push origin your-branch` (origin would be your GitHub repo or `your-github-username/choco` in this case). You may need to `git push origin your-branch --force` to get the commits pushed. This is generally acceptable with topic branches not in the mainstream repository. @@ -281,7 +282,7 @@ The only reasons a pull request should be closed and resubmitted are as follows: * When there are updates made to the original by someone other than the original contributor (and the PR is not open for contributions). Then the old branch is closed with a note on the newer branch this supersedes #github_number. ## Other General Information -The helpers/utility functions that are available to the packages are what we consider the API. If you are working in the API, please note that you will need to maintain backwards compatibility. If you plan to rename a function or make it more generic, you must provide an alias in the [chocolateyInstaller.psm1](https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/helpers/chocolateyInstaller.psm1) as part of what gets exported. You should not remove or reorder parameters, only add optional parameters to the end. They should be named and not positional (we are moving away from positional parameters as much as possible). +The helpers/utility functions that are available to the packages are what we consider the API. If you are working in the API, please note that you will need to maintain backwards compatibility. If you plan to rename a function or make it more generic, you must provide an alias in the [chocolateyInstaller.psm1](https://github.com/chocolatey/choco/blob/develop/src/chocolatey.resources/helpers/chocolateyInstaller.psm1) as part of what gets exported. You should not remove or reorder parameters, only add optional parameters to the end. They should be named and not positional (we are moving away from positional parameters as much as possible). If you reformat code or hit core functionality without an approval from a person on the Chocolatey Team, it's likely that no matter how awesome it looks afterwards, it will probably not get accepted. Reformatting code makes it harder for us to evaluate exactly what was changed. diff --git a/GenerateDocs.ps1 b/GenerateDocs.ps1 index 0be09afc32..1f5d427207 100644 --- a/GenerateDocs.ps1 +++ b/GenerateDocs.ps1 @@ -1,3 +1,4 @@ +#Requires -PSEdition Desktop # Copyright © 2017 Chocolatey Software, Inc # Copyright © 2011 - 2017 RealDimensions Software, LLC # @@ -22,9 +23,9 @@ $thisDirectory = (Split-Path -parent $MyInvocation.MyCommand.Definition); $psModuleName = 'chocolateyInstaller' $psModuleLocation = [System.IO.Path]::GetFullPath("$thisDirectory\src\chocolatey.resources\helpers\chocolateyInstaller.psm1") $docsFolder = [System.IO.Path]::GetFullPath("$thisDirectory\docs\generated") -$chocoExe = [System.IO.Path]::GetFullPath("$thisDirectory\code_drop\chocolatey\console\choco.exe") +$chocoExe = [System.IO.Path]::GetFullPath("$thisDirectory\code_drop\temp\_PublishedApps\choco_merged\choco.exe") $lineFeed = "`r`n" -$sourceLocation = 'https://github.com/chocolatey/choco/blob/stable/' +$sourceLocation = 'https://github.com/chocolatey/choco/blob/master/' $sourceCommands = $sourceLocation + 'src/chocolatey/infrastructure.app/commands' $sourceFunctions = $sourceLocation + 'src/chocolatey.resources/helpers/functions' $global:powerShellReferenceTOC = @' @@ -57,13 +58,6 @@ These functions call other functions and many times may be the only thing you ne * [Install-ChocolateyPowershellCommand](xref:install-chocolateypowershellcommand) * [Install-ChocolateyVsixPackage](xref:install-chocolateyvsixpackage) -## Error / Success Functions - -* [Write-ChocolateySuccess](xref:write-chocolateysuccess) - **DEPRECATED** -* [Write-ChocolateyFailure](xref:write-chocolateyfailure) - **DEPRECATED** - -You really don't need a try catch with Chocolatey PowerShell files anymore. - ## More Functions ### Administrative Access Functions @@ -86,13 +80,11 @@ These are the functions from above as one list. * [Install-ChocolateyZipPackage](xref:install-chocolateyzippackage) * [Install-ChocolateyPowershellCommand](xref:install-chocolateypowershellcommand) -* [Write-ChocolateySuccess](xref:write-chocolateysuccess) -* [Write-ChocolateyFailure](xref:write-chocolateyfailure) +* [Get-ChocolateyPath](xref:get-chocolateypath) * [Get-ChocolateyWebFile](xref:get-chocolateywebfile) * [Get-ChocolateyUnzip](xref:get-chocolateyunzip) * [Install-ChocolateyPath](xref:install-chocolateypath) - when specifying user path * [Install-ChocolateyEnvironmentVariable](xref:install-chocolateyenvironmentvariable) - when specifying user path -* [Install-ChocolateyDesktopLink](xref:install-chocolateydesktoplink) - **DEPRECATED** - see [Install-ChocolateyShortcut](xref:install-chocolateyshortcut) * [Install-ChocolateyPinnedTaskBarItem](xref:install-chocolateypinnedtaskbaritem) * [Install-ChocolateyShortcut](xref:install-chocolateyshortcut) - v0.9.9+ * [Update-SessionEnvironment](xref:update-sessionenvironment) @@ -105,7 +97,7 @@ These are the functions from above as one list. function Get-Aliases($commandName){ $aliasOutput = '' - Get-Alias -Definition $commandName -ErrorAction SilentlyContinue | %{ $aliasOutput += "``$($_.Name)``$lineFeed"} + Get-Alias -Definition $commandName -ErrorAction SilentlyContinue | ForEach-Object { $aliasOutput += "``$($_.Name)``$lineFeed"} if ($aliasOutput -eq $null -or $aliasOutput -eq '') { $aliasOutput = 'None' @@ -120,7 +112,7 @@ function Convert-Example($objItem) { ~~~powershell $($objItem.Code.Replace("`n",$lineFeed)) -$($objItem.remarks | ? { $_.Text -ne ''} | % { Write-Output $_.Text.Replace("`n", $lineFeed) }) +$($objItem.remarks | Where-Object { $_.Text } | ForEach-Object { $_.Text.Replace("`n", $lineFeed) }) ~~~ "@ } @@ -148,7 +140,7 @@ function Convert-Syntax($objItem, $hasCmdletBinding) { $cmd = $objItem.Name if ($objItem.parameter -ne $null) { - $objItem.parameter | % { + $objItem.parameter | ForEach-Object { $cmd += ' `' + $lineFeed $cmd += " " if ($_.required -eq $false) { $cmd += '['} @@ -165,19 +157,19 @@ function Convert-Syntax($objItem, $hasCmdletBinding) { } function Convert-Parameter($objItem, $commandName) { - $parmText = $lineFeed + "### -$($objItem.name.substring(0,1).ToUpper() + $objItem.name.substring(1))" + $paramText = $lineFeed + "### -$($objItem.name.substring(0,1).ToUpper() + $objItem.name.substring(1))" if ( ($objItem.parameterValue -ne $null) -and ($objItem.parameterValue -ne 'SwitchParameter') ) { - $parmText += ' ' - if ([string]($objItem.required) -eq 'false') { $parmText += "["} - $parmText += "<$($objItem.parameterValue)>" - if ([string]($objItem.required) -eq 'false') { $parmText += "]"} + $paramText += ' ' + if ([string]($objItem.required) -eq 'false') { $paramText += "["} + $paramText += "<$($objItem.parameterValue)>" + if ([string]($objItem.required) -eq 'false') { $paramText += "]"} } - $parmText += $lineFeed + $paramText += $lineFeed if ($objItem.description -ne $null) { - $parmText += (($objItem.description | % { Replace-CommonItems $_.Text }) -join "$lineFeed") + $lineFeed + $lineFeed + $parmText += (($objItem.description | ForEach-Object { Replace-CommonItems $_.Text }) -join "$lineFeed") + $lineFeed + $lineFeed } if ($objItem.parameterValueGroup -ne $null) { - $parmText += "$($lineFeed)Valid options: " + ($objItem.parameterValueGroup.parameterValue -join ", ") + $lineFeed + $lineFeed + $paramText += "$($lineFeed)Valid options: " + ($objItem.parameterValueGroup.parameterValue -join ", ") + $lineFeed + $lineFeed } $aliases = [string]((Get-Command -Name $commandName).parameters."$($objItem.Name)".Aliases -join ', ') @@ -188,7 +180,7 @@ function Convert-Parameter($objItem, $commandName) { $padding = ($aliases.Length, $required.Length, $position.Length, $defValue.Length, $acceptPipeline.Length | Measure-Object -Maximum).Maximum - $parmText += @" + $paramText += @" Property | Value ---------------------- | $([string]('-' * $padding)) Aliases | $($aliases) @@ -199,7 +191,7 @@ Accept Pipeline Input? | $($acceptPipeline) "@ - Write-Output $parmText + Write-Output $paramText } function Convert-CommandText { @@ -216,13 +208,13 @@ param( return } $commandText = $commandText -creplace '^(.+)(\s+Command\s*)$', "# `$1`$2 (choco $commandName)" - $commandText = $commandText -creplace '^(Usage|Troubleshooting|Examples|Exit Codes|Connecting to Chocolatey.org|See It In Action|Alternative Sources|Resources|Packages.config|Scripting \/ Integration - Best Practices \/ Style Guide)', '## $1' + $commandText = $commandText -creplace '^(DEPRECATION NOTICE|Usage|Troubleshooting|Examples|Exit Codes|Connecting to Chocolatey.org|See It In Action|Alternative Sources|Resources|Packages.config|Scripting \/ Integration - Best Practices \/ Style Guide)', '## $1' $commandText = $commandText -replace '^(Commands|How To Pass Options)', '## $1' $commandText = $commandText -replace '^(WebPI|Windows Features|Ruby|Cygwin|Python)\s*$', '### $1' $commandText = $commandText -replace 'NOTE\:', '> :memo: **NOTE**' $commandText = $commandText -replace '\*> :memo: \*\*NOTE\*\*\*', '> :memo: **NOTE**' $commandText = $commandText -replace 'the command reference', '[how to pass arguments](xref:choco-commands#how-to-pass-options-switches)' - $commandText = $commandText -replace '(community feed[s]?|community repository)', '[$1](https://comminty.chocolatey.org/packages)' + $commandText = $commandText -replace '(community feed[s]?|community repository)', '[$1](https://community.chocolatey.org/packages)' #$commandText = $commandText -replace '\`(apikey|install|upgrade|uninstall|list|search|info|outdated|pin)\`', '[[`$1`|Commands$1]]' $commandText = $commandText -replace '\`([choco\s]*)(apikey|install|upgrade|uninstall|list|search|info|outdated|pin)\`', '[`$1$2`](xref:choco-command-$2)' $commandText = $commandText -replace '^(.+):\s(.+.gif)$', '![$1]($2)' @@ -313,7 +305,10 @@ function Generate-TopLevelCommandReference { $commandOutput += @("$lineFeed~~~$lineFeed") $commandOutput += @("$lineFeed$lineFeed*NOTE:* This documentation has been automatically generated from ``choco -h``. $lineFeed") - $commandOutput | %{ Convert-CommandText($_) } | %{ Convert-CommandReferenceSpecific($_) } | Out-File $fileName -Encoding UTF8 -Force + $commandOutput | + ForEach-Object { Convert-CommandText($_) } | + ForEach-Object { Convert-CommandReferenceSpecific($_) } | + Out-File $fileName -Encoding UTF8 -Force } function Move-GeneratedFiles { @@ -323,6 +318,9 @@ function Move-GeneratedFiles { Move-Item -Path "$docsFolder\choco\commands\new.md" -Destination "$docsFolder\create\commands\new.md" Move-Item -Path "$docsFolder\choco\commands\pack.md" -Destination "$docsFolder\create\commands\pack.md" Move-Item -Path "$docsFolder\choco\commands\push.md" -Destination "$docsFolder\create\commands\push.md" + Move-Item -Path "$docsFolder\choco\commands\template.md" -Destination "$docsFolder\create\commands\template.md" + Move-Item -Path "$docsFolder\choco\commands\templates.md" -Destination "$docsFolder\create\commands\templates.md" + Move-Item -Path "$docsFolder\choco\commands\convert.md" -Destination "$docsFolder\create\commands\convert.md" } function Generate-CommandReference($commandName, $order) { @@ -352,12 +350,36 @@ function Generate-CommandReference($commandName, $order) { $commandOutput += @("ShowInSidebar: false") } + if($commandName -eq 'Templates') { + $commandOutput += @("ShowInNavbar: false") + $commandOutput += @("ShowInSidebar: false") + } + $commandOutput += @("---$lineFeed") $commandOutput += @(" $lineFeed") + + $commandOutput += @(@" +> :memo: **WARNING** SHIM DEPRECATION +> +> With the release of Chocolatey CLI v1.0.0 we have deprecated the following shims/shortcuts: +> +> - `chocolatey` (Alias for `choco`) +> - `cinst` (Shortcut for `choco install`) +> - `cpush` (Shortcut for `choco push`) +> - `cuninst` (Shortcut for `cuninst`) +> - `cup` (Shortcut for `choco upgrade`) +> +> We recommend that any scripts calling these shims be updated to use the full command, as +> these shims will be removed in Chocolatey CLI v2.0.0. + +"@) + $commandOutput += $(& $chocoExe $commandName.ToLower() -h -r) $commandOutput += @("$lineFeed~~~$lineFeed$lineFeed[Command Reference](xref:choco-commands)") $commandOutput += @("$lineFeed$lineFeed*NOTE:* This documentation has been automatically generated from ``choco $($commandName.ToLower()) -h``. $lineFeed") - $commandOutput | %{ Convert-CommandText $_ $commandName.ToLower() } | Out-File $fileName -Encoding UTF8 -Force + $commandOutput | + ForEach-Object { Convert-CommandText $_ $commandName.ToLower() } | + Out-File $fileName -Encoding UTF8 -Force } try @@ -412,14 +434,14 @@ RedirectFrom: $(Replace-CommonItems $_.Synopsis) ## Syntax -$( ($_.syntax.syntaxItem | % { Convert-Syntax $_ $hasCmdletBinding }) -join "$lineFeed$lineFeed") +$( ($_.syntax.syntaxItem | ForEach-Object { Convert-Syntax $_ $hasCmdletBinding }) -join "$lineFeed$lineFeed") $( if ($_.description -ne $null) { $lineFeed + "## Description" + $lineFeed + $lineFeed + $(Replace-CommonItems $_.description.Text) }) $( if ($_.alertSet -ne $null) { $lineFeed + "## Notes" + $lineFeed + $lineFeed + $(Replace-CommonItems $_.alertSet.alert.Text) }) ## Aliases $(Get-Aliases $_.Name) -$( if ($_.Examples -ne $null) { Write-Output "$lineFeed## Examples$lineFeed$lineFeed"; ($_.Examples.Example | % { Convert-Example $_ }) -join "$lineFeed$lineFeed"; Write-Output "$lineFeed" }) +$( if ($_.Examples -ne $null) { Write-Output "$lineFeed## Examples$lineFeed$lineFeed"; ($_.Examples.Example | ForEach-Object { Convert-Example $_ }) -join "$lineFeed$lineFeed"; Write-Output "$lineFeed" }) ## Inputs $( if ($_.InputTypes -ne $null -and $_.InputTypes.Length -gt 0 -and -not $_.InputTypes.Contains('inputType')) { $lineFeed + " * $($_.InputTypes)" + $lineFeed} else { 'None'}) @@ -429,9 +451,9 @@ $( if ($_.InputTypes -ne $null -and $_.InputTypes.Length -gt 0 -and -not $_.Inpu $( if ($_.ReturnValues -ne $null -and $_.ReturnValues.Length -gt 0 -and -not $_.ReturnValues.StartsWith('returnValue')) { "$lineFeed * $($_.ReturnValues)$lineFeed"} else { 'None'}) ## Parameters -$( if ($_.parameters.parameter.count -gt 0) { $_.parameters.parameter | % { Convert-Parameter $_ $commandName }}) $( if ($hasCmdletBinding) { "$lineFeed### <CommonParameters>$lineFeed$($lineFeed)This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see ``about_CommonParameters`` http://go.microsoft.com/fwlink/p/?LinkID=113216 ." } ) +$( if ($_.parameters.parameter.count -gt 0) { $_.parameters.parameter | ForEach-Object { Convert-Parameter $_ $commandName }}) $( if ($hasCmdletBinding) { "$lineFeed### <CommonParameters>$lineFeed$($lineFeed)This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see ``about_CommonParameters`` http://go.microsoft.com/fwlink/p/?LinkID=113216 ." } ) -$( if ($_.relatedLinks -ne $null) {Write-Output "$lineFeed## Links$lineFeed$lineFeed"; $_.relatedLinks.navigationLink | ? { $_.linkText -ne $null} | % { Write-Output "* [$($_.LinkText)](xref:$($_.LinkText.ToLower()))$lineFeed" }}) +$( if ($_.relatedLinks -ne $null) {Write-Output "$lineFeed## Links$lineFeed$lineFeed"; $_.relatedLinks.navigationLink | Where-Object { $_.linkText -ne $null} | ForEach-Object { Write-Output "* [$($_.LinkText)](xref:$($_.LinkText.ToLower()))$lineFeed" }}) [Function Reference](xref:powershell-reference) @@ -468,7 +490,6 @@ Chocolatey makes a number of environment variables available (You can access any * ChocolateyPackageName - The name of the package, equivalent to the `` field in the nuspec (0.9.9+) * ChocolateyPackageTitle - The title of the package, equivalent to the `` field in the nuspec (0.10.1+) * ChocolateyPackageVersion - The version of the package, equivalent to the `<version />` field in the nuspec (0.9.9+) - * ChocolateyPackageFolder - The top level location of the package folder - the folder where Chocolatey has downloaded and extracted the NuGet package, typically `C:\ProgramData\chocolatey\lib\packageName`. #### Advanced Environment Variables @@ -477,11 +498,11 @@ The following are more advanced settings: * ChocolateyPackageParameters - Parameters to use with packaging, not the same as install arguments (which are passed directly to the native installer). Based on `--package-parameters`. (0.9.8.22+) * CHOCOLATEY_VERSION - The version of Choco you normally see. Use if you are 'lighting' things up based on choco version. (0.9.9+) - Otherwise take a dependency on the specific version you need. * ChocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. (0.9.9+) - Automatically handled in built in Choco functions. - * OS_PLATFORM - Like Windows, OSX, Linux. (0.9.9+) + * OS_PLATFORM - Like Windows, macOS, Linux. (0.9.9+) * OS_VERSION - The version of OS, like 6.1 something something for Windows. (0.9.9+) * OS_NAME - The reported name of the OS. (0.9.9+) * IS_PROCESSELEVATED = Is the process elevated? (0.9.9+) - * ChocolateyToolsLocation - formerly 'ChocolateyBinRoot' ('ChocolateyBinRoot' will be removed with Chocolatey v2.0.0), this is where tools being installed outside of Chocolatey packaging will go. (0.9.10+) + * ChocolateyPackageInstallLocation - Install location of the software that the package installs. Displayed at the end of the package install. (0.9.10+) #### Set By Options and Configuration @@ -498,7 +519,7 @@ Some environment variables are set based on options that are passed, configurati #### Business Edition Variables * ChocolateyInstallArgumentsSensitive - Encrypted arguments passed from command line `--install-arguments-sensitive` that are not logged anywhere. (0.10.1+ and licensed editions 1.6.0+) - * ChocolateyPackageParametersSensitive - Package parameters passed from command line `--package-parameters-senstivite` that are not logged anywhere. (0.10.1+ and licensed editions 1.6.0+) + * ChocolateyPackageParametersSensitive - Package parameters passed from command line `--package-parameters-sensitive` that are not logged anywhere. (0.10.1+ and licensed editions 1.6.0+) * ChocolateyLicensedVersion - What version is the licensed edition on? * ChocolateyLicenseType - What edition / type of the licensed edition is installed? @@ -512,12 +533,11 @@ The following are experimental or use not recommended: #### Not Useful Or Anti-Pattern If Used - * ChocolateyInstallOverride = Not for use in package automation scripts. Based on `--override-arguments` being passed. (0.9.9+) - * ChocolateyInstallArguments = The installer arguments meant for the native installer. You should use chocolateyPackageParameters instead. Based on `--install-arguments` being passed. (0.9.9+) + * ChocolateyInstallOverride - Not for use in package automation scripts. Based on `--override-arguments` being passed. (0.9.9+) + * ChocolateyInstallArguments - The installer arguments meant for the native installer. You should use chocolateyPackageParameters instead. Based on `--install-arguments` being passed. (0.9.9+) * ChocolateyIgnoreChecksums - Was `--ignore-checksums` passed or the feature `checksumFiles` turned off? (0.9.9.9+) * ChocolateyAllowEmptyChecksums - Was `--allow-empty-checksums` passed or the feature `allowEmptyChecksums` turned on? (0.10.0+) * ChocolateyAllowEmptyChecksumsSecure - Was `--allow-empty-checksums-secure` passed or the feature `allowEmptyChecksumsSecure` turned on? (0.10.0+) - * ChocolateyCheckLastExitCode - Should Chocolatey check LASTEXITCODE? Is the feature `scriptsCheckLastExitCode` turned on? (0.10.3+) * ChocolateyChecksum32 - Was `--download-checksum` passed? (0.10.0+) * ChocolateyChecksumType32 - Was `--download-checksum-type` passed? (0.10.0+) * ChocolateyChecksum64 - Was `--download-checksum-x64` passed? (0.10.0)+ @@ -531,37 +551,45 @@ The following are experimental or use not recommended: * http_proxy - Set by original `http_proxy` passthrough, or same as `ChocolateyProxyLocation` if explicitly set. (0.10.4+) * https_proxy - Set by original `https_proxy` passthrough, or same as `ChocolateyProxyLocation` if explicitly set. (0.10.4+) * no_proxy- Set by original `no_proxy` passthrough, or same as `ChocolateyProxyBypassList` if explicitly set. (0.10.4+) + * ChocolateyPackageFolder - Not for use in package automation scripts. Recommend using `$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"` as per template generated by `choco new` + * ChocolateyToolsLocation - Not for use in package automation scripts. Recommend using Get-ToolsLocation instead '@ $global:powerShellReferenceTOC | Out-File $fileName -Encoding UTF8 -Force Write-Host "Generating command reference markdown files" - Generate-CommandReference 'List' '60' - Generate-CommandReference 'Search' '100' - Generate-CommandReference 'Info' '40' - Generate-CommandReference 'Install' '50' - Generate-CommandReference 'Pin' '90' - Generate-CommandReference 'Outdated' '80' - Generate-CommandReference 'Upgrade' '200' - Generate-CommandReference 'Uninstall' '170' Generate-CommandReference 'Config' '10' - Generate-CommandReference 'Source' '120' - Generate-CommandReference 'Sources' '130' - Generate-CommandReference 'Feature' '30' - Generate-CommandReference 'Features' '35' + Generate-CommandReference 'Download' '20' + Generate-CommandReference 'Export' '30' + Generate-CommandReference 'Find' '35' + Generate-CommandReference 'Feature' '40' + Generate-CommandReference 'Features' '45' + Generate-CommandReference 'Help' '50' + Generate-CommandReference 'Info' '60' + Generate-CommandReference 'Install' '70' + Generate-CommandReference 'List' '80' + Generate-CommandReference 'Optimize' '90' + Generate-CommandReference 'Outdated' '100' + Generate-CommandReference 'Pin' '110' + Generate-CommandReference 'Search' '120' + Generate-CommandReference 'SetApiKey' '130' + Generate-CommandReference 'Source' '140' + Generate-CommandReference 'Sources' '150' + Generate-CommandReference 'Support' '160' + Generate-CommandReference 'Sync' '170' + Generate-CommandReference 'Synchronize' '180' + Generate-CommandReference 'Uninstall' '190' + Generate-CommandReference 'UnpackSelf' '200' + Generate-CommandReference 'Upgrade' '220' + Generate-CommandReference 'New' '10' Generate-CommandReference 'Pack' '20' Generate-CommandReference 'ApiKey' '30' - Generate-CommandReference 'SetApiKey' '110' Generate-CommandReference 'Push' '40' - Generate-CommandReference 'UnpackSelf' '180' - Generate-CommandReference 'Update' '190' - Generate-CommandReference 'Version' '210' - Generate-CommandReference 'Download' '20' - Generate-CommandReference 'Support' '140' - Generate-CommandReference 'Sync' '150' - Generate-CommandReference 'Synchronize' '160' - Generate-CommandReference 'Optimize' '70' + Generate-CommandReference 'Template' '50' + Generate-CommandReference 'Templates' '55' + Generate-CommandReference 'Convert' '60' + Generate-TopLevelCommandReference Move-GeneratedFiles diff --git a/Invoke-Tests.ps1 b/Invoke-Tests.ps1 new file mode 100644 index 0000000000..b11fb8524c --- /dev/null +++ b/Invoke-Tests.ps1 @@ -0,0 +1,124 @@ +#Requires -Module @{ ModuleName = 'pester'; ModuleVersion = '5.3.1' } +#Requires -RunAsAdministrator +<# + .SYNOPSIS + Extracts and "installs" Chocolatey nupkg package for testing with Pester. +#> +param( + # Path to place Chocolatey test related artifacts. + [string] + $TestPath = "$env:TEMP/chocolateyTests", + + # Path of the nupkg to be tested. Defaults to `code_drop/nuget/chocolatey.<version>.nupkg` + [ValidateScript({ + $count = (Get-Item $_).Count + if ($count -ne 1) { + throw "Expected 1 item, found $count" + } + $true + })] + [string] + $TestPackage, + + # Indicate to skip packaging all of the tests packages. Useful for running tests after you've performed the tests previously. + [switch] + $SkipPackaging +) +$packageRegex = 'chocolatey\.\d.*\.nupkg' + +# Use TstPkg as TestPackage has ValidateScript that can't be circumvented +if (-not $TestPackage) { + $TstPkg = Get-ChildItem $PSScriptRoot/code_drop/Packages/Chocolatey -Filter *.nupkg | Where-Object Name -Match $packageRegex +} +else { + $TstPkg = Get-ChildItem $TestPackage +} + +if (-not (Test-Path "$TestPath/packages") -or -not $SkipPackaging) { + $null = New-Item -Path "$TestPath/packages" -ItemType Directory -Force + # Get and pack packages + $nuspecs = Get-ChildItem -Path $PSScriptRoot/src/chocolatey.tests.integration, $PSScriptRoot/tests/packages -Recurse | Where-Object Name -Like '*.nuspec' + + foreach ($file in $nuspecs) { + Write-Host "Packaging $file" + $null = choco pack $file.FullName --out "$TestPath/packages" + } +} + +Copy-Item -Path $TstPkg.FullName -Destination $TestPath -Force +$nupkg = Get-ChildItem -Path "$TestPath/$($TstPkg.Name)" + +if (Test-Path "$TestPath\chocolatey") { + Write-Host "$TestPath\chocolatey already exists. Removing so we can continue installation successfully." + Remove-Item "$TestPath/chocolatey" -Recurse -Force +} + +try { + Push-Location $TestPath + Import-Module $PSScriptRoot\tests\helpers\common-helpers.psm1 -Force + Expand-ZipArchive -Source $nupkg.FullName -Destination ./chocolatey + Import-Module $TestPath/Chocolatey/tools/ChocolateyInstall/helpers/chocolateyInstaller.psm1 + Import-Module $TestPath/Chocolatey/tools/ChocolateySetup.psm1 + $environmentVariables = @{ + UserPath = Get-EnvironmentVariable -Name 'PATH' -Scope 'User' + UserChocolateyInstall = Get-EnvironmentVariable -Name 'ChocolateyInstall' -Scope 'User' + UserPSModulePath = Get-EnvironmentVariable -Name 'PSModulePath' -Scope 'User' + MachinePath = Get-EnvironmentVariable -Name 'PATH' -Scope 'Machine' + MachineChocolateyInstall = Get-EnvironmentVariable -Name 'ChocolateyInstall' -Scope 'Machine' + MachinePSModulePath = Get-EnvironmentVariable -Name 'PSModulePath' -Scope 'Machine' + } + + $env:ChocolateyInstall = "$TestPath/base" + $null = Initialize-Chocolatey + # It seems this is getting clobbered by Intialize-Chocolatey... No idea why... + $env:ChocolateyInstall = "$TestPath/base" + + Pop-Location + Push-Location $PSScriptRoot/tests + $env:PSModulePath = "$PSScriptRoot/tests;$env:PSModulePath" + + Import-Module $PSScriptRoot\tests\helpers\common-helpers.psm1 -Force + $null = Invoke-Choco source add --name hermes --source "$TestPath/packages" + Enable-ChocolateyFeature -Name allowGlobalConfirmation + $PesterConfiguration = [PesterConfiguration]@{ + Run = @{ + PassThru = $true + Path = "$PSScriptRoot/tests/chocolatey-tests" + } + TestResult = @{ + Enabled = $true + TestSuiteName = "Pester - Chocolatey" + } + Output = @{ + Verbosity = 'Minimal' + } + Filter = @{ + ExcludeTag = @( + 'Background' + 'Licensed' + 'CCM' + 'WIP' + 'NonAdmin' + 'Internal' + if (-not $env:VM_RUNNING -and -not $env:TEST_KITCHEN) { + 'VMOnly' + } + ) + } + } + + Invoke-Pester -Configuration $PesterConfiguration + +} +finally { + # For some reason we need to import this again... I'm not 100% sure on why... + Import-Module $TestPath/Chocolatey/tools/ChocolateyInstall/helpers/chocolateyInstaller.psm1 + # Put back Path and Chocolatey + Set-EnvironmentVariable -Name 'PATH' -Scope 'User' -Value $environmentVariables.UserPath + Set-EnvironmentVariable -Name 'ChocolateyInstall' -Scope 'User' -Value $environmentVariables.UserChocolateyInstall + Set-EnvironmentVariable -Name 'PSModulePath' -Scope 'User' -Value $environmentVariables.UserPSModulePath + Set-EnvironmentVariable -Name 'PATH' -Scope 'Machine' -Value $environmentVariables.MachinePath + Set-EnvironmentVariable -Name 'ChocolateyInstall' -Scope 'Machine' -Value $environmentVariables.MachineChocolateyInstall + Set-EnvironmentVariable -Name 'PSModulePath' -Scope 'Machine' -Value $environmentVariables.MachinePSModulePath + Pop-Location +} diff --git a/NOTICE b/NOTICE index 1ea7d30a96..5ed4024bd4 100644 --- a/NOTICE +++ b/NOTICE @@ -12,3 +12,7 @@ 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. + + Additional legal information and licenses used by Chocolatey CLI can be + found in the CREDITS file or at + https://github.com/chocolatey/choco/blob/develop/docs/legal/CREDITS.md diff --git a/README.md b/README.md index e23e79428f..aa396f4ee5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,11 @@ You can just call me choco. ![Chocolatey Logo](https://rawcdn.githack.com/chocolatey/choco/14a627932c78c8baaba6bef5f749ebfa1957d28d/docs/logo/chocolateyicon.gif "Chocolatey") -[![](https://img.shields.io/chocolatey/dt/chocolatey.svg)](https://community.chocolatey.org/packages/chocolatey) [![](https://img.shields.io/chocolatey/v/chocolatey.svg)](https://community.chocolatey.org/packages/chocolatey) [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/chocolatey/choco?label=docker&logo=docker&sort=semver)](https://hub.docker.com/r/chocolatey/choco) [![Project Stats](https://www.openhub.net/p/chocolatey/widgets/project_thin_badge.gif)](https://www.openhub.net/p/chocolatey) +[![](https://img.shields.io/chocolatey/dt/chocolatey.svg)](https://community.chocolatey.org/packages/chocolatey) +[![](https://img.shields.io/chocolatey/v/chocolatey.svg)](https://community.chocolatey.org/packages/chocolatey) +[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/chocolatey/choco?label=docker&logo=docker&sort=semver)](https://hub.docker.com/r/chocolatey/choco) +[![Project Stats](https://www.openhub.net/p/chocolatey/widgets/project_thin_badge.gif)](https://www.openhub.net/p/chocolatey) +[![Coverage Status](https://coveralls.io/repos/github/chocolatey/choco/badge.svg?branch=develop)](https://coveralls.io/github/chocolatey/choco?branch=develop) <!-- TOC --> @@ -29,16 +33,15 @@ You can just call me choco. <!-- /TOC --> ## Build Status -TeamCity | AppVeyor | Travis | GitHub Action -------------- | ------------- | ------------- | ------------- -[![TeamCity Build Status](https://img.shields.io/teamcity/codebetter/bt429.svg)](http://teamcity.codebetter.com/viewType.html?buildTypeId=bt429) | [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/jfxywa3xuwowt20w/branch/master?svg=true)](https://ci.appveyor.com/project/ferventcoder/choco/branch/master) | [![Travis Build Status](https://travis-ci.org/chocolatey/choco.svg?branch=master)](https://travis-ci.org/chocolatey/choco) | [![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/chocolatey/choco/Chocolatey%20Builds/master?logo=github)]((https://github.com/chocolatey/choco/actions/workflows/build.yml)) -## Chat Room -Come join in the conversation about Chocolatey in our Gitter Chat Room. +| GitHub Action | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/chocolatey/choco/Chocolatey%20Builds/develop?logo=github)](https://github.com/chocolatey/choco/actions/workflows/build.yml) | -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/chocolatey/choco?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +## Chat Room +Come join in the conversation about Chocolatey in our Community Chat Room. -Or, you can find us in IRC at #chocolatey on freenode. IRC is not as often checked by committers, so it is recommended you stick to Gitter if you need more timely assistance. +[![Discord](https://img.shields.io/discord/778552361454141460?logo=Discord)](https://ch0.co/community) Please make sure you've read over and agree with the [etiquette regarding communication](#etiquette-regarding-communication). @@ -61,7 +64,7 @@ If you are using a [commercial edition of Chocolatey](https://chocolatey.org/com ## Information * [Chocolatey Website and Community Package Repository](https://community.chocolatey.org) - * [Mailing List](http://groups.google.com/group/chocolatey) / [Release Announcements Only Mailing List](https://groups.google.com/group/chocolatey-announce) / [Build Status Mailing List](http://groups.google.com/group/chocolatey-build-status) + * [Mailing List](https://groups.google.com/group/chocolatey) / [Release Announcements Only Mailing List](https://groups.google.com/group/chocolatey-announce) / [Build Status Mailing List](http://groups.google.com/group/chocolatey-build-status) * [Twitter](https://twitter.com/chocolateynuget) / [Facebook](https://www.facebook.com/ChocolateySoftware) / [GitHub](https://github.com/chocolatey) * [Blog](https://blog.chocolatey.org/) / [Newsletter](https://chocolatey.us8.list-manage1.com/subscribe?u=86a6d80146a0da7f2223712e4&id=73b018498d) * [Documentation](https://docs.chocolatey.org/en-us/) / [Support](https://chocolatey.org/support) @@ -98,8 +101,8 @@ Prerequisites: * The issue has to do with choco itself and is not a package or website issue. * Please check to see if your issue already exists with a quick search of the issues. Start with one relevant term and then add if you get too many results. - * You are not submitting an "Enhancement". Enhancements should observe [CONTRIBUTING](https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md) guidelines. - * You are not submitting a question - questions are better served as [emails](https://groups.google.com/group/chocolatey) or [gitter chat questions](https://gitter.im/chocolatey/choco). + * You are not submitting an "Enhancement". Enhancements should observe [CONTRIBUTING](https://github.com/chocolatey/choco/blob/develop/CONTRIBUTING.md) guidelines. + * You are not submitting a question - questions are better served as [emails](https://groups.google.com/group/chocolatey) or [Community Chat questions](https://ch0.co/community-support). * Please make sure you've read over and agree with the [etiquette regarding communication](#etiquette-regarding-communication). Submitting a ticket: @@ -113,10 +116,10 @@ Submitting a ticket: * Include screenshots and/or animated gifs whenever possible, they help show us exactly what the problem is. ## Contributing -If you would like to contribute code or help squash a bug or two, that's awesome. Please familiarize yourself with [CONTRIBUTING](https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md). +If you would like to contribute code or help squash a bug or two, that's awesome. Please familiarize yourself with [CONTRIBUTING](https://github.com/chocolatey/choco/blob/develop/CONTRIBUTING.md). ## Committers -Committers, you should be very familiar with [COMMITTERS](https://github.com/chocolatey/choco/blob/master/COMMITTERS.md). +Committers, you should be very familiar with [COMMITTERS](https://github.com/chocolatey/choco/blob/develop/COMMITTERS.md). ### Compiling / Building Source There is a `build.bat`/`build.sh` file that creates a necessary generated file named `SolutionVersion.cs`. It must be run at least once before Visual Studio will build. @@ -139,7 +142,7 @@ Running the build on Windows should produce an artifact that is tested and ready ##### Prerequisites: * Install and configure Mono. Mono 5.20 or newer should work, see the Dockerfile for the currently recommended version. - * [Debian based](http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives) + * [Debian based](https://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives) ```sh # install prerequisites @@ -170,9 +173,9 @@ sudo apt-get install mono-devel -y * Consider adding the following to your `~/.profile` (or other relevant dot source file): ```sh -# mono +# Mono # http://www.michaelruck.de/2010/03/solving-pkg-config-and-mono-35-profile.html -# http://cloudgen.wordpress.com/2013/03/06/configure-nant-to-run-under-mono-3-06-beta-for-mac-osx/ +# https://cloudgen.wordpress.com/2013/03/06/configure-nant-to-run-under-mono-3-06-beta-for-mac-osx/ export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig:$PKG_CONFIG_PATH ``` @@ -189,5 +192,12 @@ chmod +x zip.sh Running the build on Mono produces an artifact similar to Windows but may have more rough edges. You may get a failure or two in the build script that can be safely ignored. +### Installing on Other Platforms: + + 1. Get a copy of the source code and build. + 1. Copy (or link) the contents of `./code_drop/temp/_PublishedApps/choco` to your preferred install directory. On Linux, the preferred directory is `/opt/chocolatey` + 1. Export the `ChocolateyInstall` environment variable, pointing to the install directory the build output was copied too. + 1. Copy `./docker/choco_wrapper` to a directory on the `$PATH`, rename to `choco`, and if the install directory is something else than `/opt/chocolatey`, then edit it to point to the correct path. + ## Credits Chocolatey is brought to you by quite a few people and frameworks. See [CREDITS](https://github.com/chocolatey/choco/blob/master/docs/legal/CREDITS.md) (just LEGAL/Credits.md in the zip folder). diff --git a/Scenarios.md b/Scenarios.md deleted file mode 100644 index ba7b16ba85..0000000000 --- a/Scenarios.md +++ /dev/null @@ -1,1095 +0,0 @@ -## Chocolatey Usage Scenarios - -### ChocolateyInstallCommand [ 35 Scenario(s), 293 Observation(s) ] - -#### when force installing a package that depends on an unavailable newer version of an installed dependency forcing dependencies - - * should contain a warning message that it was unable to install any packages - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - * should not upgrade the dependency - -#### when force installing an already installed package - - * config should match package result name - * should contain a warning message that it installed successfully - * should delete the rollback - * should have a successful package result - * should have a version of one dot zero dot zero - * should install the package in the lib directory - * should install the same version of the package - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should remove and re add the package files in the lib directory - -#### when force installing an already installed package forcing and ignoring dependencies - - * should contain a warning message that it installed successfully - * should have a successful package result - * should install a package in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should reinstall the exact same version of the package - * should remove the exact dependency - * should remove the floating dependency - -#### when force installing an already installed package forcing dependencies - - * should contain a warning message that it installed successfully - * should have a successful package result - * should install a package in the lib directory - * should install the dependency in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should reinstall the exact same version of the exact dependency - * should reinstall the exact same version of the package - * should reinstall the floating dependency with the latest version that satisfies the dependency - -#### when force installing an already installed package ignoring dependencies - - * should contain a warning message that it installed successfully - * should have a successful package result - * should install a package in the lib directory - * should install the dependency in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should not touch the exact dependency - * should not touch the floating dependency - * should reinstall the exact same version of the package - -#### when force installing an already installed package that errors - - * should contain a message that it was unsuccessful - * should delete the rollback - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should restore the backup version of the package - * should restore the original files in the package lib folder - -#### when force installing an already installed package with a read and delete share locked file - - * config should match package result name - * should contain a message that it installed successfully - * should have a successful package result - * should have a version of one dot zero dot zero - * should install where install location reports - * should not be able delete the rollback - * should not have inconclusive package result - * should not have warning package result - * should reinstall the package in the lib directory - * should reinstall the same version of the package - -#### when force installing an already installed package with dependencies - - * should contain a message that it installed successfully - * should have a successful package result - * should have a version of one dot zero dot zero - * should install a package in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should not upgrade the dependency - * should reinstall the exact same version of the package - * should still have the dependency in the lib directory - -#### when force installing an already installed package with with an exclusively locked file - - * [PENDING] should delete the rollback - * [PENDING] should not have a successful package result - * [PENDING] should not have warning package result - * should contain a message that it was unable to reinstall successfully - * should have a package installed in the lib directory - * should have inconclusive package result - * should still have the package installed with the expected version of the package - -#### when installing a package from a nupkg file - - * config should match package result name - * should contain a warning message that it installed successfully - * should create a shim for console in the bin directory - * should create a shim for graphical in the bin directory - * should have a console shim that is set for non gui access - * should have a graphical shim that is set for gui access - * should have a successful package result - * should have a version of one dot zero dot zero - * should install the expected version of the package - * should install the package in the lib directory - * should install where install location reports - * should not create a shim for ignored executable in the bin directory - * should not create a shim for mismatched case ignored executable in the bin directory - * should not create an extensions folder for the package - * should not have inconclusive package result - * should not have warning package result - -#### when installing a package happy path - - * config should match package result name - * should contain a warning message that it installed successfully - * should create a shim for console in the bin directory - * should create a shim for graphical in the bin directory - * should have a console shim that is set for non gui access - * should have a graphical shim that is set for gui access - * should have a successful package result - * should have a version of one dot zero dot zero - * should have executed chocolateyInstall script - * should install the expected version of the package - * should install the package in the lib directory - * should install where install location reports - * should not create a shim for ignored executable in the bin directory - * should not create a shim for mismatched case ignored executable in the bin directory - * should not create an extensions folder for the package - * should not have inconclusive package result - * should not have warning package result - -#### when installing a package ignoring dependencies that cannot be found - - * config should match package result name - * should contain a warning message that it installed successfully - * should have a successful package result - * should install a package in the lib directory - * should install the expected version of the package - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should not install the dependency in the lib directory - -#### when installing a package that depends on a newer version of an installed dependency - - * should contain a warning message that it installed successfully - * should have a successful package result - * should install a package in the lib directory - * should install the dependency in the lib directory - * should install the expected version of the package - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should upgrade the dependency - -#### when installing a package that depends on an unavailable newer version of an installed dependency - - * should contain a message that is was unable to install any packages - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install the package in the lib directory - -#### when installing a package that depends on an unavailable newer version of an installed dependency ignoring dependencies - - * should contain a message that it installed successfully - * should have a successful package result - * should install a package in the lib directory - * should install the expected version of the package - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - -#### when installing a package that does not exist - - * should contain a warning message that it was unable to install a package - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - -#### when installing a package that errors - - * should contain a warning message that it was unable to install a package - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - * should put a package in the lib bad directory - -#### when installing a package that exists but a version that does not exist - - * should contain a warning message that it did not install successfully - * should have a version of one dot zero dot one - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - -#### when installing a package that has nonterminating errors - - * config should match package result name - * should contain a message that it installed successfully - * should have a successful package result - * should have a version of one dot zero - * should install the expected version of the package - * should install the package in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - -#### when installing a package that has nonterminating errors with fail on stderr - - * should contain a warning message that it was unable to install a package - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - * should put a package in the lib bad directory - -#### when installing a package with a dependent package that also depends on a less constrained but still valid dependency of the same package - - * [PENDING] should contain a message that everything installed successfully - * [PENDING] should have a successful package result - * [PENDING] should install a package in the lib directory - * [PENDING] should install the dependency in the lib directory - * [PENDING] should install the expected version of the constrained dependency - * [PENDING] should install the expected version of the dependency - * [PENDING] should install where install location reports - * [PENDING] should not have inconclusive package result - * [PENDING] should not have warning package result - -#### when installing a package with config transforms - - * should add the insert value in the config due to XDT InsertIfMissing - * should change the testReplace value in the config due to XDT Replace - * should contain a warning message that it installed successfully - * should have a successful package result - * should have a version of one dot zero dot zero - * should install the expected version of the package - * should not change the test value in the config due to XDT InsertIfMissing - * should not have inconclusive package result - * should not have warning package result - -#### when installing a package with dependencies and dependency cannot be found - - * should contain a warning message that it was unable to install any packages - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - * should not install the dependency in the lib directory - -#### when installing a package with dependencies happy - - * should contain a message that everything installed successfully - * should have a successful package result - * should have a version of one dot zero dot zero - * should install a package in the lib directory - * should install the dependency in the lib directory - * should install the expected version of the dependency - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - -#### when installing a package with dependencies on a newer version of a package than an existing package has with that dependency - - * should contain a message that it installed successfully - * should have a successful package result - * should install a package in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - * should upgrade the dependency - -#### when installing a package with dependencies on a newer version of a package than are allowed by an existing package with that dependency - - * [PENDING] should contain a message that it was unable to install any packages - * [PENDING] should have an error package result - * [PENDING] should not have a successful package result - * [PENDING] should not have inconclusive package result - * [PENDING] should not have warning package result - * [PENDING] should not install the conflicting package - * [PENDING] should not install the conflicting package in the lib directory - * [PENDING] should not upgrade the exact version dependency - * [PENDING] should not upgrade the minimum version dependency - -#### when installing a package with dependencies on an older version of a package than is already installed - - * [PENDING] should contain a message that it was unable to install any packages - * [PENDING] should have an error package result - * [PENDING] should not have a successful package result - * [PENDING] should not have inconclusive package result - * [PENDING] should not have warning package result - * [PENDING] should not install the conflicting package in the lib directory - * [PENDING] should not upgrade the exact version dependency - -#### when installing a package with no sources enabled - - * should have no sources enabled result - * should not install any packages - -#### when installing a side by side package - - * config should match package result name - * should contain a warning message that it installed successfully - * should have a successful package result - * should have a version of one dot zero dot zero - * should install a package in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - -#### when installing an already installed package - - * should ave warning package result - * should contain a message about force to reinstall - * should contain a warning message that it was unable to install any packages - * should have inconclusive package result - * should still have a package in the lib directory - * should still have the expected version of the package installed - -#### when installing packages with packages config - - * should contain a message that upgradepackage with an expected specified version was installed - * should contain a warning message that it installed 4 out of 5 packages successfully - * should have a successful package result for all but expected missing package - * should install expected packages in the lib directory - * should install the dependency in the lib directory - * should install where install location reports - * should not have a successful package result for missing package - * should not have inconclusive package result - * should not have warning package result - * should print out package from config file in message - * should specify config file is being used in message - -#### when noop installing a package - - * should contain a message that it would have run a powershell script - * should contain a message that it would have used Nuget to install a package - * should not contain a message that it would have run powershell modification script - * should not install a package in the lib directory - -#### when noop installing a package that does not exist - - * should contain a message that it was unable to find package - * should contain a message that it would have used Nuget to install a package - * should not install a package in the lib directory - -#### when switching a normal package to a side by side package - - * config should match package result name - * should contain a warning message that it installed successfully - * should have a successful package result - * should have a version of one dot zero dot zero - * should install a package in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - -#### when switching a side by side package to a normal package - - * config should match package result name - * should contain a warning message that it installed successfully - * should have a successful package result - * should have a version of one dot zero dot zero - * should install a package in the lib directory - * should install where install location reports - * should not have inconclusive package result - * should not have warning package result - -### ChocolateyListCommand [ 13 Scenario(s), 56 Observation(s) ] - -#### when listing local packages - - * should contain a summary - * should contain debugging messages - * should contain packages and versions with a space between them - * should not contain packages and versions with a pipe between them - -#### when listing local packages limiting output - - * should contain packages and versions with a pipe between them - * should not contain a summary - * should not contain debugging messages - * should not contain packages and versions with a space between them - * should only have messages related to package information - -#### when listing local packages limiting output with id only - - * should contain packages id - * should not contain any version number - * should not contain pipe - -#### when listing local packages with id only - - * should contain package name - * should not contain any version number - -#### when listing packages with no sources enabled - - * should have no sources enabled result - * should not list any packages - -#### when searching all available packages - - * should contain a summary - * should contain debugging messages - * should contain packages and versions with a space between them - * should list available packages as many times as they show on the feed - * should not contain packages and versions with a pipe between them - -#### when searching for a particular package - - * should contain a summary - * should contain debugging messages - * should contain packages and versions with a space between them - * should not contain packages that do not match - -#### when searching for all packages including prerelease with exact id - - * should find all versions in descending order - * should find only packages with exact id - * should find three results - * should not error - -#### when searching for all packages with exact id - - * should find all non prerelease versions in descending order - * should find only packages with exact id - * should find two results - * should not error - -#### when searching for an exact package - - * should contain a summary - * should contain debugging messages - * should contain packages and versions with a space between them - * should find exactly one result - * should not contain packages that do not match - * should not error - -#### when searching for an exact package with zero results - - * should contain a summary - * should contain debugging messages - * should not contain packages that do not match - * should not error - * should not have any results - -#### when searching packages with no filter happy path - - * should contain a summary - * should contain debugging messages - * should contain packages and versions with a space between them - * should list available packages only once - * should not contain packages and versions with a pipe between them - -#### when searching packages with verbose - - * should contain a summary - * should contain debugging messages - * should contain description - * should contain download counts - * should contain packages and versions with a space between them - * should contain tags - * should not contain packages and versions with a pipe between them - -### ChocolateyPackCommand [ 3 Scenario(s), 6 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 with properties - - * generated package should be in current directory - * property settings should be logged as debug messages - -#### 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) ] - -#### when listing pins with an existing pin - - * should contain existing pin messages - * should not contain list results - -#### when listing pins with existing pins - - * should contain a pin message for each existing pin - * should not contain list results - -#### when listing pins with no pins - - * should not contain any pins by default - * should not contain list results - -#### when removing a pin for a non installed package - - * should throw an error about not finding the package - -#### when removing a pin for a pinned package - - * should contain success message - -#### when removing a pin for an unpinned package - - * should contain nothing to do message - -#### when setting a pin for a non installed package - - * should throw an error about not finding the package - -#### when setting a pin for an already pinned package - - * should contain nothing to do message - -#### when setting a pin for an installed package - - * should contain success message - -### ChocolateyUninstallCommand [ 13 Scenario(s), 93 Observation(s) ] - -#### when force uninstalling a package - - * config should match package result name - * should contain a warning message that it uninstalled successfully - * should delete a shim for console in the bin directory - * should delete a shim for graphical in the bin directory - * should delete the rollback - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should remove the package from the lib directory - -#### when force uninstalling a package with added and changed files - - * config should match package result name - * should contain a warning message that it uninstalled successfully - * should delete a shim for console in the bin directory - * should delete a shim for graphical in the bin directory - * should delete the rollback - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not keep the added file - * should not keep the changed file - * should remove the package from the lib directory - -#### when noop uninstalling a package - - * should contain a message that it would have run a powershell script - * should contain a message that it would have run powershell modification script - * should contain a message that it would have uninstalled a package - * should not uninstall a package from the lib directory - -#### when noop uninstalling a package that does not exist - - * should contain a message that it was unable to find package - -#### when uninstalling a package happy path - - * config should match package result name - * should contain a warning message that it uninstalled successfully - * should delete a shim for console in the bin directory - * should delete a shim for graphical in the bin directory - * should delete any files created during the install - * should delete the rollback - * should have a successful package result - * should have executed chocolateyBeforeModify script - * should have executed chocolateyUninstall script - * should not have inconclusive package result - * should not have warning package result - * should remove the package from the lib directory - -#### when uninstalling a package that does not exist - - * should contain a message that it was unable to find package - * should contain a warning message that it uninstalled successfully - * should have an error package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - -#### when uninstalling a package that errors - - * should contain a warning message that it was unable to install a package - * should have an error package result - * should have expected error in package result - * should not delete the rollback - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not put the package in the lib bad directory - * should not remove package from the lib directory - * should still have the package file in the directory - -#### when uninstalling a package with a read and delete share locked file - - * should contain a message that it uninstalled successfully - * should have a successful package result - * should not be able delete the rollback - * should not have inconclusive package result - * should not have warning package result - * should uninstall the package from the lib directory - -#### when uninstalling a package with added files - - * config should match package result name - * should contain a warning message that it uninstalled successfully - * should delete a shim for console in the bin directory - * should delete a shim for graphical in the bin directory - * should delete everything but the added file from the package directory - * should delete the rollback - * should have a successful package result - * should keep the added file - * should not have inconclusive package result - * should not have warning package result - -#### when uninstalling a package with an exclusively locked file - - * should contain a message that it was not able to uninstall - * should contain old files in directory - * should delete the rollback - * should not be able to remove the package from the lib directory - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - -#### when uninstalling a package with changed files - - * config should match package result name - * should contain a warning message that it uninstalled successfully - * should delete a shim for console in the bin directory - * should delete a shim for graphical in the bin directory - * should delete everything but the changed file from the package directory - * should delete the rollback - * should have a successful package result - * should keep the changed file - * should not have inconclusive package result - * should not have warning package result - -#### when uninstalling a package with readonly files - - * should contain a message that it uninstalled successfully - * should delete the rollback - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should uninstall the package from the lib directory - -#### when uninstalling packages with packages config - - * should throw an error that it is not allowed - -### ChocolateyUpgradeCommand [ 36 Scenario(s), 295 Observation(s) ] - -#### when force upgrading a package - - * config should match package result name - * should contain a warning message that it upgraded successfully - * should contain a warning message with old and new versions - * should contain newer version in directory - * should delete the rollback - * should have a successful package result - * should match the upgrade version of one dot one dot zero - * should not have inconclusive package result - * should not have warning package result - * should upgrade a package in the lib directory - * should upgrade the package - * should upgrade where install location reports - -#### when force upgrading a package that does not have available upgrades - - * should be the same version of the package - * should contain a message that the package was upgraded - * should contain a message that you have the latest version available - * should have a successful package result - * should match the existing version of one dot zero dot zero - * should not create a rollback - * should not have inconclusive package result - * should not have warning package result - * should not remove the package from the lib directory - -#### when noop upgrading a package that does not exist - - * should contain a message that no packages can be upgraded - * should contain a message the package was not found - -#### when noop upgrading a package that does not have available upgrades - - * should contain a message that no packages can be upgraded - * should contain a message that you have the latest version available - * should not create a rollback - -#### when noop upgrading a package that has available upgrades - - * should contain a message that a new version is available - * should contain a message that a package can be upgraded - * should contain older version in directory - * should not create a rollback - -#### when upgrading a dependency happy - - * should contain a message the dependency upgraded successfully - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not upgrade the exact version dependency - * should not upgrade the parent package - * should upgrade the package - -#### when upgrading a dependency legacy folder version - - * should contain a message the dependency upgraded successfully - * should have a successful package result - * should leave the exact version package as legacy folder - * should leave the parent package as legacy folder - * should not add a versionless exact version package folder to the lib dir - * should not add a versionless parent package folder to the lib dir - * should not have inconclusive package result - * should not have warning package result - * should not upgrade the exact version dependency - * should not upgrade the parent package - * should remove the legacy folder version of the package - * should replace the legacy folder version of the package with a lib package folder that has no version - * should upgrade the package - -#### when upgrading a dependency with parent that depends on a range less than upgrade version - - * should contain a message that everything upgraded successfully - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should upgrade the exact version dependency - * should upgrade the package - * should upgrade the parent package to lowest version that meets new dependency version - -#### when upgrading a legacy folder dependency with parent that depends on a range less than upgrade version - - * [PENDING] should remove the legacy folder version of the exact version package - * [PENDING] should remove the legacy folder version of the parent package - * should contain a message that everything upgraded successfully - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should remove the legacy folder version of the package - * should replace the legacy folder version of the exact version package with a lib package folder that has no version - * should replace the legacy folder version of the package with a lib package folder that has no version - * should replace the legacy folder version of the parent package with a lib package folder that has no version - * should upgrade the exact version dependency - * should upgrade the package - * should upgrade the parent package to lowest version that meets new dependency version - -#### when upgrading a package that does not exist - - * should contain a message that no packages were upgraded - * should contain a message the package was not found - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - -#### when upgrading a package that does not have available upgrades - - * should be the same version of the package - * should contain a message that no packages were upgraded - * should contain a message that you have the latest version available - * should have a successful package result - * should have inconclusive package result - * should match the existing version of one dot zero dot zero - * should not create a rollback - * should not have warning package result - * should not remove the package from the lib directory - -#### when upgrading a package that errors - - * should contain a warning message that it was unable to upgrade a package - * should delete the rollback - * should have an error package result - * should have expected error in package result - * should have the erroring upgraded package in the lib bad directory - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not remove package from the lib directory - * should not upgrade the package - * should put the package in the lib bad directory - -#### when upgrading a package that is not installed - - * should contain a warning message that it upgraded successfully - * should have a successful package result - * should install a package in the lib directory - * should install where install location reports - * should not have a rollback directory - * should not have inconclusive package result - * should not have warning package result - -#### when upgrading a package that is not installed and failing on not installed - - * should contain a warning message that it was unable to upgrade a package - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not install a package in the lib directory - -#### when upgrading a package with a read and delete share locked file - - * should contain a warning message that it upgraded successfully - * should contain a warning message with old and new versions - * should contain newer version in directory - * should have a successful package result - * should not be able delete the rollback - * should not have inconclusive package result - * should not have warning package result - * should upgrade a package in the lib directory - * should upgrade the package - * should upgrade where install location reports - -#### when upgrading a package with added files - - * should contain a warning message that it upgraded successfully - * should contain newer version in directory - * should have a successful package result - * should keep the added file - * should match the upgrade version of one dot one dot zero - * should not have inconclusive package result - * should not have warning package result - * should upgrade the package - -#### when upgrading a package with an exclusively locked file - - * should contain a warning message that it was not able to upgrade - * should contain a warning message with old and new versions - * should contain old version in directory - * should delete the rollback - * should have a package installed in the lib directory - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not upgrade the package - -#### when upgrading a package with changed files - - * should contain a warning message that it upgraded successfully - * should contain newer version in directory - * should have a successful package result - * should match the upgrade version of one dot one dot zero - * should not have inconclusive package result - * should not have warning package result - * should update the changed file - * should upgrade the package - -#### when upgrading a package with config transforms - - * should add the insertNew value in the config due to XDT InsertIfMissing - * should change the testReplace value in the config due to XDT Replace - * should contain a warning message that it upgraded successfully - * should have a successful package result - * should match the upgrade version of one dot one dot zero - * should not change the insert value in the config due to upgrade and XDT InsertIfMissing - * should not change the test value in the config from original one dot zero dot zero due to upgrade and XDT InsertIfMissing - * should not have inconclusive package result - * should not have warning package result - * should upgrade the package - -#### when upgrading a package with config transforms when config was edited - - * should add the insertNew value in the config due to XDT InsertIfMissing - * should change the testReplace value in the config due to XDT Replace - * should contain a warning message that it upgraded successfully - * should have a config with the comment from the original - * should have a successful package result - * should match the upgrade version of one dot one dot zero - * should not change the insert value in the config due to upgrade and XDT InsertIfMissing - * should not change the test value in the config from original one dot zero dot zero due to upgrade and XDT InsertIfMissing - * should not have inconclusive package result - * should not have warning package result - * should upgrade the package - -#### when upgrading a package with dependencies happy - - * should contain a message that everything upgraded successfully - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should upgrade the exact version dependency - * should upgrade the minimum version dependency - * should upgrade the package - -#### when upgrading a package with no sources enabled - - * should have no sources enabled result - * should not have any packages upgraded - -#### when upgrading a package with readonly files - - * should contain a warning message that it upgraded successfully - * should contain a warning message with old and new versions - * should contain newer version in directory - * should delete the rollback - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should upgrade a package in the lib directory - * should upgrade the package - * should upgrade where install location reports - -#### when upgrading a package with unavailable dependencies - - * should contain a message that it was unable to upgrade anything - * should have an error package result - * should have expected error in package result - * should not have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not upgrade the exact version dependency - * should not upgrade the minimum version dependency - * should not upgrade the package - -#### when upgrading a package with unavailable dependencies ignoring dependencies - - * should contain a message that it upgraded only the package successfully - * should have a successful package result - * should not have inconclusive package result - * should not have warning package result - * should not upgrade the exact version dependency - * should not upgrade the minimum version dependency - * should upgrade the package - -#### when upgrading all packages happy path - - * should report for all installed packages - * should skip packages without upgrades - * should upgrade packages with upgrades - -#### when upgrading all packages with except - - * should report for all non skipped packages - * should skip packages in except list - -#### when upgrading all packages with prereleases installed - - * should report for all installed packages - * should skip packages without upgrades - * should upgrade packages with upgrades - * should upgrade upgradepackage - -#### when upgrading all packages with prereleases installed with excludeprerelease specified - - * should not upgrade upgradepackage - * should report for all installed packages - * should skip packages without upgrades - * should upgrade packages with upgrades - -#### when upgrading an existing package happy path - - * config should match package result name - * should contain a warning message that it upgraded successfully - * should contain a warning message with old and new versions - * should contain newer version in directory - * should delete the rollback - * should have a successful package result - * should have executed chocolateyBeforeModify before chocolateyInstall - * should have executed chocolateyBeforeModify script for original package - * should have executed chocolateyInstall script for new package - * should match the upgrade version of one dot one dot zero - * should not have executed chocolateyBeforeModify script for new package - * should not have executed chocolateyUninstall script for original package - * should not have inconclusive package result - * should not have warning package result - * should upgrade a package in the lib directory - * should upgrade the package - * should upgrade where install location reports - -#### when upgrading an existing package with prerelease available and prerelease specified - - * config should match package result name - * should contain a warning message that it upgraded successfully - * should contain a warning message with old and new versions - * should contain newer version in directory - * should delete the rollback - * should have a successful package result - * should have executed chocolateyBeforeModify before chocolateyInstall - * should have executed chocolateyBeforeModify script for original package - * should have executed chocolateyInstall script for new package - * should match the upgrade version of the new beta - * should not have executed chocolateyBeforeModify script for new package - * should not have executed chocolateyUninstall script for original package - * should not have inconclusive package result - * should not have warning package result - * should upgrade a package in the lib directory - * should upgrade the package - * should upgrade where install location reports - -#### when upgrading an existing package with prerelease available without prerelease specified - - * should be the same version of the package - * should contain a message that no packages were upgraded - * should contain a message that you have the latest version available - * should have a successful package result - * should have inconclusive package result - * should match the original package version - * should not create a rollback - * should not have warning package result - * should not remove the package from the lib directory - -#### when upgrading an existing prerelease package with allow downgrade with excludeprelease and without prerelease specified - - * should be the same version of the package - * should contain a message that no packages were upgraded - * should contain a message that you have the latest version available - * should have a successful package result - * should have inconclusive package result - * should not create a rollback - * should not have warning package result - * should not remove the package from the lib directory - * should only find the last stable version - -#### when upgrading an existing prerelease package with prerelease available with excludeprelease and without prerelease specified - - * should be the same version of the package - * should contain a message that no packages were upgraded - * should contain a message that you have the latest version available - * should have a successful package result - * should have inconclusive package result - * should not create a rollback - * should not have warning package result - * should not remove the package from the lib directory - * should only find the last stable version - -#### when upgrading an existing prerelease package without prerelease specified - - * config should match package result name - * should contain a warning message that it upgraded successfully - * should contain a warning message with old and new versions - * should contain newer version in directory - * should delete the rollback - * should have a successful package result - * should have executed chocolateyBeforeModify before chocolateyInstall - * should have executed chocolateyBeforeModify script for original package - * should have executed chocolateyInstall script for new package - * should match the upgrade version of the new beta - * should not have executed chocolateyBeforeModify script for new package - * should not have executed chocolateyUninstall script for original package - * should not have inconclusive package result - * should not have warning package result - * should upgrade a package in the lib directory - * should upgrade the package - * should upgrade where install location reports - -#### when upgrading packages with packages config - - * should throw an error that it is not allowed diff --git a/ScriptFormat.Tests.ps1 b/ScriptFormat.Tests.ps1 new file mode 100644 index 0000000000..603190b686 --- /dev/null +++ b/ScriptFormat.Tests.ps1 @@ -0,0 +1,75 @@ +#Requires -Module @{ ModuleName = 'pester'; ModuleVersion = '5.3.1' } + +Describe "Verifying integrity of module files" { + BeforeDiscovery { + $FilesToVerify = Get-ChildItem -Include '*.psm1', '*.ps1' -Recurse + $DirectoriesToExclude = @( + # These directories contain dependencies we bring in, we don't control their file formats + 'lib' + 'packages' + '.nuget' + # These directories contain output of builds, if there's anything in these with "bad" formatting it's likely an old build, or not relevant + 'bin' + 'obj' + # This directory currently contains scripts to assist in creating the docker container. It is not formatted and should not require signing (at this time) + 'docker' + # These directories contain uppercut configurations. Here be dragons + '.build' + '.build.custom' + # GitHub/git configs. No PowerShell here? + '.github' + '.git' + ) + $Slash = [System.IO.Path]::DirectorySeparatorChar + $FilesBeingTested = $FilesToVerify | Where-Object { $null -ne $env:CHOCO_TEST_ALL -or $_.FullName -notmatch "\$Slash($($DirectoriesToExclude -join '|'))\$Slash" } + } + + BeforeAll { + function Get-FileEncoding { + <# + .SYNOPSIS + Tests a file for encoding. + + .DESCRIPTION + Tests a file for encoding. + + .PARAMETER Path + The file to test + #> + [CmdletBinding()] + Param ( + [Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)] + [Alias('FullName')] + [string] + $Path + ) + + if ($PSVersionTable.PSVersion.Major -lt 6) { + [byte[]]$byte = get-content -Encoding byte -ReadCount 4 -TotalCount 4 -Path $Path + } + else { + [byte[]]$byte = Get-Content -AsByteStream -ReadCount 4 -TotalCount 4 -Path $Path + } + + if ($byte[0] -eq 0xef -and $byte[1] -eq 0xbb -and $byte[2] -eq 0xbf) { 'UTF8 BOM' } + elseif ($byte[0] -eq 0xfe -and $byte[1] -eq 0xff) { 'Unicode' } + elseif ($byte[0] -eq 0 -and $byte[1] -eq 0 -and $byte[2] -eq 0xfe -and $byte[3] -eq 0xff) { 'UTF32' } + elseif ($byte[0] -eq 0x2b -and $byte[1] -eq 0x2f -and $byte[2] -eq 0x76) { 'UTF7' } + else { 'Unknown' } + } + } + + Context "Validating PowerShell file <_.FullName>" -Foreach $FilesBeingTested { + BeforeAll { + $FileUnderTest = $_ + } + + It "Should have Byte Order Mark" { + Get-FileEncoding -Path $FileUnderTest.FullName | Should -Be 'UTF8 BOM' + } + + It "Should have 'CRLF' Line Endings" { + (Get-Content $FileUnderTest -Raw) -match '([^\r]\n|\r[^\n])' | Should -BeFalse + } + } +} diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 0000000000..8fd01f0ca6 --- /dev/null +++ b/TESTING.md @@ -0,0 +1,35 @@ +# Testing Chocolatey + +Tests for Chocolatey are written in C# or in PowerShell depending on what type of test is being created. + +* NUnit Unit Tests are written in C# and found in the `chocolatey.tests` project. They are individual tests of the various Chocolatey components. +* NUnit Integration tests are written in C# and found in the `chocolatey.tests.integration` project. They are tests of various Chocolatey components that reach outside of Chocolatey. +* Pester test are written in PowerShell and found in the `tests` directory of the repository. They test the overall integration of Chocolatey into a larger system. + +## Running Tests + +### NUnit Tests + +The NUnit tests get run automatically when you run `./build.bat` or `./build.sh`, and you can also run them without completing the full build process by running `./build.bat --target=test-nunit --exclusive`, or `./build.sh --target=test-nunit --exclusive`. + +### NUnit Integration Tests + +If you need to run the integration tests, you can do so using: `./build.bat --target=test-nunit --exclusive --testExecutionType=integration --shouldRunOpenCover=false`, or `./build.sh --target=test-nunit --exclusive --testExecutionType=integration --shouldRunOpenCover=false`. + +### All NUnit Integration Tests + +If you need to run all the tests, you can do so using: `./build.bat --target=test-nunit --exclusive --testExecutionType=all --shouldRunOpenCover=false`, or `./build.sh --target=test-nunit --exclusive --testExecutionType=all --shouldRunOpenCover=false`. + +The `shouldRunOpenCover` argument is required when running the integration tests because some of the integration tests rely on the standard output and error output, which is not available when run via OpenCover. This switch changes the NUnit tests to run on NUnit directly, instead of on NUnit via OpenCover. + +### Skipping NUnit Tests + +If you need to skip the execution of tests, you can run the following: `./build.bat --testExecutionType=none`, or `./build.sh --testExecutionType=none`. + +### Pester Tests + +The Pester tests have been modelled in a way to be testable without installing Chocolatey to your local system. We have made efforts to prevent installing software with the tests, or at least uninstalling any that is installed. That being said, we also provide a `Vagrantfile` with a base configuration that will build the Chocolatey package (inside the VM) and run the tests for you. + +To run them locally on your system: Open an administrative PowerShell prompt to the root of the repository, and run `./Invoke-Tests.ps1`. This script will then "install" Chocolatey to a temporary test directory, run the tests, and when complete attempt to restore the system as close to when it started as possible. The script takes the following parameters: `TestPath` The location to use as the base for the Chocolatey Tests, defaults to `$env:TEMP\chocolateyTests`. `TestPackage` The path to the `.nupkg` package to run tests against, defaults to `$chocolateyRepository\code_drop\nuget\chocolatey.<version>.nupkg`. `SkipPackaging` Optionally skip the packaging of the test packages. + +To use the `Vagrantfile` you need to change directory into the `tests` directory, then run `vagrant up`. The Vagrantfile has been tested with VirtualBox. The [box being used](https://app.vagrantup.com/StefanScherer/boxes/windows_2019) is currently only updated for vmware_desktop and virtualbox providers, but there is a dated hyperv one that should work. diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8f252f56d3..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,48 +0,0 @@ -version: 1.0.0.{build} -clone_depth: 5 -init: -- git config --global user.email "chocolatey@realdimensions.net" -- git config --global user.name "Chocolatey yo" -nuget: - disable_publish_on_pr: true -environment: - COVERALLS_REPO_TOKEN: - secure: GWDFHkyZwDvbtYzPCHt29njjcm1blAwuTcbT0IEyJZoRSC/soUAa8dwXIlA6l/Fj -build_script: -- build.bat -v -test: - categories: - except: - - ignore - - Ignore - - NotWorking - - notworking -artifacts: -- path: build_output\build_artifacts\compile\msbuild-net-4.0-results.xml - name: Compile.xml -- path: build_output\build_artifacts\tests\index.html - name: NUnitResults.html -- path: build_output\build_artifacts\codecoverage\Html\index.htm - name: OpenCoverResults.htm -- path: build_output\_BuildInfo.xml - name: BuildInfo.xml -- path: build_output\build.log - name: DetailedBuildLog.log -- path: code_drop\build_artifacts\ilmerge\ilmerge.log - name: ILMerge.log -- path: code_drop\build_artifacts\ilmerge\ilmergedll.log - name: ILMergeDLL.log -- path: code_drop\nuget\*.nupkg -notifications: -- provider: Email - to: - - chocolatey-build-status@googlegroups.com - subject: AppVeyor - choco Build Notification - on_build_success: false - on_build_failure: true - on_build_status_changed: true -- provider: Webhook - url: https://webhooks.gitter.im/e/ef0d02785675d16d0cad - on_build_success: true - on_build_failure: true - on_build_status_changed: true diff --git a/build.bat b/build.bat index ba1bb0bc7e..8a69bbd674 100644 --- a/build.bat +++ b/build.bat @@ -1,33 +1,11 @@ -@echo off - -::Project UppercuT - http://uppercut.googlecode.com -::No edits to this file are required - http://uppercut.pbwiki.com - -if '%1' == '/?' goto usage -if '%1' == '-?' goto usage -if '%1' == '?' goto usage -if '%1' == '/help' goto usage - -SET DIR=%cd% -SET BUILD_DIR=%~d0%~p0% -SET NANT="%BUILD_DIR%lib\Nant\nant.exe" -SET build.config.settings="%DIR%\.uppercut" - -%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\default.build" -D:build.config.settings=%build.config.settings% %* - -if %ERRORLEVEL% NEQ 0 goto errors - -call %DIR%\documentscenarios.bat - -goto finish - -:usage -echo. -echo Usage: build.bat -echo. -goto finish - -:errors -EXIT /B %ERRORLEVEL% - -:finish \ No newline at end of file +@echo off +set psscript="%~dp0build.ps1" +echo ================================================== +echo ============= WRAP POWERSHELL SCRIPT ============= +echo ================================================== + +echo calling %psscript% with args %* +PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%psscript%' %*" +set buildstatus=%ERRORLEVEL% +echo ================================================== +exit /b %buildstatus% \ No newline at end of file diff --git a/build.debug.bat b/build.debug.bat index 12355ea50e..417cf087bf 100644 --- a/build.debug.bat +++ b/build.debug.bat @@ -1,35 +1,11 @@ @echo off - -::Project UppercuT - http://uppercut.googlecode.com -::No edits to this file are required - http://uppercut.pbwiki.com - -if '%1' == '/?' goto usage -if '%1' == '-?' goto usage -if '%1' == '?' goto usage -if '%1' == '/help' goto usage - -SET DIR=%cd% -SET BUILD_DIR=%~d0%~p0% -SET NANT="%BUILD_DIR%lib\Nant\nant.exe" -SET build.config.settings="%DIR%\.uppercut" - -%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\default.build" -D:build.config.settings=%build.config.settings% -D:msbuild.configuration="Debug" -D:run.nuget="false" -D:test.framework="None" -D:cover.framework="None" -D:run.codesign="false" %* - -::#-D:run.ilmerge="false" - -if %ERRORLEVEL% NEQ 0 goto errors - -call %DIR%\documentscenarios.bat - -goto finish - -:usage -echo. -echo Usage: build.bat -echo. -goto finish - -:errors -EXIT /B %ERRORLEVEL% - -:finish \ No newline at end of file +set psscript="%~dp0build.ps1" +echo ================================================== +echo ============= WRAP POWERSHELL SCRIPT ============= +echo ================================================== + +echo calling %psscript% with args %* +PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%psscript%' -Configuration Debug %*" +set buildstatus=%ERRORLEVEL% +echo ================================================== +exit /b %buildstatus% diff --git a/build.debug.sh b/build.debug.sh new file mode 100755 index 0000000000..ea7734a596 --- /dev/null +++ b/build.debug.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eo pipefail + +./build.sh --configuration=Debug $* \ No newline at end of file diff --git a/build.official.bat b/build.official.bat index d2abb676fe..66bad5bb0f 100644 --- a/build.official.bat +++ b/build.official.bat @@ -1,33 +1,11 @@ @echo off - -::Project UppercuT - http://uppercut.googlecode.com -::No edits to this file are required - http://uppercut.pbwiki.com - -if '%1' == '/?' goto usage -if '%1' == '-?' goto usage -if '%1' == '?' goto usage -if '%1' == '/help' goto usage - -SET DIR=%cd% -SET BUILD_DIR=%~d0%~p0% -SET NANT="%BUILD_DIR%lib\Nant\nant.exe" -SET build.config.settings="%DIR%\.uppercut" - -%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\default.build" -D:build.config.settings=%build.config.settings% -D:msbuild.configuration="ReleaseOfficial" %* - -if %ERRORLEVEL% NEQ 0 goto errors - -call %DIR%\documentscenarios.bat - -goto finish - -:usage -echo. -echo Usage: build.official.bat -echo. -goto finish - -:errors -EXIT /B %ERRORLEVEL% - -:finish \ No newline at end of file +set psscript="%~dp0build.ps1" +echo ================================================== +echo ============= WRAP POWERSHELL SCRIPT ============= +echo ================================================== + +echo calling %psscript% with args %* +PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%psscript%' -Configuration ReleaseOfficial %*" +set buildstatus=%ERRORLEVEL% +echo ================================================== +exit /b %buildstatus% diff --git a/build.official.sh b/build.official.sh new file mode 100755 index 0000000000..7d4ee2aba9 --- /dev/null +++ b/build.official.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eo pipefail + +./build.sh --configuration=Release $* \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000000..674e6d1868 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,249 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +<# + +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. + +.DESCRIPTION +This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) +and execute your Cake build script with the parameters you provide. + +.PARAMETER Script +The build script to execute. +.PARAMETER Target +The build script target to run. +.PARAMETER Configuration +The build configuration to use. +.PARAMETER Verbosity +Specifies the amount of information to be displayed. +.PARAMETER ShowDescription +Shows description about tasks. +.PARAMETER DryRun +Performs a dry run. +.PARAMETER SkipToolPackageRestore +Skips restoring of packages. +.PARAMETER ScriptArgs +Remaining arguments are added here. + +.LINK +https://cakebuild.net + +#> + +[CmdletBinding()] +Param( + [string]$Script = "recipe.cake", + [string]$Target, + [string]$Configuration, + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity, + [switch]$ShowDescription, + [Alias("WhatIf", "Noop")] + [switch]$DryRun, + [switch]$SkipToolPackageRestore, + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +# Attempt to set highest encryption available for SecurityProtocol. +# PowerShell will not set this by default (until maybe .NET 4.6.x). This +# will typically produce a message for PowerShell v2 (just an info +# message though) +try +{ + # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) + # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't + # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is + # installed (.NET 4.5 is an in-place upgrade). + [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 +} catch { + Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' +} + +[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null +function MD5HashFile([string] $filePath) +{ + if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) + { + return $null + } + + [System.IO.Stream] $file = $null; + [System.Security.Cryptography.MD5] $md5 = $null; + try + { + $md5 = [System.Security.Cryptography.MD5]::Create() + $file = [System.IO.File]::OpenRead($filePath) + return [System.BitConverter]::ToString($md5.ComputeHash($file)) + } + finally + { + if ($file -ne $null) + { + $file.Dispose() + } + } +} + +function GetProxyEnabledWebClient +{ + $wc = New-Object System.Net.WebClient + $proxy = [System.Net.WebRequest]::GetSystemWebProxy() + $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials + $wc.Proxy = $proxy + return $wc +} + +Write-Host "Preparing to run build script..." + +if(!$PSScriptRoot){ + $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +} + +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" +$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" +$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" +$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" +$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" + +# Make sure tools folder exists +if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { + Write-Verbose -Message "Creating tools directory..." + New-Item -Path $TOOLS_DIR -Type directory | out-null +} + +# Make sure that packages.config exist. +if (!(Test-Path $PACKAGES_CONFIG)) { + Write-Verbose -Message "Downloading packages.config..." + try { + $wc = GetProxyEnabledWebClient + $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) + } catch { + Throw "Could not download packages.config." + } +} + +# Try find NuGet.exe in path if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Trying to find nuget.exe in PATH..." + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } + $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 + if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { + Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." + $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName + } +} + +# Try download NuGet.exe if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Downloading NuGet.exe..." + try { + $wc = GetProxyEnabledWebClient + $wc.DownloadFile($NUGET_URL, $NUGET_EXE) + } catch { + Throw "Could not download NuGet.exe." + } +} + +# Save nuget.exe path to environment to be available to child processed +$ENV:NUGET_EXE = $NUGET_EXE + +# Restore tools from NuGet? +if(-Not $SkipToolPackageRestore.IsPresent) { + Push-Location + Set-Location $TOOLS_DIR + + # Check for changes in packages.config and remove installed tools if true. + [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + Write-Verbose -Message "Missing or changed package.config hash..." + Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | + Remove-Item -Recurse + } + + Write-Verbose -Message "Restoring tools from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet tools." + } + else + { + $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" + } + Write-Verbose -Message ($NuGetOutput | out-string) + + Pop-Location +} + +# Restore addins from NuGet +if (Test-Path $ADDINS_PACKAGES_CONFIG) { + Push-Location + Set-Location $ADDINS_DIR + + Write-Verbose -Message "Restoring addins from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet addins." + } + + Write-Verbose -Message ($NuGetOutput | out-string) + + Pop-Location +} + +# Restore modules from NuGet +if (Test-Path $MODULES_PACKAGES_CONFIG) { + Push-Location + Set-Location $MODULES_DIR + + Write-Verbose -Message "Restoring modules from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet modules." + } + + Write-Verbose -Message ($NuGetOutput | out-string) + + Pop-Location +} + +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} + + + +# Build Cake arguments +$cakeArguments = @("$Script"); +if ($Target) { $cakeArguments += "-target=$Target" } +if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } +if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } +if ($ShowDescription) { $cakeArguments += "-showdescription" } +if ($DryRun) { $cakeArguments += "-dryrun" } +$cakeArguments += $ScriptArgs + +# Start Cake +Write-Host "Running build script..." + +& "$CAKE_EXE" ./recipe.cake --bootstrap +if ($LASTEXITCODE -eq 0) +{ + & "$CAKE_EXE" $cakeArguments +} + +exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh index cd1b4a558a..dfdc92e93e 100755 --- a/build.sh +++ b/build.sh @@ -1,30 +1,130 @@ -#!/bin/bash -# stty -echo +#!/usr/bin/env bash +set -eo pipefail -# ::Project UppercuT - http://uppercut.googlecode.com -# ::No edits to this file are required - http://uppercut.pbwiki.com +########################################################################## +# This is the Cake bootstrapper script for Linux and macOS. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## -function usage -{ - echo "" - echo "Usage: build.sh" - exit -} +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +ADDINS_DIR=$TOOLS_DIR/Addins +MODULES_DIR=$TOOLS_DIR/Modules +NUGET_EXE=$TOOLS_DIR/nuget.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe +PACKAGES_CONFIG=$TOOLS_DIR/packages.config +PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum +ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config +MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config -function displayUsage -{ - case $1 in - "/?"|"-?"|"?"|"/help") usage ;; - esac -} +export CAKE_PATHS_TOOLS=$TOOLS_DIR +export CAKE_PATHS_ADDINS=$ADDINS_DIR +export CAKE_PATHS_MODULES=$MODULES_DIR -displayUsage $1 +# Define md5sum or md5 depending on Linux / macOS +MD5_EXE= +if [[ "$(uname -s)" == "Darwin" ]]; then + MD5_EXE="md5 -r" +else + MD5_EXE="md5sum" +fi -# http://www.michaelruck.de/2010/03/solving-pkg-config-and-mono-35-profile.html -# http://cloudgen.wordpress.com/2013/03/06/configure-nant-to-run-under-mono-3-06-beta-for-mac-osx/ -export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig:$PKG_CONFIG_PATH +# Define default arguments. +SCRIPT=$SCRIPT_DIR/recipe.cake +CAKE_ARGUMENTS=() -#mono ./lib/NAnt/NAnt.exe /logger:"NAnt.Core.DefaultLogger" /nologo /quiet /f:"$(cd $(dirname "$0"); pwd)/.build/default.build" /D:build.config.settings="$(cd $(dirname "$0"); pwd)/.uppercut" /D:microsoft.framework="mono-3.5" $* -mono --runtime=v4.0.30319 ./lib/NAnt/NAnt.exe /logger:"NAnt.Core.DefaultLogger" /nologo /quiet /f:"$(cd $(dirname "$0"); pwd)/.build/default.build" /D:build.config.settings="$(cd $(dirname "$0"); pwd)/.uppercut" /D:microsoft.framework="mono-4.5" /D:run.ilmerge="false" /D:run.nuget="false" $* +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + --) shift; CAKE_ARGUMENTS+=("$@"); break ;; + *) CAKE_ARGUMENTS+=("$1") ;; + esac + shift +done -#/quiet /nologo /debug /verbose /t:"mono-4.5" \ No newline at end of file +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +# Make sure that packages.config exist. +if [ ! -f "$TOOLS_DIR/packages.config" ]; then + echo "Downloading packages.config..." + curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occurred while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet if it does not exist. +if [ ! -f "$NUGET_EXE" ]; then + echo "Downloading NuGet..." + curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occurred while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd "$TOOLS_DIR" >/dev/null +if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then + find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf +fi + +mono "$NUGET_EXE" install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet tools." + exit 1 +fi + +$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" + +popd >/dev/null + +# Restore addins from NuGet. +if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then + pushd "$ADDINS_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet addins." + exit 1 + fi + + popd >/dev/null +fi + +# Restore modules from NuGet. +if [ -f "$MODULES_PACKAGES_CONFIG" ]; then + pushd "$MODULES_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet modules." + exit 1 + fi + + popd >/dev/null +fi + +# Make sure that Cake has been installed. +if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +mono "$CAKE_EXE" $SCRIPT --bootstrap +if [ $? -eq 0 ]; then + mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" +fi + +# Clean up environment variables that were created earlier in this bootstrapper +unset CAKE_PATHS_TOOLS +unset CAKE_PATHS_ADDINS +unset CAKE_PATHS_MODULES \ No newline at end of file diff --git a/cake.config b/cake.config new file mode 100644 index 0000000000..4db963c921 --- /dev/null +++ b/cake.config @@ -0,0 +1,14 @@ +; This is the default configuration file for Cake. +; This file was downloaded from https://github.com/cake-build/resources + +[Nuget] +UseInProcessClient=true +LoadDependencies=false + +[Paths] +Tools=./tools +Addins=./tools/Addins +Modules=./tools/Modules + +[Settings] +SkipVerification=true \ No newline at end of file diff --git a/docker/Dockerfile.linux b/docker/Dockerfile.linux index f5d825a099..4becb323b9 100644 --- a/docker/Dockerfile.linux +++ b/docker/Dockerfile.linux @@ -1,21 +1,67 @@ -FROM mono:6.12 +ARG monoversion="6.12" +FROM mono:${monoversion} as build -MAINTAINER Justin Phelps <linuturk@onitato.com> +ARG github_actions="false" +ARG github_ref +ARG github_repository +ARG github_base_ref +ARG github_head_ref +ARG github_run_number -RUN apt-get update && apt-get install git -y +ENV GITHUB_REF=$github_ref +ENV GITHUB_REPOSITORY=$github_repository +ENV GITHUB_BASE_REF=$github_base_ref +ENV GITHUB_HEAD_REF=$github_head_ref +ENV GITHUB_RUN_NUMBER=$github_run_number + +RUN echo deb http://deb.debian.org/debian buster-backports main | tee /etc/apt/sources.list.d/buster-backports.list; \ + apt-get update && apt-get install -t buster-backports git -y + +RUN curl -o packages-microsoft-prod.deb https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb; \ + dpkg -i packages-microsoft-prod.deb; \ + apt-get update; \ + apt-get install -y dotnet-sdk-6.0 COPY . /usr/local/src/choco/ WORKDIR /usr/local/src/choco -RUN chmod +x build.sh -RUN chmod +x zip.sh -RUN ./build.sh +RUN chmod +x *.sh + +ARG buildscript="build.sh" + +RUN if [ "$github_actions" = "true" ]; then \ + export GITHUB_ACTIONS=$github_actions; \ + fi; \ + if [ "$buildscript" = "build.official.sh" ]; then \ + export CHOCOLATEY_OFFICIAL_KEY="/usr/local/src/choco/chocolatey.official.snk"; \ + ./$buildscript; \ + cp docker/choco_official_wrapper code_drop/temp/_PublishedApps/choco/choco_wrapper; \ + else \ + ./$buildscript --verbosity=diagnostic; \ + cp docker/choco_wrapper code_drop/temp/_PublishedApps/choco/choco_wrapper; \ + fi; + + +ARG monoversion="6.12" +FROM mono:${monoversion} as install + +ARG monoversion="6.12" +LABEL org.opencontainers.image.url="https://chocolatey.org/" +LABEL org.opencontainers.image.documentation="https://docs.chocolatey.org/" +LABEL org.opencontainers.image.source="https://github.com/chocolatey/choco" +LABEL org.opencontainers.image.vendor="Chocolatey Software, Inc" +LABEL org.opencontainers.image.licenses="Apache-2.0" +LABEL org.opencontainers.image.title="Chocolatey" +LABEL org.opencontainers.image.description="Chocolatey Client running on Mono" +LABEL org.opencontainers.image.authors="https://chocolatey.org/support" +LABEL org.opencontainers.image.base.name="index.docker.io/library/mono:${monoversion}" -WORKDIR /usr/local/bin -RUN ln -s /usr/local/src/choco/code_drop/chocolatey +ENV ChocolateyInstall /opt/chocolatey -COPY docker/choco_wrapper /usr/local/bin/choco +COPY --from=build /usr/local/src/choco/code_drop/temp/_PublishedApps/choco /opt/chocolatey -ENV ChocolateyInstall /usr/local/bin/chocolatey +RUN mkdir /opt/chocolatey/lib; \ + cp /opt/chocolatey/choco_wrapper usr/local/bin/choco; \ + cp /opt/chocolatey/choco_wrapper usr/local/bin/choco.exe; -WORKDIR /root +WORKDIR /root \ No newline at end of file diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows new file mode 100644 index 0000000000..df9d6fbf80 --- /dev/null +++ b/docker/Dockerfile.windows @@ -0,0 +1,18 @@ +ARG tagversion="ltsc2016" +FROM mcr.microsoft.com/windows/servercore:${tagversion} + +LABEL org.opencontainers.image.url="https://chocolatey.org/" +LABEL org.opencontainers.image.documentation="https://docs.chocolatey.org/" +LABEL org.opencontainers.image.source="https://github.com/chocolatey/choco" +LABEL org.opencontainers.image.vendor="Chocolatey Software, Inc" +LABEL org.opencontainers.image.licenses="Apache-2.0" +LABEL org.opencontainers.image.title="Chocolatey" +LABEL org.opencontainers.image.description="Chocolatey Client running on .NET" +LABEL org.opencontainers.image.authors="https://chocolatey.org/support" +LABEL org.opencontainers.image.base.name="mcr.microsoft.com/windows/servercore:${tagversion}" + +COPY ./code_drop/Packages/Chocolatey C:/choco-nupkg +COPY ./docker/Install-ChocolateyInContainer.ps1 C:/choco-nupkg/Install-ChocolateyInContainer.ps1 +COPY ./src/chocolatey.resources/tools/ C:/choco-nupkg/tools/ + +RUN PowerShell.exe "C:\choco-nupkg\Install-ChocolateyInContainer.ps1" diff --git a/docker/Install-ChocolateyInContainer.ps1 b/docker/Install-ChocolateyInContainer.ps1 new file mode 100644 index 0000000000..35e5505250 --- /dev/null +++ b/docker/Install-ChocolateyInContainer.ps1 @@ -0,0 +1,112 @@ +$nupkgDir = 'C:\choco-nupkg' +$7zPath = Join-Path $nupkgDir 'tools\7z.exe' + +function Install-LocalChocolateyPackage { +param ( + [string]$chocolateyPackageFilePath = '', + [string]$sevenZipPath = '' +) + + if ($chocolateyPackageFilePath -eq $null -or $chocolateyPackageFilePath -eq '') { + throw "You must specify a local package to run the local install." + } + + if (!(Test-Path($chocolateyPackageFilePath))) { + throw "No file exists at $chocolateyPackageFilePath" + } + + if ($sevenZipPath -eq $null -or $sevenZipPath -eq '') { + throw "You must specify a path to 7zip" + } + + if (!(Test-Path($sevenZipPath))) { + throw "No file exists at 7zipPath" + } + + if ($env:TEMP -eq $null) { + $env:TEMP = Join-Path $env:SystemDrive 'temp' + } + $chocoTempDir = Join-Path $env:TEMP "chocolatey" + $tempDir = Join-Path $chocoTempDir "chocoInstall" + if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)} + $file = Join-Path $tempDir "chocolatey.zip" + Copy-Item $chocolateyPackageFilePath $file -Force + + # unzip the package + Write-Output "Extracting $file to $tempDir..." + $params = 'x -o"{0}" -bd -y "{1}"' -f $tempDir, $file + # use more robust Process as compared to Start-Process -Wait (which doesn't + # wait for the process to finish in PowerShell v3) + $process = New-Object System.Diagnostics.Process + + try { + $process.StartInfo = New-Object System.Diagnostics.ProcessStartInfo -ArgumentList $sevenZipPath, $params + $process.StartInfo.RedirectStandardOutput = $true + $process.StartInfo.UseShellExecute = $false + $process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden + + $null = $process.Start() + $process.BeginOutputReadLine() + $process.WaitForExit() + + $exitCode = $process.ExitCode + } + finally { + $process.Dispose() + } + + $errorMessage = "Unable to unzip package using 7zip. Error:" + if ($exitCode -ne 0) { + $errorDetails = switch ($exitCode) { + 1 { "Some files could not be extracted" } + 2 { "7-Zip encountered a fatal error while extracting the files" } + 7 { "7-Zip command line error" } + 8 { "7-Zip out of memory" } + 255 { "Extraction cancelled by the user" } + default { "7-Zip signalled an unknown error (code $exitCode)" } + } + + throw ($errorMessage, $errorDetails -join [Environment]::NewLine) + } + + # Call chocolatey install + Write-Output "Installing chocolatey on this machine" + $toolsFolder = Join-Path $tempDir "tools" + $chocoInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1" + + & $chocoInstallPS1 + + Write-Output 'Ensuring chocolatey commands are on the path' + $chocoInstallVariableName = "ChocolateyInstall" + $chocoPath = [Environment]::GetEnvironmentVariable($chocoInstallVariableName) + if ($chocoPath -eq $null -or $chocoPath -eq '') { + $chocoPath = 'C:\ProgramData\Chocolatey' + } + + $chocoExePath = Join-Path $chocoPath 'bin' + + if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower()) -eq $false) { + $env:Path = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine); + } +} + +If (-not (Test-Path $nupkgDir)) { + Throw "Cannot find $nupkgDir" +} + +If (-not (Test-Path $7zPath)) { + Throw "Cannot find $7zPath" +} + + +$nupkgPath = Get-Childitem -Path $nupkgDir | + ` Where-Object { $_.name -match "chocolatey.\d.*nupkg" } | + ` Select-Object -First 1 -ExpandProperty fullname + + +Write-Host "Installing Chocolatey from $nupkgPath" +Install-LocalChocolateyPackage -chocolateyPackageFilePath $nupkgPath -sevenZipPath $7zPath + + +Write-Host "Removing temporary files" +Remove-Item -Force -Recurse -EA 0 -Path $nupkgDir \ No newline at end of file diff --git a/docker/README.md b/docker/README.md index 504a96261a..bf90ef5927 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,12 +1,29 @@ Building Docker Image ===================== -This directory contains the necessary Dockerfile and wrapper script for building a Docker Image. This is a Linux based image that builds and runs choco.exe with mono. +This directory contains the necessary files for building a Docker Images. There is a Windows based image which runs choco on .NET and a Linux based image that builds and runs choco with Mono. -To build this image yourself, follow these steps: +To build the Windows image yourself, follow these steps: + +1. Clone down the repository on a Windows system using `git clone https://github.com/chocolatey/choco.git`. +1. Change directories to the root of the repository. +1. Either build choco on the host or put a pre-built chocolatey `.nupkg` in `.\code_drop\nuget`. + * See the README at the root of the repository for instructions on how to build choco. +1. Run the docker build command. `docker build -t choco:latest-windows -f docker/Dockerfile.windows .` (the trailing . is important) + * To change the version of the servercore image used, add the argument `--build-arg tagversion=servercore-tag` + * To build a official version, put an official `.nupkg` in `.\code_drop\nuget` and change the image name to `chocolatey/choco:latest-windows` + * If you get messages similar to "Can't add file x to tar: archive/tar: missed writing 794 bytes", make sure Visual Studio is closed. +1. Run your new image using the command `docker run -ti --rm choco:latest-windows cmd.exe` +1. Test choco by running `choco -h`. You should see the help message from choco.exe. + +To build the Linux image yourself, follow these steps: 1. Clone down the repository using `git clone https://github.com/chocolatey/choco.git`. 1. Change directories to the root of the repository. -1. Run the docker build command. `docker build -t mono-choco -f docker/Dockerfile.linux .` (the trailing . is important) -1. Run your new image using the command `docker run -ti --rm mono-choco /bin/bash` +1. Run the docker build command. `docker build -t choco:latest-linux -f docker/Dockerfile.linux .` (the trailing . is important) + * To build a official version, use this command: `docker build -t chocolatey/choco:latest-linux -f docker/Dockerfile.linux . --build-arg buildscript=build.official.sh` + * To build a debug version, add the argument `--build-arg buildscript=build.debug.sh` + * To change the version of mono used, add the argument `--build-arg monoversion=mono-tag` +1. Run your new image using the command `docker run -ti --rm choco:latest-linux /bin/bash` 1. Test choco by running `choco -h`. You should see the help message from choco.exe. + diff --git a/docker/choco_official_wrapper b/docker/choco_official_wrapper new file mode 100755 index 0000000000..6005de42d5 --- /dev/null +++ b/docker/choco_official_wrapper @@ -0,0 +1,3 @@ +#!/bin/bash + +mono /opt/chocolatey/choco.exe "$@" diff --git a/docker/choco_wrapper b/docker/choco_wrapper index 745cdf43ce..881390888f 100755 --- a/docker/choco_wrapper +++ b/docker/choco_wrapper @@ -1,3 +1,3 @@ #!/bin/bash -mono /usr/local/bin/chocolatey/console/choco.exe "$@" --allow-unofficial +mono /opt/chocolatey/choco.exe "$@" --allow-unofficial diff --git a/docs/images/branching-strategy.png b/docs/images/branching-strategy.png new file mode 100644 index 0000000000..48b135f8c4 Binary files /dev/null and b/docs/images/branching-strategy.png differ diff --git a/docs/legal/CREDITS.md b/docs/legal/CREDITS.md index 20b4a0df99..c602df5481 100644 --- a/docs/legal/CREDITS.md +++ b/docs/legal/CREDITS.md @@ -4,7 +4,6 @@ - [Committers](#committers) - [Chocolatey Community Team](#chocolatey-community-team) - [Contributors](#contributors) - - [Other Contributors](#other-contributors) - [Third Party Licenses - Development](#third-party-licenses---development) - [Third Party Licenses - Runtime](#third-party-licenses---runtime) - [7-Zip](#7-zip) @@ -21,63 +20,54 @@ <!-- /TOC --> ## Committers & Contributors -Chocolatey has been the the thoughts, ideas, and work of a large community. While [Rob](https://github.com/ferventcoder) heads up direction and plays a primary role in development, there are several people that have really been a part of making Chocolatey what it is today. +Chocolatey has been the thoughts, ideas, and work of a large community. While [Rob](https://github.com/ferventcoder) heads up direction and plays a primary role in development, there are several people that have really been a part of making Chocolatey what it is today. ### Committers -These are the committers to Chocolatey/Choco repositories: - * [Core Development Team](https://github.com/orgs/chocolatey/teams/developers) - * [Rob Reynolds](https://github.com/ferventcoder) - Creator of Chocolatey, committer, vision, direction, community feed moderator - * [Gary Ewan Park](https://github.com/gep13) - Committer, Chocolatey GUI, community feed moderator - * [Matt Wrock](https://github.com/mwrock) - Committer, Creator of BoxStarter, community feed moderator - * [Rich Siegel](https://github.com/rismoney) - Committer, Creator of Puppet provider - * [Richard Simpson](https://github.com/RichiCoder1) - created and maintains the new Chocolatey GUI +These are the committers to the chocolatey/choco repository: + +- [Chocolatey Development Team](https://github.com/orgs/chocolatey/teams/developers) +- The project [contributors](https://github.com/chocolatey/choco/graphs/contributors) +- A few of the [very special people](https://github.com/orgs/chocolatey/teams/chocolatey-alumni) we are grateful to. ### Chocolatey Community Team -The Chocolatey Community Team includes the committers and adds these fine folks: -* [Community Package Repository Moderation Team](https://github.com/orgs/chocolatey/teams/community-moderators) -* [Chocolatey Core Community Maintainers Team](https://github.com/orgs/chocolatey/teams/community-maintainers) +The Chocolatey Community Team manage the [Chocolatey Community Chocolatey Packages repository](https://github.com/chocolatey-community/chocolatey-packages) and includes these fine folks: -### Contributors - * [choco.exe](https://github.com/chocolatey/choco/graphs/contributors) - * [Original Chocolatey - POSH choco](https://github.com/chocolatey/chocolatey/graphs/contributors) +- [Chocolatey Community Repository Moderation Team](https://github.com/orgs/chocolatey-community/teams/community-moderators/members) +- [Chocolatey Community Chocolatey Packages Maintainers Team](https://github.com/orgs/chocolatey-community/teams/community-maintainers/members) +- [Chocolatey Community Chocolatey Packages Contributors](https://github.com/chocolatey-community/chocolatey-packages/graphs/contributors) -### Other Contributors -**NOTE: NEEDS UPDATED** +### Contributors - * Nekresh (https://github.com/nekresh) - Contributing code and ideas on direction - * Chris Ortman (https://github.com/chrisortman) - package contributions and thoughts on where to take it - * Svein Arne Ackenhausen (https://github.com/acken) - suggestions and thoughts on features and packages - * Marcel Hoyer - suggestions on making this stuff work without administrative access to a machine - * Jason Jarrett (https://github.com/staxmanade) - contributing code and ideas +- [Chocolatey CLI](https://github.com/chocolatey/choco/graphs/contributors) +- [Original Chocolatey - POSH choco](https://github.com/chocolatey/chocolatey/graphs/contributors) ## Third Party Licenses - Development -Choco is built, tested and analyzed with the following fantastic frameworks (in no particular order): - * ILMerge - * UppercuT (NAnt) - * PublishedApplications - * NuGet.exe +Chocolatey CLI is built, tested and analyzed with the following fantastic frameworks (in no particular order): -Choco is tested and analyzed with the following rockstar frameworks (in no particular order): +- ILMerge +- NuGet.exe - * bdddoc - * NUnit - * Moq - * TinySpec - * Should - * OpenCover - * ReportGenerator +Chocolatey CLI is tested and analyzed with the following rockstar frameworks (in no particular order): -We would like to credit other super sweet tools/frameworks that aid in the development of choco: +- NUnit +- Moq +- TinySpec +- Should +- OpenCover +- ReportGenerator - * ReSharper - * NuGet Framework +We would like to credit other super sweet tools/frameworks that aid in the development of Chocolatey CLI: + +- ReSharper +- NuGet Framework ## Third Party Licenses - Runtime -Chocolatey open source uses a number of 3rd party components. Their details are below (order is alphabetical). + +Chocolatey CLI open source uses a number of 3rd party components. Their details are below (order is alphabetical). <!-- TOC --> @@ -99,20 +89,21 @@ Chocolatey uses [7-Zip](http://www.7-zip.org/) for uncompressing archives. [Lice ~~~ 7-Zip - + ~~~~~ License for use and distribution - -------------------------------- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 7-Zip Copyright (C) 1999-2016 Igor Pavlov. + 7-Zip Copyright (C) 1999-2021 Igor Pavlov. - Licenses for files are: + The licenses for files are: - 1) 7z.dll: GNU LGPL + unRAR restriction - 2) All other files: GNU LGPL - - The GNU LGPL + unRAR restriction means that you must follow both - GNU LGPL rules and unRAR restriction rules. + 1) 7z.dll: + - The "GNU LGPL" as main license for most of the code + - The "GNU LGPL" with "unRAR license restriction" for some code + - The "BSD 3-clause License" for some code + 2) All other files: the "GNU LGPL". + Redistributions in binary form must reproduce related license information from this file. Note: You can use 7-Zip on any computer, including a computer in a commercial @@ -136,8 +127,41 @@ Chocolatey uses [7-Zip](http://www.7-zip.org/) for uncompressing archives. [Lice http://www.gnu.org/ - unRAR restriction - ----------------- + + + BSD 3-clause License + -------------------- + + The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression. + That code was derived from the code in the "LZFSE compression library" developed by Apple Inc, + that also uses the "BSD 3-clause License": + + ---- + Copyright (c) 2015-2016, Apple Inc. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ---- + + + + + unRAR license restriction + ------------------------- The decompression engine for RAR archives was developed using source code of unRAR program. @@ -154,7 +178,6 @@ Chocolatey uses [7-Zip](http://www.7-zip.org/) for uncompressing archives. [Lice -- Igor Pavlov - ~~~ ### AlphaFS @@ -725,57 +748,72 @@ Chocolatey uses [Rx](http://reactivex.io/) for schedules and internal messaging. ~~~ ### Shim Generator (shimgen) -Chocolatey uses [shimgen](https://github.com/chocolatey/shimgen) to generate shim executables that call the original binaries. [License terms](https://github.com/chocolatey/choco/blob/782a1cd228df548661e6c4eb5bb49b347025f85a/src/chocolatey.resources/tools/shimgen.license.txt): +Chocolatey uses [shimgen](https://github.com/chocolatey/shimgen) to generate shim executables that call the original binaries. [License terms](https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/tools/shimgen.license.txt): ~~~ - Shim Generator - shimgen.exe - Copyright (C) 2013 - 2017 RealDimensions Software, LLC ("RDS") - =================================================================== - Grant of License - =================================================================== - You may use Shim Generator ("shimgen.exe") only with the official Chocolatey - client. The use of shimgen.exe for any other reason is strictly prohibited. - - If you would like to use this software for any other reason, you must obtain a - personal or commercial license to do so. To do that you must contact RDS at - ferventcoder.com. - - This software is not free to distribute apart from the Chocolatey client. If you - would like to distribute this software outside of use through Chocolatey, you - must receive written permission from the software owner. - - =================================================================== - End-User License Agreement - =================================================================== - EULA - Shim Generator - - IMPORTANT- READ CAREFULLY: This RealDimensions Software ("RDS") End-User License - Agreement ("EULA") is a legal agreement between you ("END USER") and RDS for all - RDS products, controls, source code, demos, intermediate files, media, printed - materials, and "online" or electronic documentation ("SOFTWARE PRODUCT(S)") - contained with this distribution. - - RDS grants to END USER as an individual, a personal, nonexclusive license to - install and use the SOFTWARE PRODUCT(S) for the sole purpose of use with the - official Chocolatey client. By installing, copying, or otherwise using the - SOFTWARE PRODUCT(S), END USER agrees to be bound by the terms of this EULA. If - END USER does not agree to any part of the terms of this EULA, DO NOT INSTALL, - USE, OR EVALUATE, ANY PART, FILE OR PORTION OF THE SOFTWARE PRODUCT(S). - - ALL SOFTWARE PRODUCT(S) are licensed not sold. If END USER is an individual, - END USER must acquire an individual license for the SOFTWARE PRODUCT(S) from RDS - or its authorized resellers. If END USER is an entity, END USER must acquire an - individual license for each machine running the SOFTWARE PRODUCT(S) within your - organization from RDS or its authorized resellers. Both Virtual and Physical - Machines running the SOFTWARE PRODUCT(S) must be counted in the SOFTWARE - PRODUCT(S) licenses quantity of the organization. - - =================================================================== - Commercial / Personal Licensing - =================================================================== - Shim Generator (shimgen.exe) is also offered under personal and commercial - licenses. You can learn more about this option by contacting RDS at - http://ferventcoder.com +Shim Generator - shimgen.exe +Copyright (C) 2017 - Present Chocolatey Software, Inc ("CHOCOLATEY") +Copyright (C) 2013 - 2017 RealDimensions Software, LLC ("RDS") +=================================================================== +Grant of License +=================================================================== +ATTENTION: Shim Generator ("shimgen.exe") is a closed source application with +a proprietary license and its use is strictly limited to the terms of this +license agreement. + +RealDimensions Software, LLC ("RDS") grants Chocolatey Software, Inc a revocable, +non-exclusive license to distribute and use shimgen.exe with the official +Chocolatey client (https://chocolatey.org). This license file must be stored in +Chocolatey source next to shimgen.exe and distributed with every copy of +shimgen.exe. The distribution or use of shimgen.exe outside of these terms +without the express written permission of RDS is strictly prohibited. + +While the source for shimgen.exe is closed source, the shims have reference +source at https://github.com/chocolatey/shimgen/tree/master/shim. + +=================================================================== +End-User License Agreement +=================================================================== +EULA - Shim Generator + +IMPORTANT- READ CAREFULLY: This RealDimensions Software, LLC ("RDS") End-User License +Agreement ("EULA") is a legal agreement between you ("END USER") and RDS for all +RDS products, controls, source code, demos, intermediate files, media, printed +materials, and "online" or electronic documentation (collectively "SOFTWARE +PRODUCT(S)") contained with this distribution. + +RDS grants to you as an individual or entity, a personal, non-exclusive license +to install and use the SOFTWARE PRODUCT(S) for the sole purpose of use with the +official Chocolatey client. By installing, copying, or otherwise using the +SOFTWARE PRODUCT(S), END USER agrees to be bound by the terms of this EULA. If +END USER does not agree to any part of the terms of this EULA, DO NOT INSTALL, +USE, OR EVALUATE, ANY PART, FILE OR PORTION OF THE SOFTWARE PRODUCT(S). + +In no event shall RDS be liable to END USER for damages, including any direct, +indirect, special, incidental, or consequential damages of any character arising +as a result of the use or inability to use the SOFTWARE PRODUCT(S) (including +but not limited to damages for loss of goodwill, work stoppage, computer failure +or malfunction, or any and all other commercial damages or losses). + +The liability of RDS to END USER for any reason and upon any cause of action +related to the performance of the work under this agreement whether in tort or +in contract or otherwise shall be limited to the amount paid by the END USER to +RDS pursuant to this agreement or as determined by written agreement signed +by both RDS and END USER. + +ALL SOFTWARE PRODUCT(S) are licensed not sold. If you are an individual, you +must acquire an individual license for the SOFTWARE PRODUCT(S) from RDS or its +authorized resellers. If you are an entity, you must acquire an individual license +for each machine running the SOFTWARE PRODUCT(S) within your organization from RDS +or its authorized resellers. Both virtual and physical machines running the SOFTWARE +PRODUCT(S) must be counted in the SOFTWARE PRODUCT(S) licenses quantity of the +organization. + +=================================================================== +Commercial / Personal Licensing +=================================================================== +Shim Generator ("shimgen.exe") is also offered under personal and commercial +licenses. You can learn more by contacting Chocolatey at https://chocolatey.org/contact. ~~~ ### SimpleInjector diff --git a/documentscenarios.bat b/documentscenarios.bat deleted file mode 100644 index db668092f4..0000000000 --- a/documentscenarios.bat +++ /dev/null @@ -1,43 +0,0 @@ -@echo off - -::Project UppercuT - http://uppercut.googlecode.com - -if '%2' NEQ '' goto usage -if '%3' NEQ '' goto usage -if '%1' == '/?' goto usage -if '%1' == '-?' goto usage -if '%1' == '?' goto usage -if '%1' == '/help' goto usage - -SET DIR=%cd% -SET BUILD_DIR=%~d0%~p0% -SET NANT="%BUILD_DIR%lib\Nant\nant.exe" -SET build.config.settings="%DIR%\.uppercut" - -SET APP_BDDDOC="%DIR%\lib\bdddoc\bdddoc.console.exe" -SET TEST_ASSEMBLY_NAME="chocolatey.tests.integration.dll" - - -%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\compile.step" -D:build.config.settings=%build.config.settings% - -if %ERRORLEVEL% NEQ 0 goto errors - -::echo "This step of running integration specs can take a long time with no output" - -::%NANT% /logger:"NAnt.Core.DefaultLogger" /nologo /f:"%BUILD_DIR%.build\analyzers\test.step" all -D:build.config.settings=%build.config.settings% -%NANT% /logger:"NAnt.Core.DefaultLogger" /nologo /f:"%BUILD_DIR%.build.custom\bdddoc.build" -D:build.config.settings=%build.config.settings% -D:app.bdddoc=%APP_BDDDOC% -D:test_assembly=%TEST_ASSEMBLY_NAME% - -if %ERRORLEVEL% NEQ 0 goto errors - -goto finish - -:usage -echo. -echo Usage: bdddoc.bat -echo. -goto finish - -:errors -EXIT /B %ERRORLEVEL% - -:finish \ No newline at end of file diff --git a/lib/Chocolatey-NuGet.Core.2.11.0.20210506/lib/net4/NuGet.Core.dll b/lib/Chocolatey-NuGet.Core.2.11.0.20210506/lib/net4/NuGet.Core.dll deleted file mode 100644 index a851d4ca76..0000000000 Binary files a/lib/Chocolatey-NuGet.Core.2.11.0.20210506/lib/net4/NuGet.Core.dll and /dev/null differ diff --git a/lib/Chocolatey-NuGet.Core.2.11.0.20210506/lib/net4/NuGet.Core.pdb b/lib/Chocolatey-NuGet.Core.2.11.0.20210506/lib/net4/NuGet.Core.pdb deleted file mode 100644 index ef3daeab69..0000000000 Binary files a/lib/Chocolatey-NuGet.Core.2.11.0.20210506/lib/net4/NuGet.Core.pdb and /dev/null differ diff --git a/lib/Chocolatey-NuGet.Core.2.11.0.20220901/lib/net4/NuGet.Core.dll b/lib/Chocolatey-NuGet.Core.2.11.0.20220901/lib/net4/NuGet.Core.dll new file mode 100644 index 0000000000..27323a9b53 Binary files /dev/null and b/lib/Chocolatey-NuGet.Core.2.11.0.20220901/lib/net4/NuGet.Core.dll differ diff --git a/lib/Chocolatey-NuGet.Core.2.11.0.20220901/lib/net4/NuGet.Core.pdb b/lib/Chocolatey-NuGet.Core.2.11.0.20220901/lib/net4/NuGet.Core.pdb new file mode 100644 index 0000000000..650c3ee969 Binary files /dev/null and b/lib/Chocolatey-NuGet.Core.2.11.0.20220901/lib/net4/NuGet.Core.pdb differ diff --git a/lib/ILMerge/ILMerge License.rtf b/lib/ILMerge/ILMerge License.rtf deleted file mode 100644 index 41f5b6ada1..0000000000 --- a/lib/ILMerge/ILMerge License.rtf +++ /dev/null @@ -1,104 +0,0 @@ -{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f37\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;} -{\f39\froman\fcharset0\fprq2{\*\panose 02040602050305030304}Book Antiqua;}{\f40\fswiss\fcharset0\fprq2{\*\panose 020b0706030402020204}Franklin Gothic Demi Cond;}{\f41\fswiss\fcharset0\fprq2{\*\panose 020b0503020102020204}Franklin Gothic Book;} -{\f42\froman\fcharset238\fprq2 Times New Roman CE;}{\f43\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f45\froman\fcharset161\fprq2 Times New Roman Greek;}{\f46\froman\fcharset162\fprq2 Times New Roman Tur;} -{\f47\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f48\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f49\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f50\froman\fcharset163\fprq2 Times New Roman (Vietnamese);} -{\f412\fswiss\fcharset238\fprq2 Tahoma CE;}{\f413\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f415\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f416\fswiss\fcharset162\fprq2 Tahoma Tur;}{\f417\fswiss\fcharset177\fprq2 Tahoma (Hebrew);} -{\f418\fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f419\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f420\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f421\fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f432\froman\fcharset238\fprq2 Book Antiqua CE;} -{\f433\froman\fcharset204\fprq2 Book Antiqua Cyr;}{\f435\froman\fcharset161\fprq2 Book Antiqua Greek;}{\f436\froman\fcharset162\fprq2 Book Antiqua Tur;}{\f439\froman\fcharset186\fprq2 Book Antiqua Baltic;} -{\f442\fswiss\fcharset238\fprq2 Franklin Gothic Demi Cond CE;}{\f443\fswiss\fcharset204\fprq2 Franklin Gothic Demi Cond Cyr;}{\f445\fswiss\fcharset161\fprq2 Franklin Gothic Demi Cond Greek;}{\f446\fswiss\fcharset162\fprq2 Franklin Gothic Demi Cond Tur;} -{\f449\fswiss\fcharset186\fprq2 Franklin Gothic Demi Cond Baltic;}{\f452\fswiss\fcharset238\fprq2 Franklin Gothic Book CE;}{\f453\fswiss\fcharset204\fprq2 Franklin Gothic Book Cyr;}{\f455\fswiss\fcharset161\fprq2 Franklin Gothic Book Greek;} -{\f456\fswiss\fcharset162\fprq2 Franklin Gothic Book Tur;}{\f459\fswiss\fcharset186\fprq2 Franklin Gothic Book Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255; -\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} -{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* -\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv -\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\s15\ql \fi-274\li274\ri0\sb120\sl460\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin274\itap0 \f40\fs44\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 \styrsid9786739 1sectionhead;}{\s16\ql \li0\ri0\sb120\sl200\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \caps\f40\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext16 \styrsid9786739 4laparahead;}{\s17\ql \li0\ri-18\sb120\sl240\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin-18\lin0\itap0 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext17 \styrsid9786739 2lasubhead;}{\s18\ql \fi-187\li187\ri0\sb60\sl180\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin187\itap0 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext18 \styrsid9786739 3cnumbered;}{\s19\ql \fi-340\li624\ri0\sb60\sl160\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin624\itap0 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext19 \styrsid9786739 3inumbered2ndlevel;}{\s20\ql \li0\ri0\sb240\sl240\slmult0 -\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext20 \styrsid9786739 2afrenchsubhead;}{\s21\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 -\cbpat9 \f37\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext21 \ssemihidden \styrsid7154712 Document Map;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\pgptbl {\pgp\ipgp2\itap0\li0\ri0\sb0\sa0\brdrt\brdrs\brdrw20 }{\pgp\ipgp0 -\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid2099452\rsid4207571\rsid5465292\rsid5510097\rsid5510644\rsid7154712\rsid7241305\rsid7672529\rsid7735936\rsid9179139\rsid9786739\rsid10440675\rsid11303133\rsid13130884\rsid14028235\rsid14100361\rsid14113652 -\rsid15276140\rsid16213514}{\*\generator Microsoft Word 11.0.6359;}{\info{\title ILMerge EULA}{\author Ken Leppert}{\operator mbarnett}{\creatim\yr2005\mo3\dy16\hr15\min43}{\revtim\yr2005\mo3\dy16\hr15\min43}{\printim\yr2004\mo4\dy30\hr13\min9}{\version2} -{\edmins0}{\nofpages3}{\nofwords1188}{\nofchars6775}{\*\company Microsoft Corporation}{\nofcharsws7948}{\vern24703}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180 -\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1\jexpand\viewkind1\viewscale68\viewzk2\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel -\wrppunct\asianbrkrule\rsidroot9786739\newtblstyruls\nogrowautofit \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang -{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang -{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain -\s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0\pararsid7154712 \f40\fs44\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f39\fs28\insrsid9786739 MICROSOFT }{ -\b\f39\fs28\insrsid5465292 ILMerge}{\insrsid9786739 -\par }{\b\f39\fs22\insrsid9786739 END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE}{\insrsid9786739 -\par }\pard\plain \s17\qj \li0\ri-17\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin-17\lin0\itap0\pararsid14100361 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f39\insrsid9786739 IMPORTANT\emdash -READ CAREFULLY: }{\f39\insrsid9786739 This End-User License Agreement (\'93EULA\'94) is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (\'93Microsoft\'94) for th -e Microsoft software that accompanies this EULA, which includes computer software and may include associated media, printed materials, \'93online\'94 or electronic documentation, and Internet-based services (\'93Software\'94).\~ - An amendment or addendum to this EULA may accompany the Software.\~ }{\b\f39\insrsid9786739 -YOU AGREE TO BE BOUND BY THE TERMS OF THIS EULA BY INSTALLING, COPYING, OR OTHERWISE USING THE SOFTWARE. IF YOU DO NOT AGREE, DO NOT INSTALL, COPY, OR USE THE SOFTWARE.}{\insrsid9786739 -\par }\pard\plain \qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 1.\~\~\~\~\~\~\~\~ }{ -\b\f39\fs22\insrsid9786739 GRANTS OF LICENSE}{\f39\fs22\insrsid9786739 . Microsoft grants you the rights described in this EULA provided that you comply with all terms and conditions of this EULA.\~ }{\insrsid9786739 -\par }\pard\plain \s19\qj \fi720\li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid9786739 1.1\~\~\~\~\~\~ }{ -\b\i\f39\fs22\cf0\insrsid9786739 License Grant}{\f39\fs22\cf0\insrsid9786739 . Microsoft grants to you a personal, nonexclusive, nontransferable, limited license to }{\f39\fs22\insrsid9786739 install and use a reasonable number of copies of -the Software on computers residing on your premises }{\f39\fs22\cf0\insrsid9786739 for the purposes of designing, developing, and testing, your software product(s), provided that you are the only individual using the Software.\~ }{\insrsid9786739 -\par }\pard\plain \s18\qj \fi720\li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 1.2\~\~\~\~\~\~ }{ -\b\i\f39\fs22\insrsid9786739 Documentation}{\f39\fs22\insrsid9786739 .}{\b\f39\fs22\insrsid9786739 \~ }{\f39\fs22\insrsid9786739 You may make and use a reasonabl -e number of copies of any documentation, provided that such copies shall be used only for your personal purposes and are not to be republished or distributed (either in hard copy or electronic form) beyond your premises.}{\insrsid9786739 -\par }\pard \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 {\f39\fs22\insrsid9786739 2.\~\~\~\~\~\~\~\~ }{\b\f39\fs22\insrsid9786739 RESERVATION OF RIGHTS AND OWNERSHIP.\~ }{ -\f39\fs22\insrsid9786739 The Software is licensed as a single product.\~ Its component parts may not be separated. Microsoft reserves all rights not expressly granted to you in this EULA.\~ - The Software is protected by copyright and other intellectual property laws and treaties}{\f39\fs22\insrsid14028235 , and}{\f39\fs22\insrsid9786739 Microsoft }{\f39\fs22\insrsid14028235 (}{\f39\fs22\insrsid9786739 or its suppliers}{ -\f39\fs22\insrsid14028235 , where applicable)}{\f39\fs22\insrsid9786739 own }{\f39\fs22\insrsid14028235 all right, }{\f39\fs22\insrsid9786739 title, }{\f39\fs22\insrsid14028235 and interest in all }{\f39\fs22\insrsid9786739 -intellectual property rights in the Software.\~ }{\b\f39\fs22\insrsid9786739 The Software is licensed, not sold.}{\insrsid9786739 -\par }\pard\plain \s19\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid9786739 3.\~\~\~\~\~\~\~\~ }{ -\b\f39\fs22\cf0\insrsid9786739 LIMITATIONS ON REVERSE ENGINEERING, DECOMPILATION, AND DISASSEMBLY}{\b\i\f39\fs22\cf0\insrsid9786739 .}{\f39\fs22\cf0\insrsid9786739 \~ - You may not reverse engineer, decompile, or disassemble the Software, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.}{\insrsid9786739 -\par }\pard\plain \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl220\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 4.\~\~\~\~\~\~\~\~ -}{\b\f39\fs22\insrsid9786739 NO RENTAL/COMMERCIAL HOSTING.}{\b\i\f39\fs22\insrsid9786739 }{\f39\fs22\insrsid9786739 You may not rent, lease, lend or provide commercial hosting services with the Software.}{\insrsid9786739 -\par }\pard\plain \s19\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid9786739 5.\~\~\~\~\~\~\~\~ }{ -\b\f39\fs22\cf0\insrsid9786739 NO SOFTWARE TRANSFER.\~ }{\f39\fs22\cf0\insrsid9786739 You may not assign or otherwise transfer the SOFTWARE or any of your rights hereunder to any third party.}{\insrsid9786739 -\par }{\f39\fs22\cf0\insrsid9786739 6.\~\~\~\~\~\~\~\~ }{\b\f39\fs22\cf0\insrsid9786739 CONSENT TO USE OF DATA.\~ }{\f39\fs22\cf0\insrsid9786739 You - agree that Microsoft and its affiliates may collect and use technical information gathered as part of the product support services provided to you, if any, related to the Software.\~ - Microsoft may use this information solely to improve our products or to provide customized services or technologies to you and will not disclose this information in a form that personally identifies you.\~\~ }{\insrsid9786739 -\par }{\f39\fs22\cf0\insrsid5510644 7}{\f39\fs22\cf0\insrsid9786739 .\~\~\~\~\~\~\~\~ }{\b\f39\fs22\cf0\insrsid9786739 ADDITIONAL SOFTWARE/SERVICES.\~ }{\f39\fs22\insrsid9786739 Microsoft is not obligated to provide maintenance, technical supplements}{ -\f39\fs22\insrsid14028235 , updates,}{\f39\fs22\insrsid9786739 or other support to you for the Software licensed under this EULA. }{\f39\fs22\insrsid7241305 }{\f39\fs22\insrsid9786739 In the event that Microsoft does provide such supplements or updates} -{\b\f39\fs22\insrsid9786739 , }{\f39\fs22\insrsid9786739 this EULA applies to such updates, supplements, or add-on components of the Software that Microsoft may provide to -you or make available to you after the date you obtain your initial copy of the Software, unless we provide other terms along with the update, supplement, or add-on component}{\f39\fs22\cf0\insrsid9786739 .\~ - Microsoft reserves the right to discontinue any Internet-based services provided to you or made available to you through the use of the Software.\~ }{\insrsid9786739 -\par }\pard\plain \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl220\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid5510644 8}{ -\f39\fs22\insrsid9786739 .\~\~\~\~\~\~\~\~ }{\b\f39\fs22\insrsid9786739 EXPORT RESTRICTIONS}{\f39\fs22\insrsid9786739 .\~ }{\f39\fs22\cgrid0\insrsid9786739 You acknowledge that the Software is subject to U.S. export jurisdiction.\~ - You agree to comply with all applicable international and national laws that apply to the Software, including the U.S. Export Administration Regulations, as well as end-user, end-use, and destination restrictions issued by U.S. and other governments.\~\~ - For additional information see }{\f39\fs22\ul\cgrid0\insrsid9786739 http://www.microsoft.com/exporting/}{\f39\fs22\cgrid0\insrsid9786739 .}{\insrsid9786739 -\par }\pard\plain \s19\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs14\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\cf0\insrsid14113652 9}{ -\f39\fs22\cf0\insrsid9786739 .\~\~\~\~\~\~ }{\b\f39\fs22\cf0\insrsid9786739 TERMINATION.}{\f39\fs22\cf0\insrsid9786739 \~ Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with }{\f39\fs22\cf0\insrsid7241305 -any }{\f39\fs22\cf0\insrsid9786739 term}{\f39\fs22\cf0\insrsid7241305 or}{\f39\fs22\cf0\insrsid9786739 condition of this EULA. }{\f39\fs22\cf0\insrsid7241305 }{\f39\fs22\cf0\insrsid9786739 -In such event, you must destroy all copies of the Software and all of its component parts.}{\insrsid9786739 -\par }\pard\plain \s18\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl220\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f41\fs16\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\fs22\insrsid9786739 1}{ -\f39\fs22\insrsid14113652 0}{\f39\fs22\insrsid9786739 .\~\~\~\~\~\~ }{\b\f39\fs22\ul\insrsid9786739 DISCLAIMER OF WARRANTIES}{\b\f39\fs22\insrsid9786739 .\~ - TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND ITS SUPPLIERS PROVIDE THE SOFTWARE}{\f39\fs22\insrsid9786739 }{\b\f39\fs22\insrsid9786739 AND SUPPORT SERVICES (IF ANY) }{\b\i\f39\fs22\insrsid9786739 AS IS AND WITH ALL FAULTS}{ -\b\f39\fs22\insrsid9786739 , AND HEREBY DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, WHETHER EXPRESS, IMPLIED - OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF RELIABILITY OR AVAILABILITY, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF WORKMANLI -K -E EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE, ALL WITH REGARD TO THE SOFTWARE, AND THE PROVISION OF OR FAILURE TO PROVIDE SUPPORT OR OTHER SERVICES, INFORMATION, SOFTWARE, AND RELATED CONTENT THROUGH THE SOFTWARE OR OTHERWISE ARISING OUT OF THE - USE OF THE SOFTWARE.\~ ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT WITH REGARD TO THE SOFTWARE.}{\insrsid9786739 -\par }{\f39\fs22\insrsid9786739 1}{\f39\fs22\insrsid14113652 1}{\f39\fs22\insrsid9786739 .}{\b\f39\fs22\insrsid9786739 \~\~\~\~\~\~ }{\b\f39\fs22\ul\insrsid9786739 EXCLUSION OF INCIDENTAL, CONSEQUENTIAL AND CERTAIN OTHER DAMAGES}{\b\f39\fs22\insrsid9786739 .\~ - }{\b\caps\f39\fs22\insrsid9786739 -To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any special, incidental, punitive, indirect, or consequential damages whatsoever (including, but not limited to, damages for loss of profit -s, LOSS OF DATA, or confidential or other information}{\b\f39\fs22\insrsid9786739 , }{\b\caps\f39\fs22\insrsid9786739 -for business interruption, for personal injury, for loss of privacy, for failure to meet any duty including of good faith or of reasonable care, for negligence, and}{\b\f39\fs22\insrsid9786739 }{\b\caps\f39\fs22\insrsid9786739 -for any other pecuniary or other los -s whatsoever) arising out of or in any way related to the use of or inability to use the SOFTWARE, the provision of or failure to provide Support OR OTHER Services, informatIon, software, and related CONTENT through the software or otherwise arising out o -f - the use of the software, or otherwise under or in connection with any provision of this EULA, even in the event of the fault, tort (including negligence), misrepresentation, strict liability, breach of contract or breach of warranty of Microsoft or any s -upplier, and even if Microsoft or any supplier has been advised of the possibility of such damages. }{\insrsid9786739 -\par }{\f39\fs22\insrsid9786739 1}{\f39\fs22\insrsid14113652 2}{\f39\fs22\insrsid9786739 .}{\b\f39\fs22\insrsid9786739 \~\~\~\~\~\~ }{\b\f39\fs22\ul\insrsid9786739 LIMITATION OF LIABILITY AND REMEDIES}{\b\f39\fs22\insrsid9786739 -. NOTWITHSTANDING ANY DAMAGES THAT YOU MIGHT INCUR FOR ANY REASON WHATSOEVER (INCLUDING, WITHOUT LIMITATION, A -LL DAMAGES REFERENCED HEREIN AND ALL DIRECT OR GENERAL DAMAGES IN CONTRACT OR ANYTHING ELSE), THE ENTIRE LIABILITY OF MICROSOFT AND ANY OF ITS SUPPLIERS UNDER ANY PROVISION OF THIS EULA AND YOUR EXCLUSIVE REMEDY HEREUNDER SHALL BE LIMITED TO THE GREATER O -F THE ACTUAL DAMAGES YOU INCUR IN REASONABLE RELIANCE ON THE SOFTWARE UP TO THE AMOUNT ACTUALLY PAID BY YOU FOR THE SOFTWARE}{\f39\fs22\insrsid9786739 }{\b\f39\fs22\insrsid9786739 OR US$5.00.\~ - THE FOREGOING LIMITATIONS, EXCLUSIONS AND DISCLAIMERS SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, EVEN IF ANY REMEDY FAILS ITS ESSENTIAL PURPOSE.}{\insrsid9786739 -\par }{\f39\fs22\insrsid9786739 1}{\f39\fs22\insrsid14113652 3}{\f39\fs22\insrsid9786739 .\~\~\~\~\~\~ }{\b\f39\fs22\insrsid9786739 APPLICABLE LAW.\~ }{\f39\fs22\insrsid7735936 T}{\f39\fs22\insrsid9786739 his EULA }{\f39\fs22\insrsid7735936 -shall be construed under and }{\f39\fs22\insrsid9786739 governed by the laws of the State of Washington}{\f39\fs22\insrsid7735936 , without regard to conflicts of law principles}{\f39\fs22\insrsid9786739 .\~ }{\insrsid9786739 -\par }\pard\plain \s20\qj \li0\ri0\sb100\sa100\sbauto1\saauto1\sl240\slmult0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \f40\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f39\insrsid9786739 1}{\f39\insrsid14113652 -4}{\f39\insrsid9786739 .\~\~\~\~ }{\b\f39\insrsid9786739 ENTIRE AGREEMENT; SEVERABILITY.\~ }{\f39\insrsid9786739 This -EULA (including any addendum or amendment to this EULA which is included with the Software) are the entire agreement between you and Microsoft relating to the Software and the support services (if any) and they supersede all prior or contemporaneous oral -or written communications,\~proposals and representations with respect to the Software or any other subject matter covered by this EULA.\~ - If any provision of this EULA is held to be void, invalid, unenforceable or illegal, the other provisions shall continue in full force and effect}{\insrsid9786739 -\par }\pard\plain \qj \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14100361 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid10440675 -\par }} \ No newline at end of file diff --git a/lib/ILMerge/ILMerge.doc b/lib/ILMerge/ILMerge.doc deleted file mode 100644 index f3ac50149f..0000000000 Binary files a/lib/ILMerge/ILMerge.doc and /dev/null differ diff --git a/lib/ILMerge/ILMerge.exe b/lib/ILMerge/ILMerge.exe deleted file mode 100644 index e4018085e4..0000000000 Binary files a/lib/ILMerge/ILMerge.exe and /dev/null differ diff --git a/lib/ILMerge/ILMerge.exe.config b/lib/ILMerge/ILMerge.exe.config deleted file mode 100644 index a43b40eee0..0000000000 --- a/lib/ILMerge/ILMerge.exe.config +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version ="1.0"?> -<configuration> -<startup useLegacyV2RuntimeActivationPolicy="true"> -<requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/> -</startup> -</configuration> \ No newline at end of file diff --git a/lib/NAnt/CollectionGen.dll b/lib/NAnt/CollectionGen.dll deleted file mode 100644 index 7dd6c58033..0000000000 Binary files a/lib/NAnt/CollectionGen.dll and /dev/null differ diff --git a/lib/NAnt/Interop.MsmMergeTypeLib.dll b/lib/NAnt/Interop.MsmMergeTypeLib.dll deleted file mode 100644 index bd051e933a..0000000000 Binary files a/lib/NAnt/Interop.MsmMergeTypeLib.dll and /dev/null differ diff --git a/lib/NAnt/Interop.StarTeam.dll b/lib/NAnt/Interop.StarTeam.dll deleted file mode 100644 index 6f56767847..0000000000 Binary files a/lib/NAnt/Interop.StarTeam.dll and /dev/null differ diff --git a/lib/NAnt/Interop.WindowsInstaller.dll b/lib/NAnt/Interop.WindowsInstaller.dll deleted file mode 100644 index d669720424..0000000000 Binary files a/lib/NAnt/Interop.WindowsInstaller.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.CompressionTasks.dll b/lib/NAnt/NAnt.CompressionTasks.dll deleted file mode 100644 index 11c81c2813..0000000000 Binary files a/lib/NAnt/NAnt.CompressionTasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.Contrib.Tasks.dll b/lib/NAnt/NAnt.Contrib.Tasks.dll deleted file mode 100644 index a4ccd72ecb..0000000000 Binary files a/lib/NAnt/NAnt.Contrib.Tasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.Core.dll b/lib/NAnt/NAnt.Core.dll deleted file mode 100644 index 1083a42435..0000000000 Binary files a/lib/NAnt/NAnt.Core.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.DotNetTasks.dll b/lib/NAnt/NAnt.DotNetTasks.dll deleted file mode 100644 index 7e2b702ef3..0000000000 Binary files a/lib/NAnt/NAnt.DotNetTasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.MSNetTasks.dll b/lib/NAnt/NAnt.MSNetTasks.dll deleted file mode 100644 index 3099966d51..0000000000 Binary files a/lib/NAnt/NAnt.MSNetTasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.NUnit.dll b/lib/NAnt/NAnt.NUnit.dll deleted file mode 100644 index cf7d5dc2dd..0000000000 Binary files a/lib/NAnt/NAnt.NUnit.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.NUnit1Tasks.dll b/lib/NAnt/NAnt.NUnit1Tasks.dll deleted file mode 100644 index a7bda372c6..0000000000 Binary files a/lib/NAnt/NAnt.NUnit1Tasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.NUnit2Tasks.dll b/lib/NAnt/NAnt.NUnit2Tasks.dll deleted file mode 100644 index 657180c2e2..0000000000 Binary files a/lib/NAnt/NAnt.NUnit2Tasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.SourceControlTasks.dll b/lib/NAnt/NAnt.SourceControlTasks.dll deleted file mode 100644 index 82e44da1f2..0000000000 Binary files a/lib/NAnt/NAnt.SourceControlTasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.VSNetTasks.dll b/lib/NAnt/NAnt.VSNetTasks.dll deleted file mode 100644 index 37f8c3aca2..0000000000 Binary files a/lib/NAnt/NAnt.VSNetTasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.VisualCppTasks.dll b/lib/NAnt/NAnt.VisualCppTasks.dll deleted file mode 100644 index 4f6c39c96d..0000000000 Binary files a/lib/NAnt/NAnt.VisualCppTasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.Win32Tasks.dll b/lib/NAnt/NAnt.Win32Tasks.dll deleted file mode 100644 index 80ec5c15d2..0000000000 Binary files a/lib/NAnt/NAnt.Win32Tasks.dll and /dev/null differ diff --git a/lib/NAnt/NAnt.exe b/lib/NAnt/NAnt.exe deleted file mode 100644 index 55f9e29a63..0000000000 Binary files a/lib/NAnt/NAnt.exe and /dev/null differ diff --git a/lib/NAnt/NAnt.exe.config b/lib/NAnt/NAnt.exe.config deleted file mode 100644 index ce2b284792..0000000000 --- a/lib/NAnt/NAnt.exe.config +++ /dev/null @@ -1,3538 +0,0 @@ -<?xml version="1.0"?> -<configuration> - <!-- Leave this alone. Sets up configsectionhandler section --> - <configSections> - <section name="nant" type="NAnt.Core.ConfigurationSection, NAnt.Core" /> - <section name="log4net" type="System.Configuration.IgnoreSectionHandler" /> - </configSections> - <appSettings> - <!-- Used to indicate the location of the cache folder for shadow files --> - <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" /> - <!-- Used to indicate that NAnt should shadow copy files in a cache folder near the executable --> - <add key="nant.shadowfiles" value="False" /> - <!-- Used to indicate if cached files should be deleted when done running--> - <add key="nant.shadowfiles.cleanup" value="False" /> - <!-- To enable internal log4net logging, uncomment the next line --> - <!-- <add key="log4net.Internal.Debug" value="true"/> --> - </appSettings> - <!-- nant config settings --> - <nant> - <frameworks> - <platform name="win32" default="auto"> - <task-assemblies> - <!-- include NAnt task assemblies --> - <include name="*Tasks.dll" /> - <!-- include NAnt test assemblies --> - <include name="*Tests.dll" /> - <!-- include framework-neutral assemblies --> - <include name="extensions/common/neutral/**/*.dll" /> - <!-- exclude Microsoft.NET specific task assembly --> - <exclude name="NAnt.MSNetTasks.dll" /> - <!-- exclude Microsoft.NET specific test assembly --> - <exclude name="NAnt.MSNet.Tests.dll" /> - </task-assemblies> - <framework - name="net-1.0" - family="net" - version="1.0" - description="Microsoft .NET Framework 1.0" - sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v1.0.3705')}" - frameworkassemblydirectory="${path::combine(installRoot, 'v1.0.3705')}" - clrversion="1.0.3705" - clrtype="Desktop" - vendor="Microsoft" - > - <runtime> - <probing-paths> - <directory name="lib/net/1.0" /> - <directory name="lib/net/neutral" /> - <directory name="lib/common/1.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v1.0.3705" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(installRoot, 'v1.0.3705')}"> - <include name="Accessibility.dll" /> - <include name="cscompmgd.dll" /> - <include name="mscorlib.dll" /> - <include name="Microsoft.Vsa.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="System.Configuration.Install.dll" /> - <include name="System.Data.dll" /> - <include name="System.Design.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.Management.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.XML.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 1.0 specific assemblies --> - <include name="extensions/net/1.0/**/*.dll" /> - <!-- include Microsoft.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include Microsoft.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 1.0 specific assemblies --> - <include name="extensions/common/1.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(sdkInstallRoot, 'bin')}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v1.0.3705')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <readregistry - property="sdkInstallRoot" - key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRoot" - hive="LocalMachine" - failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="supportsnowarnlist">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - </task> - <task name="aximp"> - <attribute name="supportsrcw">false</attribute> - </task> - <task name="tlbimp"> - <attribute name="supportstransform">false</attribute> - </task> - </tasks> - </framework> - <framework - name="net-1.1" - family="net" - version="1.1" - description="Microsoft .NET Framework 1.1" - sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v1.1.4322')}" - frameworkassemblydirectory="${path::combine(installRoot, 'v1.1.4322')}" - clrversion="1.1.4322" - clrtype="Desktop" - vendor="Microsoft" - > - <runtime> - <probing-paths> - <directory name="lib/net/1.1" /> - <directory name="lib/net/neutral" /> - <directory name="lib/common/1.1" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v1.1.4322" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(installRoot, 'v1.1.4322')}"> - <include name="Accessibility.dll" /> - <include name="cscompmgd.dll" /> - <include name="mscorlib.dll" /> - <include name="Microsoft.Vsa.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> - <include name="System.Configuration.Install.dll" /> - <include name="System.Data.dll" /> - <include name="System.Data.OracleClient.dll" /> - <include name="System.Design.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.Management.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.Mobile.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.XML.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 1.1 specific assemblies --> - <include name="extensions/net/1.1/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 1.1 specific assemblies --> - <include name="extensions/common/1.1/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(sdkInstallRoot, 'bin')}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v1.1.4322')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <readregistry - property="sdkInstallRoot" - key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv1.1" - hive="LocalMachine" - failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="supportsnowarnlist">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - </task> - </tasks> - </framework> - <framework - name="net-2.0" - family="net" - version="2.0" - description="Microsoft .NET Framework 2.0" - sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v2.0.50727')}" - frameworkassemblydirectory="${path::combine(installRoot, 'v2.0.50727')}" - clrversion="2.0.50727" - clrtype="Desktop" - vendor="Microsoft" - > - <runtime> - <probing-paths> - <directory name="lib/net/2.0" /> - <directory name="lib/net/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v2.0.50727" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(installRoot, 'v2.0.50727')}"> - <include name="Accessibility.dll" /> - <include name="cscompmgd.dll" /> - <include name="mscorlib.dll" /> - <include name="Microsoft.Build.Engine.dll" /> - <include name="Microsoft.Build.Framework.dll" /> - <include name="Microsoft.Build.Utilities.dll" /> - <include name="Microsoft.Vsa.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> - <include name="System.Configuration.dll" /> - <include name="System.Configuration.Install.dll" /> - <include name="System.Data.dll" /> - <include name="System.Data.OracleClient.dll" /> - <include name="System.Data.SqlXml.dll" /> - <include name="System.Deployment.dll" /> - <include name="System.Design.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.Management.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Transactions.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.Mobile.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.XML.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 2.0 specific assemblies --> - <include name="extensions/net/2.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(sdkInstallRoot, 'bin')}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v2.0.50727')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <readregistry - property="sdkInstallRoot" - key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv2.0" - hive="LocalMachine" - failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="net-3.5" - family="net" - version="3.5" - description="Microsoft .NET Framework 3.5" - sdkdirectory="${sdkInstallRoot}" - frameworkdirectory="${path::combine(installRoot, 'v3.5')}" - frameworkassemblydirectory="${path::combine(installRoot, 'v2.0.50727')}" - clrversion="2.0.50727" - clrtype="Desktop" - vendor="Microsoft" - > - <runtime> - <probing-paths> - <directory name="lib/net/2.0" /> - <directory name="lib/net/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v2.0.50727" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(installRoot, 'v2.0.50727')}"> - <include name="Accessibility.dll" /> - <include name="cscompmgd.dll" /> - <include name="mscorlib.dll" /> - <include name="Microsoft.Build.Utilities.dll" /> - <include name="Microsoft.Vsa.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> - <include name="System.Configuration.dll" /> - <include name="System.Configuration.Install.dll" /> - <include name="System.Data.dll" /> - <include name="System.Data.OracleClient.dll" /> - <include name="System.Data.SqlXml.dll" /> - <include name="System.Deployment.dll" /> - <include name="System.Design.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.Management.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Transactions.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.Mobile.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.XML.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${environment::get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/v3.5"> - <include name="Microsoft.Build.Engine.dll" /> - <include name="Microsoft.Build.Framework.dll" /> - <include name="System.AddIn.Contract.dll" /> - <include name="System.AddIn.dll" /> - <include name="System.ComponentModel.DataAnnotations.dll" /> - <include name="System.Core.dll" /> - <include name="System.Data.DataSetExtensions.dll" /> - <include name="System.Data.Entity.Design.dll" /> - <include name="System.Data.Entity.dll" /> - <include name="System.Data.Linq.dll" /> - <include name="System.Data.Services.Client.dll" /> - <include name="System.Data.Services.Design.dll" /> - <include name="System.Data.Services.dll" /> - <include name="System.DirectoryServices.AccountManagement.dll" /> - <include name="System.Management.Instrumentation.dll" /> - <include name="System.Net.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.Web.Abstractions.dll" /> - <include name="System.Web.DynamicData.Design.dll" /> - <include name="System.Web.DynamicData.dll" /> - <include name="System.Web.Entitly.Design.dll" /> - <include name="System.Web.Entitly.dll" /> - <include name="System.Web.Extensions.Design.dll" /> - <include name="System.Web.Extensions.dll" /> - <include name="System.Web.Routing.dll" /> - <include name="System.Windows.Presentation.dll" /> - <include name="System.WorkflowServices.dll" /> - <include name="System.Xml.Linq.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${environment::get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/v3.0"> - <include name="PresentationBuildTasks.dll" /> - <include name="PresentationCore.dll" /> - <include name="PresentationFramework.Aero.dll" /> - <include name="PresentationFramework.Classic.dll" /> - <include name="PresentationFramework.dll" /> - <include name="PresentationFramework.Luna.dll" /> - <include name="PresentationFramework.Royale.dll" /> - <include name="ReachFramework.dll" /> - <include name="System.IdentityModel.dll" /> - <include name="System.IdentityModel.Selectors.dll" /> - <include name="System.IO.Log.dll" /> - <include name="System.Printing.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.Speech.dll" /> - <include name="System.Workflow.Activities.dll" /> - <include name="System.Workflow.ComponentModel.dll" /> - <include name="System.Workflow.Runtime.dll" /> - <include name="UIAutomationClient.dll" /> - <include name="UIAutomationClientsideProviders.dll" /> - <include name="UIAutomationProvider.dll" /> - <include name="UIAutomationTypes.dll" /> - <include name="WindowsBase.dll" /> - <include name="WindowsFormsIntegration.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 2.0 specific assemblies --> - <include name="extensions/net/2.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${sdkInstallRoot}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v3.5')}" /> - <directory name="${path::combine(installRoot, 'v2.0.50727')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <locatesdk property="sdkInstallRoot" minwinsdkver="v6.0A" maxnetfxver="3.5" failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="net-4.0" - family="net" - version="4.0" - description="Microsoft .NET Framework 4.0" - sdkdirectory="${sdkInstallRoot}" - frameworkdirectory="${path::combine(installRoot, 'v4.0.30319')}" - frameworkassemblydirectory="${path::combine(installRoot, 'v4.0.30319')}" - clrversion="4.0.30319" - clrtype="Desktop" - vendor="Microsoft" - > - <runtime> - <probing-paths> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v4.0.30319" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(installRoot, 'v4.0.30319')}"> - <include name="Accessibility.dll" /> - <include name="Microsoft.Build.Conversion.v4.0.dll" /> - <include name="Microsoft.Build.dll" /> - <include name="Microsoft.Build.Engine.dll" /> - <include name="Microsoft.Build.Framework.dll" /> - <include name="Microsoft.Build.Tasks.v4.0.dll" /> - <include name="Microsoft.Build.Utilities.v4.0.dll" /> - <include name="Microsoft.CSharp.dll" /> - <include name="Microsoft.Data.Entity.Build.Tasks.dll" /> - <include name="Microsoft.JScript.dll" /> - <include name="Microsoft.Transactions.Bridge.dll" /> - <include name="Microsoft.Transactions.Bridge.Dtc.dll" /> - <include name="Microsoft.VisualBasic.Activities.Compiler.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="Microsoft.VisualC.dll" /> - <include name="Microsoft.VisualC.STLCLR.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Activities.Core.Presentation.dll" /> - <include name="System.Activities.dll" /> - <include name="System.Activities.DurableInstancing.dll" /> - <include name="System.Activities.Presentation.dll" /> - <include name="System.AddIn.Contract" /> - <include name="System.AddIn.dll" /> - <include name="System.ComponentModel.Composition.dll" /> - <include name="System.ComponentModel.DataAnnotations.dll" /> - <include name="System.Configuration.dll" /> - <include name="System.Configuration.Install.dll" /> - <include name="System.Core.dll" /> - <include name="System.Data.DataSetExtensions.dll" /> - <include name="System.Data.dll" /> - <include name="System.Data.Entity.Design.dll" /> - <include name="System.Data.Entity.dll" /> - <include name="System.Data.Linq.dll" /> - <include name="System.Data.OracleClient.dll" /> - <include name="System.Data.Services.Client.dll" /> - <include name="System.Data.Services.Design.dll" /> - <include name="System.Data.Services.dll" /> - <include name="System.Data.SqlXml.dll" /> - <include name="System.Deployment.dll" /> - <include name="System.Design.dll" /> - <include name="System.Device.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.DirectoryServices.Protocols.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.Dynamic.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.EnterpriseServices.Thunk.dll" /> - <include name="System.EnterpriseServices.Wrapper.dll" /> - <include name="System.IdentityModel.dll" /> - <include name="System.IdentityModel.Selectors.dll" /> - <include name="System.IO.Log.dll" /> - <include name="System.Management.dll" /> - <include name="System.Management.Instrumentation.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Net.dll" /> - <include name="System.Numerics.dll" /> - <include name="System.Runtime.Caching.dll" /> - <include name="System.Runtime.DurableInstancing.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceModel.Activation.dll" /> - <include name="System.ServiceModel.Activities.dll" /> - <include name="System.ServiceModel.Channels.dll" /> - <include name="System.ServiceModel.Discovery.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Routing.dll" /> - <include name="System.ServiceModel.ServiceMoniker40.dll" /> - <include name="System.ServiceModel.WasHosting.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Transactions.dll" /> - <include name="System.Web.Abstractions.dll" /> - <include name="System.Web.ApplicationServices.dll" /> - <include name="System.Web.DataVisualization.Design.dll" /> - <include name="System.Web.DataVisualization.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.DynamicData.Design.dll" /> - <include name="System.Web.DynamicData.dll" /> - <include name="System.Web.Entity.Design.dll" /> - <include name="System.Web.Entity.dll" /> - <include name="System.Web.Extensions.Design.dll" /> - <include name="System.Web.Extensions.dll" /> - <include name="System.Web.Mobile.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Routing.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.DataVisualization.Design.dll" /> - <include name="System.Windows.Forms.DataVisualization.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.Workflow.Activities.dll" /> - <include name="System.Workflow.ComponentModel.dll" /> - <include name="System.Workflow.Runtime.dll" /> - <include name="System.WorkflowServices.dll" /> - <include name="System.Xaml.dll" /> - <include name="System.Xaml.Hosting.dll" /> - <include name="System.Xml.dll" /> - <include name="System.Xml.Linq.dll" /> - </reference-assemblies> - <!-- WPF Assemblies --> - <reference-assemblies basedir="${path::combine(installRoot, 'v4.0.30319')}/WPF"> - <include name="NaturalLanguage6.dll" /> - <include name="NlsData0009.dll" /> - <include name="NlsLexicons0009.dll" /> - <include name="PenIMC.dll" /> - <include name="PresentationCore.dll" /> - <include name="PresentationFramework.Aero.dll" /> - <include name="PresentationFramework.Classic.dll" /> - <include name="PresentationFramework.dll" /> - <include name="PresentationFramework.Luna.dll" /> - <include name="PresentationFramework.Royale.dll" /> - <include name="PresentationHost_v0400.dll" /> - <include name="PresentationNative_v0400.dll" /> - <include name="PresentationUI.dll" /> - <include name="ReachFramework.dll" /> - <include name="System.Printing.dll" /> - <include name="System.Speech.dll" /> - <include name="System.Windows.Input.Manipulations.dll" /> - <include name="System.Windows.Presentation.dll" /> - <include name="UIAutomationClient.dll" /> - <include name="UIAutomationClientsideProviders.dll" /> - <include name="UIAutomationProvider.dll" /> - <include name="UIAutomationTypes.dll" /> - <include name="WindowsBase.dll" /> - <include name="WindowsFormsIntegration.dll" /> - <include name="wpfgfx_v0400.dll" /> - <include name="wpftxt_v0400.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${environment::get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.0"> - <include name="Microsoft.Build.Conversion.v4.0.dll" /> - <include name="Microsoft.Build.dll" /> - <include name="Microsoft.Build.Engine.dll" /> - <include name="Microsoft.Build.Framework.dll" /> - <include name="Microsoft.Build.Tasks.v4.0.dll" /> - <include name="Microsoft.Build.Utilities.v4.0.dll" /> - <include name="Microsoft.CSharp.dll" /> - <include name="Microsoft.JScript.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> - <include name="Microsoft.VisualBasic.Comptatibility.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="Microsoft.VisualC.dll" /> - <include name="Microsoft.VisualC.STLCLR.dll" /> - <include name="mscorlib.dll" /> - <include name="PresentationBuildTasks.dll" /> - <include name="PresentationCore.dll" /> - <include name="WindowsBase.dll" /> - <include name="PresentationFramework.dll" /> - <include name="PresentationFramework.Aero.dll" /> - <include name="PresentationFramework.Classic.dll" /> - <include name="PresentationFramework.Luna.dll" /> - <include name="PresentationFramework.Royale.dll" /> - <include name="ReachFramework.dll" /> - <include name="System.Activities.Core.Presentation.dll" /> - <include name="System.Activities.dll" /> - <include name="System.Activities.DurableInstancing.dll" /> - <include name="System.Activities.Presentation.dll" /> - <include name="System.AddIn.Contract.dll" /> - <include name="System.AddIn.dll" /> - <include name="System.ComponentModel.Composition.dll" /> - <include name="System.ComponentModel.DataAnnotations.dll" /> - <include name="System.Configuration.dll" /> - <include name="System.Core.dll" /> - <include name="System.Data.DataSetExtension.dll" /> - <include name="System.Data.dll" /> - <include name="System.Data.Entity.Design.dll" /> - <include name="System.Data.Entity.dll" /> - <include name="System.Data.Linq.dll" /> - <include name="System.Data.OracleClient.dll" /> - <include name="System.Data.Services.Client.dll" /> - <include name="System.Data.Services.Design.dll" /> - <include name="System.Data.Services.dll" /> - <include name="System.Data.SqlXml.dll" /> - <include name="System.Deployment.dll" /> - <include name="System.Design.dll" /> - <include name="System.Device.dll" /> - <include name="System.DirectoryServices.AccountManagement.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.DirectoryServices.Protocols.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.EnterpriseServices.Thunk.dll" /> - <include name="System.EnterpriseServices.Wrapper.dll" /> - <include name="System.IdentityModel.dll" /> - <include name="System.IdentityModel.Selectors.dll" /> - <include name="System.IO.Log.dll" /> - <include name="System.Management.dll" /> - <include name="System.Management.Instrumentation.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Net.dll" /> - <include name="System.Numerics.dll" /> - <include name="System.Printing.dll" /> - <include name="System.Runtime.Caching.dll" /> - <include name="System.Runtime.DurableInstancing.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceModel.Activation.dll" /> - <include name="System.ServiceModel.Activities.dll" /> - <include name="System.ServiceModel.Channels.dll" /> - <include name="System.ServiceModel.Discovery.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Routing.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Speech.dll" /> - <include name="System.Transactions.dll" /> - <include name="System.Web.Abstractions.dll" /> - <include name="System.Web.ApplicationServices.dll" /> - <include name="System.Web.DataVisualization.Design.dll" /> - <include name="System.Web.DataVisualization.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.DynamicData.Design.dll" /> - <include name="System.Web.DynamicData.dll" /> - <include name="System.Web.Entity.Design.dll" /> - <include name="System.Web.Entity.dll" /> - <include name="System.Web.Extensions.Design.dll" /> - <include name="System.Web.Extensions.dll" /> - <include name="System.Web.Mobile.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Routing.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.DataVisualization.Design.dll" /> - <include name="System.Windows.Forms.DataVisualization.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.Windows.Input.Manipulations.dll" /> - <include name="System.Windows.Presentation.dll" /> - <include name="System.Workflow.Activities.dll" /> - <include name="System.Workflow.ComponentModel.dll" /> - <include name="System.Workflow.Runtime.dll" /> - <include name="System.WorkflowServices.dll" /> - <include name="System.Xaml.dll" /> - <include name="System.Xml.dll" /> - <include name="System.Xml.Linq.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 4.0 specific assemblies --> - <include name="extensions/net/4.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 4.0 specific assemblies --> - <include name="extensions/common/4.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${sdkInstallRoot}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v4.0.30319')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <locatesdk property="sdkInstallRoot" minwinsdkver="v7.0A" minnetfxver="4.0" maxnetfxver="4.0.99999" failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="net-4.5" - family="net" - version="4.5" - description="Microsoft .NET Framework 4.5" - sdkdirectory="${sdkInstallRoot}" - frameworkdirectory="${path::combine(installRoot, 'v4.0.30319')}" - frameworkassemblydirectory="${path::combine(installRoot, 'v4.0.30319')}" - clrversion="4.0.30319" - clrtype="Desktop" - vendor="Microsoft" - > - <runtime> - <probing-paths> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v4.0.30319" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(installRoot, 'v4.0.30319')}"> - <include name="Accessibility.dll" /> - <include name="Microsoft.Build.Conversion.v4.0.dll" /> - <include name="Microsoft.Build.dll" /> - <include name="Microsoft.Build.Engine.dll" /> - <include name="Microsoft.Build.Framework.dll" /> - <include name="Microsoft.Build.Tasks.v4.0.dll" /> - <include name="Microsoft.Build.Utilities.v4.0.dll" /> - <include name="Microsoft.CSharp.dll" /> - <include name="Microsoft.Data.Entity.Build.Tasks.dll" /> - <include name="Microsoft.JScript.dll" /> - <include name="Microsoft.Transactions.Bridge.dll" /> - <include name="Microsoft.Transactions.Bridge.Dtc.dll" /> - <include name="Microsoft.VisualBasic.Activities.Compiler.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="Microsoft.VisualC.dll" /> - <include name="Microsoft.VisualC.STLCLR.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Activities.Core.Presentation.dll" /> - <include name="System.Activities.dll" /> - <include name="System.Activities.DurableInstancing.dll" /> - <include name="System.Activities.Presentation.dll" /> - <include name="System.AddIn.Contract" /> - <include name="System.AddIn.dll" /> - <include name="System.ComponentModel.Composition.dll" /> - <include name="System.ComponentModel.DataAnnotations.dll" /> - <include name="System.Configuration.dll" /> - <include name="System.Configuration.Install.dll" /> - <include name="System.Core.dll" /> - <include name="System.Data.DataSetExtensions.dll" /> - <include name="System.Data.dll" /> - <include name="System.Data.Entity.Design.dll" /> - <include name="System.Data.Entity.dll" /> - <include name="System.Data.Linq.dll" /> - <include name="System.Data.OracleClient.dll" /> - <include name="System.Data.Services.Client.dll" /> - <include name="System.Data.Services.Design.dll" /> - <include name="System.Data.Services.dll" /> - <include name="System.Data.SqlXml.dll" /> - <include name="System.Deployment.dll" /> - <include name="System.Design.dll" /> - <include name="System.Device.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.DirectoryServices.Protocols.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.Dynamic.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.EnterpriseServices.Thunk.dll" /> - <include name="System.EnterpriseServices.Wrapper.dll" /> - <include name="System.IdentityModel.dll" /> - <include name="System.IdentityModel.Selectors.dll" /> - <include name="System.IO.Log.dll" /> - <include name="System.Management.dll" /> - <include name="System.Management.Instrumentation.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Net.dll" /> - <include name="System.Numerics.dll" /> - <include name="System.Runtime.Caching.dll" /> - <include name="System.Runtime.DurableInstancing.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceModel.Activation.dll" /> - <include name="System.ServiceModel.Activities.dll" /> - <include name="System.ServiceModel.Channels.dll" /> - <include name="System.ServiceModel.Discovery.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Routing.dll" /> - <include name="System.ServiceModel.ServiceMoniker40.dll" /> - <include name="System.ServiceModel.WasHosting.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Transactions.dll" /> - <include name="System.Web.Abstractions.dll" /> - <include name="System.Web.ApplicationServices.dll" /> - <include name="System.Web.DataVisualization.Design.dll" /> - <include name="System.Web.DataVisualization.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.DynamicData.Design.dll" /> - <include name="System.Web.DynamicData.dll" /> - <include name="System.Web.Entity.Design.dll" /> - <include name="System.Web.Entity.dll" /> - <include name="System.Web.Extensions.Design.dll" /> - <include name="System.Web.Extensions.dll" /> - <include name="System.Web.Mobile.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Routing.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.DataVisualization.Design.dll" /> - <include name="System.Windows.Forms.DataVisualization.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.Workflow.Activities.dll" /> - <include name="System.Workflow.ComponentModel.dll" /> - <include name="System.Workflow.Runtime.dll" /> - <include name="System.WorkflowServices.dll" /> - <include name="System.Xaml.dll" /> - <include name="System.Xaml.Hosting.dll" /> - <include name="System.Xml.dll" /> - <include name="System.Xml.Linq.dll" /> - </reference-assemblies> - <!-- WPF Assemblies --> - <reference-assemblies basedir="${path::combine(installRoot, 'v4.0.30319')}/WPF"> - <include name="NaturalLanguage6.dll" /> - <include name="NlsData0009.dll" /> - <include name="NlsLexicons0009.dll" /> - <include name="PenIMC.dll" /> - <include name="PresentationCore.dll" /> - <include name="PresentationFramework.Aero.dll" /> - <include name="PresentationFramework.Classic.dll" /> - <include name="PresentationFramework.dll" /> - <include name="PresentationFramework.Luna.dll" /> - <include name="PresentationFramework.Royale.dll" /> - <include name="PresentationHost_v0400.dll" /> - <include name="PresentationNative_v0400.dll" /> - <include name="PresentationUI.dll" /> - <include name="ReachFramework.dll" /> - <include name="System.Printing.dll" /> - <include name="System.Speech.dll" /> - <include name="System.Windows.Input.Manipulations.dll" /> - <include name="System.Windows.Presentation.dll" /> - <include name="UIAutomationClient.dll" /> - <include name="UIAutomationClientsideProviders.dll" /> - <include name="UIAutomationProvider.dll" /> - <include name="UIAutomationTypes.dll" /> - <include name="WindowsBase.dll" /> - <include name="WindowsFormsIntegration.dll" /> - <include name="wpfgfx_v0400.dll" /> - <include name="wpftxt_v0400.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${environment::get-folder-path('ProgramFiles')}/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.5"> - <include name="Microsoft.Build.Conversion.v4.0.dll" /> - <include name="Microsoft.Build.dll" /> - <include name="Microsoft.Build.Engine.dll" /> - <include name="Microsoft.Build.Framework.dll" /> - <include name="Microsoft.Build.Tasks.v4.0.dll" /> - <include name="Microsoft.Build.Utilities.v4.0.dll" /> - <include name="Microsoft.CSharp.dll" /> - <include name="Microsoft.JScript.dll" /> - <include name="Microsoft.VisualBasic.Compatibility.Data.dll" /> - <include name="Microsoft.VisualBasic.Comptatibility.dll" /> - <include name="Microsoft.VisualBasic.dll" /> - <include name="Microsoft.VisualC.dll" /> - <include name="Microsoft.VisualC.STLCLR.dll" /> - <include name="mscorlib.dll" /> - <include name="PresentationBuildTasks.dll" /> - <include name="PresentationCore.dll" /> - <include name="WindowsBase.dll" /> - <include name="PresentationFramework.dll" /> - <include name="PresentationFramework.Aero.dll" /> - <include name="PresentationFramework.Classic.dll" /> - <include name="PresentationFramework.Luna.dll" /> - <include name="PresentationFramework.Royale.dll" /> - <include name="ReachFramework.dll" /> - <include name="System.Activities.Core.Presentation.dll" /> - <include name="System.Activities.dll" /> - <include name="System.Activities.DurableInstancing.dll" /> - <include name="System.Activities.Presentation.dll" /> - <include name="System.AddIn.Contract.dll" /> - <include name="System.AddIn.dll" /> - <include name="System.ComponentModel.Composition.dll" /> - <include name="System.ComponentModel.DataAnnotations.dll" /> - <include name="System.Configuration.dll" /> - <include name="System.Core.dll" /> - <include name="System.Data.DataSetExtension.dll" /> - <include name="System.Data.dll" /> - <include name="System.Data.Entity.Design.dll" /> - <include name="System.Data.Entity.dll" /> - <include name="System.Data.Linq.dll" /> - <include name="System.Data.OracleClient.dll" /> - <include name="System.Data.Services.Client.dll" /> - <include name="System.Data.Services.Design.dll" /> - <include name="System.Data.Services.dll" /> - <include name="System.Data.SqlXml.dll" /> - <include name="System.Deployment.dll" /> - <include name="System.Design.dll" /> - <include name="System.Device.dll" /> - <include name="System.DirectoryServices.AccountManagement.dll" /> - <include name="System.DirectoryServices.dll" /> - <include name="System.DirectoryServices.Protocols.dll" /> - <include name="System.dll" /> - <include name="System.Drawing.Design.dll" /> - <include name="System.Drawing.dll" /> - <include name="System.EnterpriseServices.dll" /> - <include name="System.EnterpriseServices.Thunk.dll" /> - <include name="System.EnterpriseServices.Wrapper.dll" /> - <include name="System.IdentityModel.dll" /> - <include name="System.IdentityModel.Selectors.dll" /> - <include name="System.IO.Log.dll" /> - <include name="System.Management.dll" /> - <include name="System.Management.Instrumentation.dll" /> - <include name="System.Messaging.dll" /> - <include name="System.Net.dll" /> - <include name="System.Numerics.dll" /> - <include name="System.Printing.dll" /> - <include name="System.Runtime.Caching.dll" /> - <include name="System.Runtime.DurableInstancing.dll" /> - <include name="System.Runtime.Remoting.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.Runtime.Serialization.Formatters.Soap.dll" /> - <include name="System.Security.dll" /> - <include name="System.ServiceModel.Activation.dll" /> - <include name="System.ServiceModel.Activities.dll" /> - <include name="System.ServiceModel.Channels.dll" /> - <include name="System.ServiceModel.Discovery.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Routing.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.ServiceProcess.dll" /> - <include name="System.Speech.dll" /> - <include name="System.Transactions.dll" /> - <include name="System.Web.Abstractions.dll" /> - <include name="System.Web.ApplicationServices.dll" /> - <include name="System.Web.DataVisualization.Design.dll" /> - <include name="System.Web.DataVisualization.dll" /> - <include name="System.Web.dll" /> - <include name="System.Web.DynamicData.Design.dll" /> - <include name="System.Web.DynamicData.dll" /> - <include name="System.Web.Entity.Design.dll" /> - <include name="System.Web.Entity.dll" /> - <include name="System.Web.Extensions.Design.dll" /> - <include name="System.Web.Extensions.dll" /> - <include name="System.Web.Mobile.dll" /> - <include name="System.Web.RegularExpressions.dll" /> - <include name="System.Web.Routing.dll" /> - <include name="System.Web.Services.dll" /> - <include name="System.Windows.Forms.DataVisualization.Design.dll" /> - <include name="System.Windows.Forms.DataVisualization.dll" /> - <include name="System.Windows.Forms.dll" /> - <include name="System.Windows.Input.Manipulations.dll" /> - <include name="System.Windows.Presentation.dll" /> - <include name="System.Workflow.Activities.dll" /> - <include name="System.Workflow.ComponentModel.dll" /> - <include name="System.Workflow.Runtime.dll" /> - <include name="System.WorkflowServices.dll" /> - <include name="System.Xaml.dll" /> - <include name="System.Xml.dll" /> - <include name="System.Xml.Linq.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 4.0 specific assemblies --> - <include name="extensions/net/4.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 4.0 specific assemblies --> - <include name="extensions/common/4.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${sdkInstallRoot}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v4.0.30319')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <locatesdk property="sdkInstallRoot" minwinsdkver="v7.0A" minnetfxver="4.0" maxnetfxver="4.0.99999" failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="netcf-1.0" - family="netcf" - version="1.0" - description="Microsoft .NET Compact Framework 1.0" - sdkdirectory="${path::combine(sdkInstallRoot, 'v1.0.5000\bin')}" - frameworkdirectory="${path::combine(installRoot, 'v1.1.4322')}" - frameworkassemblydirectory="${path::combine(sdkInstallRoot, 'v1.0.5000\Windows CE')}" - clrversion="1.1.4322" - clrtype="Compact" - vendor="Microsoft" - > - <runtime> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v1.1.4322" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(sdkInstallRoot, 'v1.0.5000\Windows CE')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- this is not a supported runtime framework --> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(sdkInstallRoot, 'v1.0.5000\bin')}" /> - <directory name="${path::combine(installRoot, 'v1.1.4322')}" /> - <directory name="${path::combine(sdkInstallRoot.DesktopFramework, 'bin')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <readregistry - property="sdkInstallRoot" - key="SOFTWARE\Microsoft\.NETCompactFramework\sdkInstallRoot" - hive="LocalMachine" /> - <readregistry - property="sdkInstallRoot.DesktopFramework" - key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv1.1" - hive="LocalMachine" /> - <fail if="${not directory::exists(sdkInstallRoot.DesktopFramework)}">The .NET Framework 1.1 SDK is not installed.</fail> - </project> - <tasks> - <task name="csc"> - <attribute name="noconfig">true</attribute> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - </task> - <task name="resgen"> - <attribute name="exename">cfresgen</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - </task> - </tasks> - </framework> - <framework - name="netcf-2.0" - family="netcf" - version="2.0" - description="Microsoft .NET Compact Framework 2.0" - sdkdirectory="${path::combine(sdkInstallRoot.DesktopFramework, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v2.0.50727')}" - frameworkassemblydirectory="${path::combine(sdkInstallRoot, 'WindowsCE')}" - clrversion="2.0.0" - clrtype="Compact" - vendor="Microsoft" - > - <runtime> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v2.0.50727" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(sdkInstallRoot, 'WindowsCE')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- this is not a supported runtime framework --> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(sdkInstallRoot.DesktopFramework, 'bin')}" /> - </tool-paths> - <project> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <readregistry - property="sdkInstallRoot" - key="SOFTWARE\Microsoft\.NETCompactFramework\v2.0.0.0\InstallRoot\" - hive="LocalMachine" /> - <readregistry - property="sdkInstallRoot.DesktopFramework" - key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv2.0" - hive="LocalMachine" /> - <fail if="${not directory::exists(sdkInstallRoot.DesktopFramework)}">The .NET Framework 2.0 SDK is not installed.</fail> - </project> - <tasks> - <task name="csc"> - <attribute name="noconfig">true</attribute> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="silverlight-2.0" - family="silverlight" - version="2.0" - description="Microsoft Silverlight 2.0" - sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v3.5')}" - frameworkassemblydirectory="${SL2RefAssemblyBaseDir}" - clrversion="2.0.50727" - clrtype="Browser" - vendor="Microsoft" - > - <runtime> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v2.0.50727" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${SL2RefAssemblyBaseDir}"> - <include name="Microsoft.VisualBasic.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Core.dll" /> - <include name="System.dll" /> - <include name="System.Net.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.Windows.Browser.dll" /> - <include name="System.Windows.dll" /> - <include name="System.Xml.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 2.0 specific assemblies --> - <include name="extensions/net/2.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${SL2RefAssemblyBaseDir}" /> - <directory name="${path::combine(sdkInstallRoot, 'bin')}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v3.5')}" /> - <directory name="${path::combine(installRoot, 'v2.0.50727')}" /> - </tool-paths> - <project> - <readregistry property="SL2RefAssemblyBaseDir" - key="SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\v2.0\ReferenceAssemblies\SLRuntimeInstallPath" - hive="LocalMachine" /> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <locatesdk property="sdkInstallRoot" minwinsdkver="v6.0A" maxnetfxver="3.5" failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="noconfig">true</attribute> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="silverlight-3.0" - family="silverlight" - version="3.0" - description="Microsoft Silverlight 3.0" - sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v3.5')}" - frameworkassemblydirectory="${SL3RefAssemblyBaseDir}" - clrversion="2.0.50727" - clrtype="Browser" - vendor="Microsoft" - > - <runtime> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v2.0.50727" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${SL3RefAssemblyBaseDir}"> - <include name="Microsoft.VisualBasic.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Core.dll" /> - <include name="System.dll" /> - <include name="System.Xml.dll" /> - <include name="System.Windows.dll" /> - <include name="System.Windows.Browser.dll" /> - <!-- Remaining libraries found in the Reference Assembly directory --> - <include name="agcore.debug.dll" /> - <include name="agcore.dll" /> - <include name="coreclr.dll" /> - <include name="mscorrc.debug.dll" /> - <include name="mscorrc.dll" /> - <include name="npctrl.dll" /> - <include name="npctrlui.dll" /> - <include name="Silverlight.ConfigurationUI.dll" /> - <include name="System.Net.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Web.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 2.0 specific assemblies --> - <include name="extensions/net/2.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${SL3RefAssemblyBaseDir}" /> - <directory name="${path::combine(sdkInstallRoot, 'bin')}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v3.5')}" /> - </tool-paths> - <project> - <readregistry property="SL3RefAssemblyBaseDir" - key="SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\v3.0\ReferenceAssemblies\SLRuntimeInstallPath" - hive="LocalMachine" /> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <locatesdk property="sdkInstallRoot" minwinsdkver="v6.0A" maxnetfxver="3.5" failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="noconfig">true</attribute> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="silverlight-4.0" - family="silverlight" - version="4.0" - description="Microsoft Silverlight 4.0" - sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v4.0.30319')}" - frameworkassemblydirectory="${SL4RefAssemblyBaseDir}" - clrversion="4.0.30319" - clrtype="Browser" - vendor="Microsoft" - > - <runtime> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v4.0.30319" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${SL4RefAssemblyBaseDir}"> - <include name="Microsoft.VisualBasic.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Core.dll" /> - <include name="system.dll" /> - <include name="System.Xml.dll" /> - <include name="System.Windows.dll" /> - <include name="System.Windows.Browser.dll" /> - <!-- Remaining libraries found in the Reference Assembly directory --> - <include name="agcore.debug.dll" /> - <include name="agcore.dll" /> - <include name="coreclr.dll" /> - <include name="mscorrc.debug.dll" /> - <include name="mscorrc.dll" /> - <include name="npctrl.dll" /> - <include name="npctrlui.dll" /> - <include name="System.Net.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Web.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 4.0 specific assemblies --> - <include name="extensions/net/4.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 4.0 specific assemblies --> - <include name="extensions/common/4.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${SL4RefAssemblyBaseDir}" /> - <directory name="${path::combine(sdkInstallRoot, 'bin')}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v4.0.30319')}" /> - </tool-paths> - <project> - <readregistry property="SL4RefAssemblyBaseDir" - key="SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\v4.0\ReferenceAssemblies\SLRuntimeInstallPath" - hive="LocalMachine" /> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <locatesdk property="sdkInstallRoot" minwinsdkver="v7.0A" minnetfxver="4.0" maxnetfxver="4.0.99999" failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="noconfig">true</attribute> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="silverlight-5.0" - family="silverlight" - version="5.0" - description="Microsoft Silverlight 5.0" - sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}" - frameworkdirectory="${path::combine(installRoot, 'v4.0.30319')}" - frameworkassemblydirectory="${SL5RefAssemblyBaseDir}" - clrversion="4.0.30319" - clrtype="Browser" - vendor="Microsoft" - > - <runtime> - <modes> - <strict> - <environment> - <variable name="COMPLUS_VERSION" value="v4.0.30319" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${SL5RefAssemblyBaseDir}"> - <include name="Microsoft.VisualBasic.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Core.dll" /> - <include name="system.dll" /> - <include name="System.Xml.dll" /> - <include name="System.Windows.dll" /> - <include name="System.Windows.Browser.dll" /> - <!-- Remaining libraries found in the Reference Assembly directory --> - <include name="agcore.debug.dll" /> - <include name="agcore.dll" /> - <include name="coreclr.dll" /> - <include name="mscorrc.debug.dll" /> - <include name="mscorrc.dll" /> - <include name="npctrl.dll" /> - <include name="npctrlui.dll" /> - <include name="System.Net.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <!-- Remaining libraries are specific to XNA programming --> - <include name="Microsoft.Xna.Framework.dll" /> - <include name="Microsoft.Xna.Framework.Graphics.dll" /> - <include name="Microsoft.Xna.Framework.Graphics.Shaders.dll" /> - <include name="System.Windows.Xna.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 4.0 specific assemblies --> - <include name="extensions/net/4.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 4.0 specific assemblies --> - <include name="extensions/common/4.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${SL5RefAssemblyBaseDir}" /> - <directory name="${path::combine(sdkInstallRoot, 'bin')}" - if="${property::exists('sdkInstallRoot')}" /> - <directory name="${path::combine(installRoot, 'v4.0.30319')}" /> - </tool-paths> - <project> - <readregistry property="SL5RefAssemblyBaseDir" - key="SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\v5.0\ReferenceAssemblies\SLRuntimeInstallPath" - hive="LocalMachine" /> - <readregistry - property="installRoot" - key="SOFTWARE\Microsoft\.NETFramework\InstallRoot" - hive="LocalMachine" /> - <locatesdk property="sdkInstallRoot" minwinsdkver="v7.0A" minnetfxver="4.0" maxnetfxver="4.0.99999" failonerror="false" /> - </project> - <tasks> - <task name="csc"> - <attribute name="noconfig">true</attribute> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="vbc"> - <attribute name="nostdlib">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportsnostdlib">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportsplatform">true</attribute> - <attribute name="supportswarnaserrorlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="supportsplatform">true</attribute> - </task> - <task name="vjc"> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="exename">lc</attribute> - <attribute name="supportsassemblyreferences">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-1.0" - family="mono" - version="1.0" - description="Mono 1.0 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}" - clrversion="1.1.4322" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/1.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/1.1" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${runtimeEngine}" /> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </auto> - <strict> - <engine program="${runtimeEngine}"> - <arg value="--runtime=v1.1.4322" /> - </engine> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 1.0 specific assemblies --> - <include name="extensions/mono/1.0/**/*.dll" /> - <!-- include .NET 1.1 specific assemblies --> - <include name="extensions/common/1.1/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <!-- unmanaged tools --> - <directory name="${sdkInstallRoot}/bin" /> - </tool-paths> - <project> - <!-- quick and dirty check to see if pkg-config is available (and configured) --> - <property name="pkgconfig.available" value="${environment::variable-exists('PKG_CONFIG_PATH')}" /> - <if test="${pkgconfig.available}"> - <if test="${pkg-config::exists('mono')}"> - <call target="configure-from-pkg-config" /> - </if> - <if test="${not pkg-config::exists('mono')}"> - <call target="configure-from-registry" /> - </if> - </if> - <if test="${not pkgconfig.available}"> - <call target="configure-from-registry" /> - </if> - - <!-- determine if we're dealing with a Mono 1.0.x release --> - <if test="${version::parse(mono.version) < version::parse('1.1')}"> - <!-- - in Mono 1.0.x, the framework tools are located - in the <install root>\lib directory - --> - <property name="toolDirectory" value="${frameworkAssemblyDirectory}" /> - <property name="runtimeEngine" value="${path::combine(frameworkAssemblyDirectory, 'mono.exe')}" /> - <property name="resgen.tool" value="monoresgen" /> - <!-- in Mono 1.0.x, only mcs and mbas are located in <install root>\lib\mono\<profile> --> - <property name="csc.tool" value="${path::combine(frameworkAssemblyDirectory, 'mono/1.0/mcs.exe')}" /> - <property name="mbas.tool" value="${path::combine(frameworkAssemblyDirectory, 'mono/1.0/mbas.exe')}" /> - <!-- /doc is not supported in Mono 1.0.x --> - <property name="csc.supportsdocgeneration" value="false" /> - - <!-- - Mono 1.0.1 installer incorrectly adds '\mono' to - "MonoConfigDir" registry value - --> - <if test="${string::ends-with(configDir, 'etc\mono')}"> - <property name="configDir" value="${string::replace(configDir, 'etc\mono', 'etc')}" /> - </if> - </if> - - <!-- determine if we're dealing with a Mono 1.1.x release or higher --> - <if test="${version::parse(mono.version) >= version::parse('1.1')}"> - <!-- - in Mono 1.1.x (and higher ?), the framework tools - are located in the <install root>\lib\mono\<profile> - directory - --> - <property name="toolDirectory" value="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}" /> - <property name="runtimeEngine" value="${path::combine(frameworkAssemblyDirectory, 'mono.exe')}" /> - <!-- starting from Mono 1.1.9.2, mono.exe is located in the bin directory --> - <if test="${not file::exists(runtimeEngine)}"> - <property name="runtimeEngine" value="${path::combine(sdkInstallRoot, 'bin/mono.exe')}" /> - </if> - <property name="resgen.tool" value="resgen" /> - <property name="csc.tool" value="mcs" /> - <property name="csc.supportsdocgeneration" value="true" /> - <property name="mbas.tool" value="mbas" /> - </if> - - <target name="configure-from-pkg-config"> - <property name="mono.version" value="${pkg-config::get-mod-version('mono')}" /> - <property name="sdkInstallRoot" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'prefix'))}" /> - <property name="frameworkAssemblyDirectory" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'libdir'))}" /> - <property name="configDir" value="${path::combine(sdkInstallRoot, 'etc')}/" /> - </target> - - <target name="configure-from-registry"> - <monoregistry property="mono.reg" failonerror="false" /> - <readregistry - property="mono.version" - key="${mono.reg}\DefaultCLR" - hive="LocalMachine" - /> - <property name="monokey" value="${mono.reg}\${mono.version}" /> - - <readregistry - property="sdkInstallRoot" - key="${monokey}\SdkInstallRoot" - hive="LocalMachine" /> - <readregistry - property="frameworkAssemblyDirectory" - key="${monokey}\FrameworkAssemblyDirectory" - hive="LocalMachine" /> - <readregistry - property="configDir" - key="${monokey}\MonoConfigDir" - hive="LocalMachine" /> - </target> - </project> - <properties> - </properties> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">${csc.tool}</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">${csc.supportsdocgeneration}</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="vbc"> - <attribute name="exename">${mbas.tool}</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="exename">${resgen.tool}</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-2.0" - family="mono" - version="2.0" - description="Mono 2.0 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}" - clrversion="2.0.50727" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${runtimeEngine}" /> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </auto> - <strict> - <engine program="${runtimeEngine}"> - <arg value="--runtime=v2.0.50727" /> - </engine> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}" /> - <!-- for compatibility with Mono 1.0.x --> - <directory name="${frameworkAssemblyDirectory}" /> - <!-- unmanaged tools --> - <directory name="${sdkInstallRoot}/bin" /> - </tool-paths> - <project> - <!-- quick and dirty check to see if pkg-config is available (and configured) --> - <property name="pkgconfig.available" value="${environment::variable-exists('PKG_CONFIG_PATH')}" /> - <if test="${pkgconfig.available}"> - <if test="${pkg-config::exists('mono')}"> - <call target="configure-from-pkg-config" /> - </if> - <if test="${not pkg-config::exists('mono')}"> - <call target="configure-from-registry" /> - </if> - </if> - <if test="${not pkgconfig.available}"> - <call target="configure-from-registry" /> - </if> - - <property name="resgen.supportsexternalfilereferences" value="false" /> - - <!-- determine if we're dealing with a Mono 1.0.x release --> - <if test="${version::parse(mono.version) < version::parse('1.1')}"> - <!-- - in Mono 1.0.x, the framework tools are located - in the <install root>\lib directory, except for - mbas and mcs - --> - <property name="toolDirectory" value="${frameworkAssemblyDirectory}" /> - <property name="runtimeEngine" value="${path::combine(frameworkAssemblyDirectory, 'mono.exe')}" /> - <property name="resgen.tool" value="monoresgen" /> - <property name="csc.supportsdocgeneration" value="false" /> - - <!-- - Mono 1.0.1 installer incorrectly adds '\mono' to - "MonoConfigDir" registry value - --> - <if test="${string::ends-with(configDir, 'etc\mono')}"> - <property name="configDir" value="${string::replace(configDir, 'etc\mono', 'etc')}" /> - </if> - </if> - - <!-- determine if we're dealing with a Mono 1.1.x release or higher --> - <if test="${version::parse(mono.version) >= version::parse('1.1')}"> - <property name="toolDirectory" value="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}" /> - <property name="runtimeEngine" value="${path::combine(frameworkAssemblyDirectory, 'mono.exe')}" /> - <!-- starting from Mono 1.1.9.2, mono.exe is located in the bin directory --> - <if test="${not file::exists(runtimeEngine)}"> - <property name="runtimeEngine" value="${path::combine(sdkInstallRoot, 'bin/mono.exe')}" /> - </if> - <property name="csc.supportsdocgeneration" value="true" /> - </if> - <!-- as from Mono 1.2.3.50, resgen supports the /usesourcepath option --> - <if test="${version::parse(mono.version) >= version::parse('1.2.3.50')}"> - <property name="resgen.supportsexternalfilereferences" value="true" /> - </if> - - <target name="configure-from-pkg-config"> - <property name="mono.version" value="${pkg-config::get-mod-version('mono')}" /> - <property name="sdkInstallRoot" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'prefix'))}" /> - <property name="frameworkAssemblyDirectory" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'libdir'))}" /> - <property name="configDir" value="${path::combine(sdkInstallRoot, 'etc')}/" /> - </target> - - <target name="configure-from-registry"> - <monoregistry property="mono.reg" failonerror="false" /> - <readregistry - property="mono.version" - key="${mono.reg}\DefaultCLR" - hive="LocalMachine" - /> - <property name="monokey" value="${mono.reg}\${mono.version}" /> - - <readregistry - property="sdkInstallRoot" - key="${monokey}\SdkInstallRoot" - hive="LocalMachine" /> - <readregistry - property="frameworkAssemblyDirectory" - key="${monokey}\FrameworkAssemblyDirectory" - hive="LocalMachine" /> - <readregistry - property="configDir" - key="${monokey}\MonoConfigDir" - hive="LocalMachine" /> - </target> - </project> - <properties> - </properties> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">gmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">${csc.supportsdocgeneration}</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="exename">${resgen.tool}</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">${resgen.supportsexternalfilereferences}</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-3.5" - family="mono" - version="3.5" - description="Mono 3.5 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}" - clrversion="2.0.50727" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${runtimeEngine}" /> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </auto> - <strict> - <engine program="${runtimeEngine}"> - <arg value="--runtime=v2.0.50727" /> - </engine> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/3.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/3.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/3.5')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${sdkInstallRoot}/bin" /> - </tool-paths> - <project> - <!-- quick and dirty check to see if pkg-config is available (and configured) --> - <property name="pkgconfig.available" value="${environment::variable-exists('PKG_CONFIG_PATH')}" /> - <if test="${pkgconfig.available}"> - <if test="${pkg-config::exists('mono')}"> - <call target="configure-from-pkg-config" /> - </if> - <if test="${not pkg-config::exists('mono')}"> - <call target="configure-from-registry" /> - </if> - </if> - <if test="${not pkgconfig.available}"> - <call target="configure-from-registry" /> - </if> - - <property name="toolDirectory" value="${path::combine(frameworkAssemblyDirectory, 'mono/3.5')}" /> - <property name="runtimeEngine" value="${path::combine(sdkInstallRoot, 'bin/mono.exe')}" /> - - <target name="configure-from-pkg-config"> - <property name="mono.version" value="${pkg-config::get-mod-version('mono')}" /> - <property name="sdkInstallRoot" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'prefix'))}" /> - <property name="frameworkAssemblyDirectory" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'libdir'))}" /> - <property name="configDir" value="${path::combine(sdkInstallRoot, 'etc')}/" /> - </target> - - <target name="configure-from-registry"> - <monoregistry property="mono.reg" failonerror="false" /> - <readregistry - property="mono.version" - key="${mono.reg}\DefaultCLR" - hive="LocalMachine" - /> - <property name="monokey" value="${mono.reg}\${mono.version}" /> - - <readregistry - property="sdkInstallRoot" - key="${monokey}\SdkInstallRoot" - hive="LocalMachine" /> - <readregistry - property="frameworkAssemblyDirectory" - key="${monokey}\FrameworkAssemblyDirectory" - hive="LocalMachine" /> - <readregistry - property="configDir" - key="${monokey}\MonoConfigDir" - hive="LocalMachine" /> - </target> - </project> - <properties> - </properties> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">gmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="langversion">linq</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-4.0" - family="mono" - version="4.0" - description="Mono 4.0 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(frameworkAssemblyDirectory, 'mono/4.0')}" - clrversion="4.0.30319" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${runtimeEngine}" /> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </auto> - <strict> - <engine program="${runtimeEngine}"> - <arg value="--runtime=v4.0.30319" /> - </engine> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/4.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/3.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/3.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/4.0')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/3.5')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${sdkInstallRoot}/bin" /> - </tool-paths> - <project> - <!-- quick and dirty check to see if pkg-config is available (and configured) --> - <property name="pkgconfig.available" value="${environment::variable-exists('PKG_CONFIG_PATH')}" /> - <if test="${pkgconfig.available}"> - <if test="${pkg-config::exists('mono')}"> - <call target="configure-from-pkg-config" /> - </if> - <if test="${not pkg-config::exists('mono')}"> - <call target="configure-from-registry" /> - </if> - </if> - <if test="${not pkgconfig.available}"> - <call target="configure-from-registry" /> - </if> - - <property name="toolDirectory" value="${path::combine(frameworkAssemblyDirectory, 'mono/4.0')}" /> - <property name="runtimeEngine" value="${path::combine(sdkInstallRoot, 'bin/mono.exe')}" /> - - <target name="configure-from-pkg-config"> - <property name="mono.version" value="${pkg-config::get-mod-version('mono')}" /> - <property name="sdkInstallRoot" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'prefix'))}" /> - <property name="frameworkAssemblyDirectory" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'libdir'))}" /> - <property name="configDir" value="${path::combine(sdkInstallRoot, 'etc')}/" /> - </target> - - <target name="configure-from-registry"> - <monoregistry property="mono.reg" failonerror="false" /> - <readregistry - property="mono.version" - key="${mono.reg}\DefaultCLR" - hive="LocalMachine" - /> - <property name="monokey" value="${mono.reg}\${mono.version}" /> - - <readregistry - property="sdkInstallRoot" - key="${monokey}\SdkInstallRoot" - hive="LocalMachine" /> - <readregistry - property="frameworkAssemblyDirectory" - key="${monokey}\FrameworkAssemblyDirectory" - hive="LocalMachine" /> - <readregistry - property="configDir" - key="${monokey}\MonoConfigDir" - hive="LocalMachine" /> - </target> - </project> - <properties> - </properties> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">dmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="langversion">linq</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-4.5" - family="mono" - version="4.5" - description="Mono 4.5 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(frameworkAssemblyDirectory, 'mono/4.5')}" - clrversion="4.0.30319" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${runtimeEngine}" /> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </auto> - <strict> - <engine program="${runtimeEngine}"> - <arg value="--runtime=v4.0.30319" /> - </engine> - <environment> - <variable name="PATH" path="${path::combine(sdkInstallRoot, 'bin')};%PATH%" /> - <variable name="MONO_CFG_DIR" path="${configDir};%MONO_CFG_DIR%" /> - </environment> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/4.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/4.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/3.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/3.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/4.5')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/4.0')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/3.5')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${sdkInstallRoot}/bin" /> - </tool-paths> - <project> - <!-- quick and dirty check to see if pkg-config is available (and configured) --> - <property name="pkgconfig.available" value="${environment::variable-exists('PKG_CONFIG_PATH')}" /> - <if test="${pkgconfig.available}"> - <if test="${pkg-config::exists('mono')}"> - <call target="configure-from-pkg-config" /> - </if> - <if test="${not pkg-config::exists('mono')}"> - <call target="configure-from-registry" /> - </if> - </if> - <if test="${not pkgconfig.available}"> - <call target="configure-from-registry" /> - </if> - - <property name="toolDirectory" value="${path::combine(frameworkAssemblyDirectory, 'mono/4.0')}" /> - <property name="runtimeEngine" value="${path::combine(sdkInstallRoot, 'bin/mono.exe')}" /> - - <target name="configure-from-pkg-config"> - <property name="mono.version" value="${pkg-config::get-mod-version('mono')}" /> - <property name="sdkInstallRoot" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'prefix'))}" /> - <property name="frameworkAssemblyDirectory" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'libdir'))}" /> - <property name="configDir" value="${path::combine(sdkInstallRoot, 'etc')}/" /> - </target> - - <target name="configure-from-registry"> - <monoregistry property="mono.reg" failonerror="false" /> - <readregistry - property="mono.version" - key="${mono.reg}\DefaultCLR" - hive="LocalMachine" - /> - <property name="monokey" value="${mono.reg}\${mono.version}" /> - - <readregistry - property="sdkInstallRoot" - key="${monokey}\SdkInstallRoot" - hive="LocalMachine" /> - <readregistry - property="frameworkAssemblyDirectory" - key="${monokey}\FrameworkAssemblyDirectory" - hive="LocalMachine" /> - <readregistry - property="configDir" - key="${monokey}\MonoConfigDir" - hive="LocalMachine" /> - </target> - </project> - <properties> - </properties> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">dmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="langversion">linq</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="moonlight-2.0" - family="moonlight" - version="2.0" - description="Moonlight 2.0" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${toolDirectory}" - clrversion="2.0.50727" - clrtype="Browser" - vendor="Mono" - > - <runtime> - <modes> - <auto> - <engine program="${runtimeEngine}"> - <arg value="--runtime=moonlight" /> - <arg value="--security=temporary-smcs-hack" /> - </engine> - </auto> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(frameworkAssemblyDirectory, 'lib/mono/2.1')}"> - <include name="Microsoft.VisualBasic.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Core.dll" /> - <include name="System.dll" /> - <include name="System.Net.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.Windows.Browser.dll" /> - <include name="System.Windows.dll" /> - <include name="System.Xml.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 2.0 specific assemblies --> - <include name="extensions/net/2.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/2.0')}" /> - <directory name="${path::combine(frameworkAssemblyDirectory, 'mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${sdkInstallRoot}/bin" /> - </tool-paths> - <project> - <!-- quick and dirty check to see if pkg-config is available (and configured) --> - <property name="pkgconfig.available" value="${environment::variable-exists('PKG_CONFIG_PATH')}" /> - <if test="${pkgconfig.available}"> - <if test="${pkg-config::exists('mono')}"> - <call target="configure-from-pkg-config" /> - </if> - <if test="${not pkg-config::exists('mono')}"> - <call target="configure-from-registry" /> - </if> - </if> - <if test="${not pkgconfig.available}"> - <call target="configure-from-registry" /> - </if> - - <property name="toolDirectory" value="${path::combine(frameworkAssemblyDirectory, 'mono/2.1')}" /> - <property name="runtimeEngine" value="${path::combine(sdkInstallRoot, 'bin/mono.exe')}" /> - - <target name="configure-from-pkg-config"> - <property name="mono.version" value="${pkg-config::get-mod-version('mono')}" /> - <property name="sdkInstallRoot" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'prefix'))}" /> - <property name="frameworkAssemblyDirectory" value="${cygpath::get-windows-path(pkg-config::get-variable('mono', 'libdir'))}" /> - <property name="configDir" value="${path::combine(sdkInstallRoot, 'etc')}/" /> - </target> - - <target name="configure-from-registry"> - <monoregistry property="mono.reg" failonerror="false" /> - <readregistry - property="mono.version" - key="${mono.reg}\DefaultCLR" - hive="LocalMachine" - /> - <property name="monokey" value="${mono.reg}\${mono.version}" /> - - <readregistry - property="sdkInstallRoot" - key="${monokey}\SdkInstallRoot" - hive="LocalMachine" /> - <readregistry - property="frameworkAssemblyDirectory" - key="${monokey}\FrameworkAssemblyDirectory" - hive="LocalMachine" /> - <readregistry - property="configDir" - key="${monokey}\MonoConfigDir" - hive="LocalMachine" /> - </target> - </project> - <tasks> - <task name="csc"> - <attribute name="exename">smcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - </tasks> - </framework> - <framework - name="sscli-1.0" - family="sscli" - version="1.0" - description="Microsoft Shared Source CLI 1.0" - sdkdirectory="C:\sscli\build\v1.x86fstchk.rotor\sdk\bin" - frameworkdirectory="C:\sscli\build\v1.x86fstchk.rotor" - frameworkassemblydirectory="C:\sscli\build\v1.x86fstchk.rotor" - clrversion="1.0.3" - clrtype="Desktop" - vendor="Microsoft" - > - <runtime> - <modes> - <auto> - <engine program="C:\sscli\build\v1.x86fstchk.rotor\clix.exe" /> - </auto> - </modes> - </runtime> - <reference-assemblies basedir="C:\sscli\build\v1.x86fstchk.rotor"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- this is not a supported runtime framework --> - </task-assemblies> - <tool-paths> - <directory name="C:\sscli\build\v1.x86fstchk.rotor\sdk\bin" /> - <directory name="C:\sscli\build\v1.x86fstchk.rotor" /> - </tool-paths> - <project /> - <tasks> - <task name="csc"> - <attribute name="supportsnowarnlist">true</attribute> - </task> - <task name="jsc"> - <attribute name="managed">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - <task name="ildasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - </platform> - <platform name="unix" default="auto"> - <task-assemblies> - <!-- include NAnt task assemblies --> - <include name="*Tasks.dll" /> - <!-- include NAnt test assemblies --> - <include name="*Tests.dll" /> - <!-- include framework-neutral assemblies --> - <include name="extensions/common/neutral/**/*.dll" /> - <!-- exclude Microsoft.NET specific task assembly --> - <exclude name="NAnt.MSNetTasks.dll" /> - <!-- exclude Microsoft.NET specific test assembly --> - <exclude name="NAnt.MSNet.Tests.dll" /> - <!-- exclude win32 specific task assembly --> - <exclude name="NAnt.Win32Tasks.dll" /> - <!-- exclude win32 specific test assembly --> - <exclude name="NAnt.Win32.Tests.dll" /> - </task-assemblies> - <framework - name="mono-1.0" - family="mono" - version="1.0" - description="Mono 1.0 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(prefix, 'lib/mono/1.0')}" - clrversion="1.1.4322" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/1.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/1.1" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${path::combine(prefix, 'bin/mono')}" /> - </auto> - <strict> - <engine program="${path::combine(prefix, 'bin/mono')}"> - <arg value="--runtime=v1.1.4322" /> - </engine> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/1.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 1.0 specific assemblies --> - <include name="extensions/mono/1.0/**/*.dll" /> - <!-- include .NET 1.1 specific assemblies --> - <include name="extensions/common/1.1/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <!-- unmanaged tools --> - <directory name="${prefix}/bin" /> - </tool-paths> - <project> - <if test="${not pkg-config::exists('mono')}"> - <fail>Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.</fail> - </if> - <property name="prefix" value="${pkg-config::get-variable('mono', 'prefix')}" /> - <if test="${not(pkg-config::is-atleast-version('mono', '1.1'))}"> - <property name="toolDirectory" value="${path::combine(prefix, 'bin')}" /> - <property name="resgen.tool" value="monoresgen" /> - <property name="csc.supportsdocgeneration" value="false" /> - </if> - <if test="${pkg-config::is-atleast-version('mono', '1.1')}"> - <property name="toolDirectory" value="${path::combine(prefix, 'lib/mono/1.0')}" /> - <property name="resgen.tool" value="resgen" /> - <property name="csc.supportsdocgeneration" value="true" /> - </if> - </project> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">${path::combine(prefix, 'lib/mono/1.0/mcs.exe')}</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">${csc.supportsdocgeneration}</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="vbc"> - <attribute name="exename">${path::combine(prefix, 'lib/mono/1.0/mbas.exe')}</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="exename">${resgen.tool}</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-2.0" - family="mono" - version="2.0" - description="Mono 2.0 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(prefix, 'lib/mono/2.0')}" - clrversion="2.0.50727" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${path::combine(prefix, 'bin/mono')}" /> - </auto> - <strict> - <engine program="${path::combine(prefix, 'bin/mono')}"> - <arg value="--runtime=v2.0.50727" /> - </engine> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <directory name="${path::combine(prefix, 'lib/mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${prefix}/bin" /> - </tool-paths> - <project> - <if test="${not pkg-config::exists('mono')}"> - <fail>Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.</fail> - </if> - <property name="resgen.supportsexternalfilereferences" value="false" /> - <property name="prefix" value="${pkg-config::get-variable('mono', 'prefix')}" /> - <if test="${not(pkg-config::is-atleast-version('mono', '1.1'))}"> - <property name="toolDirectory" value="${path::combine(prefix, 'bin')}" /> - <property name="resgen.tool" value="monoresgen" /> - <property name="csc.supportsdocgeneration" value="false" /> - </if> - <if test="${pkg-config::is-atleast-version('mono', '1.1')}"> - <property name="toolDirectory" value="${path::combine(prefix, 'lib/mono/2.0')}" /> - <property name="resgen.tool" value="resgen" /> - <property name="csc.supportsdocgeneration" value="true" /> - </if> - <!-- as from Mono 1.2.3.50, resgen supports the /usesourcepath option --> - <if test="${pkg-config::is-atleast-version('mono', '1.2.3.50')}"> - <property name="resgen.supportsexternalfilereferences" value="true" /> - </if> - </project> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">gmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">${csc.supportsdocgeneration}</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="exename">${resgen.tool}</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">${resgen.supportsexternalfilereferences}</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-3.5" - family="mono" - version="3.5" - description="Mono 3.5 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(prefix, 'lib/mono/2.0')}" - clrversion="2.0.50727" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${path::combine(prefix, 'bin/mono')}" /> - </auto> - <strict> - <engine program="${path::combine(prefix, 'bin/mono')}"> - <arg value="--runtime=v2.0.50727" /> - </engine> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/3.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/3.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <directory name="${path::combine(prefix, 'lib/mono/2.0')}" /> - <directory name="${path::combine(prefix, 'lib/mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${prefix}/bin" /> - </tool-paths> - <project> - <if test="${not pkg-config::exists('mono')}"> - <fail>Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.</fail> - </if> - <property name="resgen.supportsexternalfilereferences" value="false" /> - <property name="prefix" value="${pkg-config::get-variable('mono', 'prefix')}" /> - <property name="toolDirectory" value="${path::combine(prefix, 'lib/mono/3.5')}" /> - </project> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">gmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="langversion">linq</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-4.0" - family="mono" - version="4.0" - description="Mono 4.0 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(prefix, 'lib/mono/4.0')}" - clrversion="4.0.30319" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${path::combine(prefix, 'bin/mono')}" /> - </auto> - <strict> - <engine program="${path::combine(prefix, 'bin/mono')}"> - <arg value="--runtime=v4.0.30319" /> - </engine> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/4.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/3.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/3.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <directory name="${path::combine(prefix, 'lib/mono/3.5')}" /> - <directory name="${path::combine(prefix, 'lib/mono/2.0')}" /> - <directory name="${path::combine(prefix, 'lib/mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${prefix}/bin" /> - </tool-paths> - <project> - <if test="${not pkg-config::exists('mono')}"> - <fail>Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.</fail> - </if> - <property name="resgen.supportsexternalfilereferences" value="false" /> - <property name="prefix" value="${pkg-config::get-variable('mono', 'prefix')}" /> - <property name="toolDirectory" value="${path::combine(prefix, 'lib/mono/4.0')}" /> - </project> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">dmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="langversion">linq</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="mono-4.5" - family="mono" - version="4.5" - description="Mono 4.5 Profile" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${path::combine(prefix, 'lib/mono/4.5')}" - clrversion="4.0.30319" - clrtype="Desktop" - vendor="Mono" - > - <runtime> - <probing-paths> - <directory name="lib/mono/2.0" /> - <directory name="lib/mono/neutral" /> - <directory name="lib/common/2.0" /> - <directory name="lib/common/neutral" /> - </probing-paths> - <modes> - <auto> - <engine program="${path::combine(prefix, 'bin/mono')}" /> - </auto> - <strict> - <engine program="${path::combine(prefix, 'bin/mono')}"> - <arg value="--runtime=v4.0.30319" /> - </engine> - </strict> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/4.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/4.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/3.5')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/3.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/2.0')}"> - <include name="*.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include Mono version-neutral assemblies --> - <include name="extensions/mono/neutral/**/*.dll" /> - <!-- include Mono 2.0 specific assemblies --> - <include name="extensions/mono/2.0/**/*.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <directory name="${path::combine(prefix, 'lib/mono/4.5')}" /> - <directory name="${path::combine(prefix, 'lib/mono/3.5')}" /> - <directory name="${path::combine(prefix, 'lib/mono/2.0')}" /> - <directory name="${path::combine(prefix, 'lib/mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${prefix}/bin" /> - </tool-paths> - <project> - <if test="${not pkg-config::exists('mono')}"> - <fail>Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.</fail> - </if> - <property name="resgen.supportsexternalfilereferences" value="false" /> - <property name="prefix" value="${pkg-config::get-variable('mono', 'prefix')}" /> - <property name="toolDirectory" value="${path::combine(prefix, 'lib/mono/4.5')}" /> - </project> - <tasks> - <task name="al"> - <attribute name="managed">true</attribute> - </task> - <task name="csc"> - <attribute name="exename">dmcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="langversion">linq</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="jsc"> - <attribute name="exename">mjs</attribute> - <attribute name="managed">strict</attribute> - </task> - <task name="vbc"> - <attribute name="exename">vbnc</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="resgen"> - <attribute name="managed">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - <attribute name="managed">true</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - <task name="ilasm"> - <attribute name="managed">true</attribute> - </task> - </tasks> - </framework> - <framework - name="moonlight-2.0" - family="moonlight" - version="2.0" - description="Moonlight 2.0" - sdkdirectory="${toolDirectory}" - frameworkdirectory="${toolDirectory}" - frameworkassemblydirectory="${toolDirectory}" - clrversion="2.0.50727" - clrtype="Browser" - vendor="Mono" - > - <runtime> - <modes> - <auto> - <engine program="${path::combine(prefix, 'bin/mono')}"> - <arg value="--runtime=moonlight" /> - <arg value="--security=temporary-smcs-hack" /> - </engine> - </auto> - </modes> - </runtime> - <reference-assemblies basedir="${path::combine(prefix, 'lib/mono/2.1')}"> - <include name="Microsoft.VisualBasic.dll" /> - <include name="mscorlib.dll" /> - <include name="System.Core.dll" /> - <include name="System.dll" /> - <include name="System.Net.dll" /> - <include name="System.Runtime.Serialization.dll" /> - <include name="System.ServiceModel.dll" /> - <include name="System.ServiceModel.Web.dll" /> - <include name="System.Windows.Browser.dll" /> - <include name="System.Windows.dll" /> - <include name="System.Xml.dll" /> - </reference-assemblies> - <task-assemblies> - <!-- include MS.NET version-neutral assemblies --> - <include name="extensions/net/neutral/**/*.dll" /> - <!-- include MS.NET 2.0 specific assemblies --> - <include name="extensions/net/2.0/**/*.dll" /> - <!-- include MS.NET specific task assembly --> - <include name="NAnt.MSNetTasks.dll" /> - <!-- include MS.NET specific test assembly --> - <include name="NAnt.MSNet.Tests.dll" /> - <!-- include .NET 2.0 specific assemblies --> - <include name="extensions/common/2.0/**/*.dll" /> - </task-assemblies> - <tool-paths> - <directory name="${toolDirectory}" /> - <directory name="${path::combine(prefix, 'lib/mono/2.0')}" /> - <directory name="${path::combine(prefix, 'lib/mono/1.0')}" /> - <!-- unmanaged tools --> - <directory name="${prefix}/bin" /> - </tool-paths> - <project> - <if test="${not pkg-config::exists('mono')}"> - <fail>Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.</fail> - </if> - <property name="prefix" value="${pkg-config::get-variable('mono', 'prefix')}" /> - <property name="toolDirectory" value="${path::combine(prefix, 'lib/mono/2.1')}" /> - </project> - <tasks> - <task name="csc"> - <attribute name="exename">smcs</attribute> - <attribute name="managed">true</attribute> - <attribute name="supportspackagereferences">true</attribute> - <attribute name="supportsnowarnlist">true</attribute> - <attribute name="supportsdocgeneration">true</attribute> - <attribute name="supportskeycontainer">true</attribute> - <attribute name="supportskeyfile">true</attribute> - <attribute name="supportsdelaysign">true</attribute> - <attribute name="supportslangversion">true</attribute> - </task> - <task name="resgen"> - <attribute name="supportsassemblyreferences">true</attribute> - <attribute name="supportsexternalfilereferences">true</attribute> - </task> - <task name="delay-sign"> - <attribute name="exename">sn</attribute> - </task> - <task name="license"> - <attribute name="hascommandlinecompiler">false</attribute> - </task> - </tasks> - </framework> - </platform> - </frameworks> - <properties> - <!-- properties defined here are accessible to all build files --> - <!-- <property name="foo" value = "bar" readonly="false" /> --> - </properties> - </nant> - <!-- - This section contains the log4net configuration settings. - - By default, no messages will be logged to the log4net logging infrastructure. - - To enable the internal logging, set the threshold attribute on the log4net element - to "ALL". - - When internal logging is enabled, internal messages will be written to the - console. - --> - <log4net threshold="OFF"> - <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> - <layout type="log4net.Layout.PatternLayout"> - <param name="ConversionPattern" value="[%c{2}:%m - [%x] <%X{auth}>]%n" /> - </layout> - </appender> - <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> - <param name="File" value="${APPDATA}\\NAnt\\NAnt.log" /> - <param name="AppendToFile" value="true" /> - <param name="MaxSizeRollBackups" value="2" /> - <param name="MaximumFileSize" value="500KB" /> - <param name="RollingStyle" value="Size" /> - <param name="StaticLogFileName" value="true" /> - <layout type="log4net.Layout.PatternLayout"> - <param name="ConversionPattern" value="[%c{2}:%m - [%x] <%X{auth}>]%n" /> - </layout> - </appender> - <!-- Setup the root category, add the appenders and set the default level --> - <root> - <!-- Only log messages with severity ERROR (or higher) --> - <level value="ERROR" /> - <!-- Log messages to the console --> - <appender-ref ref="ConsoleAppender" /> - <!-- Uncomment the next line to enable logging messages to the NAnt.log file --> - <!-- <appender-ref ref="RollingLogFileAppender" /> --> - </root> - <!-- Specify the priority for some specific categories --> - <!-- - <logger name="NAnt.Core.TaskBuilderCollection"> - <level value="DEBUG" /> - </logger> - <logger name="NAnt"> - <level value="INFO" /> - </logger> - --> - </log4net> - <runtime> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <probing privatePath="lib" /> - <dependentAssembly> - <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.2.10.0" - newVersion="1.2.10.0"/> - </dependentAssembly> - </assemblyBinding> - <NetFx40_LegacySecurityPolicy enabled="true"/> - </runtime> - <startup> - <!-- .NET Framework 4.0 --> - <supportedRuntime version="v4.0" /> - <!-- .NET Framework 2.0 --> - <supportedRuntime version="v2.0.50727" /> - </startup> -</configuration> diff --git a/lib/NAnt/NCoverExplorer.NAntTasks.dll b/lib/NAnt/NCoverExplorer.NAntTasks.dll deleted file mode 100644 index 552e45253d..0000000000 Binary files a/lib/NAnt/NCoverExplorer.NAntTasks.dll and /dev/null differ diff --git a/lib/NAnt/NDoc.Documenter.NAnt.dll b/lib/NAnt/NDoc.Documenter.NAnt.dll deleted file mode 100644 index e646883208..0000000000 Binary files a/lib/NAnt/NDoc.Documenter.NAnt.dll and /dev/null differ diff --git a/lib/NAnt/SLiNgshoT.Core.dll b/lib/NAnt/SLiNgshoT.Core.dll deleted file mode 100644 index 7a3b91b8a2..0000000000 Binary files a/lib/NAnt/SLiNgshoT.Core.dll and /dev/null differ diff --git a/lib/NAnt/SLiNgshoT.exe b/lib/NAnt/SLiNgshoT.exe deleted file mode 100644 index 749f82b9bc..0000000000 Binary files a/lib/NAnt/SLiNgshoT.exe and /dev/null differ diff --git a/lib/NAnt/SourceSafe.Interop.dll b/lib/NAnt/SourceSafe.Interop.dll deleted file mode 100644 index 85493ae6e7..0000000000 Binary files a/lib/NAnt/SourceSafe.Interop.dll and /dev/null differ diff --git a/lib/NAnt/ThoughtWorks.CruiseControl.MSBuild.dll b/lib/NAnt/ThoughtWorks.CruiseControl.MSBuild.dll deleted file mode 100644 index a302f400d4..0000000000 Binary files a/lib/NAnt/ThoughtWorks.CruiseControl.MSBuild.dll and /dev/null differ diff --git a/lib/NAnt/extensions/common/2.0/NAnt.MSBuild.dll b/lib/NAnt/extensions/common/2.0/NAnt.MSBuild.dll deleted file mode 100644 index 43a627ce91..0000000000 Binary files a/lib/NAnt/extensions/common/2.0/NAnt.MSBuild.dll and /dev/null differ diff --git a/lib/NAnt/extensions/common/4.0/NAnt.MSBuild.dll b/lib/NAnt/extensions/common/4.0/NAnt.MSBuild.dll deleted file mode 100644 index 43a627ce91..0000000000 Binary files a/lib/NAnt/extensions/common/4.0/NAnt.MSBuild.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/2.0/nunit-console-runner.dll b/lib/NAnt/lib/common/2.0/nunit-console-runner.dll deleted file mode 100644 index b0e611afb7..0000000000 Binary files a/lib/NAnt/lib/common/2.0/nunit-console-runner.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/2.0/nunit-console.exe b/lib/NAnt/lib/common/2.0/nunit-console.exe deleted file mode 100644 index 0735eef6be..0000000000 Binary files a/lib/NAnt/lib/common/2.0/nunit-console.exe and /dev/null differ diff --git a/lib/NAnt/lib/common/2.0/nunit-console.exe.config b/lib/NAnt/lib/common/2.0/nunit-console.exe.config deleted file mode 100644 index 3a2afb33d1..0000000000 --- a/lib/NAnt/lib/common/2.0/nunit-console.exe.config +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <!-- - The .NET 2.0 build of the console runner only - runs under .NET 2.0 or higher. The setting - useLegacyV2RuntimeActivationPolicy only applies - under .NET 4.0 and permits use of mixed mode - assemblies, which would otherwise not load - correctly. - --> - <startup useLegacyV2RuntimeActivationPolicy="true"> - <!-- Comment out the next line to force use of .NET 4.0 --> - <supportedRuntime version="v2.0.50727" /> - <supportedRuntime version="v4.0.30319" /> - </startup> - - <runtime> - <!-- Ensure that test exceptions don't crash NUnit --> - <legacyUnhandledExceptionPolicy enabled="1" /> - - <!-- Run partial trust V2 assemblies in full trust under .NET 4.0 --> - <loadFromRemoteSources enabled="true" /> - - <!-- Look for addins in the addins directory for now --> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <probing privatePath="lib;addins"/> - </assemblyBinding> - - </runtime> - -</configuration> \ No newline at end of file diff --git a/lib/NAnt/lib/common/2.0/nunit.core.dll b/lib/NAnt/lib/common/2.0/nunit.core.dll deleted file mode 100644 index 5f748becd1..0000000000 Binary files a/lib/NAnt/lib/common/2.0/nunit.core.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/2.0/nunit.core.interfaces.dll b/lib/NAnt/lib/common/2.0/nunit.core.interfaces.dll deleted file mode 100644 index 72b9486d74..0000000000 Binary files a/lib/NAnt/lib/common/2.0/nunit.core.interfaces.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/2.0/nunit.framework.dll b/lib/NAnt/lib/common/2.0/nunit.framework.dll deleted file mode 100644 index eaea9eedf7..0000000000 Binary files a/lib/NAnt/lib/common/2.0/nunit.framework.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/2.0/nunit.util.dll b/lib/NAnt/lib/common/2.0/nunit.util.dll deleted file mode 100644 index 28d603c662..0000000000 Binary files a/lib/NAnt/lib/common/2.0/nunit.util.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/ICSharpCode.SharpCvsLib.Console.dll b/lib/NAnt/lib/common/neutral/ICSharpCode.SharpCvsLib.Console.dll deleted file mode 100644 index a64360bc46..0000000000 Binary files a/lib/NAnt/lib/common/neutral/ICSharpCode.SharpCvsLib.Console.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/ICSharpCode.SharpCvsLib.dll b/lib/NAnt/lib/common/neutral/ICSharpCode.SharpCvsLib.dll deleted file mode 100644 index e2a71cb1ed..0000000000 Binary files a/lib/NAnt/lib/common/neutral/ICSharpCode.SharpCvsLib.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/ICSharpCode.SharpZipLib.dll b/lib/NAnt/lib/common/neutral/ICSharpCode.SharpZipLib.dll deleted file mode 100644 index 60ef0c99f9..0000000000 Binary files a/lib/NAnt/lib/common/neutral/ICSharpCode.SharpZipLib.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/NDoc.Core.dll b/lib/NAnt/lib/common/neutral/NDoc.Core.dll deleted file mode 100644 index 07fbbe87ea..0000000000 Binary files a/lib/NAnt/lib/common/neutral/NDoc.Core.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/NDoc.Documenter.Msdn.dll b/lib/NAnt/lib/common/neutral/NDoc.Documenter.Msdn.dll deleted file mode 100644 index 986998ca4c..0000000000 Binary files a/lib/NAnt/lib/common/neutral/NDoc.Documenter.Msdn.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/NDoc.ExtendedUI.dll b/lib/NAnt/lib/common/neutral/NDoc.ExtendedUI.dll deleted file mode 100644 index bc3d5a4ee7..0000000000 Binary files a/lib/NAnt/lib/common/neutral/NDoc.ExtendedUI.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/NUnitCore.dll b/lib/NAnt/lib/common/neutral/NUnitCore.dll deleted file mode 100644 index 0f1873c1e6..0000000000 Binary files a/lib/NAnt/lib/common/neutral/NUnitCore.dll and /dev/null differ diff --git a/lib/NAnt/lib/common/neutral/netDumbster.dll b/lib/NAnt/lib/common/neutral/netDumbster.dll deleted file mode 100644 index 49d7191fcb..0000000000 Binary files a/lib/NAnt/lib/common/neutral/netDumbster.dll and /dev/null differ diff --git a/lib/NAnt/log4net.dll b/lib/NAnt/log4net.dll deleted file mode 100644 index 20a2e1c47d..0000000000 Binary files a/lib/NAnt/log4net.dll and /dev/null differ diff --git a/lib/NAnt/scvs.exe b/lib/NAnt/scvs.exe deleted file mode 100644 index 093d36e1c5..0000000000 Binary files a/lib/NAnt/scvs.exe and /dev/null differ diff --git a/lib/NuGet/LICENSE.txt b/lib/NuGet/LICENSE.txt deleted file mode 100644 index 63c0dc1766..0000000000 --- a/lib/NuGet/LICENSE.txt +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/lib/NuGet/NuGet.exe b/lib/NuGet/NuGet.exe deleted file mode 100644 index 5943f680ce..0000000000 Binary files a/lib/NuGet/NuGet.exe and /dev/null differ diff --git a/lib/OpenCover/Autofac.Configuration.dll b/lib/OpenCover/Autofac.Configuration.dll deleted file mode 100644 index 230786aa24..0000000000 Binary files a/lib/OpenCover/Autofac.Configuration.dll and /dev/null differ diff --git a/lib/OpenCover/Autofac.dll b/lib/OpenCover/Autofac.dll deleted file mode 100644 index e4a596a975..0000000000 Binary files a/lib/OpenCover/Autofac.dll and /dev/null differ diff --git a/lib/OpenCover/Gendarme.Framework.dll b/lib/OpenCover/Gendarme.Framework.dll deleted file mode 100644 index fcb6c1d036..0000000000 Binary files a/lib/OpenCover/Gendarme.Framework.dll and /dev/null differ diff --git a/lib/OpenCover/Gendarme.Rules.Maintainability.dll b/lib/OpenCover/Gendarme.Rules.Maintainability.dll deleted file mode 100644 index 186ee353c9..0000000000 Binary files a/lib/OpenCover/Gendarme.Rules.Maintainability.dll and /dev/null differ diff --git a/lib/OpenCover/License.rtf b/lib/OpenCover/License.rtf deleted file mode 100644 index 0a6340c1e0..0000000000 --- a/lib/OpenCover/License.rtf +++ /dev/null @@ -1,166 +0,0 @@ -{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang3081\deflangfe3081\themelang3081\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;} -{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} -{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} -{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} -{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} -{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f39\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f40\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\f42\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f43\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f44\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f45\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\f46\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f47\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f379\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f380\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;} -{\f382\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f383\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f386\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f387\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);} -{\f409\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f410\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\f412\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f413\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} -{\f416\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f417\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} -{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} -{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} -{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} -{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} -{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} -{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;} -{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} -{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0; -\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp -\f31506\fs22\lang3081\langfe1033\langfenp1033 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1 -\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang3081\langfe1033\cgrid\langnp3081\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive -\ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\* -\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1 -\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31506\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang3081\langfe1033\cgrid\langnp3081\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}} -{\*\rsidtbl \rsid11275983\rsid14818796\rsid15367925\rsid16724145}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author Shaun}{\operator Shaun} -{\creatim\yr2012\mo1\dy5\hr7\min52}{\revtim\yr2012\mo2\dy21\hr8\min10}{\version3}{\edmins2}{\nofpages1}{\nofwords157}{\nofchars900}{\*\company Microsoft}{\nofcharsws1055}{\vern49273}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/word -ml}}\paperw11906\paperh16838\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect -\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen -\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1 -\jexpand\viewkind1\viewscale60\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct -\asianbrkrule\rsidroot15367925\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0 -{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2 -\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6 -\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang -{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14818796 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\f31506\fs22\lang3081\langfe1033\cgrid\langnp3081\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid14818796 Copyright (c) 2011}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid16724145 -2012}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid14818796 Shaun Wilde -\par Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is fu -rnished to do so, subject to the following conditions: -\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -\par THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11275983 -\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a -9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad -5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6 -b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0 -0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6 -a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f -c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512 -0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462 -a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865 -6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b -4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b -4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f -7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87 -615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad -79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b -5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab -999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9 -699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586 -8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6 -0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f -9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be -15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979 -3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d -32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a -f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86 -e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90 -fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2 -ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae -a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1 -399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5 -4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84 -0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b -c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7 -689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20 -5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0 -aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d -316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840 -545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a -c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100 -0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7 -8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89 -d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500 -1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f -bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6 -a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a -0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021 -0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008 -00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000} -{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d -617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 -6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 -656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} -{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; -\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; -\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; -\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 -4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000 -d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000e00b -b50e14f0cc01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/lib/OpenCover/Mono.Cecil.Mdb.dll b/lib/OpenCover/Mono.Cecil.Mdb.dll deleted file mode 100644 index 285d9da524..0000000000 Binary files a/lib/OpenCover/Mono.Cecil.Mdb.dll and /dev/null differ diff --git a/lib/OpenCover/Mono.Cecil.Pdb.dll b/lib/OpenCover/Mono.Cecil.Pdb.dll deleted file mode 100644 index 75787ad6d2..0000000000 Binary files a/lib/OpenCover/Mono.Cecil.Pdb.dll and /dev/null differ diff --git a/lib/OpenCover/Mono.Cecil.dll b/lib/OpenCover/Mono.Cecil.dll deleted file mode 100644 index b0691e850b..0000000000 Binary files a/lib/OpenCover/Mono.Cecil.dll and /dev/null differ diff --git a/lib/OpenCover/OpenCover.Console.exe b/lib/OpenCover/OpenCover.Console.exe deleted file mode 100644 index eb716a3ddd..0000000000 Binary files a/lib/OpenCover/OpenCover.Console.exe and /dev/null differ diff --git a/lib/OpenCover/OpenCover.Console.exe.config b/lib/OpenCover/OpenCover.Console.exe.config deleted file mode 100644 index 8299e1bb49..0000000000 --- a/lib/OpenCover/OpenCover.Console.exe.config +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <configSections> - <section name="autofac" type="Autofac.Configuration.SectionHandler, Autofac.Configuration"/> - </configSections> - <autofac> - <modules> - <module type="OpenCover.Extensions.RegisterStrategiesModule, OpenCover.Extensions" /> - </modules> - </autofac> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /> - </startup> - <runtime> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <dependentAssembly> - <assemblyIdentity name="Mono.Cecil" publicKeyToken="0738eb9f132ed756" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-0.9.5.0" newVersion="0.9.5.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" /> - </dependentAssembly> - </assemblyBinding> - </runtime> -</configuration> \ No newline at end of file diff --git a/lib/OpenCover/OpenCover.Extensions.dll b/lib/OpenCover/OpenCover.Extensions.dll deleted file mode 100644 index ffca7e4cdc..0000000000 Binary files a/lib/OpenCover/OpenCover.Extensions.dll and /dev/null differ diff --git a/lib/OpenCover/OpenCover.Framework.dll b/lib/OpenCover/OpenCover.Framework.dll deleted file mode 100644 index aa4259892e..0000000000 Binary files a/lib/OpenCover/OpenCover.Framework.dll and /dev/null differ diff --git a/lib/OpenCover/log4net.config b/lib/OpenCover/log4net.config deleted file mode 100644 index 2dd6dfb6be..0000000000 --- a/lib/OpenCover/log4net.config +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<configuration> - <configSections> - <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> - </configSections> - - <log4net> - <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender"> - <mapping> - <level value="ERROR" /> - <foreColor value="White" /> - <backColor value="Red, HighIntensity" /> - </mapping> - <mapping> - <level value="DEBUG" /> - <backColor value="Green" /> - </mapping> - <layout type="log4net.Layout.PatternLayout"> - <conversionPattern value="%message%newline" /> - </layout> - </appender> - - <root> - <appender-ref ref="ColoredConsoleAppender" /> - </root> - - </log4net> - -</configuration> \ No newline at end of file diff --git a/lib/OpenCover/log4net.dll b/lib/OpenCover/log4net.dll deleted file mode 100644 index 47cd9ad41b..0000000000 Binary files a/lib/OpenCover/log4net.dll and /dev/null differ diff --git a/lib/OpenCover/transform/simple_report.xslt b/lib/OpenCover/transform/simple_report.xslt deleted file mode 100644 index 0acac5b214..0000000000 --- a/lib/OpenCover/transform/simple_report.xslt +++ /dev/null @@ -1,332 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -This report was provided by pawan52tiwari (https://github.com/pawan52tiwari) -see https://github.com/sawilde/opencover/issues/93 - -sample usage: -powershell -noexit -file transform.ps1 -xsl simple_report.xslt -xml ..\results\opencovertests.xml -output ..\results\simple_output.html ---> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > - <xsl:output method="html"/> - <xsl:variable name="covered.lines" select="count(/CoverageSession/Modules/Module/Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0])" /> - <xsl:variable name="uncovered.lines" select="count(/CoverageSession/Modules/Module/Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc = 0])" /> - <xsl:variable name="coverable.Lines" select="count(/CoverageSession/Modules/Module/Classes/Class/Methods/Method/SequencePoints/SequencePoint)" /> - <xsl:template match="/"> - <html><body> - <h2 class="sectionheader">Code Coverage Report</h2> - <table class="overview"> - <colgroup> - <col width="130" /> - <col /> - </colgroup> - <tr> - <td class="sectionheader"> - Generated on: - </td> - <td> - <xsl:value-of select="/@date"/> - </td> - </tr> - <tr> - <td class="sectionheader"> - Parser: - </td> - <td> - Pawan Tiwari's Parser - </td> - </tr> - <tr> - <td class="sectionheader"> - Assemblies: - </td> - <td> - <xsl:value-of select="count(/CoverageSession/Modules/Module/ModuleName)"></xsl:value-of> - </td> - </tr> - <tr> - <td class="sectionheader"> - Files: - </td> - <td> - <xsl:value-of select="count(/CoverageSession/Modules/Module/Files/File)"/> - </td> - </tr> - <tr> - <td class="sectionheader"> - Coverage: - </td> - <td> - <xsl:value-of select="$covered.lines div ($uncovered.lines + $covered.lines) * 100"/>% - </td> - </tr> - <tr> - <td class="sectionheader"> - Covered lines: - </td> - <td> - <xsl:value-of select="$covered.lines"/> - </td> - </tr> - <tr> - <td class="sectionheader"> - UnCovered lines: - </td> - <td> - <xsl:value-of select="$uncovered.lines"/> - </td> - </tr> - <tr> - <td class="sectionheader"> - Coverable lines: - </td> - <td> - <xsl:value-of select="$coverable.Lines"/> - </td> - </tr> - <tr> - <td class="sectionheader"> - Total lines: - </td> - <td> - Yet To be discovered - - </td> - </tr> - </table> - <h2 class="sectionheader"> - Assemblies - </h2> - <p class="toggleClasses"> - <a id="collapseAllClasses" style="text-decoration: none;color:red;font-size:10px" href="#">Collapse all classes</a> | <a id="expandAllClasses" style="text-decoration: none;color:red;font-size:10px" - href="#">Expand all classes</a> - </p> - <table class="overview"> - <colgroup> - <col /> - <col width="60" /> - <col width="105" /> - </colgroup> - <xsl:for-each select="/CoverageSession/Modules/Module"> - <xsl:sort select="ModuleName" order="ascending"/> - <xsl:sort select="ModuleName"/> - <xsl:variable name="ModulenameVariable" select="ModuleName"></xsl:variable> - <xsl:variable name="FileLocationLink" select="."></xsl:variable> - <tr class="expanded"> - <th> - <a href="#" class="toggleClassesInAssembly" style="text-decoration: none;color:red;font-size:10px" title="Collapse/Expand classes"></a> - <xsl:value-of select="ModuleName"/> - <a href="#" class="toggleAssemblyDetails" style="text-decoration: none;color:red;font-size:10px" title="Show details of assembly">Details</a> - <div class="detailspopup"> - <table class="overview"> - <colgroup> - <col width="130" /> - <col /> - </colgroup> - <tr> - <td class="sectionheader"> - Classes: - </td> - <td> - <xsl:value-of select="count(Classes/Class/FullName[not(contains(text(),'<'))])"></xsl:value-of> - </td> - </tr> - <tr> - <td class="sectionheader"> - Covered lines: - </td> - <td> - <xsl:value-of select="count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0])"></xsl:value-of> - </td> - </tr> - <tr> - <td class="sectionheader"> - Coverable lines: - </td> - <td> - <xsl:value-of select="count(Classes/Class/Methods/Method/SequencePoints/SequencePoint)" /> - </td> - </tr> - <tr> - <td class="sectionheader"> - Coverage: - </td> - <td> - <xsl:choose> - <xsl:when test="(count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc = 0]) + count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0])) > 0"> - <xsl:value-of select="count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0]) div (count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc = 0]) + count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0])) * 100"/>% - </xsl:when> - <xsl:otherwise> - 0 - </xsl:otherwise> - </xsl:choose> - </td> - </tr> - </table> - </div> - </th> - <th title="LineCoverage"> - <xsl:if test="(Classes/Class/Methods/Method)"> - <xsl:value-of select="round(count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0]) div (count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc = 0]) + count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0])) * 100)"/>% - </xsl:if> - </th> - <td> - <xsl:variable name="width" select="count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0]) div (count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc = 0]) + count(Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0])) * 100"></xsl:variable> - <table class="coverage"> - <tr> - <td class="green" style="width: {$width}px;"> -   - </td> - <td class="red" style="width: {100-$width}px;"> -   - </td> - </tr> - </table> - </td> - </tr> - <xsl:for-each select="Classes/Class"> - <xsl:if test="FullName[not(contains(text(),'<'))]"> - <tr class="classrow"> - <td align="center"> - <h3 class="sectionheader"> - Class Name:<xsl:value-of select="FullName"></xsl:value-of> - </h3> - </td> - <td title="LineCoverage"> - <xsl:value-of select="round(count(Methods/Method/SequencePoints/SequencePoint[@vc > 0]) div (count(Methods/Method/SequencePoints/SequencePoint[@vc = 0]) + count(Methods/Method/SequencePoints/SequencePoint[@vc > 0])) * 100)"/>% - </td> - <td> - <table class="coverage"> - <tr width="100px"> - <xsl:variable name="Line.CoveragerClass" select="round(count(Methods/Method/SequencePoints/SequencePoint[@vc > 0]) div (count(Methods/Method/SequencePoints/SequencePoint[@vc = 0]) + count(Methods/Method/SequencePoints/SequencePoint[@vc > 0])) * 100)"></xsl:variable> - <td class="green" style="width: {$Line.CoveragerClass +9}px;"> -   - </td> - <td class="red" style="width: {100- $Line.CoveragerClass}px;"> -   - </td> - </tr> - </table> - </td> - </tr> - <tr class="classrow"> - <td colspan="3"> - <table class="overview"> - <colgroup> - <col width="130" /> - <col /> - </colgroup> - <tr> - <td class="sectionheader"> - Class: - </td> - <td> - <xsl:value-of select="FullName"></xsl:value-of> - </td> - </tr> - <tr> - <td class="sectionheader"> - Assembly: - </td> - <td> - <xsl:value-of select="$ModulenameVariable"></xsl:value-of> - </td> - </tr> - <tr> - <td class="sectionheader"> - File(s): - </td> - <td> - <xsl:variable name="CounterForFile" select="position()"></xsl:variable> - <xsl:value-of select="$FileLocationLink/Files/File[$CounterForFile]/@fullPath"/> - <xsl:variable name="FilePathVariable" select="//Files/File[@uid=($CounterForFile -1)]/@fullPath"></xsl:variable> - <a href="file:///{$FilePathVariable}"> - <!--<xsl:value-of select="$FilePathVariable"></xsl:value-of>--> - </a> - </td> - </tr> - <tr> - <td class="sectionheader"> - Coverage: - </td> - <td> - <xsl:variable name="Covered.lines" select="count(Methods/Method/SequencePoints/SequencePoint[@vc > 0])"></xsl:variable> - <xsl:value-of select="count(Methods/Method/SequencePoints/SequencePoint[@vc > 0]) div (count(Methods/Method/SequencePoints/SequencePoint[@vc = 0]) + count(Methods/Method/SequencePoints/SequencePoint[@vc > 0])) * 100"/>% - </td> - </tr> - <tr> - <td class="sectionheader"> - Covered lines: - </td> - <td> - <xsl:value-of select="count(Methods/Method/SequencePoints/SequencePoint[@vc > 0])"></xsl:value-of> - </td> - </tr> - <tr> - <td class="sectionheader"> - Coverable lines: - </td> - <td> - <xsl:value-of select="count(Methods/Method/SequencePoints/SequencePoint)"></xsl:value-of> - </td> - </tr> - <tr> - <td class="sectionheader"> - Total lines: - </td> - <td> - 51 - </td> - </tr> - </table> - </td> - </tr> - <tr class="classrow"> - <td colspan="3"> - <table class="overview"> - <tr> - <td class="sectionheader"> - Method - </td> - <td class="sectionheader"> - Cyclomatic Complexity - </td> - <td class="sectionheader"> - Sequence Coverage - </td> - <td class="sectionheader"> - Branch Coverage - </td> - <td class="sectionheader"> - Static Method - </td> - </tr> - <xsl:for-each select="Methods/Method[@isConstructor='false']"> - <tr> - <td> - <xsl:variable name="indexvariable" select="string-length(substring-before(Name, '::'))"/> - <xsl:value-of disable-output-escaping="yes" select="substring(Name,$indexvariable +3)"></xsl:value-of> - </td> - <td> - <xsl:value-of disable-output-escaping="yes" select="@cyclomaticComplexity"></xsl:value-of> - </td> - <td> - <xsl:value-of disable-output-escaping="yes" select="@sequenceCoverage"></xsl:value-of> - </td> - <td> - <xsl:value-of disable-output-escaping="yes" select="@branchCoverage"></xsl:value-of> - </td> - <td> - <xsl:value-of disable-output-escaping="yes" select="@isStatic"></xsl:value-of> - </td> - </tr> - </xsl:for-each> - </table> - </td> - </tr> - </xsl:if> - </xsl:for-each> - </xsl:for-each> - </table> - </body></html> - </xsl:template> -</xsl:stylesheet> diff --git a/lib/OpenCover/transform/transform.ps1 b/lib/OpenCover/transform/transform.ps1 deleted file mode 100644 index e273e3778c..0000000000 --- a/lib/OpenCover/transform/transform.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -[CmdletBinding()] -Param( - [Parameter(Mandatory=$True,Position=1)] - [string]$xsl, - - [Parameter(Mandatory=$True)] - [string]$xml, - - [Parameter(Mandatory=$True)] - [string]$output -) - -$xslt = New-Object System.Xml.Xsl.XslCompiledTransform; -$xslt.Load($xsl); -$xslt.Transform($xml, $output); - -Write-Host "The file has been transformed." diff --git a/lib/OpenCover/x64/OpenCover.Profiler.dll b/lib/OpenCover/x64/OpenCover.Profiler.dll deleted file mode 100644 index 2ccc969e85..0000000000 Binary files a/lib/OpenCover/x64/OpenCover.Profiler.dll and /dev/null differ diff --git a/lib/OpenCover/x86/OpenCover.Profiler.dll b/lib/OpenCover/x86/OpenCover.Profiler.dll deleted file mode 100644 index 6674bc392f..0000000000 Binary files a/lib/OpenCover/x86/OpenCover.Profiler.dll and /dev/null differ diff --git a/lib/ReportGenerator/ICSharpCode.NRefactory.dll b/lib/ReportGenerator/ICSharpCode.NRefactory.dll deleted file mode 100644 index f25fd5ceef..0000000000 Binary files a/lib/ReportGenerator/ICSharpCode.NRefactory.dll and /dev/null differ diff --git a/lib/ReportGenerator/LICENSE.txt b/lib/ReportGenerator/LICENSE.txt deleted file mode 100644 index 9b5e4019df..0000000000 --- a/lib/ReportGenerator/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. \ No newline at end of file diff --git a/lib/ReportGenerator/Readme.txt b/lib/ReportGenerator/Readme.txt deleted file mode 100644 index cb37de0fc3..0000000000 --- a/lib/ReportGenerator/Readme.txt +++ /dev/null @@ -1,268 +0,0 @@ -======================================================================= -= = -= = -= ReportGenerator = -= Generation of reports based on OpenCover/ PartCover / NCover = -= = -= http://www.palmmedia.de = -= = -= = -======================================================================= - -DESCRIPTION - -ReportGenerator converts XML reports generated by PartCover, OpenCover -or NCover into a readable report in various formats. -The reports do not only show the coverage quota, but also include the -source code and visualize which line has been covered. - -ReportGenerator supports merging several reports into one. -It is also possible to pass one XML file containing several reports to -ReportGenerator (e.g. a build log file). - -The following output formats are supported by ReportGenerator: - --HTML, HTMLSummary --XML, XMLSummary --Latex, LatexSummary --TextSummary --Custom formats (https://reportgenerator.codeplex.com/documentation) - -Compatibility: - -OpenCover -PartCover 4.0 -PartCover 2.2, 2.3 -Visual Studio (vstest.console.exe, CodeCoverage.exe) -NCover (tested version 1.5.8, other versions may not work) - -Also available as NuGet package: -http://nuget.org/List/Packages/ReportGenerator - -======================================================================= - -LICENSE - -This program is licensed under the Apache License 2.0. -This means you may use this program in any project. -You are allowed to modify the program as you like. - -For further details take a look at LICENSE.txt. - -======================================================================= - -CHANGELOG - -2.0.4.0 - - * Fix: Issue #10849: Improved handling of handling several classes in same - file - * Fix: Automatical unblocking of assemblies that are loaded - -2.0.3.0 - - * Fix: HTML report now compatible with IE 10 - -2.0.2.0 - - * New: Table in HTML summary report now shows total lines - * Fix: Better support of CodeContracts with OpenCover - -2.0.1.0 - - * New: Visual indicator for branch coverage percentage - -2.0.0.0 - - * New: Added ability for custom reports using MEF plugins - * New: Added support for OpenCover branch information by line - * New: Added new report format: TextSummary - * Fix: Issue #10553: Handling of compiler generated classes in F# - * Fix: Generic classes appear correctly in reports - (VisualStudioParser and DynamicCodeCoverageParser) - * Fix: HTML report now compatible with IE 11 - -1.9.1.0 - - * Fix: Improved naming of HTML report files - -1.9.0.0 - - * New: Added support for Visual Studio coverage reports - (CodeCoverage.exe) - -1.8.1.0 - - * Fix: Issue #9988: Completely empty classes now show correct - coverage - -1.8.0.0 - - * New: Issue #9891: Aggregation of results by namespace - * New: Issue #9875: More details and sorting possiblity in summary - report - * New: Issue #9913: Mark of complete line according to coverage - * New: Issue #9935: In HTMLSummary static text instead of link is - rendered - * New: Issue #9937: HTMLSummary now is a self containing report - without external CSS or JavaScript - -1.7.3.0 - - * New: Issue #9833: Version command line parameter - * Fix: Issue #9886: Compatibility for OpenCover 4.0.1229 - -1.7.2.0 - - * Fix: Issue #9736: NCover 1.5.8 Exclude attribute is not handled - * Fix: Issue #9773: Ignored casing in directory search - -1.7.1.0 - - * Fix: Issue #9706: Trailing slashes in command line arguments - -1.7.0.0 - - * New: Issue #9698: Added "coverbytest" support of OpenCover - * Fix: Issue #9671: Reduced length of report filenames - * Fix: Reports can now be located in an UNC path - -1.6.1.0 - - * Fix: Issue #9646: Unhandled IO-Exception when source directories - are supplied - -1.6.0.0 - - * New: Added support for Visual Studio coverage reports - (vstest.console.exe) - * New: Issue #9534: Added support for wildcards in report file - pattern - * Fix: OpenCoverParser supports coverage for methods that 'yield' - the result - -1.5.0.0 - - * Fix: Improved merging of metrics (now using full signature) - * Fix: Reduced memory usage during report generation - -1.4.1.0 - - * New: Added verbosity switch - * New: Added possibility to generate several output formats at once - -1.4.0.0 - - * Fix: Issue #9372: Reduced memory usage - -1.3.0.0 - - * New: Added more report preprocessing to deal with auto properties - and source files that don't appear in OpenCover/PartCover - reports - * New: Added possibility to filter assemblies - -1.2.7.0 - - * Fix: Issue #9266: Improved performance - -1.2.6.0 - - * Fix: Issue #9141: Handling of same assembly in different - directories in OpenCoverParser - -1.2.5.0 - - * New: Excluded ignored classes from OpenCoverParser - -1.2.4.0 - - * Fix: Issue #9065: Rounding of coverage quota down to the last - significant figure - * Fix: Issue #9041: Merging reports doesn't work when the same - module is used from different paths - -1.2.3.0 - - * Fix: Issue #8992: Improved HTML Summary (collapsing of classes) - -1.2.2.0 - - * Fix: Issue #8931: Improved layout of Html reports - * Fix: Issue #8958: Coverage for types with no sequence points - * Fix: Issue #8936: Additional statistics for assemblies - -1.2.1.0 - - * Fix: Issue #8653: NCover - OutOfMemoryException on a seqpoint with - a magic line - * Fix: Improved layout of Latex reports - -1.2.0.0 - - * New: Added support for OpenCover metrics - * New: Added support for AutoProperties in OpenCover/PartCover - -1.1.1.0 - - * Fix: Reports now saved with more unique filename - -1.1.0.0 - - * New: Added support for OpenCover - * New: Added XML and Latex as output formats - -1.0.0.0 - - * New: Return code now indicates success/failure - * New: Added MSBuild Task - -0.7.2.0 - - * New: Upgraded to .NET 4.0 and VS 2010 - * Fix: Improved performance by using TPL - -0.7.1.0 - - * Fix: Improved performance - -0.7.0.0 - - * New: Coverage information of unexecuted methods for - PartCover 2.3.0.35109 - -0.6.2.0 - - * Fix: Improved performance - -0.6.1.0 - - * New: Added support for PartCover 2.3.0.35109 - -0.6.0.0 - - * New: Included log4net - -0.5.0.0 - - * New: Added more statistics - * Fix: Coverage quota is now calculated exactly - -0.4.0.0 - - * Fix: Improved performance - -0.3.0.0 - - * New: Merging of reports - * New: Multicore support - -0.2.0.0 - - * New: Added NCover support - * New: Automatical detection of parser - * Fix: Improved performance - -0.1.0.0 - - * New: Initial release \ No newline at end of file diff --git a/lib/ReportGenerator/ReportGenerator.Reporting.dll b/lib/ReportGenerator/ReportGenerator.Reporting.dll deleted file mode 100644 index 4ec281bfe8..0000000000 Binary files a/lib/ReportGenerator/ReportGenerator.Reporting.dll and /dev/null differ diff --git a/lib/ReportGenerator/ReportGenerator.exe b/lib/ReportGenerator/ReportGenerator.exe deleted file mode 100644 index 21c6019f6e..0000000000 Binary files a/lib/ReportGenerator/ReportGenerator.exe and /dev/null differ diff --git a/lib/ReportGenerator/log4net.dll b/lib/ReportGenerator/log4net.dll deleted file mode 100644 index 47cd9ad41b..0000000000 Binary files a/lib/ReportGenerator/log4net.dll and /dev/null differ diff --git a/lib/Rhino.Licensing.1.4.1/lib/net40/Rhino.Licensing.dll b/lib/Rhino.Licensing.1.4.1/lib/net40/Rhino.Licensing.dll new file mode 100644 index 0000000000..c52b1d5e6a Binary files /dev/null and b/lib/Rhino.Licensing.1.4.1/lib/net40/Rhino.Licensing.dll differ diff --git a/lib/Rhino.Licensing/acknowledgements.txt b/lib/Rhino.Licensing.1.4.1/lib/net40/acknowledgements.txt similarity index 100% rename from lib/Rhino.Licensing/acknowledgements.txt rename to lib/Rhino.Licensing.1.4.1/lib/net40/acknowledgements.txt diff --git a/lib/Rhino.Licensing/license.txt b/lib/Rhino.Licensing.1.4.1/lib/net40/license.txt similarity index 100% rename from lib/Rhino.Licensing/license.txt rename to lib/Rhino.Licensing.1.4.1/lib/net40/license.txt diff --git a/lib/Rhino.Licensing/Rhino.Licensing.dll b/lib/Rhino.Licensing/Rhino.Licensing.dll deleted file mode 100644 index 69aaaaddc6..0000000000 Binary files a/lib/Rhino.Licensing/Rhino.Licensing.dll and /dev/null differ diff --git a/lib/bdddoc/bdddoc.console.exe b/lib/bdddoc/bdddoc.console.exe deleted file mode 100644 index c221982b6d..0000000000 Binary files a/lib/bdddoc/bdddoc.console.exe and /dev/null differ diff --git a/lib/bdddoc/bdddoc.dll b/lib/bdddoc/bdddoc.dll deleted file mode 100644 index ad7d8d62f4..0000000000 Binary files a/lib/bdddoc/bdddoc.dll and /dev/null differ diff --git a/nuget/chocolatey/tools/chocolateyInstall.ps1 b/nuget/chocolatey/tools/chocolateyInstall.ps1 deleted file mode 100644 index 4e2d6ae883..0000000000 --- a/nuget/chocolatey/tools/chocolateyInstall.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -$toolsPath = (Split-Path -parent $MyInvocation.MyCommand.Definition) - -# ensure module loading preference is on -$PSModuleAutoLoadingPreference = "All"; - -$modules = Get-ChildItem $toolsPath -Filter *.psm1 -$modules | ForEach-Object { - $psm1File = $_.FullName; - $moduleName = $([System.IO.Path]::GetFileNameWithoutExtension($psm1File)) - if (Get-Module $moduleName) { - remove-module $moduleName -ErrorAction SilentlyContinue; - } - import-module -name $psm1File; - } - -Initialize-Chocolatey diff --git a/nuget/chocolatey/chocolatey.nuspec b/nuspec/chocolatey/chocolatey/chocolatey.nuspec similarity index 92% rename from nuget/chocolatey/chocolatey.nuspec rename to nuspec/chocolatey/chocolatey/chocolatey.nuspec index c7b5db2514..3995891dbf 100644 --- a/nuget/chocolatey/chocolatey.nuspec +++ b/nuspec/chocolatey/chocolatey/chocolatey.nuspec @@ -1,67 +1,67 @@ -<?xml version="1.0"?> -<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <metadata> - <id>chocolatey</id> - <version>0.9.10</version> - <!--<packageSourceUrl>https://github.com/chocolatey/choco</packageSourceUrl> Need to move build to use choco to pack instead of nuget--> - <owners>Rob Reynolds</owners> - <title>Chocolatey - Chocolatey Software, Inc - https://github.com/chocolatey/choco - https://raw.githubusercontent.com/chocolatey/choco/master/docs/logo/chocolateyicon.gif - https://raw.githubusercontent.com/chocolatey/choco/master/LICENSE - false - 2017-2021 Chocolatey Software, Inc, 2011-2017 RealDimensions Software, LLC - - nuget apt-get machine repository chocolatey - Chocolatey is the package manager for Windows (like apt-get but for Windows) - -Chocolatey is a package manager for Windows (like apt-get but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer. - -Chocolatey is brought to you by the work and inspiration of the community, the work and thankless nights of the [Chocolatey Team](https://github.com/orgs/chocolatey/people), with Rob heading up the direction. - -You can host your own sources and add them to Chocolatey, you can extend Chocolatey's capabilities, and folks, it's only going to get better. - -### Information - - * [Chocolatey Website and Community Package Repository](https://community.chocolatey.org) - * [Mailing List](http://groups.google.com/group/chocolatey) / [Release Announcements Only Mailing List](https://groups.google.com/group/chocolatey-announce) / [Build Status Mailing List](http://groups.google.com/group/chocolatey-build-status) - * [Twitter](https://twitter.com/chocolateynuget) / [Facebook](https://www.facebook.com/ChocolateySoftware) / [Github](https://github.com/chocolatey) - * [Blog](https://blog.chocolatey.org/) / [Newsletter](https://chocolatey.us8.list-manage1.com/subscribe?u=86a6d80146a0da7f2223712e4&id=73b018498d) - * [Documentation](https://docs.chocolatey.org/en-us/) / [Support](https://chocolatey.org/support) - -### Commands -There are quite a few commands you can call - you should check out the [command reference](https://docs.chocolatey.org/en-us/choco/commands). Here are the most common: - - * Help - choco -? or choco command -? - * Search - choco search something - * List - choco list -lo - * Config - choco config list - * Install - choco install baretail - * Pin - choco pin windirstat - * Outdated - choco outdated - * Upgrade - choco upgrade baretail - * Uninstall - choco uninstall baretail - -#### Alternative installation sources: - * Install ruby gem - choco install compass -source ruby - * Install python egg - choco install sphynx -source python - * Install windows feature - choco install IIS -source windowsfeatures - * Install webpi feature - choco install IIS7.5Express -source webpi - -#### More -For more advanced commands and switches, use `choco -?` or `choco command -h`. You can also look at the [command reference](https://docs.chocolatey.org/en-us/choco/commands), including how you can force a package to install the x86 version of a package. - -### Create Packages? -We have some great guidance on how to do that. Where? I'll give you a hint, it rhymes with socks! [Docs!](https://docs.chocolatey.org/en-us/create/create-packages) - -In that mess there is a link to the [PowerShell Chocolatey module reference](https://docs.chocolatey.org/en-us/create/functions). - - -See all - https://github.com/chocolatey/choco/blob/stable/CHANGELOG.md - - - + + + + chocolatey + 0.9.10 + + Rob Reynolds + Chocolatey + Chocolatey Software, Inc + https://github.com/chocolatey/choco + https://chocolatey.org/assets/images/nupkg/chocolateyicon.png + https://raw.githubusercontent.com/chocolatey/choco/master/LICENSE + false + 2017-2021 Chocolatey Software, Inc, 2011-2017 RealDimensions Software, LLC + + nuget apt-get machine repository chocolatey + Chocolatey is the package manager for Windows (like apt-get but for Windows) + +Chocolatey is a package manager for Windows (like apt-get but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer. + +Chocolatey is brought to you by the work and inspiration of the community, the work and thankless nights of the [Chocolatey Team](https://github.com/orgs/chocolatey/people), with Rob heading up the direction. + +You can host your own sources and add them to Chocolatey, you can extend Chocolatey's capabilities, and folks, it's only going to get better. + +### Information + + * [Chocolatey Website and Community Package Repository](https://community.chocolatey.org) + * [Mailing List](http://groups.google.com/group/chocolatey) / [Release Announcements Only Mailing List](https://groups.google.com/group/chocolatey-announce) / [Build Status Mailing List](http://groups.google.com/group/chocolatey-build-status) + * [Twitter](https://twitter.com/chocolateynuget) / [Facebook](https://www.facebook.com/ChocolateySoftware) / [GitHub](https://github.com/chocolatey) + * [Blog](https://blog.chocolatey.org/) / [Newsletter](https://chocolatey.us8.list-manage1.com/subscribe?u=86a6d80146a0da7f2223712e4&id=73b018498d) + * [Documentation](https://docs.chocolatey.org/en-us/) / [Support](https://chocolatey.org/support) + +### Commands +There are quite a few commands you can call - you should check out the [command reference](https://docs.chocolatey.org/en-us/choco/commands). Here are the most common: + + * Help - choco -? or choco command -? + * Search - choco search something + * List - choco list -lo + * Config - choco config list + * Install - choco install baretail + * Pin - choco pin windirstat + * Outdated - choco outdated + * Upgrade - choco upgrade baretail + * Uninstall - choco uninstall baretail + +#### Alternative installation sources: + * Install ruby gem - choco install compass -source ruby + * Install python egg - choco install sphynx -source python + * Install windows feature - choco install IIS -source windowsfeatures + * Install webpi feature - choco install IIS7.5Express -source webpi + +#### More +For more advanced commands and switches, use `choco -?` or `choco command -h`. You can also look at the [command reference](https://docs.chocolatey.org/en-us/choco/commands), including how you can force a package to install the x86 version of a package. + +### Create Packages? +We have some great guidance on how to do that. Where? I'll give you a hint, it rhymes with socks! [Docs!](https://docs.chocolatey.org/en-us/create/create-packages) + +In that mess there is a link to the [PowerShell Chocolatey module reference](https://docs.chocolatey.org/en-us/create/functions). + + +See all - https://docs.chocolatey.org/en-us/choco/release-notes + + + diff --git a/nuget/chocolatey/tools/VERIFICATION.txt b/nuspec/chocolatey/chocolatey/tools/VERIFICATION.txt similarity index 98% rename from nuget/chocolatey/tools/VERIFICATION.txt rename to nuspec/chocolatey/chocolatey/tools/VERIFICATION.txt index f350a8ca49..4d4f7b189a 100644 --- a/nuget/chocolatey/tools/VERIFICATION.txt +++ b/nuspec/chocolatey/chocolatey/tools/VERIFICATION.txt @@ -1,23 +1,23 @@ -Chocolatey comes from Chocolatey Software. - -To verify the binaries: - -* Ensure you have Git installed. -* Run `git clone https://github.com/chocolatey/choco.git` -* Switch to the tag of the released version. For instance: - `git checkout 0.10.11` -* Run `build.bat` (`.\build.bat` in PowerShell) -* Once that is successfully completed, head into code_drop\chocolatey\console - folder where you will find choco.exe. -* Verify the checksum you find there with the checksum shown on the package - page of the community repository. - -NOTE: For prereleases we don't always post a tag. However, the version of - choco.exe in those prereleases does carry the git SHA as part of the - version (informational version). So you can start out with downloading - the package (left menu on the community repo), then extract that as a - zip file. If you right click on the choco.exe at the top level of - tools\chocolateyInstall and choose "Properties", click on "Details", then - look at Product Version, you can see the SHA there. You would check out - that specific SHA and then run the build. +Chocolatey comes from Chocolatey Software. + +To verify the binaries: + +* Ensure you have Git installed. +* Run `git clone https://github.com/chocolatey/choco.git` +* Switch to the tag of the released version. For instance: + `git checkout 0.10.11` +* Run `build.bat` (`.\build.bat` in PowerShell) +* Once that is successfully completed, head into code_drop\chocolatey\console + folder where you will find choco.exe. +* Verify the checksum you find there with the checksum shown on the package + page of the community repository. + +NOTE: For prereleases we don't always post a tag. However, the version of + choco.exe in those prereleases does carry the git SHA as part of the + version (informational version). So you can start out with downloading + the package (left menu on the community repo), then extract that as a + zip file. If you right click on the choco.exe at the top level of + tools\chocolateyInstall and choose "Properties", click on "Details", then + look at Product Version, you can see the SHA there. You would check out + that specific SHA and then run the build. \ No newline at end of file diff --git a/nuspec/chocolatey/chocolatey/tools/chocolateyInstall.ps1 b/nuspec/chocolatey/chocolatey/tools/chocolateyInstall.ps1 new file mode 100644 index 0000000000..d7033cc01f --- /dev/null +++ b/nuspec/chocolatey/chocolatey/tools/chocolateyInstall.ps1 @@ -0,0 +1,75 @@ +$toolsPath = Split-Path -Parent $MyInvocation.MyCommand.Definition + +# Ensure module loading preference is on +$PSModuleAutoLoadingPreference = "All" + +$licensedAssembly = [System.AppDomain]::CurrentDomain.GetAssemblies() | + Where-Object { $_.GetName().Name -eq 'chocolatey.licensed' } | + Select-Object -First 1 + +if ($null -ne $licensedAssembly) { + # The licensed assembly is installed, check its supported Chocolatey versions and/or the assembly + # version so we can attempt to determine whether it's compatible with this version of Chocolatey. + $attributeData = $licensedAssembly.GetCustomAttributes($true) + + $minVersion = $attributeData | + Where-Object { $_.TypeId -like '*MinimumChocolateyVersion*' } | + Select-Object -ExpandProperty Version -First 1 + + $borderWidth = 70 + try { + $borderWidth = [System.Console]::BufferWidth - 10 + } catch { + # Do nothing. This means we're in a non-interactive environment without a console attached. + } + + $messageBorder = '=' * $borderWidth + $extensionVersionWarning = @" +$messageBorder + +You are installing a version of Chocolatey that may not be compatible with the currently installed version of the chocolatey.extension package. +Running Chocolatey with the current version of the chocolatey.extension package is an unsupported configuration. +See https://ch0.co/compatibility for more information. + +If you are also modifying the chocolatey.extension package, you can ignore this warning. + +$messageBorder +"@ + + if ($null -ne $minVersion) { + # Found an explicit attribute declaring what version(s) of Chocolatey the current licensed + # assembly is known to work with. + # Check what Chocolatey version we're installing in Major.Minor.Patch form, stripping off any prerelease suffix + $packageVersion = $env:ChocolateyPackageVersion -replace '-.+$' -as [System.Version] + + if ($packageVersion -lt $minVersion) { + Write-Warning $extensionVersionWarning + } + } + else { + $version = $attributeData | + Where-Object { $_.TypeId -like '*AssemblyInformationalVersion*' } | + Select-Object -ExpandProperty InformationalVersion -First 1 + + # Strip off quotes and prerelease suffix if present, that's not critical for this check. + $version = $version -replace '-.+$' -as [System.Version] + + if ($version.Major -lt 4) { + Write-Warning $extensionVersionWarning + } + } +} + +$modules = Get-ChildItem $toolsPath -Filter *.psm1 +$modules | ForEach-Object { + $psm1File = $_.FullName + $moduleName = [System.IO.Path]::GetFileNameWithoutExtension($psm1File) + + if (Get-Module $moduleName) { + Remove-Module $moduleName -ErrorAction SilentlyContinue + } + + Import-Module -Name $psm1File +} + +Initialize-Chocolatey diff --git a/nuget/chocolatey/tools/chocolateyInstall/choco.exe.ignore b/nuspec/chocolatey/chocolatey/tools/chocolateyInstall/choco.exe.ignore similarity index 100% rename from nuget/chocolatey/tools/chocolateyInstall/choco.exe.ignore rename to nuspec/chocolatey/chocolatey/tools/chocolateyInstall/choco.exe.ignore diff --git a/nuget/chocolatey/tools/chocolateysetup.psm1 b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 similarity index 85% rename from nuget/chocolatey/tools/chocolateysetup.psm1 rename to nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 index 6dd5334074..a6bdfd8ab3 100644 --- a/nuget/chocolatey/tools/chocolateysetup.psm1 +++ b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 @@ -1,721 +1,808 @@ -$thisScriptFolder = (Split-Path -parent $MyInvocation.MyCommand.Definition) -$chocInstallVariableName = "ChocolateyInstall" -$sysDrive = $env:SystemDrive -$tempDir = $env:TEMP -$defaultChocolateyPathOld = "$sysDrive\Chocolatey" - -$originalForegroundColor = $host.ui.RawUI.ForegroundColor - -function Write-ChocolateyWarning { -param ( - [string]$message = '' -) - - try { - Write-Host "WARNING: $message" -ForegroundColor "Yellow" -ErrorAction "Stop" - } catch { - Write-Output "WARNING: $message" - } -} - -function Write-ChocolateyError { -param ( - [string]$message = '' -) - - try { - Write-Host "ERROR: $message" -ForegroundColor "Red" -ErrorAction "Stop" - } catch { - Write-Output "ERROR: $message" - } -} - -function Initialize-Chocolatey { -<# - .DESCRIPTION - This will initialize the Chocolatey tool by - a) setting up the "chocolateyPath" (the location where all chocolatey nuget packages will be installed) - b) Installs chocolatey into the "chocolateyPath" - c) Instals .net 4.0 if needed - d) Adds Chocolatey to the PATH environment variable so you have access to the choco commands. - .PARAMETER ChocolateyPath - Allows you to override the default path of (C:\ProgramData\chocolatey\) by specifying a directory chocolatey will install nuget packages. - - .EXAMPLE - C:\PS> Initialize-Chocolatey - - Installs chocolatey into the default C:\ProgramData\Chocolatey\ directory. - - .EXAMPLE - C:\PS> Initialize-Chocolatey -chocolateyPath "D:\ChocolateyInstalledNuGets\" - - Installs chocolatey into the custom directory D:\ChocolateyInstalledNuGets\ - -#> -param( - [Parameter(Mandatory=$false)][string]$chocolateyPath = '' -) - Write-Debug "Initialize-Chocolatey" - - $installModule = Join-Path $thisScriptFolder 'chocolateyInstall\helpers\chocolateyInstaller.psm1' - Import-Module $installModule -Force - - if ($chocolateyPath -eq '') { - $programData = [Environment]::GetFolderPath("CommonApplicationData") - $chocolateyPath = Join-Path "$programData" 'chocolatey' - } - - # variable to allow insecure directory: - $allowInsecureRootInstall = $false - if ($env:ChocolateyAllowInsecureRootDirectory -eq 'true') { $allowInsecureRootInstall = $true } - - # if we have an already environment variable path, use it. - $alreadyInitializedNugetPath = Get-ChocolateyInstallFolder - if ($alreadyInitializedNugetPath -and $alreadyInitializedNugetPath -ne $chocolateyPath -and ($allowInsecureRootInstall -or $alreadyInitializedNugetPath -ne $defaultChocolateyPathOld)){ - $chocolateyPath = $alreadyInitializedNugetPath - } - else { - Set-ChocolateyInstallFolder $chocolateyPath - } - Create-DirectoryIfNotExists $chocolateyPath - Ensure-Permissions $chocolateyPath - - #set up variables to add - $chocolateyExePath = Join-Path $chocolateyPath 'bin' - $chocolateyLibPath = Join-Path $chocolateyPath 'lib' - - if ($tempDir -eq $null) { - $tempDir = Join-Path $chocolateyPath 'temp' - Create-DirectoryIfNotExists $tempDir - } - - $yourPkgPath = [System.IO.Path]::Combine($chocolateyLibPath,"yourPackageName") -@" -We are setting up the Chocolatey package repository. -The packages themselves go to `'$chocolateyLibPath`' - (i.e. $yourPkgPath). -A shim file for the command line goes to `'$chocolateyExePath`' - and points to an executable in `'$yourPkgPath`'. - -Creating Chocolatey folders if they do not already exist. - -"@ | Write-Output - - Write-ChocolateyWarning "You can safely ignore errors related to missing log files when `n upgrading from a version of Chocolatey less than 0.9.9. `n 'Batch file could not be found' is also safe to ignore. `n 'The system cannot find the file specified' - also safe." - - #create the base structure if it doesn't exist - Create-DirectoryIfNotExists $chocolateyExePath - Create-DirectoryIfNotExists $chocolateyLibPath - - Install-ChocolateyFiles $chocolateyPath - Ensure-ChocolateyLibFiles $chocolateyLibPath - - Install-ChocolateyBinFiles $chocolateyPath $chocolateyExePath - - $chocolateyExePathVariable = $chocolateyExePath.ToLower().Replace($chocolateyPath.ToLower(), "%DIR%..\").Replace("\\","\") - Initialize-ChocolateyPath $chocolateyExePath $chocolateyExePathVariable - Process-ChocolateyBinFiles $chocolateyExePath $chocolateyExePathVariable - - $realModule = Join-Path $chocolateyPath "helpers\chocolateyInstaller.psm1" - Import-Module "$realModule" -Force - - if (-not $allowInsecureRootInstall -and (Test-Path($defaultChocolateyPathOld))) { - Upgrade-OldChocolateyInstall $defaultChocolateyPathOld $chocolateyPath - Install-ChocolateyBinFiles $chocolateyPath $chocolateyExePath - } - - Add-ChocolateyProfile - Install-DotNet4IfMissing - Invoke-Chocolatey-Initial - if ($env:ChocolateyExitCode -eq $null -or $env:ChocolateyExitCode -eq '') { - $env:ChocolateyExitCode = 0 - } - -@" -Chocolatey (choco.exe) is now ready. -You can call choco from anywhere, command line or powershell by typing choco. -Run choco /? for a list of functions. -You may need to shut down and restart powershell and/or consoles - first prior to using choco. -"@ | write-Output - - if (-not $allowInsecureRootInstall) { - Remove-OldChocolateyInstall $defaultChocolateyPathOld - } -} - -function Set-ChocolateyInstallFolder { -param( - [string]$folder -) - Write-Debug "Set-ChocolateyInstallFolder" - - $environmentTarget = [System.EnvironmentVariableTarget]::User - # removing old variable - Install-ChocolateyEnvironmentVariable -variableName "$chocInstallVariableName" -variableValue $null -variableType $environmentTarget - if (Test-ProcessAdminRights) { - Write-Debug "Administrator installing so using Machine environment variable target instead of User." - $environmentTarget = [System.EnvironmentVariableTarget]::Machine - # removing old variable - Install-ChocolateyEnvironmentVariable -variableName "$chocInstallVariableName" -variableValue $null -variableType $environmentTarget - } else { - Write-ChocolateyWarning "Setting ChocolateyInstall Environment Variable on USER and not SYSTEM variables.`n This is due to either non-administrator install OR the process you are running is not being run as an Administrator." - } - - Write-Output "Creating $chocInstallVariableName as an environment variable (targeting `'$environmentTarget`') `n Setting $chocInstallVariableName to `'$folder`'" - Write-ChocolateyWarning "It's very likely you will need to close and reopen your shell `n before you can use choco." - Install-ChocolateyEnvironmentVariable -variableName "$chocInstallVariableName" -variableValue "$folder" -variableType $environmentTarget -} - -function Get-ChocolateyInstallFolder(){ - Write-Debug "Get-ChocolateyInstallFolder" - [Environment]::GetEnvironmentVariable($chocInstallVariableName) -} - -function Create-DirectoryIfNotExists($folderName){ - Write-Debug "Create-DirectoryIfNotExists" - if (![System.IO.Directory]::Exists($folderName)) { [System.IO.Directory]::CreateDirectory($folderName) | Out-Null } -} - -function Get-LocalizedWellKnownPrincipalName { -param ( - [Parameter(Mandatory = $true)] - [Security.Principal.WellKnownSidType] $WellKnownSidType -) - $sid = New-Object -TypeName 'System.Security.Principal.SecurityIdentifier' -ArgumentList @($WellKnownSidType, $null) - $account = $sid.Translate([Security.Principal.NTAccount]) - - return $account.Value -} - -function Ensure-Permissions { -param( - [string]$folder -) - Write-Debug "Ensure-Permissions" - - $defaultInstallPath = "$env:SystemDrive\ProgramData\chocolatey" - try { - $defaultInstallPath = Join-Path ([Environment]::GetFolderPath("CommonApplicationData")) 'chocolatey' - } catch { - # keep first setting - } - - if ($folder.ToLower() -ne $defaultInstallPath.ToLower()) { - Write-ChocolateyWarning "Installation folder is not the default. Not changing permissions. Please ensure your installation is secure." - return - } - - # Everything from here on out applies to the default installation folder - - if (!(Test-ProcessAdminRights)) { - throw "Installation of Chocolatey to default folder requires Administrative permissions. Please run from elevated prompt. Please see https://chocolatey.org/install for details and alternatives if needing to install as a non-administrator." - } - - $currentEA = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - try { - # get current acl - $acl = (Get-Item $folder).GetAccessControl('Access,Owner') - - Write-Debug "Removing existing permissions." - $acl.Access | % { $acl.RemoveAccessRuleAll($_) } - - $inheritanceFlags = ([Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [Security.AccessControl.InheritanceFlags]::ObjectInherit) - $propagationFlags = [Security.AccessControl.PropagationFlags]::None - - $rightsFullControl = [Security.AccessControl.FileSystemRights]::FullControl - $rightsModify = [Security.AccessControl.FileSystemRights]::Modify - $rightsReadExecute = [Security.AccessControl.FileSystemRights]::ReadAndExecute - $rightsWrite = [Security.AccessControl.FileSystemRights]::Write - - Write-Output "Restricting write permissions to Administrators" - $builtinAdmins = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid) - $adminsAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinAdmins, $rightsFullControl, $inheritanceFlags, $propagationFlags, "Allow") - $acl.SetAccessRule($adminsAccessRule) - $localSystem = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::LocalSystemSid) - $localSystemAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($localSystem, $rightsFullControl, $inheritanceFlags, $propagationFlags, "Allow") - $acl.SetAccessRule($localSystemAccessRule) - $builtinUsers = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::BuiltinUsersSid) - $usersAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinUsers, $rightsReadExecute, $inheritanceFlags, $propagationFlags, "Allow") - $acl.SetAccessRule($usersAccessRule) - - $allowCurrentUser = $env:ChocolateyInstallAllowCurrentUser -eq 'true' - if ($allowCurrentUser) { - # get current user - $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() - - if ($currentUser.Name -ne $localSystem) { - $userAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($currentUser.Name, $rightsModify, $inheritanceFlags, $propagationFlags, "Allow") - Write-ChocolateyWarning 'Adding Modify permission for current user due to $env:ChocolateyInstallAllowCurrentUser. This could lead to escalation of privilege attacks. Consider not allowing this.' - $acl.SetAccessRule($userAccessRule) - } - } else { - Write-Debug 'Current user no longer set due to possible escalation of privileges - set $env:ChocolateyInstallAllowCurrentUser="true" if you require this.' - } - - Write-Debug "Set Owner to Administrators" - $builtinAdminsSid = New-Object System.Security.Principal.SecurityIdentifier([Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid, $null) - $acl.SetOwner($builtinAdminsSid) - - Write-Debug "Default Installation folder - removing inheritance with no copy" - $acl.SetAccessRuleProtection($true, $false) - - # enact the changes against the actual - (Get-Item $folder).SetAccessControl($acl) - - # set an explicit append permission on the logs folder - Write-Debug "Allow users to append to log files." - $logsFolder = "$folder\logs" - Create-DirectoryIfNotExists $logsFolder - $logsAcl = (Get-Item $logsFolder).GetAccessControl('Access') - $usersAppendAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinUsers, $rightsWrite, [Security.AccessControl.InheritanceFlags]::ObjectInherit, [Security.AccessControl.PropagationFlags]::InheritOnly, "Allow") - $logsAcl.SetAccessRule($usersAppendAccessRule) - $logsAcl.SetAccessRuleProtection($false, $true) - (Get-Item $logsFolder).SetAccessControl($logsAcl) - } catch { - Write-ChocolateyWarning "Not able to set permissions for $folder." - } - $ErrorActionPreference = $currentEA -} - -function Upgrade-OldChocolateyInstall { -param( - [string]$chocolateyPathOld = "$sysDrive\Chocolatey", - [string]$chocolateyPath = "$($env:ALLUSERSPROFILE)\chocolatey" -) - - Write-Debug "Upgrade-OldChocolateyInstall" - - if (Test-Path $chocolateyPathOld) { - Write-Output "Attempting to upgrade `'$chocolateyPathOld`' to `'$chocolateyPath`'." - Write-ChocolateyWarning "Copying the contents of `'$chocolateyPathOld`' to `'$chocolateyPath`'. `n This step may fail if you have anything in this folder running or locked." - Write-Output 'If it fails, just manually copy the rest of the items out and then delete the folder.' - Write-ChocolateyWarning "!!!! ATTN: YOU WILL NEED TO CLOSE AND REOPEN YOUR SHELL !!!!" - #-ForegroundColor Magenta -BackgroundColor Black - - $chocolateyExePathOld = Join-Path $chocolateyPathOld 'bin' - 'Machine', 'User' | - % { - $path = Get-EnvironmentVariable -Name 'PATH' -Scope $_ - $updatedPath = [System.Text.RegularExpressions.Regex]::Replace($path,[System.Text.RegularExpressions.Regex]::Escape($chocolateyExePathOld) + '(?>;)?', '', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) - if ($updatedPath -ne $path) { - Write-Output "Updating `'$_`' PATH to reflect removal of '$chocolateyPathOld'." - try { - Set-EnvironmentVariable -Name 'Path' -Value $updatedPath -Scope $_ -ErrorAction Stop - } catch { - Write-ChocolateyWarning "Was not able to remove the old environment variable from PATH. You will need to do this manually" - } - - } - } - - Copy-Item "$chocolateyPathOld\lib\*" "$chocolateyPath\lib" -force -recurse - - $from = "$chocolateyPathOld\bin" - $to = "$chocolateyPath\bin" - $exclude = @("choco.exe", "chocolatey.exe", "cinst.exe", "clist.exe", "cpack.exe", "cpush.exe", "cuninst.exe", "cup.exe", "cver.exe", "RefreshEnv.cmd") - Get-ChildItem -Path $from -recurse -Exclude $exclude | - % { - Write-Debug "Copying $_ `n to $to" - if ($_.PSIsContainer) { - Copy-Item $_ -Destination (Join-Path $to $_.Parent.FullName.Substring($from.length)) -Force -ErrorAction SilentlyContinue - } else { - $fileToMove = (Join-Path $to $_.FullName.Substring($from.length)) - try { - Copy-Item $_ -Destination $fileToMove -Exclude $exclude -Force -ErrorAction Stop - } - catch { - Write-ChocolateyWarning "Was not able to move `'$fileToMove`'. You may need to reinstall the shim" - } - } - } - } -} - -function Remove-OldChocolateyInstall { -param( - [string]$chocolateyPathOld = "$sysDrive\Chocolatey" -) - Write-Debug "Remove-OldChocolateyInstall" - - if (Test-Path $chocolateyPathOld) { - Write-ChocolateyWarning "This action will result in Log Errors, you can safely ignore those. `n You may need to finish removing '$chocolateyPathOld' manually." - try { - Get-ChildItem -Path "$chocolateyPathOld" | % { - if (Test-Path $_.FullName) { - Write-Debug "Removing $_ unless matches .log" - Remove-Item $_.FullName -exclude *.log -recurse -force -ErrorAction SilentlyContinue - } - } - - Write-Output "Attempting to remove `'$chocolateyPathOld`'. This may fail if something in the folder is being used or locked." - Remove-Item "$($chocolateyPathOld)" -force -recurse -ErrorAction Stop - } - catch { - Write-ChocolateyWarning "Was not able to remove `'$chocolateyPathOld`'. You will need to manually remove it." - } - } -} - -function Install-ChocolateyFiles { -param( - [string]$chocolateyPath -) - Write-Debug "Install-ChocolateyFiles" - - Write-Debug "Removing install files in chocolateyInstall, helpers, redirects, and tools" - "$chocolateyPath\chocolateyInstall", "$chocolateyPath\helpers", "$chocolateyPath\redirects", "$chocolateyPath\tools" | % { - #Write-Debug "Checking path $_" - - if (Test-Path $_) { - Get-ChildItem -Path "$_" | % { - #Write-Debug "Checking child path $_ ($($_.FullName))" - if (Test-Path $_.FullName) { - Write-Debug "Removing $_ unless matches .log" - Remove-Item $_.FullName -exclude *.log -recurse -force -ErrorAction SilentlyContinue - } - } - } - } - - Write-Debug "Attempting to move choco.exe to choco.exe.old so we can place the new version here." - # rename the currently running process / it will be locked if it exists - $chocoExe = Join-Path $chocolateyPath 'choco.exe' - if (Test-Path ($chocoExe)) { - Write-Debug "Renaming '$chocoExe' to '$chocoExe.old'" - try { - Remove-Item "$chocoExe.old" -force -ErrorAction SilentlyContinue - Move-Item $chocoExe "$chocoExe.old" -force -ErrorAction SilentlyContinue - } - catch { - Write-ChocolateyWarning "Was not able to rename `'$chocoExe`' to `'$chocoExe.old`'." - } - } - - # remove pdb file if it is found - $chocoPdb = Join-Path $chocolateyPath 'choco.pdb' - if (Test-Path ($chocoPdb)) { - Remove-Item "$chocoPdb" -Force -ErrorAction SilentlyContinue - } - - Write-Debug "Unpacking files required for Chocolatey." - $chocInstallFolder = Join-Path $thisScriptFolder "chocolateyInstall" - $chocoExe = Join-Path $chocInstallFolder 'choco.exe' - $chocoExeDest = Join-Path $chocolateyPath 'choco.exe' - Copy-Item $chocoExe $chocoExeDest -force - - Write-Debug "Copying the contents of `'$chocInstallFolder`' to `'$chocolateyPath`'." - Copy-Item $chocInstallFolder\* $chocolateyPath -Recurse -Force -} - -function Ensure-ChocolateyLibFiles { -param( - [string]$chocolateyLibPath -) - Write-Debug "Ensure-ChocolateyLibFiles" - $chocoPkgDirectory = Join-Path $chocolateyLibPath 'chocolatey' - - Create-DirectoryIfNotExists $chocoPkgDirectory - - if (!(Test-Path("$chocoPkgDirectory\chocolatey.nupkg"))) { - Write-Output "chocolatey.nupkg file not installed in lib.`n Attempting to locate it from bootstrapper." - $chocoZipFile = Join-Path $tempDir "chocolatey\chocInstall\chocolatey.zip" - - Write-Debug "First the zip file at '$chocoZipFile'." - Write-Debug "Then from a neighboring chocolatey.*nupkg file '$thisScriptFolder/../../'." - - if (Test-Path("$chocoZipFile")) { - Write-Debug "Copying '$chocoZipFile' to '$chocoPkgDirectory\chocolatey.nupkg'." - Copy-Item "$chocoZipFile" "$chocoPkgDirectory\chocolatey.nupkg" -Force -ErrorAction SilentlyContinue - } - - if (!(Test-Path("$chocoPkgDirectory\chocolatey.nupkg"))) { - $chocoPkg = Get-ChildItem "$thisScriptFolder/../../" | ?{$_.name -match "^chocolatey.*nupkg" } | Sort name -Descending | Select -First 1 - if ($chocoPkg -ne '') { $chocoPkg = $chocoPkg.FullName } - "$chocoZipFile", "$chocoPkg" | % { - if ($_ -ne $null -and $_ -ne '') { - if (Test-Path $_) { - Write-Debug "Copying '$_' to '$chocoPkgDirectory\chocolatey.nupkg'." - Copy-Item $_ "$chocoPkgDirectory\chocolatey.nupkg" -Force -ErrorAction SilentlyContinue - } - } - } - } - } -} - -function Install-ChocolateyBinFiles { -param( - [string] $chocolateyPath, - [string] $chocolateyExePath -) - Write-Debug "Install-ChocolateyBinFiles" - Write-Debug "Installing the bin file redirects" - $redirectsPath = Join-Path $chocolateyPath 'redirects' - if (!(Test-Path "$redirectsPath")) { - Write-ChocolateyWarning "$redirectsPath does not exist" - return - } - - $exeFiles = Get-ChildItem "$redirectsPath" -include @("*.exe","*.cmd") -recurse - foreach ($exeFile in $exeFiles) { - $exeFilePath = $exeFile.FullName - $exeFileName = [System.IO.Path]::GetFileName("$exeFilePath") - $binFilePath = Join-Path $chocolateyExePath $exeFileName - $binFilePathRename = $binFilePath + '.old' - $batchFilePath = $binFilePath.Replace(".exe",".bat") - $bashFilePath = $binFilePath.Replace(".exe","") - if (Test-Path ($batchFilePath)) { Remove-Item $batchFilePath -force -ErrorAction SilentlyContinue } - if (Test-Path ($bashFilePath)) { Remove-Item $bashFilePath -force -ErrorAction SilentlyContinue } - if (Test-Path ($binFilePathRename)) { - try { - Write-Debug "Attempting to remove $binFilePathRename" - Remove-Item $binFilePathRename -force -ErrorAction Stop - } - catch { - Write-ChocolateyWarning "Was not able to remove `'$binFilePathRename`'. This may cause errors." - } - } - if (Test-Path ($binFilePath)) { - try { - Write-Debug "Attempting to rename $binFilePath to $binFilePathRename" - Move-Item -path $binFilePath -destination $binFilePathRename -force -ErrorAction Stop - } - catch { - Write-ChocolateyWarning "Was not able to rename `'$binFilePath`' to `'$binFilePathRename`'." - } - } - - try { - Write-Debug "Attempting to copy $exeFilePath to $binFilePath" - Copy-Item -path $exeFilePath -destination $binFilePath -force -ErrorAction Stop - } - catch { - Write-ChocolateyWarning "Was not able to replace `'$binFilePath`' with `'$exeFilePath`'. You may need to do this manually." - } - - $commandShortcut = [System.IO.Path]::GetFileNameWithoutExtension("$exeFilePath") - Write-Debug "Added command $commandShortcut" - } -} - -function Initialize-ChocolateyPath { -param( - [string]$chocolateyExePath = "$($env:ALLUSERSPROFILE)\chocolatey\bin", - [string]$chocolateyExePathVariable = "%$($chocInstallVariableName)%\bin" -) - Write-Debug "Initialize-ChocolateyPath" - Write-Debug "Initializing Chocolatey Path if required" - $environmentTarget = [System.EnvironmentVariableTarget]::User - if (Test-ProcessAdminRights) { - Write-Debug "Administrator installing so using Machine environment variable target instead of User." - $environmentTarget = [System.EnvironmentVariableTarget]::Machine - } else { - Write-ChocolateyWarning "Setting ChocolateyInstall Path on USER PATH and not SYSTEM Path.`n This is due to either non-administrator install OR the process you are running is not being run as an Administrator." - } - - Install-ChocolateyPath -pathToInstall "$chocolateyExePath" -pathType $environmentTarget -} - -function Process-ChocolateyBinFiles { -param( - [string]$chocolateyExePath = "$($env:ALLUSERSPROFILE)\chocolatey\bin", - [string]$chocolateyExePathVariable = "%$($chocInstallVariableName)%\bin" -) - Write-Debug "Process-ChocolateyBinFiles" - $processedMarkerFile = Join-Path $chocolateyExePath '_processed.txt' - if (!(test-path $processedMarkerFile)) { - $files = get-childitem $chocolateyExePath -include *.bat -recurse - if ($files -ne $null -and $files.Count -gt 0) { - Write-Debug "Processing Bin files" - foreach ($file in $files) { - Write-Output "Processing $($file.Name) to make it portable" - $fileStream = [System.IO.File]::Open("$file", 'Open', 'Read', 'ReadWrite') - $reader = New-Object System.IO.StreamReader($fileStream) - $fileText = $reader.ReadToEnd() - $reader.Close() - $fileStream.Close() - - $fileText = $fileText.ToLower().Replace("`"" + $chocolateyPath.ToLower(), "SET DIR=%~dp0%`n""%DIR%..\").Replace("\\","\") - - Set-Content $file -Value $fileText -Encoding Ascii - } - } - - Set-Content $processedMarkerFile -Value "$([System.DateTime]::Now.Date)" -Encoding Ascii - } -} - -# Adapted from http://www.west-wind.com/Weblog/posts/197245.aspx -function Get-FileEncoding($Path) { - $bytes = [byte[]](Get-Content $Path -Encoding byte -ReadCount 4 -TotalCount 4) - - if(!$bytes) { return 'utf8' } - - switch -regex ('{0:x2}{1:x2}{2:x2}{3:x2}' -f $bytes[0],$bytes[1],$bytes[2],$bytes[3]) { - '^efbbbf' { return 'utf8' } - '^2b2f76' { return 'utf7' } - '^fffe' { return 'unicode' } - '^feff' { return 'bigendianunicode' } - '^0000feff' { return 'utf32' } - default { return 'ascii' } - } -} - -function Add-ChocolateyProfile { - Write-Debug "Add-ChocolateyProfile" - try { - $profileFile = "$profile" - if ($profileFile -eq $null -or $profileFile -eq '') { - Write-Output 'Not setting tab completion: Profile variable ($profile) resulted in an empty string.' - return - } - - $profileDirectory = (Split-Path -Parent $profileFile) - - if ($env:ChocolateyNoProfile -ne $null -and $env:ChocolateyNoProfile -ne '') { - Write-Warning "Not setting tab completion: Environment variable "ChocolateyNoProfile" exists and is set." - return - } - - $localSystem = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::LocalSystemSid) - # get current user - $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() - if ($currentUser.Name -eq $localSystem) { - Write-Warning "Not setting tab completion: Current user is SYSTEM user." - return - } - - if (!(Test-Path($profileDirectory))) { - Write-Debug "Creating '$profileDirectory'" - New-Item "$profileDirectory" -Type Directory -Force -ErrorAction SilentlyContinue | Out-Null - } - - if (!(Test-Path($profileFile))) { - Write-Warning "Not setting tab completion: Profile file does not exist at '$profileFile'." - return - - #Write-Debug "Creating '$profileFile'" - #"" | Out-File $profileFile -Encoding UTF8 - } - - # Check authenticode, but only if file is greater than 4 bytes - $profileFileInfo = New-Object System.IO.FileInfo($profileFile) - if ($profileFileInfo.Length -ge 5) { - $signature = Get-AuthenticodeSignature $profile - if ($signature.Status -ne 'NotSigned') { - Write-Warning "Not setting tab completion: File is Authenticode signed at '$profile'." - return - } - } - - $profileInstall = @' - -# Chocolatey profile -$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" -if (Test-Path($ChocolateyProfile)) { - Import-Module "$ChocolateyProfile" -} -'@ - - $chocoProfileSearch = '$ChocolateyProfile' - if(Select-String -Path $profileFile -Pattern $chocoProfileSearch -Quiet -SimpleMatch) { - Write-Debug "Chocolatey profile is already installed." - return - } - - Write-Output 'Adding Chocolatey to the profile. This will provide tab completion, refreshenv, etc.' - $profileInstall | Out-File $profileFile -Append -Encoding (Get-FileEncoding $profileFile) - Write-ChocolateyWarning 'Chocolatey profile installed. Reload your profile - type . $profile' - - if ($PSVersionTable.PSVersion.Major -lt 3) { - Write-ChocolateyWarning "Tab completion does not currently work in PowerShell v2. `n Please upgrade to a more recent version of PowerShell to take advantage of tab completion." - #Write-ChocolateyWarning "To load tab expansion, you need to install PowerTab. `n See https://powertab.codeplex.com/ for details." - } - - } catch { - Write-ChocolateyWarning "Unable to add Chocolatey to the profile. You will need to do it manually. Error was '$_'" -@' -This is how add the Chocolatey Profile manually. -Find your $profile. Then add the following lines to it: - -$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" -if (Test-Path($ChocolateyProfile)) { - Import-Module "$ChocolateyProfile" -} -'@ | Write-Output - } -} - -$netFx4InstallTries = 0 - -function Install-DotNet4IfMissing { -param( - $forceFxInstall = $false -) - # we can't take advantage of any chocolatey module functions, because they - # haven't been unpacked because they require .NET Framework 4.0 - - Write-Debug "Install-DotNet4IfMissing called with `$forceFxInstall=$forceFxInstall" - $NetFxArch = "Framework" - if ([IntPtr]::Size -eq 8) {$NetFxArch="Framework64" } - - $NetFx4ClientUrl = 'https://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe' - $NetFx4FullUrl = 'https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe' - $NetFx4Url = $NetFx4FullUrl - $NetFx4Path = "$tempDir" - $NetFx4InstallerFile = 'dotNetFx40_Full_x86_x64.exe' - $NetFx4Installer = Join-Path $NetFx4Path $NetFx4InstallerFile - - if ((!(Test-Path "$env:SystemRoot\Microsoft.Net\$NetFxArch\v4.0.30319") -and !(Test-Path "C:\Windows\Microsoft.Net\$NetFxArch\v4.0.30319")) -or $forceFxInstall) { - Write-Output "'$env:SystemRoot\Microsoft.Net\$NetFxArch\v4.0.30319' was not found or this is forced" - if (!(Test-Path $NetFx4Path)) { - Write-Output "Creating folder `'$NetFx4Path`'" - $null = New-Item -Path "$NetFx4Path" -ItemType Directory - } - - $netFx4InstallTries += 1 - - if (!(Test-Path $NetFx4Installer)) { - Write-Output "Downloading `'$NetFx4Url`' to `'$NetFx4Installer`' - the installer is 40+ MBs, so this could take a while on a slow connection." - (New-Object Net.WebClient).DownloadFile("$NetFx4Url","$NetFx4Installer") - } - - $psi = New-Object System.Diagnostics.ProcessStartInfo - $psi.WorkingDirectory = "$NetFx4Path" - $psi.FileName = "$NetFx4InstallerFile" - # https://msdn.microsoft.com/library/ee942965(v=VS.100).aspx#command_line_options - # http://blogs.msdn.com/b/astebner/archive/2010/05/12/10011664.aspx - # For the actual setup.exe (if you want to unpack first) - /repair /x86 /x64 /ia64 /parameterfolder Client /q /norestart - $psi.Arguments = "/q /norestart /repair" - - Write-Output "Installing `'$NetFx4Installer`' - this may take awhile with no output." - $s = [System.Diagnostics.Process]::Start($psi); - $s.WaitForExit(); - if ($s.ExitCode -ne 0 -and $s.ExitCode -ne 3010) { - if ($netFx4InstallTries -ge 2) { - Write-ChocolateyError ".NET Framework install failed with exit code `'$($s.ExitCode)`'. `n This will cause the rest of the install to fail." - throw "Error installing .NET Framework 4.0 (exit code $($s.ExitCode)). `n Please install the .NET Framework 4.0 manually and then try to install Chocolatey again. `n Download at `'$NetFx4Url`'" - } else { - Write-ChocolateyWarning "Try #$netFx4InstallTries of .NET framework install failed with exit code `'$($s.ExitCode)`'. Trying again." - Install-DotNet4IfMissing $true - } - } - } -} - -function Invoke-Chocolatey-Initial { - Write-Debug "Initializing Chocolatey files, etc by running Chocolatey..." - - try { - $chocoInstallationFolder = Get-ChocolateyInstallFolder - $chocoExe = Join-Path -Path $chocoInstallationFolder -ChildPath "choco.exe" - & $chocoExe -v | Out-Null - Write-Debug "Chocolatey execution completed successfully." - } catch { - Write-ChocolateyWarning "Unable to run Chocolately at this time. It is likely that .Net Framework installation requires a system reboot" - } -} - -Export-ModuleMember -function Initialize-Chocolatey; +$thisScriptFolder = (Split-Path -parent $MyInvocation.MyCommand.Definition) +$chocoInstallVariableName = "ChocolateyInstall" +$sysDrive = $env:SystemDrive +$tempDir = $env:TEMP +$defaultChocolateyPathOld = "$sysDrive\Chocolatey" + +$originalForegroundColor = $host.ui.RawUI.ForegroundColor + +function Write-ChocolateyWarning { +param ( + [string]$message = '' +) + + try { + Write-Host "WARNING: $message" -ForegroundColor "Yellow" -ErrorAction "Stop" + } catch { + Write-Output "WARNING: $message" + } +} + +function Write-ChocolateyError { +param ( + [string]$message = '' +) + + try { + Write-Host "ERROR: $message" -ForegroundColor "Red" -ErrorAction "Stop" + } catch { + Write-Output "ERROR: $message" + } +} + +function Remove-ShimWithAuthenticodeSignature { + param ( + [string] $filePath + ) + if (!(Test-Path $filePath)) { + return + } + + $signature = Get-AuthenticodeSignature $filePath -ErrorAction SilentlyContinue + + if (!$signature -or !$signature.SignerCertificate) { + Write-ChocolateyWarning "Shim found in $filePath, but was not signed. Ignoring removal..." + return + } + + $possibleSignatures = @( + 'RealDimensions Software, LLC' + 'Chocolatey Software, Inc\.' + ) + + $possibleSignatures | ForEach-Object { + if ($signature.SignerCertificate.Subject -match "$_") { + Write-Output "Removing shim $filePath" + $null = Remove-Item "$filePath" + + if (Test-Path "$filePath.ignore") { + $null = Remove-Item "$filePath.ignore" + } + + if (Test-Path "$filePath.old") { + $null = Remove-Item "$filePath.old" + } + } + } + + # This means the file was found, however did not get removed as it contained a authenticode signature that + # is not ours. + if (Test-Path $filePath) { + Write-ChocolateyWarning "Shim found in $filePath, but did not match our signature. Ignoring removal..." + return + } +} + +function Remove-UnsupportedShimFiles { + param([string[]]$Paths) + + $shims = @("cpack.exe", "cver.exe") + + $Paths | ForEach-Object { + $path = $_ + $shims | ForEach-Object { Join-Path $path $_ } | Where-Object { Test-Path $_ } | ForEach-Object { + $shimPath = $_ + Write-Debug "Removing shim from '$shimPath'." + + try { + Remove-ShimWithAuthenticodeSignature -filePath $shimPath + } + catch { + Write-ChocolateyWarning "Unable to remove '$shimPath'. Please remove the file manually." + } + } + } +} + +function Initialize-Chocolatey { +<# + .DESCRIPTION + This will initialize the Chocolatey tool by + a) setting up the "chocolateyPath" (the location where all chocolatey nuget packages will be installed) + b) Installs chocolatey into the "chocolateyPath" + c) Installs .net 4.0 if needed + d) Adds Chocolatey to the PATH environment variable so you have access to the choco commands. + .PARAMETER ChocolateyPath + Allows you to override the default path of (C:\ProgramData\chocolatey\) by specifying a directory chocolatey will install nuget packages. + + .EXAMPLE + C:\PS> Initialize-Chocolatey + + Installs chocolatey into the default C:\ProgramData\Chocolatey\ directory. + + .EXAMPLE + C:\PS> Initialize-Chocolatey -chocolateyPath "D:\ChocolateyInstalledNuGets\" + + Installs chocolatey into the custom directory D:\ChocolateyInstalledNuGets\ + +#> +param( + [Parameter(Mandatory=$false)][string]$chocolateyPath = '' +) + Write-Debug "Initialize-Chocolatey" + + $installModule = Join-Path $thisScriptFolder 'chocolateyInstall\helpers\chocolateyInstaller.psm1' + Import-Module $installModule -Force + + if ($chocolateyPath -eq '') { + $programData = [Environment]::GetFolderPath("CommonApplicationData") + $chocolateyPath = Join-Path "$programData" 'chocolatey' + } + + # variable to allow insecure directory: + $allowInsecureRootInstall = $false + if ($env:ChocolateyAllowInsecureRootDirectory -eq 'true') { $allowInsecureRootInstall = $true } + + # if we have an already environment variable path, use it. + $alreadyInitializedNugetPath = Get-ChocolateyInstallFolder + if ($alreadyInitializedNugetPath -and $alreadyInitializedNugetPath -ne $chocolateyPath -and ($allowInsecureRootInstall -or $alreadyInitializedNugetPath -ne $defaultChocolateyPathOld)){ + $chocolateyPath = $alreadyInitializedNugetPath + } + else { + Set-ChocolateyInstallFolder $chocolateyPath + } + Create-DirectoryIfNotExists $chocolateyPath + Ensure-Permissions $chocolateyPath + + #set up variables to add + $chocolateyExePath = Join-Path $chocolateyPath 'bin' + $chocolateyLibPath = Join-Path $chocolateyPath 'lib' + + if ($tempDir -eq $null) { + $tempDir = Join-Path $chocolateyPath 'temp' + Create-DirectoryIfNotExists $tempDir + } + + $yourPkgPath = [System.IO.Path]::Combine($chocolateyLibPath,"yourPackageName") +@" +We are setting up the Chocolatey package repository. +The packages themselves go to `'$chocolateyLibPath`' + (i.e. $yourPkgPath). +A shim file for the command line goes to `'$chocolateyExePath`' + and points to an executable in `'$yourPkgPath`'. + +Creating Chocolatey folders if they do not already exist. + +"@ | Write-Output + + Write-ChocolateyWarning "You can safely ignore errors related to missing log files when `n upgrading from a version of Chocolatey less than 0.9.9. `n 'Batch file could not be found' is also safe to ignore. `n 'The system cannot find the file specified' - also safe." + + #create the base structure if it doesn't exist + Create-DirectoryIfNotExists $chocolateyExePath + Create-DirectoryIfNotExists $chocolateyLibPath + + $possibleShimPaths = @( + Join-Path "$chocolateyPath" "redirects" + Join-Path "$thisScriptFolder" "chocolateyInstall\redirects" + ) + Remove-UnsupportedShimFiles -Paths $possibleShimPaths + + Install-ChocolateyFiles $chocolateyPath + Ensure-ChocolateyLibFiles $chocolateyLibPath + + Install-ChocolateyBinFiles $chocolateyPath $chocolateyExePath + + $chocolateyExePathVariable = $chocolateyExePath.ToLower().Replace($chocolateyPath.ToLower(), "%DIR%..\").Replace("\\","\") + Initialize-ChocolateyPath $chocolateyExePath $chocolateyExePathVariable + Process-ChocolateyBinFiles $chocolateyExePath $chocolateyExePathVariable + + $realModule = Join-Path $chocolateyPath "helpers\chocolateyInstaller.psm1" + Import-Module "$realModule" -Force + + if (-not $allowInsecureRootInstall -and (Test-Path($defaultChocolateyPathOld))) { + Upgrade-OldChocolateyInstall $defaultChocolateyPathOld $chocolateyPath + Install-ChocolateyBinFiles $chocolateyPath $chocolateyExePath + } + + Add-ChocolateyProfile + Install-DotNet4IfMissing + Invoke-Chocolatey-Initial + if ($env:ChocolateyExitCode -eq $null -or $env:ChocolateyExitCode -eq '') { + $env:ChocolateyExitCode = 0 + } + +@" +Chocolatey (choco.exe) is now ready. +You can call choco from anywhere, command line or powershell by typing choco. +Run choco /? for a list of functions. +You may need to shut down and restart powershell and/or consoles + first prior to using choco. +"@ | write-Output + + if (-not $allowInsecureRootInstall) { + Remove-OldChocolateyInstall $defaultChocolateyPathOld + } + + Remove-UnsupportedShimFiles -Paths $chocolateyExePath +} + +function Set-ChocolateyInstallFolder { +param( + [string]$folder +) + Write-Debug "Set-ChocolateyInstallFolder" + + $environmentTarget = [System.EnvironmentVariableTarget]::User + # removing old variable + Install-ChocolateyEnvironmentVariable -variableName "$chocoInstallVariableName" -variableValue $null -variableType $environmentTarget + if (Test-ProcessAdminRights) { + Write-Debug "Administrator installing so using Machine environment variable target instead of User." + $environmentTarget = [System.EnvironmentVariableTarget]::Machine + # removing old variable + Install-ChocolateyEnvironmentVariable -variableName "$chocoInstallVariableName" -variableValue $null -variableType $environmentTarget + } else { + Write-ChocolateyWarning "Setting ChocolateyInstall Environment Variable on USER and not SYSTEM variables.`n This is due to either non-administrator install OR the process you are running is not being run as an Administrator." + } + + Write-Output "Creating $chocoInstallVariableName as an environment variable (targeting `'$environmentTarget`') `n Setting $chocoInstallVariableName to `'$folder`'" + Write-ChocolateyWarning "It's very likely you will need to close and reopen your shell `n before you can use choco." + Install-ChocolateyEnvironmentVariable -variableName "$chocoInstallVariableName" -variableValue "$folder" -variableType $environmentTarget +} + +function Get-ChocolateyInstallFolder(){ + Write-Debug "Get-ChocolateyInstallFolder" + [Environment]::GetEnvironmentVariable($chocoInstallVariableName) +} + +function Create-DirectoryIfNotExists($folderName){ + Write-Debug "Create-DirectoryIfNotExists" + if (![System.IO.Directory]::Exists($folderName)) { [System.IO.Directory]::CreateDirectory($folderName) | Out-Null } +} + +function Get-LocalizedWellKnownPrincipalName { +param ( + [Parameter(Mandatory = $true)] + [Security.Principal.WellKnownSidType] $WellKnownSidType +) + $sid = New-Object -TypeName 'System.Security.Principal.SecurityIdentifier' -ArgumentList @($WellKnownSidType, $null) + $account = $sid.Translate([Security.Principal.NTAccount]) + + return $account.Value +} + +function Ensure-Permissions { +param( + [string]$folder +) + Write-Debug "Ensure-Permissions" + + $defaultInstallPath = "$env:SystemDrive\ProgramData\chocolatey" + try { + $defaultInstallPath = Join-Path ([Environment]::GetFolderPath("CommonApplicationData")) 'chocolatey' + } catch { + # keep first setting + } + + if ($folder.ToLower() -ne $defaultInstallPath.ToLower()) { + Write-ChocolateyWarning "Installation folder is not the default. Not changing permissions. Please ensure your installation is secure." + return + } + + # Everything from here on out applies to the default installation folder + + if (!(Test-ProcessAdminRights)) { + throw "Installation of Chocolatey to default folder requires Administrative permissions. Please run from elevated prompt. Please see https://chocolatey.org/install for details and alternatives if needing to install as a non-administrator." + } + + $currentEA = $ErrorActionPreference + $ErrorActionPreference = 'Stop' + try { + # get current acl + $acl = Get-Acl $folder + + Write-Debug "Removing existing permissions." + $acl.Access | ForEach-Object { $acl.RemoveAccessRuleAll($_) } + + $inheritanceFlags = ([Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [Security.AccessControl.InheritanceFlags]::ObjectInherit) + $propagationFlags = [Security.AccessControl.PropagationFlags]::None + + $rightsFullControl = [Security.AccessControl.FileSystemRights]::FullControl + $rightsModify = [Security.AccessControl.FileSystemRights]::Modify + $rightsReadExecute = [Security.AccessControl.FileSystemRights]::ReadAndExecute + $rightsWrite = [Security.AccessControl.FileSystemRights]::Write + + Write-Output "Restricting write permissions to Administrators" + $builtinAdmins = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid) + $adminsAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinAdmins, $rightsFullControl, $inheritanceFlags, $propagationFlags, "Allow") + $acl.SetAccessRule($adminsAccessRule) + $localSystem = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::LocalSystemSid) + $localSystemAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($localSystem, $rightsFullControl, $inheritanceFlags, $propagationFlags, "Allow") + $acl.SetAccessRule($localSystemAccessRule) + $builtinUsers = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::BuiltinUsersSid) + $usersAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinUsers, $rightsReadExecute, $inheritanceFlags, $propagationFlags, "Allow") + $acl.SetAccessRule($usersAccessRule) + + $allowCurrentUser = $env:ChocolateyInstallAllowCurrentUser -eq 'true' + if ($allowCurrentUser) { + # get current user + $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() + + if ($currentUser.Name -ne $localSystem) { + $userAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($currentUser.Name, $rightsModify, $inheritanceFlags, $propagationFlags, "Allow") + Write-ChocolateyWarning 'Adding Modify permission for current user due to $env:ChocolateyInstallAllowCurrentUser. This could lead to escalation of privilege attacks. Consider not allowing this.' + $acl.SetAccessRule($userAccessRule) + } + } else { + Write-Debug 'Current user no longer set due to possible escalation of privileges - set $env:ChocolateyInstallAllowCurrentUser="true" if you require this.' + } + + Write-Debug "Set Owner to Administrators" + $builtinAdminsSid = New-Object System.Security.Principal.SecurityIdentifier([Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid, $null) + $acl.SetOwner($builtinAdminsSid) + + Write-Debug "Default Installation folder - removing inheritance with no copy" + $acl.SetAccessRuleProtection($true, $false) + + # enact the changes against the actual + Set-Acl -Path $folder -AclObject $acl + + # set an explicit append permission on the logs folder + Write-Debug "Allow users to append to log files." + $logsFolder = "$folder\logs" + Create-DirectoryIfNotExists $logsFolder + $logsAcl = Get-Acl $logsFolder + $usersAppendAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($builtinUsers, $rightsWrite, [Security.AccessControl.InheritanceFlags]::ObjectInherit, [Security.AccessControl.PropagationFlags]::InheritOnly, "Allow") + $logsAcl.SetAccessRule($usersAppendAccessRule) + $logsAcl.SetAccessRuleProtection($false, $true) + Set-Acl -Path $logsFolder -AclObject $logsAcl + } catch { + Write-ChocolateyWarning "Not able to set permissions for $folder." + } + $ErrorActionPreference = $currentEA +} + +function Upgrade-OldChocolateyInstall { +param( + [string]$chocolateyPathOld = "$sysDrive\Chocolatey", + [string]$chocolateyPath = "$($env:ALLUSERSPROFILE)\chocolatey" +) + + Write-Debug "Upgrade-OldChocolateyInstall" + + if (Test-Path $chocolateyPathOld) { + Write-Output "Attempting to upgrade `'$chocolateyPathOld`' to `'$chocolateyPath`'." + Write-ChocolateyWarning "Copying the contents of `'$chocolateyPathOld`' to `'$chocolateyPath`'. `n This step may fail if you have anything in this folder running or locked." + Write-Output 'If it fails, just manually copy the rest of the items out and then delete the folder.' + Write-ChocolateyWarning "!!!! ATTN: YOU WILL NEED TO CLOSE AND REOPEN YOUR SHELL !!!!" + #-ForegroundColor Magenta -BackgroundColor Black + + $chocolateyExePathOld = Join-Path $chocolateyPathOld 'bin' + 'Machine', 'User' | + ForEach-Object { + $path = Get-EnvironmentVariable -Name 'PATH' -Scope $_ + $updatedPath = [System.Text.RegularExpressions.Regex]::Replace($path,[System.Text.RegularExpressions.Regex]::Escape($chocolateyExePathOld) + '(?>;)?', '', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) + if ($updatedPath -ne $path) { + Write-Output "Updating `'$_`' PATH to reflect removal of '$chocolateyPathOld'." + try { + Set-EnvironmentVariable -Name 'Path' -Value $updatedPath -Scope $_ -ErrorAction Stop + } catch { + Write-ChocolateyWarning "Was not able to remove the old environment variable from PATH. You will need to do this manually" + } + + } + } + + Copy-Item "$chocolateyPathOld\lib\*" "$chocolateyPath\lib" -force -recurse + + $from = "$chocolateyPathOld\bin" + $to = "$chocolateyPath\bin" + # TODO: This exclusion list needs to be updated once shims are removed + $exclude = @("choco.exe", "chocolatey.exe", "cinst.exe", "clist.exe", "cpush.exe", "cuninst.exe", "cup.exe", "RefreshEnv.cmd") + Get-ChildItem -Path $from -recurse -Exclude $exclude | + ForEach-Object { + Write-Debug "Copying $_ `n to $to" + if ($_.PSIsContainer) { + Copy-Item $_ -Destination (Join-Path $to $_.Parent.FullName.Substring($from.length)) -Force -ErrorAction SilentlyContinue + } else { + $fileToMove = (Join-Path $to $_.FullName.Substring($from.length)) + try { + Copy-Item $_ -Destination $fileToMove -Exclude $exclude -Force -ErrorAction Stop + } + catch { + Write-ChocolateyWarning "Was not able to move `'$fileToMove`'. You may need to reinstall the shim" + } + } + } + } +} + +function Remove-OldChocolateyInstall { +param( + [string]$chocolateyPathOld = "$sysDrive\Chocolatey" +) + Write-Debug "Remove-OldChocolateyInstall" + + if (Test-Path $chocolateyPathOld) { + Write-ChocolateyWarning "This action will result in Log Errors, you can safely ignore those. `n You may need to finish removing '$chocolateyPathOld' manually." + try { + Get-ChildItem -Path "$chocolateyPathOld" | ForEach-Object { + if (Test-Path $_.FullName) { + Write-Debug "Removing $_ unless matches .log" + Remove-Item $_.FullName -exclude *.log -recurse -force -ErrorAction SilentlyContinue + } + } + + Write-Output "Attempting to remove `'$chocolateyPathOld`'. This may fail if something in the folder is being used or locked." + Remove-Item "$($chocolateyPathOld)" -force -recurse -ErrorAction Stop + } + catch { + Write-ChocolateyWarning "Was not able to remove `'$chocolateyPathOld`'. You will need to manually remove it." + } + } +} + +function Install-ChocolateyFiles { +param( + [string]$chocolateyPath +) + Write-Debug "Install-ChocolateyFiles" + + Write-Debug "Removing install files in chocolateyInstall, helpers, redirects, and tools" + "$chocolateyPath\chocolateyInstall", "$chocolateyPath\helpers", "$chocolateyPath\redirects", "$chocolateyPath\tools" | ForEach-Object { + #Write-Debug "Checking path $_" + + if (Test-Path $_) { + Get-ChildItem -Path "$_" | ForEach-Object { + #Write-Debug "Checking child path $_ ($($_.FullName))" + if (Test-Path $_.FullName) { + Write-Debug "Removing $_ unless matches .log" + Remove-Item $_.FullName -exclude *.log -recurse -force -ErrorAction SilentlyContinue + } + } + } + } + + Write-Debug "Attempting to move choco.exe to choco.exe.old so we can place the new version here." + # rename the currently running process / it will be locked if it exists + $chocoExe = Join-Path $chocolateyPath 'choco.exe' + if (Test-Path ($chocoExe)) { + Write-Debug "Renaming '$chocoExe' to '$chocoExe.old'" + try { + Remove-Item "$chocoExe.old" -force -ErrorAction SilentlyContinue + Move-Item $chocoExe "$chocoExe.old" -force -ErrorAction SilentlyContinue + } + catch { + Write-ChocolateyWarning "Was not able to rename `'$chocoExe`' to `'$chocoExe.old`'." + } + } + + # remove pdb file if it is found + $chocoPdb = Join-Path $chocolateyPath 'choco.pdb' + if (Test-Path ($chocoPdb)) { + Remove-Item "$chocoPdb" -Force -ErrorAction SilentlyContinue + } + + Write-Debug "Unpacking files required for Chocolatey." + $chocoInstallFolder = Join-Path $thisScriptFolder "chocolateyInstall" + $chocoExe = Join-Path $chocoInstallFolder 'choco.exe' + $chocoExeDest = Join-Path $chocolateyPath 'choco.exe' + Copy-Item $chocoExe $chocoExeDest -force + + Write-Debug "Copying the contents of `'$chocoInstallFolder`' to `'$chocolateyPath`'." + Copy-Item $chocoInstallFolder\* $chocolateyPath -Recurse -Force +} + +function Ensure-ChocolateyLibFiles { +param( + [string]$chocolateyLibPath +) + Write-Debug "Ensure-ChocolateyLibFiles" + $chocoPkgDirectory = Join-Path $chocolateyLibPath 'chocolatey' + + Create-DirectoryIfNotExists $chocoPkgDirectory + + if (!(Test-Path("$chocoPkgDirectory\chocolatey.nupkg"))) { + Write-Output "chocolatey.nupkg file not installed in lib.`n Attempting to locate it from bootstrapper." + $chocoZipFile = Join-Path $tempDir "chocolatey\chocoInstall\chocolatey.zip" + + Write-Debug "First the zip file at '$chocoZipFile'." + Write-Debug "Then from a neighboring chocolatey.*nupkg file '$thisScriptFolder/../../'." + + if (Test-Path("$chocoZipFile")) { + Write-Debug "Copying '$chocoZipFile' to '$chocoPkgDirectory\chocolatey.nupkg'." + Copy-Item "$chocoZipFile" "$chocoPkgDirectory\chocolatey.nupkg" -Force -ErrorAction SilentlyContinue + } + + if (!(Test-Path("$chocoPkgDirectory\chocolatey.nupkg"))) { + $chocoPkg = Get-ChildItem "$thisScriptFolder/../../" | + Where-Object {$_.name -match "^chocolatey.*nupkg" } | + Sort-Object name -Descending | + Select-Object -First 1 + if ($chocoPkg -ne '') { $chocoPkg = $chocoPkg.FullName } + "$chocoZipFile", "$chocoPkg" | ForEach-Object { + if ($_ -ne $null -and $_ -ne '') { + if (Test-Path $_) { + Write-Debug "Copying '$_' to '$chocoPkgDirectory\chocolatey.nupkg'." + Copy-Item $_ "$chocoPkgDirectory\chocolatey.nupkg" -Force -ErrorAction SilentlyContinue + } + } + } + } + } +} + +function Install-ChocolateyBinFiles { +param( + [string] $chocolateyPath, + [string] $chocolateyExePath +) + Write-Debug "Install-ChocolateyBinFiles" + Write-Debug "Installing the bin file redirects" + $redirectsPath = Join-Path $chocolateyPath 'redirects' + if (!(Test-Path "$redirectsPath")) { + Write-ChocolateyWarning "$redirectsPath does not exist" + return + } + + $exeFiles = Get-ChildItem "$redirectsPath" -include @("*.exe","*.cmd") -recurse + foreach ($exeFile in $exeFiles) { + $exeFilePath = $exeFile.FullName + $exeFileName = [System.IO.Path]::GetFileName("$exeFilePath") + $binFilePath = Join-Path $chocolateyExePath $exeFileName + $binFilePathRename = $binFilePath + '.old' + $batchFilePath = $binFilePath.Replace(".exe",".bat") + $bashFilePath = $binFilePath.Replace(".exe","") + if (Test-Path ($batchFilePath)) { Remove-Item $batchFilePath -force -ErrorAction SilentlyContinue } + if (Test-Path ($bashFilePath)) { Remove-Item $bashFilePath -force -ErrorAction SilentlyContinue } + if (Test-Path ($binFilePathRename)) { + try { + Write-Debug "Attempting to remove $binFilePathRename" + Remove-Item $binFilePathRename -force -ErrorAction Stop + } + catch { + Write-ChocolateyWarning "Was not able to remove `'$binFilePathRename`'. This may cause errors." + } + } + if (Test-Path ($binFilePath)) { + try { + Write-Debug "Attempting to rename $binFilePath to $binFilePathRename" + Move-Item -path $binFilePath -destination $binFilePathRename -force -ErrorAction Stop + } + catch { + Write-ChocolateyWarning "Was not able to rename `'$binFilePath`' to `'$binFilePathRename`'." + } + } + + try { + Write-Debug "Attempting to copy $exeFilePath to $binFilePath" + Copy-Item -path $exeFilePath -destination $binFilePath -force -ErrorAction Stop + } + catch { + Write-ChocolateyWarning "Was not able to replace `'$binFilePath`' with `'$exeFilePath`'. You may need to do this manually." + } + + $commandShortcut = [System.IO.Path]::GetFileNameWithoutExtension("$exeFilePath") + Write-Debug "Added command $commandShortcut" + } +} + +function Initialize-ChocolateyPath { +param( + [string]$chocolateyExePath = "$($env:ALLUSERSPROFILE)\chocolatey\bin", + [string]$chocolateyExePathVariable = "%$($chocoInstallVariableName)%\bin" +) + Write-Debug "Initialize-ChocolateyPath" + Write-Debug "Initializing Chocolatey Path if required" + $environmentTarget = [System.EnvironmentVariableTarget]::User + if (Test-ProcessAdminRights) { + Write-Debug "Administrator installing so using Machine environment variable target instead of User." + $environmentTarget = [System.EnvironmentVariableTarget]::Machine + } else { + Write-ChocolateyWarning "Setting ChocolateyInstall Path on USER PATH and not SYSTEM Path.`n This is due to either non-administrator install OR the process you are running is not being run as an Administrator." + } + + Install-ChocolateyPath -pathToInstall "$chocolateyExePath" -pathType $environmentTarget +} + +function Process-ChocolateyBinFiles { +param( + [string]$chocolateyExePath = "$($env:ALLUSERSPROFILE)\chocolatey\bin", + [string]$chocolateyExePathVariable = "%$($chocoInstallVariableName)%\bin" +) + Write-Debug "Process-ChocolateyBinFiles" + $processedMarkerFile = Join-Path $chocolateyExePath '_processed.txt' + if (!(test-path $processedMarkerFile)) { + $files = get-childitem $chocolateyExePath -include *.bat -recurse + if ($files -ne $null -and $files.Count -gt 0) { + Write-Debug "Processing Bin files" + foreach ($file in $files) { + Write-Output "Processing $($file.Name) to make it portable" + $fileStream = [System.IO.File]::Open("$file", 'Open', 'Read', 'ReadWrite') + $reader = New-Object System.IO.StreamReader($fileStream) + $fileText = $reader.ReadToEnd() + $reader.Close() + $fileStream.Close() + + $fileText = $fileText.ToLower().Replace("`"" + $chocolateyPath.ToLower(), "SET DIR=%~dp0%`n""%DIR%..\").Replace("\\","\") + + Set-Content $file -Value $fileText -Encoding Ascii + } + } + + Set-Content $processedMarkerFile -Value "$([System.DateTime]::Now.Date)" -Encoding Ascii + } +} + +# Adapted from http://www.west-wind.com/Weblog/posts/197245.aspx +function Get-FileEncoding($Path) { + if ($PSVersionTable.PSVersion.Major -lt 6) { + Write-Debug "Detected Powershell version < 6 ; Using -Encoding byte parameter" + $bytes = [byte[]](Get-Content $Path -Encoding byte -ReadCount 4 -TotalCount 4) + } + else { + Write-Debug "Detected Powershell version >= 6 ; Using -AsByteStream parameter" + $bytes = [byte[]](Get-Content $Path -AsByteStream -ReadCount 4 -TotalCount 4) + } + + if(!$bytes) { return 'utf8' } + + switch -regex ('{0:x2}{1:x2}{2:x2}{3:x2}' -f $bytes[0],$bytes[1],$bytes[2],$bytes[3]) { + '^efbbbf' { return 'utf8' } + '^2b2f76' { return 'utf7' } + '^fffe' { return 'unicode' } + '^feff' { return 'bigendianunicode' } + '^0000feff' { return 'utf32' } + default { return 'ascii' } + } +} + +function Add-ChocolateyProfile { + Write-Debug "Add-ChocolateyProfile" + try { + $profileFile = "$profile" + if ($profileFile -eq $null -or $profileFile -eq '') { + Write-Output 'Not setting tab completion: Profile variable ($profile) resulted in an empty string.' + return + } + + $profileDirectory = (Split-Path -Parent $profileFile) + + if ($env:ChocolateyNoProfile -ne $null -and $env:ChocolateyNoProfile -ne '') { + Write-Warning "Not setting tab completion: Environment variable "ChocolateyNoProfile" exists and is set." + return + } + + $localSystem = Get-LocalizedWellKnownPrincipalName -WellKnownSidType ([Security.Principal.WellKnownSidType]::LocalSystemSid) + # get current user + $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() + if ($currentUser.Name -eq $localSystem) { + Write-Warning "Not setting tab completion: Current user is SYSTEM user." + return + } + + if (!(Test-Path($profileDirectory))) { + Write-Debug "Creating '$profileDirectory'" + New-Item "$profileDirectory" -Type Directory -Force -ErrorAction SilentlyContinue | Out-Null + } + + if (!(Test-Path($profileFile))) { + Write-Warning "Not setting tab completion: Profile file does not exist at '$profileFile'." + return + + #Write-Debug "Creating '$profileFile'" + #"" | Out-File $profileFile -Encoding UTF8 + } + + # Check authenticode, but only if file is greater than 5 bytes + $profileFileInfo = New-Object System.IO.FileInfo($profileFile) + if ($profileFileInfo.Length -gt 5) { + $signature = Get-AuthenticodeSignature $profile + if ($signature.Status -ne 'NotSigned') { + Write-Warning "Not setting tab completion: File is Authenticode signed at '$profile'." + return + } + } + + $profileInstall = @' + +# Import the Chocolatey Profile that contains the necessary code to enable +# tab-completions to function for `choco`. +# Be aware that if you are missing these lines from your profile, tab completion +# for `choco` will not function. +# See https://ch0.co/tab-completion for details. +$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" +if (Test-Path($ChocolateyProfile)) { + Import-Module "$ChocolateyProfile" +} +'@ + + $chocoProfileSearch = '$ChocolateyProfile' + if(Select-String -Path $profileFile -Pattern $chocoProfileSearch -Quiet -SimpleMatch) { + Write-Debug "Chocolatey profile is already installed." + return + } + + Write-Output 'Adding Chocolatey to the profile. This will provide tab completion, refreshenv, etc.' + $profileInstall | Out-File $profileFile -Append -Encoding (Get-FileEncoding $profileFile) + Write-ChocolateyWarning 'Chocolatey profile installed. Reload your profile - type . $profile' + + if ($PSVersionTable.PSVersion.Major -lt 3) { + Write-ChocolateyWarning "Tab completion does not currently work in PowerShell v2. `n Please upgrade to a more recent version of PowerShell to take advantage of tab completion." + #Write-ChocolateyWarning "To load tab expansion, you need to install PowerTab. `n See https://powertab.codeplex.com/ for details." + } + + } catch { + Write-ChocolateyWarning "Unable to add Chocolatey to the profile. You will need to do it manually. Error was '$_'" +@' +This is how add the Chocolatey Profile manually. +Find your $profile. Then add the following lines to it: + +$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" +if (Test-Path($ChocolateyProfile)) { + Import-Module "$ChocolateyProfile" +} +'@ | Write-Output + } +} + +$netFx4InstallTries = 0 + +function Install-DotNet4IfMissing { +param( + $forceFxInstall = $false +) + # we can't take advantage of any chocolatey module functions, because they + # haven't been unpacked because they require .NET Framework 4.0 + + Write-Debug "Install-DotNet4IfMissing called with `$forceFxInstall=$forceFxInstall" + $NetFxArch = "Framework" + if ([IntPtr]::Size -eq 8) {$NetFxArch="Framework64" } + + $NetFx4ClientUrl = 'https://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe' + $NetFx4FullUrl = 'https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe' + $NetFx4Url = $NetFx4FullUrl + $NetFx4Path = "$tempDir" + $NetFx4InstallerFile = 'dotNetFx40_Full_x86_x64.exe' + $NetFx4Installer = Join-Path $NetFx4Path $NetFx4InstallerFile + + if ((!(Test-Path "$env:SystemRoot\Microsoft.Net\$NetFxArch\v4.0.30319") -and !(Test-Path "C:\Windows\Microsoft.Net\$NetFxArch\v4.0.30319")) -or $forceFxInstall) { + Write-Output "'$env:SystemRoot\Microsoft.Net\$NetFxArch\v4.0.30319' was not found or this is forced" + if (!(Test-Path $NetFx4Path)) { + Write-Output "Creating folder `'$NetFx4Path`'" + $null = New-Item -Path "$NetFx4Path" -ItemType Directory + } + + $netFx4InstallTries += 1 + + if (!(Test-Path $NetFx4Installer)) { + Write-Output "Downloading `'$NetFx4Url`' to `'$NetFx4Installer`' - the installer is 40+ MBs, so this could take a while on a slow connection." + (New-Object Net.WebClient).DownloadFile("$NetFx4Url","$NetFx4Installer") + } + + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.WorkingDirectory = "$NetFx4Path" + $psi.FileName = "$NetFx4InstallerFile" + # https://msdn.microsoft.com/library/ee942965(v=VS.100).aspx#command_line_options + # http://blogs.msdn.com/b/astebner/archive/2010/05/12/10011664.aspx + # For the actual setup.exe (if you want to unpack first) - /repair /x86 /x64 /ia64 /parameterfolder Client /q /norestart + $psi.Arguments = "/q /norestart /repair" + + Write-Output "Installing `'$NetFx4Installer`' - this may take awhile with no output." + $s = [System.Diagnostics.Process]::Start($psi); + $s.WaitForExit(); + if ($s.ExitCode -ne 0 -and $s.ExitCode -ne 3010) { + if ($netFx4InstallTries -ge 2) { + Write-ChocolateyError ".NET Framework install failed with exit code `'$($s.ExitCode)`'. `n This will cause the rest of the install to fail." + throw "Error installing .NET Framework 4.0 (exit code $($s.ExitCode)). `n Please install the .NET Framework 4.0 manually and then try to install Chocolatey again. `n Download at `'$NetFx4Url`'" + } else { + Write-ChocolateyWarning "Try #$netFx4InstallTries of .NET framework install failed with exit code `'$($s.ExitCode)`'. Trying again." + Install-DotNet4IfMissing $true + } + } + } +} + +function Invoke-Chocolatey-Initial { + Write-Debug "Initializing Chocolatey files, etc by running Chocolatey..." + + try { + $chocoInstallationFolder = Get-ChocolateyInstallFolder + $chocoExe = Join-Path -Path $chocoInstallationFolder -ChildPath "choco.exe" + & $chocoExe -v | Out-Null + Write-Debug "Chocolatey execution completed successfully." + } catch { + Write-ChocolateyWarning "Unable to run Chocolatey at this time. It is likely that .Net Framework installation requires a system reboot" + } +} + +Export-ModuleMember -function Initialize-Chocolatey; diff --git a/nuget/chocolatey/tools/init.ps1 b/nuspec/chocolatey/chocolatey/tools/init.ps1 similarity index 95% rename from nuget/chocolatey/tools/init.ps1 rename to nuspec/chocolatey/chocolatey/tools/init.ps1 index 7694f97cb8..e82b0c84b5 100644 --- a/nuget/chocolatey/tools/init.ps1 +++ b/nuspec/chocolatey/chocolatey/tools/init.ps1 @@ -1,28 +1,28 @@ -param($installPath, $toolsPath, $package, $project) - -$modules = Get-ChildItem $ToolsPath -Filter *.psm1 -$modules | ForEach-Object { import-module -name $_.FullName } - -@" -======================== -Chocolatey -======================== -Welcome to Chocolatey, your local machine repository built on the NuGet infrastructure. Chocolatey allows you to install application packages to your machine with the goodness of a #chocolatey #nuget combo. -Application executables get added to the path automatically so you can call them from anywhere (command line/powershell prompt), not just in Visual Studio. - -Lets get Chocolatey! ----------- -Visual Studio - ----------- -Please run Initialize-Chocolatey one time per machine to set up the repository. -If you are upgrading, please remember to run Initialize-Chocolatey again. -After you have run Initialize-Chocolatey, you can safely uninstall the chocolatey package from your current Visual Studio solution. ----------- -Alternative NuGet - ----------- -If you are not using NuGet in Visual Studio, please navigate to the directory with the chocolateysetup.psm1 and run that in Powershell, followed by Initialize-Chocolatey. -Upgrade is the same, just run Initialize-Chocolatey again. ----------- -Once you've run initialize or upgrade, you can uninstall this package from the local project without affecting your chocolatey repository. -======================== -"@ | Write-Host +param($installPath, $toolsPath, $package, $project) + +$modules = Get-ChildItem $ToolsPath -Filter *.psm1 +$modules | ForEach-Object { import-module -name $_.FullName } + +@" +======================== +Chocolatey +======================== +Welcome to Chocolatey, your local machine repository built on the NuGet infrastructure. Chocolatey allows you to install application packages to your machine with the goodness of a #chocolatey #nuget combo. +Application executables get added to the path automatically so you can call them from anywhere (command line/powershell prompt), not just in Visual Studio. + +Lets get Chocolatey! +---------- +Visual Studio - +---------- +Please run Initialize-Chocolatey one time per machine to set up the repository. +If you are upgrading, please remember to run Initialize-Chocolatey again. +After you have run Initialize-Chocolatey, you can safely uninstall the chocolatey package from your current Visual Studio solution. +---------- +Alternative NuGet - +---------- +If you are not using NuGet in Visual Studio, please navigate to the directory with the chocolateysetup.psm1 and run that in PowerShell, followed by Initialize-Chocolatey. +Upgrade is the same, just run Initialize-Chocolatey again. +---------- +Once you've run initialize or upgrade, you can uninstall this package from the local project without affecting your chocolatey repository. +======================== +"@ | Write-Host diff --git a/nuget/chocolatey.lib/chocolatey.lib.nuspec b/nuspec/nuget/chocolatey.lib/chocolatey.lib.nuspec similarity index 87% rename from nuget/chocolatey.lib/chocolatey.lib.nuspec rename to nuspec/nuget/chocolatey.lib/chocolatey.lib.nuspec index 65c39ecd0a..ee56ccd7c7 100644 --- a/nuget/chocolatey.lib/chocolatey.lib.nuspec +++ b/nuspec/nuget/chocolatey.lib/chocolatey.lib.nuspec @@ -1,40 +1,40 @@ - - - - chocolatey.lib - 0.9.9 - Rob Reynolds - Chocolatey Core [PREVIEW] - Chocolatey Software, Inc - https://github.com/chocolatey/choco - https://raw.githubusercontent.com/chocolatey/choco/master/docs/logo/chocolateyicon.gif - https://raw.githubusercontent.com/chocolatey/choco/master/LICENSE - false - 2017-2021 Chocolatey Software, Inc, 2011-2017 RealDimensions Software, LLC - apt-get machine repository chocolatey - Chocolatey is the package manager for Windows (like apt-get but for Windows) - -Chocolatey is a package manager for Windows (like apt-get but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer. - -Chocolatey is brought to you by the work and inspiration of the community, the work and thankless nights of the Chocolatey Team (https://github.com/orgs/chocolatey/people), with Rob heading up the direction. - -You can host your own sources and add them to Chocolatey, you can extend Chocolatey's capabilities, and folks, it's only going to get better. - -This is the Chocolatey Library (API / DLL) package which allows Chocolatey to be embedded in your application. - -### Information - - * [Chocolatey Website and Community Package Repository](https://community.chocolatey.org) - * [Mailing List](http://groups.google.com/group/chocolatey) / [Release Announcements Only Mailing List](https://groups.google.com/group/chocolatey-announce) / [Build Status Mailing List](http://groups.google.com/group/chocolatey-build-status) - * [Twitter](https://twitter.com/chocolateynuget) / [Facebook](https://www.facebook.com/ChocolateySoftware) / [Github](https://github.com/chocolatey) - * [Blog](https://blog.chocolatey.org/) / [Newsletter](https://chocolatey.us8.list-manage1.com/subscribe?u=86a6d80146a0da7f2223712e4&id=73b018498d) - * [Documentation](https://docs.chocolatey.org/en-us/) / [Support](https://chocolatey.org/support) - - - See all - https://github.com/chocolatey/choco/blob/stable/CHANGELOG.md - - - - - - + + + + chocolatey.lib + 0.9.9 + Rob Reynolds + Chocolatey Core [PREVIEW] + Chocolatey Software, Inc + https://github.com/chocolatey/choco + https://chocolatey.org/assets/images/nupkg/chocolateyicon.png + https://raw.githubusercontent.com/chocolatey/choco/master/LICENSE + false + 2017-2021 Chocolatey Software, Inc, 2011-2017 RealDimensions Software, LLC + apt-get machine repository chocolatey + Chocolatey is the package manager for Windows (like apt-get but for Windows) + +Chocolatey is a package manager for Windows (like apt-get but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer. + +Chocolatey is brought to you by the work and inspiration of the community, the work and thankless nights of the Chocolatey Team (https://github.com/orgs/chocolatey/people), with Rob heading up the direction. + +You can host your own sources and add them to Chocolatey, you can extend Chocolatey's capabilities, and folks, it's only going to get better. + +This is the Chocolatey Library (API / DLL) package which allows Chocolatey to be embedded in your application. + +### Information + + * [Chocolatey Website and Community Package Repository](https://community.chocolatey.org) + * [Mailing List](http://groups.google.com/group/chocolatey) / [Release Announcements Only Mailing List](https://groups.google.com/group/chocolatey-announce) / [Build Status Mailing List](http://groups.google.com/group/chocolatey-build-status) + * [Twitter](https://twitter.com/chocolateynuget) / [Facebook](https://www.facebook.com/ChocolateySoftware) / [GitHub](https://github.com/chocolatey) + * [Blog](https://blog.chocolatey.org/) / [Newsletter](https://chocolatey.us8.list-manage1.com/subscribe?u=86a6d80146a0da7f2223712e4&id=73b018498d) + * [Documentation](https://docs.chocolatey.org/en-us/) / [Support](https://chocolatey.org/support) + + + See all - https://docs.chocolatey.org/en-us/choco/release-notes + + + + + + diff --git a/recipe.cake b/recipe.cake new file mode 100644 index 0000000000..c192390fb4 --- /dev/null +++ b/recipe.cake @@ -0,0 +1,179 @@ +#load nuget:?package=Chocolatey.Cake.Recipe&version=0.16.0 + +/////////////////////////////////////////////////////////////////////////////// +// TOOLS +/////////////////////////////////////////////////////////////////////////////// + +// This is needed in order to allow NUnit v2 tested to be executed by the NUnit +// v3 Test Runner +#tool nuget:?package=NUnit.Extension.NUnitV2Driver&version=3.9.0 + +/////////////////////////////////////////////////////////////////////////////// +// SCRIPT +/////////////////////////////////////////////////////////////////////////////// + +Func> getILMergeConfigs = () => +{ + var mergeConfigs = new List(); + + var targetPlatform = "v4,C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0"; + var assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/*.{exe|dll}") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/System.Management.Automation.dll"); + + Information("The following assemblies have been selected to be ILMerged for choco.exe..."); + foreach (var assemblyToILMerge in assembliesToILMerge) + { + Information(assemblyToILMerge.FullPath); + } + + mergeConfigs.Add(new ILMergeConfig() { + KeyFile = BuildParameters.StrongNameKeyPath, + LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocoexe.log", + TargetPlatform = targetPlatform, + Target = "exe", + Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey.console/ilmerge.internalize.ignore.txt", + Output = BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", + PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe", + AssemblyPaths = assembliesToILMerge }); + + assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/*.{exe|dll}") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/choco.exe") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/log4net.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/System.Management.Automation.dll"); + + Information("The following assemblies have been selected to be ILMerged for chocolatey.dll..."); + foreach (var assemblyToILMerge in assembliesToILMerge) + { + Information(assemblyToILMerge.FullPath); + } + + mergeConfigs.Add(new ILMergeConfig() { + KeyFile = BuildParameters.StrongNameKeyPath, + LogFile = BuildParameters.Paths.Directories.Build + "/ilmerge-chocolateydll.log", + TargetPlatform = targetPlatform, + Target = "dll", + Internalize = BuildParameters.RootDirectoryPath + "/src/chocolatey/ilmerge.internalize.ignore.dll.txt", + Output = BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey_merged/chocolatey.dll", + PrimaryAssemblyName = BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll", + AssemblyPaths = assembliesToILMerge }); + + return mergeConfigs; +}; + +Func getScriptsToSign = () => +{ + var scriptsToSign = GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/**/*.{ps1|psm1}") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/**/*.{ps1|psm1}"); + + Information("The following PowerShell scripts have been selected to be signed..."); + foreach (var scriptToSign in scriptsToSign) + { + Information(scriptToSign.FullPath); + } + + return scriptsToSign; +}; + +Func getFilesToSign = () => +{ + var filesToSign = GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/chocolatey.dll") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools/{checksum|shimgen}.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects/*.exe"); + + Information("The following assemblies have been selected to be signed..."); + foreach (var fileToSign in filesToSign) + { + Information(fileToSign.FullPath); + } + + return filesToSign; +}; + +/////////////////////////////////////////////////////////////////////////////// +// CUSTOM TASKS +/////////////////////////////////////////////////////////////////////////////// + +Task("Prepare-Chocolatey-Packages") + .IsDependeeOf("Create-Chocolatey-Packages") + .IsDependeeOf("Sign-PowerShellScripts") + .IsDependeeOf("Sign-Assemblies") + .WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping because not running on Windows") + .Does(() => +{ + // Copy legal documents + CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt"); + + // Run Chocolatey Unpackself + CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe"); + + StartProcess(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" }); + + // Tidy up logs and config folder which are not required + var logsDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/logs"; + var configDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/config"; + + if (DirectoryExists(logsDirectory)) + { + DeleteDirectory(logsDirectory, new DeleteDirectorySettings { + Recursive = true, + Force = true + }); + } + + if (DirectoryExists(configDirectory)) + { + DeleteDirectory(configDirectory, new DeleteDirectorySettings { + Recursive = true, + Force = true + }); + } +}); + +Task("Prepare-NuGet-Packages") + .IsDependeeOf("Create-NuGet-Packages") + .IsDependeeOf("Sign-PowerShellScripts") + .IsDependeeOf("Sign-Assemblies") + .Does(() => +{ + // Copy legal documents + CleanDirectory(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib"); + CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/CREDITS.txt"); + + CopyFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey_merged/*", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib"); + CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.xml", BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/chocolatey.xml"); +}); + +/////////////////////////////////////////////////////////////////////////////// +// RECIPE SCRIPT +/////////////////////////////////////////////////////////////////////////////// + +Environment.SetVariableNames(); + +BuildParameters.SetParameters(context: Context, + buildSystem: BuildSystem, + sourceDirectoryPath: "./src", + solutionFilePath: "./src/chocolatey.sln", + solutionDirectoryPath: "./src/chocolatey", + resharperSettingsFileName: "chocolatey.sln.DotSettings", + title: "Chocolatey", + repositoryOwner: "chocolatey", + repositoryName: "choco", + productName: "Chocolatey", + productDescription: "chocolatey is a product of Chocolatey Software, Inc. - All Rights Reserved.", + productCopyright: string.Format("Copyright © 2017 - {0} Chocolatey Software, Inc. Copyright © 2011 - 2017, RealDimensions Software, LLC - All Rights Reserved.", DateTime.Now.Year), + shouldStrongNameSignDependentAssemblies: false, + treatWarningsAsErrors: false, + getScriptsToSign: getScriptsToSign, + getFilesToSign: getFilesToSign, + getILMergeConfigs: getILMergeConfigs, + preferDotNetGlobalToolUsage: !IsRunningOnWindows()); + +ToolSettings.SetToolSettings(context: Context, + buildMSBuildToolVersion: MSBuildToolVersion.NET40); + +BuildParameters.PrintParameters(Context); + +Build.Run(); \ No newline at end of file diff --git a/setup.ps1 b/setup.ps1 index 9ed7de8713..159973991e 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -1,6 +1,6 @@ -### install chocolatey ### +### install chocolatey ### if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall")){ - iex ((new-object net.webclient).DownloadString("https://community.chocolatey.org/install.ps1")) + Invoke-Expression ((new-object net.webclient).DownloadString("https://community.chocolatey.org/install.ps1")) } cinst pester -version 2.0.2 diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index af0752f0d5..20cf37fffe 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -1,4 +1,4 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 RealDimensions Software, LLC // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,20 +21,25 @@ namespace chocolatey.console using System.IO; using System.Linq; using System.Reflection; + using chocolatey.infrastructure.information; using infrastructure.app; using infrastructure.app.builders; using infrastructure.app.configuration; using infrastructure.app.runners; using infrastructure.commandline; - using infrastructure.configuration; using infrastructure.extractors; using infrastructure.licensing; using infrastructure.logging; using infrastructure.registration; using infrastructure.tolerance; + using SimpleInjector; + #if !NoResources + using resources; + #endif + using Assembly = infrastructure.adapters.Assembly; using Console = System.Console; using Environment = System.Environment; @@ -46,6 +51,9 @@ public sealed class Program private static void Main(string[] args) // ReSharper restore InconsistentNaming { + ChocolateyConfiguration config = null; + ChocolateyLicense license = null; + try { add_assembly_resolver(); @@ -57,16 +65,22 @@ private static void Main(string[] args) Log4NetAppenderConfiguration.configure(loggingLocation, excludeLoggerNames: ChocolateyLoggers.Trace.to_string()); Bootstrap.initialize(); Bootstrap.startup(); - var license = License.validate_license(); + license = License.validate_license(); var container = SimpleInjectorContainer.Container; "LogFileOnly".Log().Info(() => "".PadRight(60, '=')); - var config = Config.get_configuration_settings(); + config = container.GetInstance(); var fileSystem = container.GetInstance(); var warnings = new List(); + if (license.AssemblyLoaded && !is_licensed_assembly_loaded(container)) + { + license.AssemblyLoaded = false; + license.IsCompatible = false; + } + ConfigurationBuilder.set_up_configuration( args, config, @@ -75,6 +89,11 @@ private static void Main(string[] args) warning => { warnings.Add(warning); } ); + if (license.AssemblyLoaded && license.is_licensed_version() && !license.IsCompatible && !config.DisableCompatibilityChecks) + { + write_warning_for_incompatible_versions(); + } + if (config.Features.LogWithoutColor) { ApplicationParameters.Log4NetConfigurationResource = @"chocolatey.infrastructure.logging.log4net.nocolor.config.xml"; @@ -83,7 +102,7 @@ private static void Main(string[] args) if (!string.IsNullOrWhiteSpace(config.AdditionalLogFileLocation)) { - Log4NetAppenderConfiguration.configure_additional_log_file(fileSystem.get_full_path(config.AdditionalLogFileLocation)); + Log4NetAppenderConfiguration.configure_additional_log_file(fileSystem.get_full_path(config.AdditionalLogFileLocation)); } report_version_and_exit_if_requested(args, config); @@ -129,7 +148,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(), "chocolatey.console", throwError:false); + AssemblyFileExtractor.extract_all_resources_to_relative_directory(fileSystem, Assembly.GetAssembly(typeof(Program)), ApplicationParameters.InstallLocation, new List(), "chocolatey.console", throwError: false); //refactor - thank goodness this is temporary, cuz manifest resource streams are dumb IList folders = new List { @@ -163,6 +182,11 @@ private static void Main(string[] args) } finally { + if (license != null && license.AssemblyLoaded && license.is_licensed_version() && !license.IsCompatible && config != null && !config.DisableCompatibilityChecks) + { + write_warning_for_incompatible_versions(); + } + "chocolatey".Log().Debug(() => "Exiting with {0}".format_with(Environment.ExitCode)); #if DEBUG "chocolatey".Log().Info(() => "Exiting with {0}".format_with(Environment.ExitCode)); @@ -173,6 +197,25 @@ private static void Main(string[] args) } } + private static bool is_licensed_assembly_loaded(Container container) + { + var allExtensions = container.GetAllInstances(); + + foreach (var extension in allExtensions) + { + if (extension.Name.is_equal_to("chocolatey.licensed")) + { + return extension.Status == ExtensionStatus.Enabled || extension.Status == ExtensionStatus.Loaded; + } + } + + // We will be going by an assumption that it has been loaded in this case. + // This is mostly to prevent that the licensed extension won't be disabled + // if it has been loaded using old method. + + return true; + } + private static void warn_on_nuspec_or_nupkg_usage(string[] args, ChocolateyConfiguration config) { var commandLine = Environment.CommandLine; @@ -183,6 +226,7 @@ private static void warn_on_nuspec_or_nupkg_usage(string[] args, ChocolateyConfi } private static ResolveEventHandler _handler = null; + private static void add_assembly_resolver() { _handler = (sender, args) => @@ -195,8 +239,40 @@ private static void add_assembly_resolver() var chocolateyPublicKey = ApplicationParameters.UnofficialChocolateyPublicKey; #endif + if (requestedAssembly.get_public_key_token().is_equal_to(chocolateyPublicKey)) + { + // Check if it is already loaded + var resolvedAssembly = AssemblyResolution.resolve_existing_assembly(requestedAssembly.Name, chocolateyPublicKey); + + if (resolvedAssembly != null) + { + return resolvedAssembly.UnderlyingType; + } + + if (Directory.Exists(ApplicationParameters.ExtensionsLocation)) + { + foreach (var extensionDll in Directory.EnumerateFiles(ApplicationParameters.ExtensionsLocation, requestedAssembly.Name + ".dll", SearchOption.AllDirectories)) + { + try + { + resolvedAssembly = AssemblyResolution.load_assembly(requestedAssembly.Name, extensionDll, chocolateyPublicKey); + + if (resolvedAssembly != null) + { + return resolvedAssembly.UnderlyingType; + } + } + catch (Exception ex) + { + // This catch statement is empty on purpose, we do + // not want to do anything if it fails to load. + } + } + } + } + // There are things that are ILMerged into Chocolatey. Anything with - // the right public key except licensed should use the choco/chocolatey assembly + // the right public key except extensions should use the choco/chocolatey assembly if (requestedAssembly.get_public_key_token().is_equal_to(chocolateyPublicKey) && !requestedAssembly.Name.is_equal_to(ApplicationParameters.LicensedChocolateyAssemblySimpleName) && !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) @@ -269,5 +345,30 @@ private static void pause_execution_if_debug() Console.ReadKey(); #endif } + + private static void write_warning_for_incompatible_versions() + { + "chocolatey".Log().Warn( + ChocolateyLoggers.Important, + @"WARNING! + +You are running a version of Chocolatey that may not be compatible with +the currently installed version of the chocolatey.extension package. +Running Chocolatey with the current version of the chocolatey.extension +package is an unsupported configuration. + +See https://ch0.co/compatibility for more information. + +If you are in the process of modifying the chocolatey.extension package, +you can ignore this warning. + +Additionally, you can ignore these warnings by either setting the +DisableCompatibilityChecks feature: + +choco feature enable --name=""'disableCompatibilityChecks'"" + +Or by passing the --skip-compatibility-checks option when executing a +command."); + } } } diff --git a/src/chocolatey.console/Properties/AssemblyInfo.cs b/src/chocolatey.console/Properties/AssemblyInfo.cs index 4aa61c9d2c..a959c0e14d 100644 --- a/src/chocolatey.console/Properties/AssemblyInfo.cs +++ b/src/chocolatey.console/Properties/AssemblyInfo.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.console/chocolatey.console.csproj b/src/chocolatey.console/chocolatey.console.csproj index 802ac636f8..0302fa2074 100644 --- a/src/chocolatey.console/chocolatey.console.csproj +++ b/src/chocolatey.console/chocolatey.console.csproj @@ -123,18 +123,18 @@ False ..\packages\AlphaFS.2.1.3\lib\net40\AlphaFS.dll - - ..\packages\log4net.2.0.3\lib\net40-client\log4net.dll + + ..\packages\log4net.2.0.12\lib\net40\log4net.dll ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll - + False - ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20210506\lib\net4\NuGet.Core.dll + ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20220901\lib\net4\NuGet.Core.dll - - ..\packages\SimpleInjector.2.5.0\lib\net40-client\SimpleInjector.dll + + ..\packages\SimpleInjector.2.8.3\lib\net40-client\SimpleInjector.dll @@ -147,6 +147,7 @@ + @@ -162,7 +163,6 @@ Designer - @@ -186,7 +186,6 @@ - - - - - - - False - True - False - $(ExeProjectOutputDirInsideProjectDefault) - $(MSBuildProjectDirectory) - $(OutDir)_PublishedApplications\$(MSBuildProjectName) - False - False - True - False - - - - - $(PrepareForRunDependsOn); - - - $(PrepareForRunDependsOn); - _CopyExeApplication; - _BuiltExeOutputGroupOutput - - - - - - - - - - - - - - - - $(CleanDependsOn); - CleanExeProjectOutputDir; - - - - - - - - - - - - - - - - - - - - - - _CopyExeApplicationLegacy; - - - $(OnBefore_CopyExeApplicationDefault); - - - - - - <_CopyExeApplicationDependsOn Condition="'$(_CopyExeApplicationDependsOn)'==''"> - $(OnBefore_CopyExeApplication); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/chocolatey.resources/ChocolateyResourcesAssembly.cs b/src/chocolatey.resources/ChocolateyResourcesAssembly.cs index 00374a8ec4..06e9c660c8 100644 --- a/src/chocolatey.resources/ChocolateyResourcesAssembly.cs +++ b/src/chocolatey.resources/ChocolateyResourcesAssembly.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -18,6 +18,6 @@ namespace chocolatey.resources { public class ChocolateyResourcesAssembly { - //this exists only to aid in finding this assembly + //this exists only to aid in finding this assembly } } diff --git a/src/chocolatey.resources/Properties/AssemblyInfo.cs b/src/chocolatey.resources/Properties/AssemblyInfo.cs index 3b439dc60a..12c51df427 100644 --- a/src/chocolatey.resources/Properties/AssemblyInfo.cs +++ b/src/chocolatey.resources/Properties/AssemblyInfo.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -22,4 +22,4 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("50541cb5-0537-464a-9cf2-3e93dae63703")] \ No newline at end of file +[assembly: Guid("50541cb5-0537-464a-9cf2-3e93dae63703")] diff --git a/src/chocolatey.resources/chocolatey.resources.csproj b/src/chocolatey.resources/chocolatey.resources.csproj index ce87e7280b..958e183c52 100644 --- a/src/chocolatey.resources/chocolatey.resources.csproj +++ b/src/chocolatey.resources/chocolatey.resources.csproj @@ -61,6 +61,7 @@ + @@ -69,7 +70,6 @@ - @@ -85,18 +85,13 @@ - - - - - @@ -106,11 +101,9 @@ - - diff --git a/src/chocolatey.resources/helpers/ChocolateyTabExpansion.ps1 b/src/chocolatey.resources/helpers/ChocolateyTabExpansion.ps1 index ee7f295b95..3988f77547 100644 --- a/src/chocolatey.resources/helpers/ChocolateyTabExpansion.ps1 +++ b/src/chocolatey.resources/helpers/ChocolateyTabExpansion.ps1 @@ -29,40 +29,45 @@ function script:chocoCmdOperations($commands, $command, $filter, $currentArgumen if ($currentArguments -ne $null -and $currentArguments.Trim() -ne '') { $currentOptions = $currentArguments.Trim() -split ' ' } $commands.$command.Replace(" "," ") -split ' ' | - where { $_ -notmatch "^(?:$($currentOptions -join '|' -replace "=", "\="))(?:\S*)\s?$" } | - where { $_ -like "$filter*" } + Where-Object { $_ -notmatch "^(?:$($currentOptions -join '|' -replace "=", "\="))(?:\S*)\s?$" } | + Where-Object { $_ -like "$filter*" } } -$script:someCommands = @('-?','search','list','info','install','outdated','upgrade','uninstall','new','download','optimize','pack','push','sync','-h','--help','pin','source','config','feature','apikey','export','help','--version') +$script:someCommands = @('-?','search','list','info','install','outdated','upgrade','uninstall','new','download','optimize','pack','push','sync','-h','--help','pin','source','config','feature','apikey','export','help','template','--version') # ensure these all have a space to start, or they will cause issues -$allcommands = " --debug --verbose --trace --noop --help --accept-license --confirm --limit-output --no-progress --log-file='' --execution-timeout='' --cache-location='' --proxy='' --proxy-user='' --proxy-password='' --proxy-bypass-list='' --proxy-bypass-on-local --force --no-color" -$proListOptions = " --audit" -$proInstallUpgradeOptions = " --install-directory='' --package-parameters-sensitive='' --max-download-rate='' --install-arguments-sensitive='' --skip-download-cache --use-download-cache --skip-virus-check --virus-check --virus-positives-minimum='' --deflate-package-size --no-deflate-package-size --deflate-nupkg-only" +$allcommands = " --debug --verbose --trace --noop --help --accept-license --confirm --limit-output --no-progress --log-file='' --execution-timeout='' --cache-location='' --proxy='' --proxy-user='' --proxy-password='' --proxy-bypass-list='' --proxy-bypass-on-local --force --no-color --skip-compatibility-checks" +$proListOptions = " --audit --use-self-service" +$proInfoOptions = " --use-self-service" +$proInstallUpgradeOptions = " --install-directory='' --package-parameters-sensitive='' --max-download-rate='' --install-arguments-sensitive='' --skip-download-cache --use-download-cache --skip-virus-check --virus-check --virus-positives-minimum='' --deflate-package-size --no-deflate-package-size --deflate-nupkg-only --use-self-service" +$proUpgradeOptions = " --exclude-chocolatey-packages-during-upgrade-all --include-chocolatey-packages-during-upgrade-all --use-self-service" $proNewOptions = " --file='' --build-package --file64='' --from-programs-and-features --use-original-location --keep-remote --url='' --url64='' --checksum='' --checksum64='' --checksumtype='' --pause-on-error --remove-architecture-from-name --include-architecture-in-name" -$proUninstallOptions = " --from-programs-and-features" -$proPinOptions = " --note=''" +$proUninstallOptions = " --from-programs-and-features --use-self-service" +$proPinOptions = " --note='' --use-self-service" +$proOutdatedOptions = " --use-self-service" +$proPushOptions = " --use-self-service" $commandOptions = @{ list = "--lo --id-only --pre --exact --by-id-only --id-starts-with --detailed --approved-only --not-broken --source='' --user='' --password='' --local-only --prerelease --include-programs --page='' --page-size='' --order-by-popularity --download-cache-only --disable-package-repository-optimizations" + $proListOptions + $allcommands - search = "--pre --exact --by-id-only --id-starts-with --detailed --approved-only --not-broken --source='' --user='' --password='' --local-only --prerelease --include-programs --page='' --page-size='' --order-by-popularity --download-cache-only --disable-package-repository-optimizations" + $allcommands - info = "--pre --lo --source='' --user='' --password='' --local-only --prerelease --disable-package-repository-optimizations" + $allcommands - install = "-y -whatif -? --pre --version= --params='' --install-arguments='' --override-arguments --ignore-dependencies --source='' --source='windowsfeatures' --source='webpi' --user='' --password='' --prerelease --forcex86 --not-silent --package-parameters='' --exit-when-reboot-detected --ignore-detected-reboot --allow-downgrade --force-dependencies --require-checksums --use-package-exit-codes --ignore-package-exit-codes --skip-automation-scripts --allow-multiple-versions --ignore-checksums --allow-empty-checksums --allow-empty-checksums-secure --download-checksum='' --download-checksum-type='' --download-checksum-x64='' --download-checksum-type-x64='' --stop-on-first-package-failure --disable-package-repository-optimizations" + $proInstallUpgradeOptions + $allcommands + search = "--pre --exact --by-id-only --id-starts-with --detailed --approved-only --not-broken --source='' --user='' --password='' --local-only --prerelease --include-programs --page='' --page-size='' --order-by-popularity --download-cache-only --disable-package-repository-optimizations" + $proListOptions + $allcommands + info = "--pre --lo --source='' --user='' --password='' --local-only --prerelease --disable-package-repository-optimizations" + $proInfoOptions + $allcommands + install = "-y -whatif -? --pre --version= --params='' --install-arguments='' --override-arguments --ignore-dependencies --source='' --source='windowsfeatures' --source='webpi' --user='' --password='' --prerelease --forcex86 --not-silent --package-parameters='' --exit-when-reboot-detected --ignore-detected-reboot --allow-downgrade --force-dependencies --require-checksums --use-package-exit-codes --ignore-package-exit-codes --skip-automation-scripts --allow-multiple-versions --ignore-checksums --allow-empty-checksums --allow-empty-checksums-secure --download-checksum='' --download-checksum-type='' --download-checksum-x64='' --download-checksum-type-x64='' --stop-on-first-package-failure --disable-package-repository-optimizations --pin" + $proInstallUpgradeOptions + $allcommands pin = "--name='' --version='' -?" + $proPinOptions + $allcommands - outdated = "-? --source='' --user='' --password='' --ignore-pinned --ignore-unfound --pre --prerelease --disable-package-repository-optimizations" + $allcommands - upgrade = "-y -whatif -? --pre --version='' --except='' --params='' --install-arguments='' --override-arguments --ignore-dependencies --source='' --source='windowsfeatures' --source='webpi' --user='' --password='' --prerelease --forcex86 --not-silent --package-parameters='' --exit-when-reboot-detected --ignore-detected-reboot --allow-downgrade --allow-multiple-versions --require-checksums --use-package-exit-codes --ignore-package-exit-codes --skip-automation-scripts --fail-on-unfound --fail-on-not-installed --ignore-checksums --allow-empty-checksums --allow-empty-checksums-secure --download-checksum='' --download-checksum-type='' --download-checksum-x64='' --download-checksum-type-x64='' --exclude-prerelease --stop-on-first-package-failure --use-remembered-options --ignore-remembered-options --skip-when-not-installed --install-if-not-installed --disable-package-repository-optimizations" + $proInstallUpgradeOptions + $allcommands + outdated = "-? --source='' --user='' --password='' --ignore-pinned --ignore-unfound --pre --prerelease --disable-package-repository-optimizations" + $proOutdatedOptions + $allcommands + upgrade = "-y -whatif -? --pre --version='' --except='' --params='' --install-arguments='' --override-arguments --ignore-dependencies --source='' --source='windowsfeatures' --source='webpi' --user='' --password='' --prerelease --forcex86 --not-silent --package-parameters='' --exit-when-reboot-detected --ignore-detected-reboot --allow-downgrade --allow-multiple-versions --require-checksums --use-package-exit-codes --ignore-package-exit-codes --skip-automation-scripts --fail-on-unfound --fail-on-not-installed --ignore-checksums --allow-empty-checksums --allow-empty-checksums-secure --download-checksum='' --download-checksum-type='' --download-checksum-x64='' --download-checksum-type-x64='' --exclude-prerelease --stop-on-first-package-failure --use-remembered-options --ignore-remembered-options --skip-when-not-installed --install-if-not-installed --disable-package-repository-optimizations --pin" + $proInstallUpgradeOptions + $proUpgradeOptions + $allcommands uninstall = "-y -whatif -? --force-dependencies --remove-dependencies --all-versions --source='windowsfeatures' --source='webpi' --version= --uninstall-arguments='' --override-arguments --not-silent --params='' --package-parameters='' --exit-when-reboot-detected --ignore-detected-reboot --use-package-exit-codes --ignore-package-exit-codes --skip-automation-scripts --use-autouninstaller --skip-autouninstaller --fail-on-autouninstaller --ignore-autouninstaller-failure --stop-on-first-package-failure" + $proUninstallOptions + $allcommands new = "--template-name='' --output-directory='' --automaticpackage --version='' --maintainer='' packageversion='' maintainername='' maintainerrepo='' installertype='' url='' url64='' silentargs='' --use-built-in-template -?" + $proNewOptions + $allcommands pack = "--version='' --output-directory='' -?" + $allcommands - push = "--source='' --api-key='' --timeout='' -?" + $allcommands + push = "--source='' --api-key='' --timeout='' -?" + $proPushOptions + $allcommands source = "--name='' --source='' --user='' --password='' --priority= --bypass-proxy --allow-self-service -?" + $allcommands config = "--name='' --value='' -?" + $allcommands feature = "--name='' -?" + $allcommands apikey = "--source='' --api-key='' --remove -?" + $allcommands - download = "--internalize --internalize-all-urls --ignore-dependencies --installed-packages --ignore-unfound-packages --resources-location='' --download-location='' --outputdirectory='' --source='' --version='' --prerelease --user='' --password='' --cert='' --certpassword='' --append-use-original-location --recompile --disable-package-repository-optimizations -?" + $allcommands - sync = "--output-directory='' --id='' --package-id='' -?" + $allcommands - optimize = "--deflate-nupkg-only --id='' -?" + $allcommands + download = "--internalize --internalize-all-urls --ignore-dependencies --installed-packages --ignore-unfound-packages --resources-location='' --download-location='' --outputdirectory='' --source='' --version='' --prerelease --user='' --password='' --cert='' --certpassword='' --append-use-original-location --recompile --disable-package-repository-optimizations -? --use-self-service" + $allcommands + sync = "--output-directory='' --id='' --package-id='' -? --use-self-service" + $allcommands + optimize = "--deflate-nupkg-only --id='' -? --use-self-service" + $allcommands export = "--include-version-numbers --output-file-path='' -?" + $allcommands + template = "--name=''" + $allcommands } try { @@ -78,9 +83,9 @@ function script:chocoCommands($filter) { $cmdList += $someCommands -like "$filter*" } else { $cmdList += (& $script:choco -h) | - where { $_ -match '^ \S.*' } | - foreach { $_.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) } | - where { $_ -like "$filter*" } + Where-Object { $_ -match '^ \S.*' } | + ForEach-Object { $_.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) } | + Where-Object { $_ -like "$filter*" } } $cmdList #| sort @@ -88,21 +93,25 @@ function script:chocoCommands($filter) { function script:chocoLocalPackages($filter) { if ($filter -ne $null -and $filter.StartsWith(".")) { return; } #file search - @(& $script:choco list $filter -lo -r --id-starts-with) | %{ $_.Split('|')[0] } + @(& $script:choco list $filter -lo -r --id-starts-with) | ForEach-Object { $_.Split('|')[0] } } function script:chocoLocalPackagesUpgrade($filter) { if ($filter -ne $null -and $filter.StartsWith(".")) { return; } #file search - @('all|') + @(& $script:choco list $filter -lo -r --id-starts-with) | where { $_ -like "$filter*" } | %{ $_.Split('|')[0] } + @('all|') + @(& $script:choco list $filter -lo -r --id-starts-with) | + Where-Object { $_ -like "$filter*" } | + ForEach-Object { $_.Split('|')[0] } } function script:chocoRemotePackages($filter) { if ($filter -ne $null -and $filter.StartsWith(".")) { return; } #file search - @('packages.config|') + @(& $script:choco search $filter --page='0' --page-size='30' -r --id-starts-with --order-by-popularity) | where { $_ -like "$filter*" } | %{ $_.Split('|')[0] } + @('packages.config|') + @(& $script:choco search $filter --page='0' --page-size='30' -r --id-starts-with --order-by-popularity) | + Where-Object { $_ -like "$filter*" } | + ForEach-Object { $_.Split('|')[0] } } function Get-AliasPattern($exe) { - $aliases = @($exe) + @(Get-Alias | where { $_.Definition -eq $exe } | select -Exp Name) + $aliases = @($exe) + @(Get-Alias | Where-Object { $_.Definition -eq $exe } | Select-Object -Exp Name) "($($aliases -join '|'))" } @@ -127,41 +136,46 @@ function ChocolateyTabExpansion($lastBlock) { # Handles list/search first tab "^(list|search)\s+(?[^-\s]*)$" { - @('','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles new first tab "^(new)\s+(?[^-\s]*)$" { - @('','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles pack first tab "^(pack)\s+(?[^-\s]*)$" { - @('','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles push first tab "^(push)\s+(?[^-\s]*)$" { - @('','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles source first tab "^(source)\s+(?[^-\s]*)$" { - @('list','add','remove','disable','enable','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('list','add','remove','disable','enable','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles pin first tab "^(pin)\s+(?[^-\s]*)$" { - @('list','add','remove','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('list','add','remove','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles feature first tab "^(feature)\s+(?[^-\s]*)$" { - @('list','disable','enable','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('list','disable','enable','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles config first tab "^(config)\s+(?[^-\s]*)$" { - @('list','get','set','unset','-?') | where { $_ -like "$($matches['subcommand'])*" } + @('list','get','set','unset','-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } + } + + # Handles template first tab + "^(template)\s+(?[^-\s]*)$" { + @('list', 'info', '-?') | Where-Object { $_ -like "$($matches['subcommand'])*" } } # Handles more options after others diff --git a/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 b/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 index 271e628359..35f8de12d9 100644 --- a/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 +++ b/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 @@ -1,4 +1,4 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. +# Copyright © 2017 - 2021 Chocolatey Software, Inc. # Copyright © 2015 - 2017 RealDimensions Software, LLC # Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey # @@ -14,34 +14,36 @@ # See the License for the specific language governing permissions and # limitations under the License. -$helpersPath = (Split-Path -parent $MyInvocation.MyCommand.Definition); +$helpersPath = Split-Path -Parent $MyInvocation.MyCommand.Definition $global:DebugPreference = "SilentlyContinue" -if ($env:ChocolateyEnvironmentDebug -eq 'true') { $global:DebugPreference = "Continue"; } +if ($env:ChocolateyEnvironmentDebug -eq 'true') { + $global:DebugPreference = "Continue" +} $global:VerbosePreference = "SilentlyContinue" -if ($env:ChocolateyEnvironmentVerbose -eq 'true') { $global:VerbosePreference = "Continue"; $verbosity = $true } +if ($env:ChocolateyEnvironmentVerbose -eq 'true') { + $global:VerbosePreference = "Continue" + $verbosity = $true +} -$installArguments = $env:chocolateyInstallArguments +$overrideArgs = $env:chocolateyInstallOverride -eq 'true' -$overrideArgs = $false -if ($env:chocolateyInstallOverride -eq 'true') { $overrideArgs = $true } +$forceX86 = $env:chocolateyForceX86 -eq 'true' -$forceX86 = $false -if ($env:chocolateyForceX86 -eq 'true') { $forceX86 = $true } +$installArguments = $env:chocolateyInstallArguments $packageParameters = $env:chocolateyPackageParameters # ensure module loading preference is on -$PSModuleAutoLoadingPreference = "All"; +$PSModuleAutoLoadingPreference = "All" Write-Debug "Host version is $($host.Version), PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'." -# grab functions from files -Get-Item $helpersPath\functions\*.ps1 | - ? { -not ($_.Name.Contains(".Tests.")) } | - % { - . $_.FullName; - #Export-ModuleMember -Function $_.BaseName +# Import functions from files +Get-Item -Path "$helpersPath\functions\*.ps1" | + Where-Object { -not $_.Name.Contains(".Tests.") } | + ForEach-Object { + . $_.FullName } # Export built-in functions prior to loading extensions so that @@ -52,42 +54,42 @@ Export-ModuleMember -Function * -Alias * -Cmdlet * $currentAssemblies = [System.AppDomain]::CurrentDomain.GetAssemblies() -# load extensions if they exist -$extensionsPath = Join-Path "$helpersPath" '..\extensions' -if (Test-Path($extensionsPath)) { - Write-Debug 'Loading community extensions' - Get-ChildItem $extensionsPath -recurse -filter "*.dll" | Select -ExpandProperty FullName | % { - $path = $_; - if ($path.Contains("extensions\chocolatey\lib-synced")) { continue } - - try { - Write-Debug "Importing '$path'"; - $fileNameWithoutExtension = $([System.IO.Path]::GetFileNameWithoutExtension($path)) - Write-Debug "Loading '$fileNameWithoutExtension' extension."; - $loaded = $false - $currentAssemblies | % { - $name = $_.GetName().Name - if ($name -eq $fileNameWithoutExtension) { - Import-Module $_ - $loaded = $true - } - } +# Load community extensions if they exist +$extensionsPath = Join-Path $helpersPath -ChildPath '..\extensions' +if (Test-Path $extensionsPath) { + $licensedExtensionPath = Join-Path $extensionsPath -ChildPath 'chocolatey\chocolatey.licensed.dll' + if (Test-Path $licensedExtensionPath) { + Write-Debug "Importing '$licensedExtensionPath'" + Write-Debug "Loading 'chocolatey.licensed' extension" - if (!$loaded) { - if ($fileNameWithoutExtension -ne "chocolateygui.licensed") { - Import-Module $path; + try { + # Attempt to import module via already-loaded assembly + $licensedAssembly = $currentAssemblies | + Where-Object { $_.GetName().Name -eq 'chocolatey.licensed' } | + Select-Object -First 1 + + if ($licensedAssembly) { + # It's already loaded, just import the existing assembly as a module for PowerShell to use + Import-Module $licensedAssembly + } + else { + # Fallback: load the extension DLL from the path directly. + Import-Module $licensedExtensionPath + } + } + catch { + # Only write a warning if the Licensed extension failed to load in some way. + Write-Warning "Import failed for Chocolatey Licensed Extension. Error: '$_'" } - } - } catch { - if ($env:ChocolateyPowerShellHost -eq 'true') { - Write-Warning "Import failed for '$path'. Error: '$_'" - } else { - Write-Warning "Import failed for '$path'. If it depends on a newer version of the .NET framework, please make sure you are using the built-in PowerShell Host. Error: '$_'" - } } - } - #Resolve-Path $extensionsPath\**\*\*.psm1 | % { Write-Debug "Importing `'$_`'"; Import-Module $_.ProviderPath } - Get-ChildItem $extensionsPath -recurse -filter "*.psm1" | Select -ExpandProperty FullName | % { Write-Debug "Importing `'$_`'"; Import-Module $_; } + + Write-Debug 'Loading community extensions' + Get-ChildItem -Path $extensionsPath -Recurse -Filter '*.psm1' | + Select-Object -ExpandProperty FullName | + ForEach-Object { + Write-Debug "Importing '$_'" + Import-Module $_ + } } # todo: explore removing this for a future version diff --git a/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 b/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 index f38bac837c..7557d347c9 100644 --- a/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 +++ b/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 @@ -4,7 +4,9 @@ [switch] $overrideArgs = $false, [alias("x86")][switch] $forceX86 = $false, [alias("params","parameters","pkgParams")][string]$packageParameters = '', - [string]$packageScript + [string]$packageScript, + [string[]]$preRunHookScripts, + [string[]]$postRunHookScripts ) $global:DebugPreference = "SilentlyContinue" @@ -13,7 +15,7 @@ $global:VerbosePreference = "SilentlyContinue" if ($env:ChocolateyEnvironmentVerbose -eq 'true') { $global:VerbosePreference = "Continue"; $verbosity = $true } Write-Debug '---------------------------Script Execution---------------------------' -Write-Debug "Running 'ChocolateyScriptRunner' for $($env:packageName) v$($env:packageVersion) with packageScript `'$packageScript`', packageFolder:`'$($env:packageFolder)`', installArguments: `'$installArguments`', packageParameters: `'$packageParameters`'," +Write-Debug "Running 'ChocolateyScriptRunner' for $($env:packageName) v$($env:packageVersion) with packageScript '$packageScript', packageFolder:'$($env:packageFolder)', installArguments: '$installArguments', packageParameters: '$packageParameters', preRunHookScripts: '$preRunHookScripts', postRunHookScripts: '$postRunHookScripts'," ## Set the culture to invariant $currentThread = [System.Threading.Thread]::CurrentThread; @@ -38,31 +40,36 @@ $nugetExePath = Join-Path $nuGetPath 'bin' $nugetLibPath = Join-Path $nuGetPath 'lib' $badLibPath = Join-Path $nuGetPath 'lib-bad' $extensionsPath = Join-Path $nugetPath 'extensions' -$chocInstallVariableName = "ChocolateyInstall" +$chocoInstallVariableName = "ChocolateyInstall" $chocoTools = Join-Path $nuGetPath 'tools' $nugetExe = Join-Path $chocoTools 'nuget.exe' $7zip = Join-Path $chocoTools '7z.exe' $ShimGen = Join-Path $chocoTools 'shimgen.exe' $checksumExe = Join-Path $chocoTools 'checksum.exe' -Write-Debug "Running `'$packageScript`'"; -& "$packageScript" +if ($PSBoundParameters.ContainsKey('preRunHookScripts')) { + foreach ($prehookscript in $preRunHookScripts) { + Write-Debug "Running Pre-Run Hook '$prehookscript'"; + & "$prehookscript" + } +} + +if ($packageScript) { + Write-Debug "Running package script '$packageScript'"; + & "$packageScript" +} $scriptSuccess = $? $lastExecutableExitCode = $LASTEXITCODE if ($lastExecutableExitCode -ne $null -and $lastExecutableExitCode -ne '') { Write-Debug "The last executable that ran had an exit code of '$lastExecutableExitCode'." -} +} if (-not $scriptSuccess) { Write-Debug "The script exited with a failure." -} - -$exitCode = 0 -if ($env:ChocolateyCheckLastExitCode -ne $null -and $env:ChocolateyCheckLastExitCode -eq 'true' -and $lastExecutableExitCode -ne $null -and $lastExecutableExitCode -ne '') { - $exitCode = $lastExecutableExitCode } +$exitCode = 0 if ($exitCode -eq 0 -and -not $scriptSuccess) { $exitCode = 1 } @@ -75,6 +82,13 @@ if ($exitCode -ne $null -and $exitCode -ne '' -and $exitCode -ne 0) { Set-PowerShellExitCode $exitCode } +if ($PSBoundParameters.ContainsKey('postRunHookScripts')) { + foreach ($posthookscript in $postRunHookScripts) { + Write-Debug "Running Post-Run Hook '$posthookscript'"; + & "$posthookscript" + } +} + Write-Debug '----------------------------------------------------------------------' Exit $exitCode \ No newline at end of file diff --git a/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 b/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 index cad17dfaa2..2687383f44 100644 --- a/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 @@ -147,7 +147,7 @@ param( Write-Warning "Missing package checksums are not allowed (by default for HTTP/FTP, `n HTTPS when feature 'allowEmptyChecksumsSecure' is disabled) for `n safety and security reasons. Although we strongly advise against it, `n if you need this functionality, please set the feature `n 'allowEmptyChecksums' ('choco feature enable -n `n allowEmptyChecksums') `n or pass in the option '--allow-empty-checksums'. You can also pass `n checksums at runtime (recommended). See `choco install -?` for details." Write-Debug "If you are a maintainer attempting to determine the checksum for packaging purposes, please run `n 'choco install checksum' and run 'checksum -t sha256 -f $file' `n Ensure you do this for all remote resources." if ($PSVersionTable.PSVersion.Major -ge 4){ - Write-Debug "Because you are running Powershell with a major version of v4 or greater, you could also opt to run `n '(Get-FileHash -Path $file -Algorithm SHA256).Hash' `n rather than install a separate tool." + Write-Debug "Because you are running PowerShell with a major version of v4 or greater, you could also opt to run `n '(Get-FileHash -Path $file -Algorithm SHA256).Hash' `n rather than install a separate tool." } if ($env:ChocolateyPowerShellHost -eq 'true') { diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyPath.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyPath.ps1 new file mode 100644 index 0000000000..bc04cfa223 --- /dev/null +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyPath.ps1 @@ -0,0 +1,83 @@ +# Copyright © 2022 Chocolatey Software, Inc. +# +# 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 Get-ChocolateyPath { +<# +.SYNOPSIS +Retrieve the paths available to be used by maintainers of packages. + +.DESCRIPTION +This function will attempt to retrieve the path according to the specified Path Type +to a valid location that can be used by maintainers in certain scenarios. + +.NOTES +Available in 1.2.0+. + +.INPUTS +None + +.OUTPUTS +This function outputs the full path stored accordingly with specified path type. +If no path could be found, there is no output. + +.PARAMETER pathType +The type of path that should be looked up. +Available values are: +- `PackagePath` - The path to the the package that is being installed. Typically `C:\ProgramData\chocolatey\lib\` +- `InstallPath` - The path to where Chocolatey is installed. Typically `C:\ProgramData\chocolatey` + +.PARAMETER IgnoredArguments +Allows splatting with arguments that do not apply. Do not use directly. + +.EXAMPLE +> +$path = Get-ChocolateyPath -PathType 'PackagePath' +#> + param( + [parameter(Mandatory=$true)] + [alias('type')] [string] $pathType + ) + + $result = $null + + switch ($pathType) { + 'PackagePath' { + if (Test-Path Env:\ChocolateyPackagePath) { + $result = "$env:ChocolateyPackagePath" + } elseif (Test-Path Env:\PackagePath) { + $result = "$env:PackagePath" + } else { + $installPath = Get-ChocolateyPath -pathType 'InstallPath' + $result = "$installPath\lib\$env:ChocolateyPackageName" + } + } + 'InstallPath' { + if (Test-Path Env:\ChocolateyInstall) { + $result = "$env:ChocolateyInstall" + } elseif (Test-Path Env:\ProgramData) { + $result = "$env:ProgramData\chocolatey" + } else { + $result = "$env:SystemDrive\ProgramData\chocolatey" + } + } + Default { + throw "The path type $pathType is not a supported." + } + } + + if ((Test-Path $result)) { + $result + } +} \ No newline at end of file diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 index eee833b452..d4acdadeef 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 @@ -75,6 +75,14 @@ folder and its contents will be extracted to the destination. OPTIONAL - This will facilitate logging unzip activity for subsequent uninstalls +.PARAMETER DisableLogging +OPTIONAL - This disables logging of the extracted items. It speeds up +extraction of archives with many files. + +Usage of this parameter will prevent Uninstall-ChocolateyZipPackage +from working, extracted files will have to be cleaned up with +Remove-Item or a similar command instead. + .PARAMETER IgnoredArguments Allows splatting with arguments that do not apply. Do not use directly. @@ -93,6 +101,7 @@ param( [parameter(Mandatory=$false, Position=2)][string] $specificFolder, [parameter(Mandatory=$false, Position=3)][string] $packageName, [alias("file64")][parameter(Mandatory=$false)][string] $fileFullPath64, + [parameter(Mandatory=$false)][switch] $disableLogging, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) @@ -100,7 +109,7 @@ param( $bitnessMessage = '' $zipfileFullPath=$fileFullPath - if ((Get-ProcessorBits 32) -or $env:ChocolateyForceX86 -eq 'true') { + if ((Get-OSArchitectureWidth 32) -or $env:ChocolateyForceX86 -eq 'true') { if (!$fileFullPath) { throw "32-bit archive is not supported for $packageName"; } if ($fileFullPath64) { $bitnessMessage = '32-bit '; } } elseif ($fileFullPath64) { @@ -156,7 +165,12 @@ param( } $workingDirectory = $workingDirectory.ProviderPath - $params = "x -aoa -bd -bb1 -o`"$destinationNoRedirection`" -y `"$fileFullPathNoRedirection`"" + $loggingParam = '-bb1' + if ($disableLogging) { + $loggingParam = '-bb0' + } + + $params = "x -aoa -bd $loggingParam -o`"$destinationNoRedirection`" -y `"$fileFullPathNoRedirection`"" if ($specificfolder) { $params += " `"$specificfolder`"" } @@ -219,7 +233,7 @@ param( Set-PowerShellExitCode $exitCode Write-Debug "Command ['$7zip' $params] exited with `'$exitCode`'." - if ($zipExtractLogFullPath) { + if ($zipExtractLogFullPath -and -not $disableLogging) { Set-Content $zipExtractLogFullPath $global:zipFileList.ToString() -Encoding UTF8 -Force } diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 index 76356b06b7..c07996d095 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 @@ -17,7 +17,7 @@ function Get-ChocolateyWebFile { <# .SYNOPSIS -Downloads a file from the internets. +Downloads a file from the internet. .DESCRIPTION This will download a file from a url, tracking with a progress bar. @@ -229,7 +229,7 @@ param( $checksum32 = $checksum $checksumType32 = $checksumType $bitWidth = 32 - if (Get-ProcessorBits 64) { + if (Get-OSArchitectureWidth 64) { $bitWidth = 64 } Write-Debug "CPU is $bitWidth bit" @@ -306,7 +306,7 @@ param( $headers = Get-WebHeaders -Url $url -ErrorAction "Stop" } catch { if ($PSVersionTable.PSVersion -lt (New-Object 'Version' 3,0)) { - Write-Debug "Converting Security Protocol to SSL3 only for Powershell v2" + Write-Debug "Converting Security Protocol to SSL3 only for PowerShell v2" # this should last for the entire duration $originalProtocol = [System.Net.ServicePointManager]::SecurityProtocol [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Ssl3 diff --git a/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 index 731d97edd1..4906c1ce34 100644 --- a/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 @@ -16,7 +16,7 @@ function Get-FtpFile { <# .SYNOPSIS -Downloads a file from a File Transfter Protocol (FTP) location. +Downloads a file from a File Transfer Protocol (FTP) location. .DESCRIPTION This will download a file from an FTP location, saving the file to the diff --git a/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 b/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 index ed08fce8c8..eee31cecb2 100644 --- a/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-OSArchitectureWidth.ps1 @@ -44,7 +44,7 @@ None .PARAMETER Compare This optional parameter causes the function to return $true or $false, -depending on wether or not the bit width matches. +depending on whether or not the bit width matches. #> param( $compare diff --git a/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 b/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 index 4bb261bedc..2c5222bfb6 100644 --- a/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-PackageParameters.ps1 @@ -150,7 +150,7 @@ param( foreach ($paramString in $paramStrings) { if (!$paramString -or $paramString -eq '') { continue } - Select-String '(?:^|\s+)\/(?[^\:\=\s)]+)(?:(?:\:|=){1}(?:\''|\"){0,1}(?.*?)(?:\''|\"){0,1}(?:(?=\s+\/)|$))?' -Input $paramString -AllMatches | % { $_.Matches } | % { + Select-String '(?:^|\s+)\/(?[^\:\=\s)]+)(?:(?:\:|=){1}(?:\''|\"){0,1}(?.*?)(?:\''|\"){0,1}(?:(?=\s+\/)|$))?' -Input $paramString -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { if (!$_) { continue } #Posh v2 issue? $paramItemName = ($_.Groups["ItemKey"].Value).Trim() $paramItemValue = ($_.Groups["ItemValue"].Value).Trim() diff --git a/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 b/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 index 2851f5e3d3..e6260f37f0 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ToolsLocation.ps1 @@ -31,8 +31,8 @@ same package directory could get tricky. .NOTES This is the successor to the poorly named `Get-BinRoot`. Available as -`Get-ToolsLocation` in 0.9.10+. If you need compatibility with pre -0.9.10, please use `Get-BinRoot`. +`Get-ToolsLocation` in 0.9.10+. The Alias `Get-BinRoot` will be removed +in version 2.0.0. Sets an environment variable called `ChocolateyToolsLocation`. If the older `ChocolateyBinRoot` is set, it uses the value from that and @@ -49,7 +49,7 @@ None Write-FunctionCallLogMessage -Invocation $invocation -Parameters $PSBoundParameters if ($invocation -ne $null -and $invocation.InvocationName -ne $null -and $invocation.InvocationName.ToLower() -eq 'get-binroot') { - Write-Host "Get-BinRoot is going to be deprecated in v1 and removed in v2. It has been replaced with Get-ToolsLocation (starting with v0.9.10), however many packages no longer require a special separate directory since package folders no longer have versions on them. Some do though and should continue to use Get-ToolsLocation." + Write-Warning "Get-BinRoot was deprecated in v1 and will be removed in v2. It has been replaced with Get-ToolsLocation (starting with v0.9.10), however many packages no longer require a special separate directory since package folders no longer have versions on them. Some do though and should continue to use Get-ToolsLocation." } $toolsLocation = $env:ChocolateyToolsLocation diff --git a/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 b/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 index 9149a4084c..a03ad69884 100644 --- a/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-UninstallRegistryKey.ps1 @@ -134,7 +134,7 @@ param( $keyPaths = $keys | Select-Object -ExpandProperty PSPath try { - [array]$foundKey = Get-ItemProperty -LiteralPath $keyPaths -ErrorAction Stop | ? { $_.DisplayName -like $softwareName } + [array]$foundKey = Get-ItemProperty -LiteralPath $keyPaths -ErrorAction Stop | Where-Object { $_.DisplayName -like $softwareName } $success = $true } catch { Write-Debug "Found bad key." @@ -146,7 +146,7 @@ param( } } Write-Verbose "Skipping bad key: $badKey" - [array]$keys = $keys | ? { $badKey -NotContains $_.PsPath } + [array]$keys = $keys | Where-Object { $badKey -NotContains $_.PsPath } } if ($success) { break; } diff --git a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 index 353172d2c7..23c778e164 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 @@ -186,7 +186,6 @@ param( 'Cookie' {$req.CookieContainer.SetCookies($uri, $options.headers.$key)} 'Referer' {$req.Referer = $options.headers.$key} 'User-Agent' {$req.UserAgent = $options.headers.$key} - 'Authorization' {$re.Authorization = $options.headers.$key} Default {$req.Headers.Add($key, $options.headers.$key)} } } diff --git a/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 index 73fe30355d..12c0d9c97b 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 @@ -24,9 +24,6 @@ This is a low-level function that is used by Chocolatey to get the headers for a request/response to better help when getting and validating internet resources. -.NOTES -Not recommended for use in package scripts. - .INPUTS None diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyDesktopLink.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyDesktopLink.ps1 deleted file mode 100644 index 33acb82c74..0000000000 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyDesktopLink.ps1 +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 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. -# 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 Install-ChocolateyDesktopLink { -<# -.SYNOPSIS -DEPRECATED - This adds a shortcut on the desktop to the specified file path. - -.DESCRIPTION -Determines the desktop folder and creates a shortcut to the specified -file path. Will not throw errors if it fails. - -It is recommended you use `Install-ChocolateyShortcut` instead of this -method as this has been deprecated. - -.NOTES -Deprecated in favor of https://docs.chocolatey.org/en-us/create/functions/install-chocolateyshortcut. -If this errors, such as it will if being installed under the local -SYSTEM account, it will display a warning instead of failing a package -installation. - -Will not throw an error if it fails. - -.INPUTS -None - -.OUTPUTS -None - -.PARAMETER TargetFilePath -This is the location to the application/executable file that you want to -add a shortcut to on the desktop. This is mandatory. - -.PARAMETER IgnoredArguments -Allows splatting with arguments that do not apply. Do not use directly. - -.EXAMPLE -> -# This will create a new Desktop Shortcut pointing at the NHibernate -# Profiler exe. -Install-ChocolateyDesktopLink -TargetFilePath "C:\tools\NHibernatProfiler\nhprof.exe" - -.LINK -Install-ChocolateyShortcut -#> -param( - [parameter(Mandatory=$true, Position=0)][string] $targetFilePath, - [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments -) - - Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - - if (!$targetFilePath) { - throw "Install-ChocolateyDesktopLink - `$targetFilePath can not be null." - } - - if (!(Test-Path($targetFilePath))) { - Write-Warning "'$targetFilePath' does not exist. If it is not created the shortcut will not be valid." - } - - Write-Debug "Creating Shortcut..." - - try { - $desktop = $([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory)) - if(!(Test-Path($desktop))) { - [System.IO.Directory]::CreateDirectory($desktop) | Out-Null - } - $link = Join-Path $desktop "$([System.IO.Path]::GetFileName($targetFilePath)).lnk" - $workingDirectory = $([System.IO.Path]::GetDirectoryName($targetFilePath)) - - $wshshell = New-Object -ComObject WScript.Shell - $lnk = $wshshell.CreateShortcut($link) - $lnk.TargetPath = $targetFilePath - $lnk.WorkingDirectory = $workingDirectory - $lnk.Save() - - Write-Host "Desktop Shortcut created pointing at `'$targetFilePath`'." - } - catch { - Write-Warning "Unable to create desktop link. Error captured was $($_.Exception.Message)." - } -} diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 index a46dc86449..f571b7de68 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyEnvironmentVariable.ps1 @@ -48,7 +48,7 @@ The name or key of the environment variable A string value assigned to the above name. .PARAMETER VariableType -Specifies whether this variable is to be accesible at either the +Specifies whether this variable is to be accessible at either the individual user level or at the Machine level. .PARAMETER IgnoredArguments @@ -64,7 +64,7 @@ Install-ChocolateyEnvironmentVariable "JAVA_HOME" "d:\oracle\jdk\bin" > # Creates a User environment variable "_NT_SYMBOL_PATH" pointing to # "symsrv*symsrv.dll*f:\localsymbols*http://msdl.microsoft.com/download/symbols". -# The command will be elevated to admin priviledges. +# The command will be elevated to admin privileges. Install-ChocolateyEnvironmentVariable ` -VariableName "_NT_SYMBOL_PATH" ` -VariableValue "symsrv*symsrv.dll*f:\localsymbols*http://msdl.microsoft.com/download/symbols" ` diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 index 6a5299b41b..c3ee1b9af3 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 @@ -228,7 +228,7 @@ Start-ChocolateyProcessAsAdmin $bitnessMessage = '' $fileFullPath = $file - if ((Get-ProcessorBits 32) -or $env:ChocolateyForceX86 -eq 'true') { + if ((Get-OSArchitectureWidth 32) -or $env:ChocolateyForceX86 -eq 'true') { if (!$file) { throw "32-bit installation is not supported for $packageName"; } if ($file64) { $bitnessMessage = '32-bit '; } } @@ -249,7 +249,7 @@ Start-ChocolateyProcessAsAdmin } $installerTypeLower = $fileType.ToLower() - if ($installerTypeLower -notin 'msi', 'exe', 'msu', 'msp') { + if ('msi', 'exe', 'msu', 'msp' -notcontains $installerTypeLower) { Write-Warning "FileType '$fileType' is unrecognized, using 'exe' instead." $fileType = 'exe' } @@ -311,14 +311,15 @@ Pro / Business supports a single, ubiquitous install directory option. try { # make sure any logging folder exists $pattern = "(?:['`"])([a-zA-Z]\:\\[^'`"]+)(?:[`"'])|([a-zA-Z]\:\\[\S]+)" - $silentArgs, $additionalInstallArgs | % { Select-String $pattern -input $_ -AllMatches } | - % { $_.Matches } | % { - $argDirectory = $_.Groups[1] - if ($argDirectory -eq $null -or $argDirectory -eq '') { continue } - $argDirectory = [System.IO.Path]::GetFullPath([System.IO.Path]::GetDirectoryName($argDirectory)) - Write-Debug "Ensuring '$argDirectory' exists" - if (![System.IO.Directory]::Exists($argDirectory)) { [System.IO.Directory]::CreateDirectory($argDirectory) | Out-Null } - } + $silentArgs, $additionalInstallArgs | + ForEach-Object { Select-String $pattern -input $_ -AllMatches } | + ForEach-Object { $_.Matches } | ForEach-Object { + $argDirectory = $_.Groups[1] + if ($argDirectory -eq $null -or $argDirectory -eq '') { continue } + $argDirectory = [System.IO.Path]::GetFullPath([System.IO.Path]::GetDirectoryName($argDirectory)) + Write-Debug "Ensuring '$argDirectory' exists" + if (![System.IO.Directory]::Exists($argDirectory)) { [System.IO.Directory]::CreateDirectory($argDirectory) | Out-Null } + } } catch { Write-Debug "Error ensuring directories exist - $($_.Exception.Message)" @@ -327,7 +328,7 @@ Pro / Business supports a single, ubiquitous install directory option. if ($fileType -like 'msi') { $msiArgs = "/i `"$fileFullPath`"" $msiArgs = if ($overrideArguments) { - Write-Host "Overriding package arguments with '$additonalInstallArgs' (replacing '$silentArgs')" + Write-Host "Overriding package arguments with '$additionalInstallArgs' (replacing '$silentArgs')" "$msiArgs $additionalInstallArgs" } else { diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 index 1d414c1d60..c0629760df 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 @@ -222,9 +222,9 @@ Allows splatting with arguments that do not apply. Do not use directly. .PARAMETER BeforeInstall Script Specifies the commands to run after download has completed but before install steps have begun. -Available in 0.10.16+. +Available in 0.11.0+. -Use this for starting an auxilary process such as AutoHotkey, so that any timeouts are not +Use this for starting an auxiliary process such as AutoHotkey, so that any timeouts are not affected by the time to download. .EXAMPLE @@ -305,7 +305,7 @@ Install-ChocolateyPackage 'StExBar' 'msi' '/quiet' ` .EXAMPLE > Install-ChocolateyPackage 'mono' 'exe' '/SILENT' ` - 'http://somehwere/something.exe' -ValidExitCodes @(0,21) + 'http://somewhere/something.exe' -ValidExitCodes @(0,21) .EXAMPLE > @@ -371,8 +371,8 @@ param( Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - $chocTempDir = $env:TEMP - $tempDir = Join-Path $chocTempDir "$($env:chocolateyPackageName)" + $chocoTempDir = $env:TEMP + $tempDir = Join-Path $chocoTempDir "$($env:chocolateyPackageName)" if ($env:chocolateyPackageVersion -ne $null) { $tempDir = Join-Path $tempDir "$($env:chocolateyPackageVersion)"; } $tempDir = $tempDir -replace '\\chocolatey\\chocolatey\\', '\chocolatey\' if (![System.IO.Directory]::Exists($tempDir)) { [System.IO.Directory]::CreateDirectory($tempDir) | Out-Null } @@ -388,7 +388,7 @@ param( [string]$filePath = $downloadFilePath if ($useOriginalLocation) { $filePath = $url - if (Get-ProcessorBits 64) { + if (Get-OSArchitectureWidth 64) { $forceX86 = $env:chocolateyForceX86 if ($forceX86) { Write-Debug "User specified '-x86' so forcing 32-bit" diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPinnedTaskBarItem.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPinnedTaskBarItem.ps1 index d0a296e6d8..032e585ea1 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPinnedTaskBarItem.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPinnedTaskBarItem.ps1 @@ -61,7 +61,7 @@ param( $shell=new-object -com "Shell.Application" $folder=$shell.Namespace($path) $item = $folder.Parsename((split-path $targetFilePath -leaf)) - $itemVerb = $item.Verbs() | ? {$_.Name.Replace("&","") -eq $verb} + $itemVerb = $item.Verbs() | Where-Object {$_.Name.Replace("&","") -eq $verb} if($itemVerb -eq $null){ Write-Host "TaskBar verb not found for $item. It may have already been pinned" } else { diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 index 5699239edf..d5d1f84f8b 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyShortcut.ps1 @@ -110,9 +110,6 @@ Install-ChocolateyShortcut ` -RunAsAdmin ` -PinToTaskbar -.LINK -Install-ChocolateyDesktopLink - .LINK Install-ChocolateyExplorerMenuItem @@ -216,8 +213,9 @@ Install-ChocolateyPinnedTaskBarItem If ($pinToTaskbar) { $scfilename = $Path.FullName - $pinverb = (new-object -com "shell.application").namespace($(split-path -parent $Path.FullName)).Parsename($(split-path -leaf $Path.FullName)).verbs() | ?{$_.Name -eq 'Pin to Tas&kbar'} - If ($pinverb) {$pinverb.doit()} + $pinverb = (new-object -com "shell.application").namespace($(split-path -parent $Path.FullName)).Parsename($(split-path -leaf $Path.FullName)).verbs() | + Where-Object{$_.Name -eq 'Pin to Tas&kbar'} + If ($pinverb) { $pinverb.doit() } } } catch { diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyVsixPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyVsixPackage.ps1 index 20d282fd20..e86a4bfadc 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyVsixPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyVsixPackage.ps1 @@ -58,7 +58,7 @@ In 0.10.4+, `Url` is an alias for VsixUrl. The major version number of Visual Studio where the package should be installed. This is optional. If not specified, the most recent Visual Studio installation -will be targetted. +will be targeted. NOTE: For Visual Studio 2015, the VsVersion is 14. It can be determined by looking at the folders under Program Files / Program Files (x86). @@ -157,11 +157,14 @@ param( if ([System.IntPtr]::Size -eq 4) { <# 32bits system case #> - $versions=(get-ChildItem HKLM:SOFTWARE\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName -match "^[0-9\.]+$") } | ? {$_.property -contains "InstallDir"} | sort {[int]($_.PSChildName)} -descending) + $versions = Get-ChildItem HKLM:SOFTWARE\Microsoft\VisualStudio -ErrorAction SilentlyContinue | + Where-Object { ($_.PSChildName -match "^[0-9\.]+$") } | + Where-Object { $_.property -contains "InstallDir" } | + Sort-Object { [int]($_.PSChildName) } -descending } else { - $versions=(get-ChildItem HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName -match "^[0-9\.]+$") } | ? {$_.property -contains "InstallDir"} | sort {[int]($_.PSChildName)} -descending) + $versions=(get-ChildItem HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio -ErrorAction SilentlyContinue | Where-Object { ($_.PSChildName -match "^[0-9\.]+$") } | Where-Object {$_.property -contains "InstallDir"} | Sort-Object {[int]($_.PSChildName)} -descending) } if($versions -and $versions.Length){ $version = $versions[0] @@ -173,11 +176,11 @@ param( if ([System.IntPtr]::Size -eq 4) { <# 32bits system case #> - $versions=(get-ChildItem HKLM:SOFTWARE\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName.EndsWith("$vsVersion.0")) } | ? {$_.property -contains "InstallDir"}) + $versions=(get-ChildItem HKLM:SOFTWARE\Microsoft\VisualStudio -ErrorAction SilentlyContinue | Where-Object { ($_.PSChildName.EndsWith("$vsVersion.0")) } | Where-Object {$_.property -contains "InstallDir"}) } else { - $version=(get-ChildItem HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName.EndsWith("$vsVersion.0")) } | ? {$_.property -contains "InstallDir"}) + $version=(get-ChildItem HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio -ErrorAction SilentlyContinue | Where-Object { ($_.PSChildName.EndsWith("$vsVersion.0")) } | Where-Object {$_.property -contains "InstallDir"}) } } diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 index 873739a61b..e021144a69 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyZipPackage.ps1 @@ -151,6 +151,14 @@ Will be used for Url64bit if Url64bit is empty. Available in 0.10.7+. This parameter provides compatibility, but should not be used directly and not with the community package repository until January 2018. +.PARAMETER DisableLogging +OPTIONAL - This disables logging of the extracted items. It speeds up +extraction of archives with many files. + +Usage of this parameter will prevent Uninstall-ChocolateyZipPackage +from working, extracted files will have to be cleaned up with +Remove-Item or a similar command instead. + .PARAMETER IgnoredArguments Allows splatting with arguments that do not apply. Do not use directly. @@ -191,6 +199,7 @@ param( [parameter(Mandatory=$false)][hashtable] $options = @{Headers=@{}}, [alias("fileFullPath")][parameter(Mandatory=$false)][string] $file = '', [alias("fileFullPath64")][parameter(Mandatory=$false)][string] $file64 = '', + [parameter(Mandatory=$false)][switch] $disableLogging, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) @@ -198,8 +207,8 @@ param( $fileType = 'zip' - $chocTempDir = $env:TEMP - $tempDir = Join-Path $chocTempDir "$($env:chocolateyPackageName)" + $chocoTempDir = $env:TEMP + $tempDir = Join-Path $chocoTempDir "$($env:chocolateyPackageName)" if ($env:chocolateyPackageVersion -ne $null) { $tempDir = Join-Path $tempDir "$($env:chocolateyPackageVersion)"; } $tempDir = $tempDir -replace '\\chocolatey\\chocolatey\\', '\chocolatey\' if (![System.IO.Directory]::Exists($tempDir)) { [System.IO.Directory]::CreateDirectory($tempDir) | Out-Null } @@ -213,5 +222,5 @@ param( } $filePath = Get-ChocolateyWebFile $packageName $downloadFilePath $url $url64bit -checkSum $checkSum -checksumType $checksumType -checkSum64 $checkSum64 -checksumType64 $checksumType64 -options $options -getOriginalFileName - Get-ChocolateyUnzip "$filePath" $unzipLocation $specificFolder $packageName + Get-ChocolateyUnzip "$filePath" $unzipLocation $specificFolder $packageName -disableLogging:$disableLogging } diff --git a/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 b/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 index e2825b4124..2a8ea90c82 100644 --- a/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/UnInstall-ChocolateyZipPackage.ps1 @@ -24,7 +24,7 @@ This will uninstall a zip file if installed via Install-ChocolateyZipPackage. This is not necessary if the files are unzipped to the package directory. .NOTES -Not necessary if files are unzippped to package directory. +Not necessary if files are unzipped to package directory. This helper reduces the number of lines one would have to remove the files extracted from a previously installed zip file. diff --git a/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 b/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 index 46a10f677e..992d1ccf16 100644 --- a/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Uninstall-ChocolateyPackage.ps1 @@ -34,7 +34,7 @@ to reverse the installation done in the install script. With auto uninstaller turned off, a chocolateyUninstall.ps1 is required to perform uninstall from "Programs and Features". In the absence of chocolateyUninstall.ps1, choco uninstall only removes the package from -Chocolatey but does not remove the sofware from your system without +Chocolatey but does not remove the software from your system without auto uninstaller. .NOTES diff --git a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 b/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 index 28e1648c1a..0c89dca3ec 100644 --- a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 +++ b/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 @@ -18,7 +18,7 @@ function Update-SessionEnvironment { <# .SYNOPSIS Updates the environment variables of the current powershell session with -any environment variable changes that may have occured during a +any environment variable changes that may have occurred during a Chocolatey package install. .DESCRIPTION @@ -67,7 +67,7 @@ None #ordering is important here, $user should override $machine... $ScopeList = 'Process', 'Machine' - if ($userName -notin 'SYSTEM', "${env:COMPUTERNAME}`$") { + if ('SYSTEM', "${env:COMPUTERNAME}`$" -notcontains $userName) { # but only if not running as the SYSTEM/machine in which case user can be ignored. $ScopeList += 'User' } diff --git a/src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1 b/src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1 deleted file mode 100644 index 57683ba3a6..0000000000 --- a/src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1 +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 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. -# 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 Write-ChocolateyFailure { -<# -.SYNOPSIS -DEPRECATED - DO NOT USE. - -.DESCRIPTION -Throws the error message as an error. - -.NOTES -This has been deprecated and is no longer useful as of 0.9.9. Instead -please just use `throw $_.Exception` when catching errors. Although -try/catch is no longer necessary unless you want to do some error -handling. - -.INPUTS -None - -.OUTPUTS -None - -.PARAMETER PackageName -The name of the package - while this is an arbitrary value, it's -recommended that it matches the package id. - -.PARAMETER FailureMessage -The message to throw an error with. - -.PARAMETER IgnoredArguments -Allows splatting with arguments that do not apply. Do not use directly. - -.LINK -Write-ChocolateySuccess -#> -param( - [string] $packageName, - [string] $failureMessage, - [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments -) - - Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - Write-Warning "Write-ChocolateyFailure is deprecated and will be removed in v2. If you are the package maintainer, please use 'throw `$_.Exception' instead." - - $error | %{ $_.Exception | fl * | Out-String } - - throw "$failureMessage" -} diff --git a/src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1 b/src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1 deleted file mode 100644 index e315f672bc..0000000000 --- a/src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1 +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 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. -# 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 Write-ChocolateySuccess { -<# -.SYNOPSIS -DEPRECATED - DO NOT USE. - -.DESCRIPTION -Writes a success message for a package. - -.NOTES -This has been deprecated and is no longer useful as of 0.9.9. Instead -please just use `throw $_.Exception` when catching errors. Although -try/catch is no longer necessary unless you want to do some error -handling. - -.INPUTS -None - -.OUTPUTS -None - -.PARAMETER PackageName -The name of the package - while this is an arbitrary value, it's -recommended that it matches the package id. - -.PARAMETER IgnoredArguments -Allows splatting with arguments that do not apply. Do not use directly. - -.LINK -Write-ChocolateyFailure -#> -param( - [string] $packageName, - [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments -) - - Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - Write-Warning "Write-ChocolateySuccess is deprecated and will be removed in v2. If you are the maintainer, please remove it from your package file." -} diff --git a/src/chocolatey.resources/helpers/functions/Write-FileUpdateLog.ps1 b/src/chocolatey.resources/helpers/functions/Write-FileUpdateLog.ps1 deleted file mode 100644 index 17caa080e7..0000000000 --- a/src/chocolatey.resources/helpers/functions/Write-FileUpdateLog.ps1 +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 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. -# 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 Write-FileUpdateLog { -<# -.SYNOPSIS -DEPRECATED - DO NOT USE. Will be removed in v1. - -.DESCRIPTION -Monitors a location and writes changes to a log file. - -.NOTES -DEPRECATED. - -Has issues with paths longer than 260 characters. See -https://github.com/chocolatey/choco/issues/156 - -.INPUTS -None - -.OUTPUTS -None - -.PARAMETER LogFilePath -The full path to where to write the log file. - -.PARAMETER LocationToMonitor -The location to watch for changes at. - -.PARAMETER ScriptToRun -The script block of what to run and monitor changes. - -.PARAMETER ArgumentList - -.PARAMETER IgnoredArguments -Allows splatting with arguments that do not apply. Do not use directly. -#> -param ( - [string] $logFilePath, - [string] $locationToMonitor, - [scriptblock] $scriptToRun, - [object[]] $argumentList, - [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments -) - - Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - Write-Warning "Write-FileUpdateLog has been deprecated and will be removed in v1." - - Write-Debug "Tracking current state of `'$locationToMonitor`'" - $originalContents = Get-ChildItem -Recurse $locationToMonitor | Select-Object LastWriteTimeUTC,FullName,Length - - Invoke-Command -ScriptBlock $scriptToRun -ArgumentList $argumentList - - $newContents = Get-ChildItem -Recurse $locationToMonitor | Select-Object LastWriteTimeUTC,FullName,Length - - if($originalContents -eq $null) {$originalContents = @()} - if($newContents -eq $null) {$newContents = @()} - - $changedFiles = Compare-Object $originalContents $newContents -Property LastWriteTimeUtc,FullName,Length -PassThru | Group-Object FullName - - #log modified files - $changedFiles | ? {$_.Count -gt 1} | % {$_.Name} | Add-Content $logFilePath - - #log added files - $addOrDelete = $changedFiles | ? { $_.Count -eq 1 } | % {$_.Group} - $addOrDelete | ? {$_.SideIndicator -eq "=>"} | % {$_.FullName} | Add-Content $logFilePath - - #log deleted files - #$addOrDelete | ? {$_.SideIndicator -eq "<="} | % {$_.FullName} | Add-Content $logFilePath -} diff --git a/src/chocolatey.resources/redirects/choco.exe b/src/chocolatey.resources/redirects/choco.exe index bef4af3a03..1857576ce2 100644 Binary files a/src/chocolatey.resources/redirects/choco.exe and b/src/chocolatey.resources/redirects/choco.exe differ diff --git a/src/chocolatey.resources/redirects/choco.exe.ignore b/src/chocolatey.resources/redirects/choco.exe.ignore index e69de29bb2..d3f5a12faa 100644 --- a/src/chocolatey.resources/redirects/choco.exe.ignore +++ b/src/chocolatey.resources/redirects/choco.exe.ignore @@ -0,0 +1 @@ + diff --git a/src/chocolatey.resources/redirects/chocolatey.exe b/src/chocolatey.resources/redirects/chocolatey.exe index 5bbc244aee..eda69f8a1e 100644 Binary files a/src/chocolatey.resources/redirects/chocolatey.exe and b/src/chocolatey.resources/redirects/chocolatey.exe differ diff --git a/src/chocolatey.resources/redirects/chocolatey.exe.ignore b/src/chocolatey.resources/redirects/chocolatey.exe.ignore index e69de29bb2..d3f5a12faa 100644 --- a/src/chocolatey.resources/redirects/chocolatey.exe.ignore +++ b/src/chocolatey.resources/redirects/chocolatey.exe.ignore @@ -0,0 +1 @@ + diff --git a/src/chocolatey.resources/redirects/cinst.exe b/src/chocolatey.resources/redirects/cinst.exe index 451e22b227..c0d2bc04e9 100644 Binary files a/src/chocolatey.resources/redirects/cinst.exe and b/src/chocolatey.resources/redirects/cinst.exe differ diff --git a/src/chocolatey.resources/redirects/cinst.exe.ignore b/src/chocolatey.resources/redirects/cinst.exe.ignore index e69de29bb2..d3f5a12faa 100644 --- a/src/chocolatey.resources/redirects/cinst.exe.ignore +++ b/src/chocolatey.resources/redirects/cinst.exe.ignore @@ -0,0 +1 @@ + diff --git a/src/chocolatey.resources/redirects/clist.exe b/src/chocolatey.resources/redirects/clist.exe index d6ca4917c9..ba0084deac 100644 Binary files a/src/chocolatey.resources/redirects/clist.exe and b/src/chocolatey.resources/redirects/clist.exe differ diff --git a/src/chocolatey.resources/redirects/clist.exe.ignore b/src/chocolatey.resources/redirects/clist.exe.ignore index e69de29bb2..d3f5a12faa 100644 --- a/src/chocolatey.resources/redirects/clist.exe.ignore +++ b/src/chocolatey.resources/redirects/clist.exe.ignore @@ -0,0 +1 @@ + diff --git a/src/chocolatey.resources/redirects/cpack.exe b/src/chocolatey.resources/redirects/cpack.exe deleted file mode 100644 index 1ddea401f8..0000000000 Binary files a/src/chocolatey.resources/redirects/cpack.exe and /dev/null differ diff --git a/src/chocolatey.resources/redirects/cpush.exe b/src/chocolatey.resources/redirects/cpush.exe index 850bdd20b7..412cf90f68 100644 Binary files a/src/chocolatey.resources/redirects/cpush.exe and b/src/chocolatey.resources/redirects/cpush.exe differ diff --git a/src/chocolatey.resources/redirects/cpush.exe.ignore b/src/chocolatey.resources/redirects/cpush.exe.ignore index e69de29bb2..d3f5a12faa 100644 --- a/src/chocolatey.resources/redirects/cpush.exe.ignore +++ b/src/chocolatey.resources/redirects/cpush.exe.ignore @@ -0,0 +1 @@ + diff --git a/src/chocolatey.resources/redirects/cuninst.exe b/src/chocolatey.resources/redirects/cuninst.exe index a6e9eab1f1..0fbc9a5cf7 100644 Binary files a/src/chocolatey.resources/redirects/cuninst.exe and b/src/chocolatey.resources/redirects/cuninst.exe differ diff --git a/src/chocolatey.resources/redirects/cuninst.exe.ignore b/src/chocolatey.resources/redirects/cuninst.exe.ignore index e69de29bb2..d3f5a12faa 100644 --- a/src/chocolatey.resources/redirects/cuninst.exe.ignore +++ b/src/chocolatey.resources/redirects/cuninst.exe.ignore @@ -0,0 +1 @@ + diff --git a/src/chocolatey.resources/redirects/cup.exe b/src/chocolatey.resources/redirects/cup.exe index 4769b4605a..758bdb9451 100644 Binary files a/src/chocolatey.resources/redirects/cup.exe and b/src/chocolatey.resources/redirects/cup.exe differ diff --git a/src/chocolatey.resources/redirects/cup.exe.ignore b/src/chocolatey.resources/redirects/cup.exe.ignore index e69de29bb2..d3f5a12faa 100644 --- a/src/chocolatey.resources/redirects/cup.exe.ignore +++ b/src/chocolatey.resources/redirects/cup.exe.ignore @@ -0,0 +1 @@ + diff --git a/src/chocolatey.resources/redirects/cver.exe b/src/chocolatey.resources/redirects/cver.exe deleted file mode 100644 index d1f7f483e5..0000000000 Binary files a/src/chocolatey.resources/redirects/cver.exe and /dev/null differ diff --git a/src/chocolatey.resources/tools/7z.dll b/src/chocolatey.resources/tools/7z.dll index 8854b8557a..654f92ef96 100644 Binary files a/src/chocolatey.resources/tools/7z.dll and b/src/chocolatey.resources/tools/7z.dll differ diff --git a/src/chocolatey.resources/tools/7z.exe b/src/chocolatey.resources/tools/7z.exe index 05c17b94f4..c8770bded3 100644 Binary files a/src/chocolatey.resources/tools/7z.exe and b/src/chocolatey.resources/tools/7z.exe differ diff --git a/src/chocolatey.resources/tools/shimgen.exe b/src/chocolatey.resources/tools/shimgen.exe index 374e449a35..dda5e8e681 100644 Binary files a/src/chocolatey.resources/tools/shimgen.exe and b/src/chocolatey.resources/tools/shimgen.exe differ diff --git a/src/chocolatey.resources/tools/shimgen.license.txt b/src/chocolatey.resources/tools/shimgen.license.txt index 68783176d8..963ee44789 100644 --- a/src/chocolatey.resources/tools/shimgen.license.txt +++ b/src/chocolatey.resources/tools/shimgen.license.txt @@ -1,4 +1,5 @@ Shim Generator - shimgen.exe +Copyright (C) 2017 - Present Chocolatey Software, Inc ("CHOCOLATEY") Copyright (C) 2013 - 2017 RealDimensions Software, LLC ("RDS") =================================================================== Grant of License @@ -59,4 +60,4 @@ organization. Commercial / Personal Licensing =================================================================== Shim Generator ("shimgen.exe") is also offered under personal and commercial -licenses. You can learn more by contacting RDS at http://ferventcoder.com. \ No newline at end of file +licenses. You can learn more by contacting Chocolatey at https://chocolatey.org/contact. \ No newline at end of file diff --git a/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs b/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs index b998610843..a7bfb228c0 100644 --- a/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs +++ b/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests.integration/NUnitSetup.cs b/src/chocolatey.tests.integration/NUnitSetup.cs index eeabd38fe6..72e067f223 100644 --- a/src/chocolatey.tests.integration/NUnitSetup.cs +++ b/src/chocolatey.tests.integration/NUnitSetup.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -47,10 +47,10 @@ public override void BeforeEverything() base.BeforeEverything(); - // deep copy so we don't have the same configuration and + // deep copy so we don't have the same configuration and // don't have to worry about issues using it var config = Container.GetInstance().deep_copy(); - config.Information.PlatformType = PlatformType.Windows; + config.Information.PlatformType = Platform.get_platform(); config.Information.IsInteractive = false; config.PromptForConfirmation = false; config.Force = true; diff --git a/src/chocolatey.tests.integration/Properties/AssemblyInfo.cs b/src/chocolatey.tests.integration/Properties/AssemblyInfo.cs index 29028ed569..0ba5adf632 100644 --- a/src/chocolatey.tests.integration/Properties/AssemblyInfo.cs +++ b/src/chocolatey.tests.integration/Properties/AssemblyInfo.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -17,7 +17,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. @@ -30,8 +30,8 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -43,11 +43,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] diff --git a/src/chocolatey.tests.integration/Scenario.cs b/src/chocolatey.tests.integration/Scenario.cs index 7240da58b5..d6dce1240a 100644 --- a/src/chocolatey.tests.integration/Scenario.cs +++ b/src/chocolatey.tests.integration/Scenario.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -49,6 +49,7 @@ public static void reset(ChocolateyConfiguration config) string badPackagesPath = get_package_install_path() + "-bad"; string backupPackagesPath = get_package_install_path() + "-bkp"; string shimsPath = ApplicationParameters.ShimsLocation; + string hooksPath = ApplicationParameters.HooksLocation; _fileSystem.delete_directory_if_exists(config.CacheLocation, recursive: true, overrideAttributes: true); _fileSystem.delete_directory_if_exists(config.Sources, recursive: true, overrideAttributes: true); @@ -58,6 +59,7 @@ public static void reset(ChocolateyConfiguration config) _fileSystem.delete_directory_if_exists(backupPackagesPath, recursive: true, overrideAttributes: true); _fileSystem.delete_directory_if_exists(_fileSystem.combine_paths(get_top_level(), ".chocolatey"), recursive: true, overrideAttributes: true); _fileSystem.delete_directory_if_exists(_fileSystem.combine_paths(get_top_level(), "extensions"), recursive: true, overrideAttributes: true); + _fileSystem.delete_directory_if_exists(hooksPath, recursive: true, overrideAttributes: true); _fileSystem.create_directory(config.CacheLocation); _fileSystem.create_directory(config.Sources); @@ -93,6 +95,7 @@ public static void install_package(ChocolateyConfiguration config, string packag installConfig.PackageNames = packageId; installConfig.Version = version; + installConfig.CommandName = CommandNameType.install.to_string(); _service.install_run(installConfig); NUnitSetup.MockLogger.Messages.Clear(); @@ -121,7 +124,7 @@ private static ChocolateyConfiguration baseline_configuration() // prior commands, so ensure that all items go back to the default values here var config = NUnitSetup.Container.GetInstance(); - config.Information.PlatformType = PlatformType.Windows; + config.Information.PlatformType = Platform.get_platform(); config.Information.IsInteractive = false; config.Information.ChocolateyVersion = "1.2.3"; config.Information.PlatformVersion = new Version(6, 1, 0, 0); diff --git a/src/chocolatey.tests.integration/TODO.cs b/src/chocolatey.tests.integration/TODO.cs index d92a8d441e..77e0bf52a0 100644 --- a/src/chocolatey.tests.integration/TODO.cs +++ b/src/chocolatey.tests.integration/TODO.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -22,15 +22,15 @@ public class TODO * Configuration related: * - value set automatically * - value overridden - * + * * Install/Upgrade/Uninstall scenarios: * - install force pinned package * - install with dependency error - * + * * - upgrade pinned package - * - when upgrading a file that has locked dependency + * - when upgrading a file that has locked dependency * - upgrade with dependency error - * + * * - uninstall pinned package * - uninstall with dependency error * - uninstall with dependencies @@ -40,8 +40,8 @@ public class TODO * - uninstall with dependencies force / removing dependencies * - uninstall as a dependency * - uninstall as a dependency with force - * - * + * + * */ } } diff --git a/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj b/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj index ef8882ad74..a9615d4bab 100644 --- a/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj +++ b/src/chocolatey.tests.integration/chocolatey.tests.integration.csproj @@ -51,11 +51,8 @@ MinimumRecommendedRules.ruleset - - ..\..\lib\bdddoc\bdddoc.dll - - - ..\packages\log4net.2.0.3\lib\net40-client\log4net.dll + + ..\packages\log4net.2.0.12\lib\net40\log4net.dll ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll @@ -63,9 +60,9 @@ ..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll - + False - ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20210506\lib\net4\NuGet.Core.dll + ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20220901\lib\net4\NuGet.Core.dll False @@ -74,13 +71,11 @@ ..\packages\Should.1.1.12.0\lib\Should.dll - - ..\packages\SimpleInjector.2.5.0\lib\net40-client\SimpleInjector.dll - - - ..\packages\SimpleInjector.2.5.0\lib\net40-client\SimpleInjector.Diagnostics.dll + + ..\packages\SimpleInjector.2.8.3\lib\net40-client\SimpleInjector.dll + ..\packages\Rx-Core.2.1.30214.0\lib\Net40\System.Reactive.Core.dll @@ -91,6 +86,7 @@ ..\packages\Rx-Linq.2.1.30214.0\lib\Net40\System.Reactive.Linq.dll + @@ -100,7 +96,7 @@ - + @@ -244,6 +240,18 @@ Always + + Always + + + Always + + + Always + + + Always + Always @@ -352,6 +360,168 @@ Always + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + Always @@ -506,6 +676,18 @@ Always + + Always + + + Always + + + Always + + + Always + Always diff --git a/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyInstall.ps1 b/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyInstall.ps1 index 744f67630e..0c3f138571 100644 --- a/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyInstall.ps1 +++ b/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyInstall.ps1 @@ -1,20 +1,13 @@ $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -try { - "simple file" | Out-File "$toolsDir\simplefile.txt" -force +"simple file" | Out-File "$toolsDir\simplefile.txt" -force - Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'." - Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'." - Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'." - Write-Host "PSScriptRoot is '$PSScriptRoot'." - Write-Debug "A debug message." - Write-Verbose "Yo!" - Write-Warning "A warning!" - Write-Error "Oh no! An error" - throw "We had an error captain!" - - Write-ChocolateySuccess "$packageName" -} catch { - Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" - throw -} +Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'." +Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'." +Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'." +Write-Host "PSScriptRoot is '$PSScriptRoot'." +Write-Debug "A debug message." +Write-Verbose "Yo!" +Write-Warning "A warning!" +Write-Error "Oh no! An error" +throw "We had an error captain!" diff --git a/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyUninstall.ps1 b/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyUninstall.ps1 index cbb52a9316..701dac3939 100644 --- a/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyUninstall.ps1 +++ b/src/chocolatey.tests.integration/context/badpackage/1.0/tools/chocolateyUninstall.ps1 @@ -1,15 +1,7 @@ $packageName = 'badpackage' -try { - - Write-Host "Ya!" - Write-Debug "A debug message" - Write-Warning "A warning!" - Write-Error "Oh no! An error" - throw "We had an error captain!" - - Write-ChocolateySuccess "$packageName" -} catch { - Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" - throw -} +Write-Host "Ya!" +Write-Debug "A debug message" +Write-Warning "A warning!" +Write-Error "Oh no! An error" +throw "We had an error captain!" diff --git a/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyInstall.ps1 b/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyInstall.ps1 index 2e4b0d4244..4305b24927 100644 --- a/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyInstall.ps1 +++ b/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyInstall.ps1 @@ -1,17 +1,9 @@ -try { - - Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'." - Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'." - Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'." - Write-Host "PSScriptRoot is '$PSScriptRoot'." - Write-Debug "A debug message." - Write-Verbose "Yo!" - Write-Warning "A warning!" - Write-Error "Oh no! An error" - throw "We had an error captain!" - - Write-ChocolateySuccess "$packageName" -} catch { - Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" - throw -} +Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'." +Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'." +Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'." +Write-Host "PSScriptRoot is '$PSScriptRoot'." +Write-Debug "A debug message." +Write-Verbose "Yo!" +Write-Warning "A warning!" +Write-Error "Oh no! An error" +throw "We had an error captain!" diff --git a/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyUninstall.ps1 b/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyUninstall.ps1 index cbb52a9316..701dac3939 100644 --- a/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyUninstall.ps1 +++ b/src/chocolatey.tests.integration/context/badpackage/2.0/tools/chocolateyUninstall.ps1 @@ -1,15 +1,7 @@ $packageName = 'badpackage' -try { - - Write-Host "Ya!" - Write-Debug "A debug message" - Write-Warning "A warning!" - Write-Error "Oh no! An error" - throw "We had an error captain!" - - Write-ChocolateySuccess "$packageName" -} catch { - Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" - throw -} +Write-Host "Ya!" +Write-Debug "A debug message" +Write-Warning "A warning!" +Write-Error "Oh no! An error" +throw "We had an error captain!" diff --git a/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/hasdependency.nuspec b/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/hasdependency.nuspec new file mode 100644 index 0000000000..4d9c6e62d6 --- /dev/null +++ b/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/hasdependency.nuspec @@ -0,0 +1,22 @@ + + + + hasdependency + 2.0.1 + hasdependency + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + __REPLACE__ + + + hasdependency admin + + + + + + + + \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/tools/chocolateyinstall.ps1 b/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..d64eb8f47b --- /dev/null +++ b/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Installed" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/tools/chocolateyuninstall.ps1 b/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/src/chocolatey.tests.integration/context/dependencies/hasdependency/2.0.1/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/isexactversiondependency.nuspec b/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/isexactversiondependency.nuspec new file mode 100644 index 0000000000..efecfd660e --- /dev/null +++ b/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/isexactversiondependency.nuspec @@ -0,0 +1,18 @@ + + + + isexactversiondependency + 1.0.0-beta + isexactversiondependency + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + __REPLACE__ + + isexactversiondependency admin + + + + + \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/tools/chocolateyinstall.ps1 b/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..d64eb8f47b --- /dev/null +++ b/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Installed" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/tools/chocolateyuninstall.ps1 b/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/src/chocolatey.tests.integration/context/dependencies/isexactversiondependency/1.0.0-beta/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/portablepackage/1.0.0/portablepackage.nuspec b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/portablepackage.nuspec new file mode 100644 index 0000000000..89aea19ad9 --- /dev/null +++ b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/portablepackage.nuspec @@ -0,0 +1,17 @@ + + + + portablepackage + 1.0.0 + portablepackage + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + __REPLACE__ + portablepackage admin + + + + + \ No newline at end of file diff --git a/src/chocolatey.resources/redirects/cpack.exe.ignore b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/Casemismatch.exe.ignore similarity index 100% rename from src/chocolatey.resources/redirects/cpack.exe.ignore rename to src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/Casemismatch.exe.ignore diff --git a/src/chocolatey.resources/redirects/cver.exe.ignore b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/casemismatch.exe similarity index 100% rename from src/chocolatey.resources/redirects/cver.exe.ignore rename to src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/casemismatch.exe diff --git a/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/console.exe b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/console.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/graphical.exe b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/graphical.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/graphical.exe.gui b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/graphical.exe.gui new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/not.installed.exe b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/not.installed.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/not.installed.exe.ignore b/src/chocolatey.tests.integration/context/portablepackage/1.0.0/tools/not.installed.exe.ignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/dontrun.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/dontrun.ps1 new file mode 100644 index 0000000000..bb6d576e6a --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/dontrun.ps1 @@ -0,0 +1 @@ +Throw "This script should not be run" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-beforemodify-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-install-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-uninstall-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/post-upgrade-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-beforemodify-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-doesnotexist.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-doesnotexist.ps1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-install-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-uninstall-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/hook/pre-upgrade-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/scriptpackage.hook.nuspec b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/scriptpackage.hook.nuspec new file mode 100644 index 0000000000..dbad56120b --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/1.0.0/scriptpackage.hook.nuspec @@ -0,0 +1,16 @@ + + + + + scriptpackage.hook + 1.0.0 + scriptpackage.hook + TheCakeIsNaOH + scriptpackage.hook + Package with various hook scripts + Package with various hook scripts. Intended to test + + + + + diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/dontrun.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/dontrun.ps1 new file mode 100644 index 0000000000..bb6d576e6a --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/dontrun.ps1 @@ -0,0 +1 @@ +Throw "This script should not be run" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-beforemodify-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-doesnotexist.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-doesnotexist.ps1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-install-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-uninstall-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/post-upgrade-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-beforemodify-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-install-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-uninstall-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-all.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-all.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-all.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-installpackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-installpackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-installpackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-upgradepackage.ps1 b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-upgradepackage.ps1 new file mode 100644 index 0000000000..1e44654cbe --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/hook/pre-upgrade-upgradepackage.ps1 @@ -0,0 +1 @@ +Write-Output "$($MyInvocation.MyCommand.Name) hook ran for $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/scriptpackage.hook.nuspec b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/scriptpackage.hook.nuspec new file mode 100644 index 0000000000..10cc1807d3 --- /dev/null +++ b/src/chocolatey.tests.integration/context/scriptpackage.hook/2.0.0/scriptpackage.hook.nuspec @@ -0,0 +1,16 @@ + + + + + scriptpackage.hook + 2.0.0 + scriptpackage.hook + TheCakeIsNaOH + scriptpackage.hook + Package with various hook scripts + Package with various hook scripts. Intended to test + + + + + diff --git a/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs b/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs index a21529b640..d648d7e5d3 100644 --- a/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -28,6 +28,7 @@ namespace chocolatey.tests.integration.infrastructure.app.services using chocolatey.infrastructure.results; using chocolatey.infrastructure.services; using Moq; + using NUnit.Framework; using Should; public class FilesServiceSpecs @@ -88,6 +89,8 @@ public void should_log_a_warning() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_log_a_warning_about_locked_files() { bool lockedFiles = false; diff --git a/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs b/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs index acce153d8c..399c34b220 100644 --- a/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -20,6 +20,7 @@ namespace chocolatey.tests.integration.infrastructure.commands using chocolatey.infrastructure.app; using chocolatey.infrastructure.commands; using chocolatey.infrastructure.filesystem; + using NUnit.Framework; using Should; public class CommandExecutorSpecs @@ -35,6 +36,8 @@ public override void Context() } } + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_CommandExecutor_errors : CommandExecutorSpecsBase { private int result; @@ -77,6 +80,8 @@ public void should_message_the_error() } } + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_CommandExecutor_is_given_a_nonexisting_process : CommandExecutorSpecsBase { private string result; diff --git a/src/chocolatey.tests.integration/infrastructure/cryptography/CrytpoHashProviderSpecs.cs b/src/chocolatey.tests.integration/infrastructure/cryptography/CryptoHashProviderSpecs.cs similarity index 89% rename from src/chocolatey.tests.integration/infrastructure/cryptography/CrytpoHashProviderSpecs.cs rename to src/chocolatey.tests.integration/infrastructure/cryptography/CryptoHashProviderSpecs.cs index 6ecd22438a..9249067706 100644 --- a/src/chocolatey.tests.integration/infrastructure/cryptography/CrytpoHashProviderSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure/cryptography/CryptoHashProviderSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -23,9 +23,9 @@ namespace chocolatey.tests.integration.infrastructure.cryptography using chocolatey.infrastructure.filesystem; using Should; - public class CrytpoHashProviderSpecs + public class CryptoHashProviderSpecs { - public abstract class CrytpoHashProviderSpecsBase : TinySpec + public abstract class CryptoHashProviderSpecsBase : TinySpec { protected CryptoHashProvider Provider; protected DotNetFileSystem FileSystem; @@ -39,7 +39,7 @@ public override void Context() } } - public class when_HashProvider_provides_a_hash : CrytpoHashProviderSpecsBase + public class when_HashProvider_provides_a_hash : CryptoHashProviderSpecsBase { private string result; private string filePath; diff --git a/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs b/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs index 4e39b985e9..290f3a1112 100644 --- a/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -74,7 +74,7 @@ public void GetExecutablePath_should_find_existing_executable_with_extension() FileSystem.get_executable_path("cmd.exe").ShouldEqual( Platform.get_platform() == PlatformType.Windows ? "c:\\windows\\system32\\cmd.exe" - : "cmd", + : "cmd.exe", StringComparer.OrdinalIgnoreCase ); } @@ -139,6 +139,8 @@ public void GetFiles_should_return_files_that_meet_the_pattern() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void GetFiles_should_return_files_that_meet_the_pattern_regardless_of_case() { string filePath = FileSystem.combine_paths(ContextPath, "chocolateyInstall.ps1"); @@ -189,6 +191,8 @@ public void GetDirectories_should_return_a_string_array_with_directories() } [Category("Integration")] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_setting_file_attributes_with_dotNetFileSystem : DotNetFileSystemSpecsBase { public override void Context() diff --git a/src/chocolatey.tests.integration/packages.config b/src/chocolatey.tests.integration/packages.config index 93abe28393..1088cda952 100644 --- a/src/chocolatey.tests.integration/packages.config +++ b/src/chocolatey.tests.integration/packages.config @@ -1,13 +1,13 @@  - - + + - + \ No newline at end of file diff --git a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs index 1354025224..4d14d58ef5 100644 --- a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -21,13 +21,13 @@ namespace chocolatey.tests.integration.scenarios using System.IO; using System.Linq; using System.Xml.XPath; - using bdddoc.core; using chocolatey.infrastructure.app.commands; using chocolatey.infrastructure.app.configuration; using chocolatey.infrastructure.app.services; using chocolatey.infrastructure.commands; using chocolatey.infrastructure.results; using NuGet; + using NUnit.Framework; using Should; using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; @@ -54,7 +54,6 @@ public override void Context() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_noop_installing_a_package : ScenariosBase { public override void Context() @@ -89,6 +88,8 @@ public void should_contain_a_message_that_it_would_have_used_Nuget_to_install_a_ } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_contain_a_message_that_it_would_have_run_a_powershell_script() { MockLogger.contains_message("chocolateyinstall.ps1", LogLevel.Info).ShouldBeTrue(); @@ -101,7 +102,6 @@ public void should_not_contain_a_message_that_it_would_have_run_powershell_modif } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_noop_installing_a_package_that_does_not_exist : ScenariosBase { public override void Context() @@ -149,7 +149,6 @@ public void should_contain_a_message_that_it_was_unable_to_find_package() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_happy_path : ScenariosBase { private PackageResult packageResult; @@ -183,6 +182,8 @@ public void should_install_the_expected_version_of_the_package() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_create_a_shim_for_console_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); @@ -191,6 +192,8 @@ public void should_create_a_shim_for_console_in_the_bin_directory() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_create_a_shim_for_graphical_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); @@ -223,6 +226,16 @@ public void should_not_create_an_extensions_folder_for_the_package() } [Fact] + public void should_not_create_an_hooks_folder_for_the_package() + { + var hooksDirectory = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames); + + Directory.Exists(hooksDirectory).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_a_console_shim_that_is_set_for_non_gui_access() { var messages = new List(); @@ -248,6 +261,8 @@ public void should_have_a_console_shim_that_is_set_for_non_gui_access() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_a_graphical_shim_that_is_set_for_gui_access() { var messages = new List(); @@ -315,19 +330,20 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyInstall_script() { MockLogger.contains_message("installpackage v1.0.0 has been installed", LogLevel.Info).ShouldBeTrue(); } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_packages_with_packages_config : ScenariosBase { public override void Context() { base.Context(); - var packagesConfig = "{0}\\context\\testing.packages.config".format_with(Scenario.get_top_level()); + var packagesConfig = "{0}{1}context{1}testing.packages.config".format_with(Scenario.get_top_level(), Path.DirectorySeparatorChar); Configuration.PackageNames = Configuration.Input = packagesConfig; Scenario.add_packages_to_source_location(Configuration, "hasdependency.1.0.0*" + Constants.PackageExtension); Scenario.add_packages_to_source_location(Configuration, "isdependency.1.0.0*" + Constants.PackageExtension); @@ -465,7 +481,6 @@ public void should_print_out_package_from_config_file_in_message() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_an_already_installed_package : ScenariosBase { private PackageResult packageResult; @@ -538,7 +553,6 @@ public void should_ave_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_force_installing_an_already_installed_package : ScenariosBase { private PackageResult packageResult; @@ -548,7 +562,7 @@ public override void Context() { base.Context(); Scenario.install_package(Configuration, "installpackage", "1.0.0"); - var fileToModify = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var fileToModify = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.WriteAllText(fileToModify, modifiedText); Configuration.Force = true; @@ -585,7 +599,7 @@ public void should_install_the_same_version_of_the_package() [Fact] public void should_remove_and_re_add_the_package_files_in_the_lib_directory() { - var modifiedFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var modifiedFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.ReadAllText(modifiedFile).ShouldNotEqual(modifiedText); } @@ -640,7 +654,8 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_force_installing_an_already_installed_package_that_errors : ScenariosBase { private PackageResult packageResult; @@ -719,7 +734,8 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_force_installing_an_already_installed_package_with_a_read_and_delete_share_locked_file : ScenariosBase { private PackageResult packageResult; @@ -819,7 +835,8 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_force_installing_an_already_installed_package_with_with_an_exclusively_locked_file : ScenariosBase { private PackageResult packageResult; @@ -904,7 +921,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_that_exists_but_a_version_that_does_not_exist : ScenariosBase { private PackageResult packageResult; @@ -996,7 +1012,6 @@ public void should_have_a_version_of_one_dot_zero_dot_one() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_that_does_not_exist : ScenariosBase { private PackageResult packageResult; @@ -1082,7 +1097,8 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_installing_a_package_that_errors : ScenariosBase { private PackageResult packageResult; @@ -1176,7 +1192,6 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_that_has_nonterminating_errors : ScenariosBase { private PackageResult packageResult; @@ -1261,7 +1276,8 @@ public void should_have_a_version_of_one_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_installing_a_package_that_has_nonterminating_errors_with_fail_on_stderr : ScenariosBase { private PackageResult packageResult; @@ -1358,7 +1374,6 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_side_by_side_package : ScenariosBase { private PackageResult packageResult; @@ -1401,6 +1416,22 @@ public void should_contain_a_warning_message_that_it_installed_successfully() installedSuccessfully.ShouldBeTrue(); } + [Fact] + public void should_contain_a_warning_message_that_installing_package_with_multiple_versions_being_deprecated() + { + const string expected = "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0."; + + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains(expected)) + { + return; + } + } + + Assert.Fail("No warning message about side by side deprecation outputted"); + } + [Fact] public void should_have_a_successful_package_result() { @@ -1432,7 +1463,6 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_switching_a_normal_package_to_a_side_by_side_package : ScenariosBase { private PackageResult packageResult; @@ -1508,7 +1538,6 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_switching_a_side_by_side_package_to_a_normal_package : ScenariosBase { private PackageResult packageResult; @@ -1585,7 +1614,6 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_dependencies_happy : ScenariosBase { public override void Context() @@ -1684,7 +1712,6 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_force_installing_an_already_installed_package_with_dependencies : ScenariosBase { public override void Context() @@ -1795,7 +1822,6 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_force_installing_an_already_installed_package_forcing_dependencies : ScenariosBase { public override void Context() @@ -1906,7 +1932,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_force_installing_an_already_installed_package_ignoring_dependencies : ScenariosBase { public override void Context() @@ -2017,7 +2042,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_force_installing_an_already_installed_package_forcing_and_ignoring_dependencies : ScenariosBase { public override void Context() @@ -2119,7 +2143,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_dependencies_and_dependency_cannot_be_found : ScenariosBase { public override void Context() @@ -2228,7 +2251,6 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_ignoring_dependencies_that_cannot_be_found : ScenariosBase { private PackageResult packageResult; @@ -2314,7 +2336,6 @@ public void config_should_match_package_result_name() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_that_depends_on_a_newer_version_of_an_installed_dependency : ScenariosBase { public override void Context() @@ -2414,7 +2435,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_that_depends_on_an_unavailable_newer_version_of_an_installed_dependency : ScenariosBase { public override void Context() @@ -2480,7 +2500,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_that_depends_on_an_unavailable_newer_version_of_an_installed_dependency_ignoring_dependencies : ScenariosBase { public override void Context() @@ -2564,7 +2583,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_force_installing_a_package_that_depends_on_an_unavailable_newer_version_of_an_installed_dependency_forcing_dependencies : ScenariosBase { public override void Context() @@ -2678,7 +2696,6 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_dependencies_on_a_newer_version_of_a_package_than_an_existing_package_has_with_that_dependency : ScenariosBase { public override void Context() @@ -2763,7 +2780,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_dependencies_on_a_newer_version_of_a_package_than_are_allowed_by_an_existing_package_with_that_dependency : ScenariosBase { public override void Context() @@ -2884,7 +2900,6 @@ public void should_have_an_error_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_dependencies_on_an_older_version_of_a_package_than_is_already_installed : ScenariosBase { public override void Context() @@ -2992,7 +3007,6 @@ public void should_have_an_error_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_a_dependent_package_that_also_depends_on_a_less_constrained_but_still_valid_dependency_of_the_same_package : ScenariosBase { public override void Context() @@ -3106,7 +3120,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_from_a_nupkg_file : ScenariosBase { private PackageResult packageResult; @@ -3114,7 +3127,7 @@ public class when_installing_a_package_from_a_nupkg_file : ScenariosBase public override void Context() { base.Context(); - Configuration.PackageNames = Configuration.Input = "{0}\\installpackage.1.0.0.nupkg".format_with(Configuration.Sources); + Configuration.PackageNames = Configuration.Input = "{0}{1}installpackage.1.0.0.nupkg".format_with(Configuration.Sources, Path.DirectorySeparatorChar); } public override void Because() @@ -3146,6 +3159,8 @@ public void should_install_the_expected_version_of_the_package() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_create_a_shim_for_console_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); @@ -3154,6 +3169,8 @@ public void should_create_a_shim_for_console_in_the_bin_directory() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_create_a_shim_for_graphical_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); @@ -3186,6 +3203,16 @@ public void should_not_create_an_extensions_folder_for_the_package() } [Fact] + public void should_not_create_an_hooks_folder_for_the_package() + { + var hooksDirectory = Path.Combine(Scenario.get_top_level(), "hooks", "installpackage"); + + Directory.Exists(hooksDirectory).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_a_console_shim_that_is_set_for_non_gui_access() { var messages = new List(); @@ -3211,6 +3238,8 @@ public void should_have_a_console_shim_that_is_set_for_non_gui_access() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_a_graphical_shim_that_is_set_for_gui_access() { var messages = new List(); @@ -3278,7 +3307,6 @@ public void should_have_a_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_config_transforms : ScenariosBase { private PackageResult packageResult; @@ -3365,7 +3393,6 @@ public void should_add_the_insert_value_in_the_config_due_to_XDT_InsertIfMissing } } - [Concern(typeof(ChocolateyInstallCommand))] public class when_installing_a_package_with_no_sources_enabled : ScenariosBase { public override void Context() @@ -3391,5 +3418,600 @@ public void should_not_install_any_packages() Results.Count().ShouldEqual(0); } } + + public class when_installing_a_hook_package : ScenariosBase + { + public override void Context() + { + base.Context(); + Configuration.PackageNames = Configuration.Input = "scriptpackage.hook"; + Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".1.0.0" + Constants.PackageExtension); + } + + private PackageResult _packageResult; + + public override void Because() + { + Results = Service.install_run(Configuration); + _packageResult = Results.FirstOrDefault().Value; + } + + [Fact] + public void should_install_the_package_in_the_lib_directory() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeTrue(); + } + + [Fact] + public void should_install_the_expected_version_of_the_package() + { + var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension); + var package = new OptimizedZipPackage(packageFile); + package.Version.Version.to_string().ShouldEqual("1.0.0.0"); + } + + [Fact] + public void should_not_create_an_extensions_folder_for_the_package() + { + var extensionsDirectory = Path.Combine(Scenario.get_top_level(), "extensions", Configuration.PackageNames); + + Directory.Exists(extensionsDirectory).ShouldBeFalse(); + } + + [Fact] + public void should_create_a_hooks_folder_for_the_package() + { + var hooksDirectory = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty)); + + Directory.Exists(hooksDirectory).ShouldBeTrue(); + } + + [Fact] + public void should_install_hook_scripts_to_folder() + { + var hookScripts = new List { "pre-install-all.ps1", "post-install-all.ps1", "pre-upgrade-all.ps1", "post-upgrade-all.ps1", "pre-uninstall-all.ps1", "post-uninstall-all.ps1" }; + foreach (string scriptName in hookScripts) + { + var hookScriptPath = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty), scriptName); + File.ReadAllText(hookScriptPath).ShouldContain("Write-Output"); + } + } + + [Fact] + public void should_contain_a_warning_message_that_it_installed_successfully() + { + bool installedSuccessfully = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("1/1")) installedSuccessfully = true; + } + + installedSuccessfully.ShouldBeTrue(); + } + + [Fact] + public void should_have_a_successful_package_result() + { + _packageResult.Success.ShouldBeTrue(); + } + + [Fact] + public void should_not_have_inconclusive_package_result() + { + _packageResult.Inconclusive.ShouldBeFalse(); + } + + [Fact] + public void should_not_have_warning_package_result() + { + _packageResult.Warning.ShouldBeFalse(); + } + + [Fact] + public void config_should_match_package_result_name() + { + _packageResult.Name.ShouldEqual(Configuration.PackageNames); + } + + [Fact] + public void should_have_a_version_of_one_dot_zero_dot_zero() + { + _packageResult.Version.ShouldEqual("1.0.0"); + } + + } + + public class when_installing_a_package_happy_path_with_hook_scripts : ScenariosBase + { + private PackageResult _packageResult; + + public override void Context() + { + base.Context(); + Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + Constants.PackageExtension); + Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0"); + Configuration.PackageNames = Configuration.Input = "installpackage"; + } + + public override void Because() + { + Results = Service.install_run(Configuration); + _packageResult = Results.FirstOrDefault().Value; + } + + [Fact] + public void should_install_where_install_location_reports() + { + Directory.Exists(_packageResult.InstallLocation).ShouldBeTrue(); + } + + [Fact] + public void should_install_the_package_in_the_lib_directory() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeTrue(); + } + + [Fact] + public void should_install_the_expected_version_of_the_package() + { + var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension); + var package = new OptimizedZipPackage(packageFile); + package.Version.Version.to_string().ShouldEqual("1.0.0.0"); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_create_a_shim_for_console_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); + + File.Exists(shimfile).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_create_a_shim_for_graphical_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); + + File.Exists(shimfile).ShouldBeTrue(); + } + + [Fact] + public void should_not_create_a_shim_for_ignored_executable_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "not.installed.exe"); + + File.Exists(shimfile).ShouldBeFalse(); + } + + [Fact] + public void should_not_create_a_shim_for_mismatched_case_ignored_executable_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "casemismatch.exe"); + + File.Exists(shimfile).ShouldBeFalse(); + } + + [Fact] + public void should_not_create_an_extensions_folder_for_the_package() + { + var extensionsDirectory = Path.Combine(Scenario.get_top_level(), "extensions", Configuration.PackageNames); + + Directory.Exists(extensionsDirectory).ShouldBeFalse(); + } + + [Fact] + public void should_not_create_an_hooks_folder_for_the_package() + { + var hooksDirectory = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames); + + Directory.Exists(hooksDirectory).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_a_console_shim_that_is_set_for_non_gui_access() + { + var messages = new List(); + + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); + CommandExecutor.execute( + shimfile, + "--shimgen-noop", + 10, + stdOutAction: (s, e) => messages.Add(e.Data), + stdErrAction: (s, e) => messages.Add(e.Data) + ); + + var messageFound = false; + + foreach (var message in messages.or_empty_list_if_null()) + { + if (string.IsNullOrWhiteSpace(message)) continue; + if (message.Contains("is gui? False")) messageFound = true; + } + + messageFound.ShouldBeTrue("GUI false message not found"); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_a_graphical_shim_that_is_set_for_gui_access() + { + var messages = new List(); + + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); + CommandExecutor.execute( + shimfile, + "--shimgen-noop", + 10, + stdOutAction: (s, e) => messages.Add(e.Data), + stdErrAction: (s, e) => messages.Add(e.Data) + ); + + var messageFound = false; + + foreach (var message in messages.or_empty_list_if_null()) + { + if (string.IsNullOrWhiteSpace(message)) continue; + if (message.Contains("is gui? True")) messageFound = true; + } + + messageFound.ShouldBeTrue("GUI true message not found"); + } + + [Fact] + public void should_contain_a_warning_message_that_it_installed_successfully() + { + bool installedSuccessfully = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("1/1")) installedSuccessfully = true; + } + + installedSuccessfully.ShouldBeTrue(); + } + + [Fact] + public void should_have_a_successful_package_result() + { + _packageResult.Success.ShouldBeTrue(); + } + + [Fact] + public void should_not_have_inconclusive_package_result() + { + _packageResult.Inconclusive.ShouldBeFalse(); + } + + [Fact] + public void should_not_have_warning_package_result() + { + _packageResult.Warning.ShouldBeFalse(); + } + + [Fact] + public void config_should_match_package_result_name() + { + _packageResult.Name.ShouldEqual(Configuration.PackageNames); + } + + [Fact] + public void should_have_a_version_of_one_dot_zero_dot_zero() + { + _packageResult.Version.ShouldEqual("1.0.0"); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_chocolateyInstall_script() + { + MockLogger.contains_message("installpackage v1.0.0 has been installed", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_all_hook_script() + { + MockLogger.contains_message("pre-install-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_all_hook_script() + { + MockLogger.contains_message("post-install-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_installpackage_hook_script() + { + MockLogger.contains_message("pre-install-installpackage.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_installpackage_hook_script() + { + MockLogger.contains_message("post-install-installpackage.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_uninstall_hook_script() + { + MockLogger.contains_message("post-uninstall-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_upgradepackage_hook_script() + { + MockLogger.contains_message("pre-install-upgradepackage.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_beforemodify_hook_script() + { + MockLogger.contains_message("pre-beforemodify-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeFalse(); + } + } + + public class when_installing_a_portable_package_happy_path_with_hook_scripts : ScenariosBase + { + private PackageResult _packageResult; + + public override void Context() + { + base.Context(); + Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + ".1.0.0" + Constants.PackageExtension); + Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0"); + Configuration.PackageNames = Configuration.Input = "portablepackage"; + Scenario.add_packages_to_source_location(Configuration, Configuration.Input + "*" + Constants.PackageExtension); + } + + public override void Because() + { + Results = Service.install_run(Configuration); + _packageResult = Results.FirstOrDefault().Value; + } + + [Fact] + public void should_install_where_install_location_reports() + { + Directory.Exists(_packageResult.InstallLocation).ShouldBeTrue(); + } + + [Fact] + public void should_install_the_package_in_the_lib_directory() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeTrue(); + } + + [Fact] + public void should_install_the_expected_version_of_the_package() + { + var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension); + var package = new OptimizedZipPackage(packageFile); + package.Version.Version.to_string().ShouldEqual("1.0.0.0"); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_create_a_shim_for_console_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); + + File.Exists(shimfile).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_create_a_shim_for_graphical_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); + + File.Exists(shimfile).ShouldBeTrue(); + } + + [Fact] + public void should_not_create_a_shim_for_ignored_executable_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "not.installed.exe"); + + File.Exists(shimfile).ShouldBeFalse(); + } + + [Fact] + public void should_not_create_a_shim_for_mismatched_case_ignored_executable_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "casemismatch.exe"); + + File.Exists(shimfile).ShouldBeFalse(); + } + + [Fact] + public void should_not_create_an_extensions_folder_for_the_package() + { + var extensionsDirectory = Path.Combine(Scenario.get_top_level(), "extensions", Configuration.PackageNames); + + Directory.Exists(extensionsDirectory).ShouldBeFalse(); + } + + [Fact] + public void should_not_create_an_hooks_folder_for_the_package() + { + var hooksDirectory = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames); + + Directory.Exists(hooksDirectory).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_a_console_shim_that_is_set_for_non_gui_access() + { + var messages = new List(); + + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); + CommandExecutor.execute( + shimfile, + "--shimgen-noop", + 10, + stdOutAction: (s, e) => messages.Add(e.Data), + stdErrAction: (s, e) => messages.Add(e.Data) + ); + + var messageFound = false; + + foreach (var message in messages.or_empty_list_if_null()) + { + if (string.IsNullOrWhiteSpace(message)) continue; + if (message.Contains("is gui? False")) messageFound = true; + } + + messageFound.ShouldBeTrue("GUI false message not found"); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_a_graphical_shim_that_is_set_for_gui_access() + { + var messages = new List(); + + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); + CommandExecutor.execute( + shimfile, + "--shimgen-noop", + 10, + stdOutAction: (s, e) => messages.Add(e.Data), + stdErrAction: (s, e) => messages.Add(e.Data) + ); + + var messageFound = false; + + foreach (var message in messages.or_empty_list_if_null()) + { + if (string.IsNullOrWhiteSpace(message)) continue; + if (message.Contains("is gui? True")) messageFound = true; + } + + messageFound.ShouldBeTrue("GUI true message not found"); + } + + [Fact] + public void should_contain_a_warning_message_that_it_installed_successfully() + { + bool installedSuccessfully = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("1/1")) installedSuccessfully = true; + } + + installedSuccessfully.ShouldBeTrue(); + } + + [Fact] + public void should_have_a_successful_package_result() + { + _packageResult.Success.ShouldBeTrue(); + } + + [Fact] + public void should_not_have_inconclusive_package_result() + { + _packageResult.Inconclusive.ShouldBeFalse(); + } + + [Fact] + public void should_not_have_warning_package_result() + { + _packageResult.Warning.ShouldBeFalse(); + } + + [Fact] + public void config_should_match_package_result_name() + { + _packageResult.Name.ShouldEqual(Configuration.PackageNames); + } + + [Fact] + public void should_have_a_version_of_one_dot_zero_dot_zero() + { + _packageResult.Version.ShouldEqual("1.0.0"); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_chocolateyInstall_script() + { + MockLogger.contains_message("portablepackage v1.0.0 has been installed", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_all_hook_script() + { + MockLogger.contains_message("pre-install-all.ps1 hook ran for portablepackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_all_hook_script() + { + MockLogger.contains_message("post-install-all.ps1 hook ran for portablepackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_uninstall_hook_script() + { + MockLogger.contains_message("post-uninstall-all.ps1 hook ran for portablepackage 1.0.0", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_upgradepackage_hook_script() + { + MockLogger.contains_message("pre-install-upgradepackage.ps1 hook ran for portablepackage 1.0.0", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_beforemodify_hook_script() + { + MockLogger.contains_message("pre-beforemodify-all.ps1 hook ran for portablepackage 1.0.0", LogLevel.Info).ShouldBeFalse(); + } + } } } diff --git a/src/chocolatey.tests.integration/scenarios/ListScenarios.cs b/src/chocolatey.tests.integration/scenarios/ListScenarios.cs index 71416d9fed..0604e8ba3a 100644 --- a/src/chocolatey.tests.integration/scenarios/ListScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/ListScenarios.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -18,13 +18,13 @@ namespace chocolatey.tests.integration.scenarios { using System.Collections.Generic; using System.Linq; - using bdddoc.core; using chocolatey.infrastructure.app; using chocolatey.infrastructure.app.commands; using chocolatey.infrastructure.app.configuration; using chocolatey.infrastructure.app.services; using chocolatey.infrastructure.results; using NuGet; + using NUnit.Framework; using Should; public class ListScenarios @@ -48,7 +48,6 @@ public override void Context() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_packages_with_no_filter_happy_path : ScenariosBase { public override void Because() @@ -58,6 +57,8 @@ public override void Because() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_list_available_packages_only_once() { MockLogger.contains_message_count("upgradepackage").ShouldEqual(1); @@ -91,7 +92,6 @@ public void should_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_for_a_particular_package : ScenariosBase { public override void Context() @@ -134,7 +134,6 @@ public void should_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_all_available_packages : ScenariosBase { public override void Context() @@ -184,7 +183,6 @@ public void should_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_packages_with_verbose : ScenariosBase { public override void Context() @@ -245,7 +243,6 @@ public void should_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_listing_local_packages : ScenariosBase { public override void Context() @@ -289,7 +286,6 @@ public void should_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_listing_local_packages_with_id_only : ScenariosBase { public override void Context() @@ -319,7 +315,6 @@ public void should_not_contain_any_version_number() } } - [Concern(typeof(ChocolateyListCommand))] public class when_listing_local_packages_limiting_output : ScenariosBase { public override void Context() @@ -372,7 +367,6 @@ public void should_not_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_listing_local_packages_limiting_output_with_id_only : ScenariosBase { public override void Context() @@ -410,7 +404,6 @@ public void should_not_contain_pipe() } } - [Concern(typeof(ChocolateyListCommand))] public class when_listing_packages_with_no_sources_enabled : ScenariosBase { public override void Context() @@ -438,7 +431,6 @@ public void should_not_list_any_packages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_for_an_exact_package : ScenariosBase { public override void Context() @@ -498,7 +490,6 @@ public void should_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_for_an_exact_package_with_zero_results : ScenariosBase { public override void Context() @@ -554,7 +545,6 @@ public void should_contain_debugging_messages() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_for_all_packages_with_exact_id : ScenariosBase { public override void Context() @@ -602,7 +592,6 @@ public void should_find_all_non_prerelease_versions_in_descending_order() } } - [Concern(typeof(ChocolateyListCommand))] public class when_searching_for_all_packages_including_prerelease_with_exact_id : ScenariosBase { public override void Context() diff --git a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs index f4cb9d0308..e535fe3f28 100644 --- a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs @@ -1,220 +1,216 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc -// Copyright © 2011 - 2017 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. - -namespace chocolatey.tests.integration.scenarios -{ - using System; - using System.IO; - using bdddoc.core; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using Should; - - public class PackScenarios - { - public abstract class ScenariosBase : TinySpec - { - protected ChocolateyConfiguration Configuration; - protected INugetService Service; - - public override void Context() - { - Configuration = Scenario.pack(); - Scenario.reset(Configuration); - Scenario.add_files(new[] { new Tuple("myPackage.nuspec", NuspecContent) }); - - Service = NUnitSetup.Container.GetInstance(); - } - } - - [Concern(typeof(ChocolateyPackCommand))] - public class when_packing_without_specifying_an_output_directory : ScenariosBase - { - private readonly string package_path = Path.Combine(Scenario.get_top_level(), "test-package.0.1.0.nupkg"); - - public override void Context() - { - base.Context(); - if (File.Exists(package_path)) - { - File.Delete(package_path); - } - } - - public override void Because() - { - MockLogger.reset(); - Service.pack_run(Configuration); - } - - [Fact] - public void generated_package_should_be_in_current_directory() - { - var infos = MockLogger.MessagesFor(LogLevel.Info); - infos.Count.ShouldEqual(2); - infos[0].ShouldEqual("Attempting to build package from 'myPackage.nuspec'."); - infos[1].ShouldEqual(string.Concat("Successfully created package '", package_path, "'")); - - File.Exists(package_path).ShouldBeTrue(); - } - - [Fact] - public void sources_should_be_set_to_current_directory() - { - Configuration.Sources.ShouldEqual(Scenario.get_top_level()); - } - } - - [Concern(typeof(ChocolateyPackCommand))] - public class when_packing_with_an_output_directory : ScenariosBase - { - private readonly string package_path = Path.Combine("PackageOutput", "test-package.0.1.0.nupkg"); - - public override void Context() - { - base.Context(); - Configuration.OutputDirectory = "PackageOutput"; - Scenario.create_directory(Configuration.OutputDirectory); - } - - public override void Because() - { - MockLogger.reset(); - Service.pack_run(Configuration); - } - - [Fact] - public void generated_package_should_be_in_specified_output_directory() - { - var infos = MockLogger.MessagesFor(LogLevel.Info); - infos.Count.ShouldEqual(2); - infos[0].ShouldEqual("Attempting to build package from 'myPackage.nuspec'."); - infos[1].ShouldEqual(string.Concat("Successfully created package '", package_path, "'")); - - File.Exists(package_path).ShouldBeTrue(); - } - - [Fact] - public void sources_should_be_set_to_specified_output_directory() - { - Configuration.Sources.ShouldEqual("PackageOutput"); - } - } - - [Concern(typeof(ChocolateyPackCommand))] - public class when_packing_with_properties : ScenariosBase - { - private readonly string package_path = Path.Combine(Scenario.get_top_level(), "test-package.0.1.0.nupkg"); - - public override void Context() - { - base.Context(); - - Scenario.reset(Configuration); - - Configuration.Version = "0.1.0"; - Configuration.PackCommand.Properties.Add("commitId", "1234abcd"); - Scenario.add_files(new[] { new Tuple("myPackage.nuspec", NuspecContentWithVariables) }); - - if (File.Exists(package_path)) - { - File.Delete(package_path); - } - } - - public override void Because() - { - MockLogger.reset(); - Service.pack_run(Configuration); - } - - [Fact] - public void generated_package_should_be_in_current_directory() - { - var infos = MockLogger.MessagesFor(LogLevel.Info); - infos.Count.ShouldEqual(2); - infos[0].ShouldEqual("Attempting to build package from 'myPackage.nuspec'."); - infos[1].ShouldEqual(string.Concat("Successfully created package '", package_path, "'")); - - File.Exists(package_path).ShouldBeTrue(); - } - - [Fact] - public void property_settings_should_be_logged_as_debug_messages() - { - var messages = MockLogger.MessagesFor(LogLevel.Debug); - messages.Count.ShouldEqual(2); - messages.Contains("Setting property 'commitId': 1234abcd"); - messages.Contains("Setting property 'version': 0.1.0"); - } - } - - private const string NuspecContent = @" - - - test-package - Test Package - 0.1.0 - package author - package owner - A brief summary - A big description - test admin - - http://apache.org/2 - false - - -"; - - private const string NuspecContentWithChocolateyData = @" - - - test-package - Test Package - 0.1.0 - package author - package owner - A brief summary - A big description - test admin - - http://apache.org/2 - false - - -"; - - private const string NuspecContentWithVariables = @" - - - test-package - Test Package - $version$ - package author - package owner - A brief summary - A big description - test admin - - https://github.com/chocolatey/choco/tree/$commitId$/LICENSE - false - - -"; - } -} +// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2011 - 2017 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. + +namespace chocolatey.tests.integration.scenarios +{ + using System; + using System.IO; + using chocolatey.infrastructure.app.commands; + using chocolatey.infrastructure.app.configuration; + using chocolatey.infrastructure.app.services; + using Should; + + public class PackScenarios + { + public abstract class ScenariosBase : TinySpec + { + protected ChocolateyConfiguration Configuration; + protected INugetService Service; + + public override void Context() + { + Configuration = Scenario.pack(); + Scenario.reset(Configuration); + Scenario.add_files(new[] { new Tuple("myPackage.nuspec", NuspecContent) }); + + Service = NUnitSetup.Container.GetInstance(); + } + } + + public class when_packing_without_specifying_an_output_directory : ScenariosBase + { + private readonly string package_path = Path.Combine(Scenario.get_top_level(), "test-package.0.1.0.nupkg"); + + public override void Context() + { + base.Context(); + if (File.Exists(package_path)) + { + File.Delete(package_path); + } + } + + public override void Because() + { + MockLogger.reset(); + Service.pack_run(Configuration); + } + + [Fact] + public void generated_package_should_be_in_current_directory() + { + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(2); + infos[0].ShouldEqual("Attempting to build package from 'myPackage.nuspec'."); + infos[1].ShouldEqual(string.Concat("Successfully created package '", package_path, "'")); + + File.Exists(package_path).ShouldBeTrue(); + } + + [Fact] + public void sources_should_be_set_to_current_directory() + { + Configuration.Sources.ShouldEqual(Scenario.get_top_level()); + } + } + + public class when_packing_with_an_output_directory : ScenariosBase + { + private readonly string package_path = Path.Combine("PackageOutput", "test-package.0.1.0.nupkg"); + + public override void Context() + { + base.Context(); + Configuration.OutputDirectory = "PackageOutput"; + Scenario.create_directory(Configuration.OutputDirectory); + } + + public override void Because() + { + MockLogger.reset(); + Service.pack_run(Configuration); + } + + [Fact] + public void generated_package_should_be_in_specified_output_directory() + { + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(2); + infos[0].ShouldEqual("Attempting to build package from 'myPackage.nuspec'."); + infos[1].ShouldEqual(string.Concat("Successfully created package '", package_path, "'")); + + File.Exists(package_path).ShouldBeTrue(); + } + + [Fact] + public void sources_should_be_set_to_specified_output_directory() + { + Configuration.Sources.ShouldEqual("PackageOutput"); + } + } + + public class when_packing_with_properties : ScenariosBase + { + private readonly string package_path = Path.Combine(Scenario.get_top_level(), "test-package.0.1.0.nupkg"); + + public override void Context() + { + base.Context(); + + Scenario.reset(Configuration); + + Configuration.Version = "0.1.0"; + Configuration.PackCommand.Properties.Add("commitId", "1234abcd"); + Scenario.add_files(new[] { new Tuple("myPackage.nuspec", NuspecContentWithVariables) }); + + if (File.Exists(package_path)) + { + File.Delete(package_path); + } + } + + public override void Because() + { + MockLogger.reset(); + Service.pack_run(Configuration); + } + + [Fact] + public void generated_package_should_be_in_current_directory() + { + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(2); + infos[0].ShouldEqual("Attempting to build package from 'myPackage.nuspec'."); + infos[1].ShouldEqual(string.Concat("Successfully created package '", package_path, "'")); + + File.Exists(package_path).ShouldBeTrue(); + } + + [Fact] + public void property_settings_should_be_logged_as_debug_messages() + { + var messages = MockLogger.MessagesFor(LogLevel.Debug); + messages.Count.ShouldEqual(2); + messages.Contains("Setting property 'commitId': 1234abcd"); + messages.Contains("Setting property 'version': 0.1.0"); + } + } + + private const string NuspecContent = @" + + + test-package + Test Package + 0.1.0 + package author + package owner + A brief summary + A big description + test admin + + http://apache.org/2 + false + + +"; + + private const string NuspecContentWithChocolateyData = @" + + + test-package + Test Package + 0.1.0 + package author + package owner + A brief summary + A big description + test admin + + http://apache.org/2 + false + + +"; + + private const string NuspecContentWithVariables = @" + + + test-package + Test Package + $version$ + package author + package owner + A brief summary + A big description + test admin + + https://github.com/chocolatey/choco/tree/$commitId$/LICENSE + false + + +"; + } +} diff --git a/src/chocolatey.tests.integration/scenarios/PinScenarios.cs b/src/chocolatey.tests.integration/scenarios/PinScenarios.cs index df70d06695..600dfd834a 100644 --- a/src/chocolatey.tests.integration/scenarios/PinScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/PinScenarios.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -19,7 +19,6 @@ namespace chocolatey.tests.integration.scenarios using System; using System.Collections.Generic; using System.Linq; - using bdddoc.core; using chocolatey.infrastructure.app; using chocolatey.infrastructure.app.attributes; using chocolatey.infrastructure.app.commands; @@ -63,7 +62,6 @@ public override void Context() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_listing_pins_with_no_pins : ScenariosBase { public override void Context() @@ -93,7 +91,6 @@ public void should_not_contain_any_pins_by_default() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_listing_pins_with_an_existing_pin : ScenariosBase { public override void Context() @@ -126,7 +123,6 @@ public void should_contain_existing_pin_messages() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_listing_pins_with_existing_pins : ScenariosBase { public override void Context() @@ -162,7 +158,6 @@ public void should_contain_a_pin_message_for_each_existing_pin() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_setting_a_pin_for_an_installed_package : ScenariosBase { public override void Context() @@ -185,7 +180,6 @@ public void should_contain_success_message() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_setting_a_pin_for_an_already_pinned_package : ScenariosBase { public override void Context() @@ -209,7 +203,6 @@ public void should_contain_nothing_to_do_message() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_setting_a_pin_for_a_non_installed_package : ScenariosBase { public override void Context() @@ -232,7 +225,6 @@ public void should_throw_an_error_about_not_finding_the_package() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_removing_a_pin_for_a_pinned_package : ScenariosBase { public override void Context() @@ -258,7 +250,6 @@ public void should_contain_success_message() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_removing_a_pin_for_an_unpinned_package : ScenariosBase { public override void Context() @@ -281,7 +272,6 @@ public void should_contain_nothing_to_do_message() } } - [Concern(typeof(ChocolateyPinCommand))] public class when_removing_a_pin_for_a_non_installed_package : ScenariosBase { public override void Context() diff --git a/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs index 19d3e8c1c1..cfc4b07868 100644 --- a/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -20,7 +20,6 @@ namespace chocolatey.tests.integration.scenarios using System.Collections.Concurrent; using System.IO; using System.Linq; - using bdddoc.core; using chocolatey.infrastructure.app.commands; using chocolatey.infrastructure.app.configuration; using chocolatey.infrastructure.app.services; @@ -59,7 +58,6 @@ public override void Context() } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_noop_uninstalling_a_package : ScenariosBase { public override void Context() @@ -94,19 +92,22 @@ public void should_contain_a_message_that_it_would_have_uninstalled_a_package() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_contain_a_message_that_it_would_have_run_a_powershell_script() { MockLogger.contains_message("chocolateyuninstall.ps1").ShouldBeTrue(); } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_contain_a_message_that_it_would_have_run_powershell_modification_script() { MockLogger.contains_message("chocolateyBeforeModify.ps1").ShouldBeTrue(); } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_noop_uninstalling_a_package_that_does_not_exist : ScenariosBase { public override void Context() @@ -134,7 +135,6 @@ public void should_contain_a_message_that_it_was_unable_to_find_package() } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_uninstalling_a_package_happy_path : ScenariosBase { private PackageResult packageResult; @@ -162,6 +162,8 @@ public void should_delete_the_rollback() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_console_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); @@ -170,6 +172,8 @@ public void should_delete_a_shim_for_console_in_the_bin_directory() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_graphical_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); @@ -222,19 +226,22 @@ public void config_should_match_package_result_name() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyBeforeModify_script() { MockLogger.contains_message("installpackage 1.0.0 Before Modification", LogLevel.Info).ShouldBeTrue(); } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyUninstall_script() { MockLogger.contains_message("installpackage 1.0.0 Uninstalled", LogLevel.Info).ShouldBeTrue(); } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_force_uninstalling_a_package : ScenariosBase { private PackageResult packageResult; @@ -320,13 +327,12 @@ public void config_should_match_package_result_name() } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_uninstalling_packages_with_packages_config : ScenariosBase { public override void Context() { base.Context(); - var packagesConfig = "{0}\\context\\testing.packages.config".format_with(Scenario.get_top_level()); + var packagesConfig = "{0}{1}context{1}testing.packages.config".format_with(Scenario.get_top_level(), Path.DirectorySeparatorChar); Configuration.PackageNames = Configuration.Input = packagesConfig; } @@ -342,7 +348,8 @@ public void should_throw_an_error_that_it_is_not_allowed() } } - [Concern(typeof(ChocolateyUninstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_uninstalling_a_package_with_readonly_files : ScenariosBase { private PackageResult _packageResult; @@ -408,7 +415,8 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUninstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_uninstalling_a_package_with_a_read_and_delete_share_locked_file : ScenariosBase { private PackageResult _packageResult; @@ -481,7 +489,8 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUninstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_uninstalling_a_package_with_an_exclusively_locked_file : ScenariosBase { private PackageResult _packageResult; @@ -562,7 +571,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_uninstalling_a_package_with_added_files : ScenariosBase { private PackageResult packageResult; @@ -608,6 +616,8 @@ public void should_delete_the_rollback() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_console_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); @@ -616,6 +626,8 @@ public void should_delete_a_shim_for_console_in_the_bin_directory() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_graphical_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); @@ -660,7 +672,6 @@ public void config_should_match_package_result_name() } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_uninstalling_a_package_with_changed_files : ScenariosBase { private PackageResult packageResult; @@ -668,7 +679,7 @@ public class when_uninstalling_a_package_with_changed_files : ScenariosBase public override void Context() { base.Context(); - var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.WriteAllText(fileChanged, "hellow"); } @@ -681,7 +692,7 @@ public override void Because() [Fact] public void should_keep_the_changed_file() { - var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.Exists(fileChanged).ShouldBeTrue(); } @@ -706,6 +717,8 @@ public void should_delete_the_rollback() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_console_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); @@ -714,6 +727,8 @@ public void should_delete_a_shim_for_console_in_the_bin_directory() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_graphical_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); @@ -758,7 +773,6 @@ public void config_should_match_package_result_name() } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_force_uninstalling_a_package_with_added_and_changed_files : ScenariosBase { private PackageResult packageResult; @@ -766,7 +780,7 @@ public class when_force_uninstalling_a_package_with_added_and_changed_files : Sc public override void Context() { base.Context(); - var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.WriteAllText(fileChanged, "hellow"); var fileAdded = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "dude.txt"); File.WriteAllText(fileAdded, "hellow"); @@ -798,7 +812,7 @@ public void should_not_keep_the_added_file() [Fact] public void should_not_keep_the_changed_file() { - var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.Exists(fileChanged).ShouldBeFalse(); } @@ -812,6 +826,8 @@ public void should_delete_the_rollback() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_console_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); @@ -820,6 +836,8 @@ public void should_delete_a_shim_for_console_in_the_bin_directory() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_delete_a_shim_for_graphical_in_the_bin_directory() { var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); @@ -864,7 +882,6 @@ public void config_should_match_package_result_name() } } - [Concern(typeof(ChocolateyUninstallCommand))] public class when_uninstalling_a_package_that_does_not_exist : ScenariosBase { private PackageResult packageResult; @@ -939,7 +956,8 @@ public void should_have_an_error_package_result() } } - [Concern(typeof(ChocolateyUninstallCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_uninstalling_a_package_that_errors : ScenariosBase { private PackageResult packageResult; @@ -1047,5 +1065,256 @@ public void should_have_expected_error_in_package_result() errorFound.ShouldBeTrue(); } } + + + public class when_uninstalling_a_hook_package : ScenariosBase + { + private PackageResult _packageResult; + + public override void Context() + { + base.Context(); + Configuration.PackageNames = Configuration.Input = "scriptpackage.hook"; + Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".1.0.0" + Constants.PackageExtension); + Service.install_run(Configuration); + } + + public override void Because() + { + Results = Service.uninstall_run(Configuration); + _packageResult = Results.FirstOrDefault().Value; + } + + [Fact] + public void should_remove_the_package_from_the_lib_directory() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeFalse(); + } + + [Fact] + public void should_delete_the_rollback() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib-bkp", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeFalse(); + } + + [Fact] + public void should_contain_a_warning_message_that_it_uninstalled_successfully() + { + bool installedSuccessfully = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("1/1")) installedSuccessfully = true; + } + + installedSuccessfully.ShouldBeTrue(); + } + + [Fact] + public void should_have_a_successful_package_result() + { + _packageResult.Success.ShouldBeTrue(); + } + + [Fact] + public void should_not_have_inconclusive_package_result() + { + _packageResult.Inconclusive.ShouldBeFalse(); + } + + [Fact] + public void should_not_have_warning_package_result() + { + _packageResult.Warning.ShouldBeFalse(); + } + + [Fact] + public void config_should_match_package_result_name() + { + _packageResult.Name.ShouldEqual(Configuration.PackageNames); + } + + [Fact] + public void should_remove_hooks_folder_for_the_package() + { + var hooksDirectory = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty)); + + Directory.Exists(hooksDirectory).ShouldBeFalse(); + } + } + + public class when_uninstalling_a_package_happy_path_with_hooks : ScenariosBase + { + private PackageResult _packageResult; + + public override void Context() + { + base.Context(); + Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + Constants.PackageExtension); + Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0"); + } + + public override void Because() + { + Results = Service.uninstall_run(Configuration); + _packageResult = Results.FirstOrDefault().Value; + } + + [Fact] + public void should_remove_the_package_from_the_lib_directory() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeFalse(); + } + + [Fact] + public void should_delete_the_rollback() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib-bkp", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_delete_a_shim_for_console_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "console.exe"); + + File.Exists(shimfile).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_delete_a_shim_for_graphical_in_the_bin_directory() + { + var shimfile = Path.Combine(Scenario.get_top_level(), "bin", "graphical.exe"); + + File.Exists(shimfile).ShouldBeFalse(); + } + + [Fact] + public void should_delete_any_files_created_during_the_install() + { + var generatedFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "simplefile.txt"); + + File.Exists(generatedFile).ShouldBeFalse(); + } + + [Fact] + public void should_contain_a_warning_message_that_it_uninstalled_successfully() + { + bool installedSuccessfully = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("1/1")) installedSuccessfully = true; + } + + installedSuccessfully.ShouldBeTrue(); + } + + [Fact] + public void should_have_a_successful_package_result() + { + _packageResult.Success.ShouldBeTrue(); + } + + [Fact] + public void should_not_have_inconclusive_package_result() + { + _packageResult.Inconclusive.ShouldBeFalse(); + } + + [Fact] + public void should_not_have_warning_package_result() + { + _packageResult.Warning.ShouldBeFalse(); + } + + [Fact] + public void config_should_match_package_result_name() + { + _packageResult.Name.ShouldEqual(Configuration.PackageNames); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_chocolateyBeforeModify_script() + { + MockLogger.contains_message("installpackage 1.0.0 Before Modification", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_chocolateyUninstall_script() + { + MockLogger.contains_message("installpackage 1.0.0 Uninstalled", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_all_hook_script() + { + MockLogger.contains_message("pre-uninstall-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_all_hook_script() + { + MockLogger.contains_message("post-uninstall-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_installpackage_hook_script() + { + MockLogger.contains_message("pre-uninstall-installpackage.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_installpackage_hook_script() + { + MockLogger.contains_message("post-uninstall-installpackage.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_upgradepackage_hook_script() + { + MockLogger.contains_message("pre-uninstall-upgradepackage.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_beforemodify_hook_script() + { + MockLogger.contains_message("pre-beforemodify-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_beforemodify_hook_script() + { + MockLogger.contains_message("post-beforemodify-all.ps1 hook ran for installpackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + } + } } diff --git a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs index 364f69ac9f..b3bdc20c7d 100644 --- a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -18,11 +18,11 @@ namespace chocolatey.tests.integration.scenarios { using System; using System.Collections.Concurrent; + using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Xml.XPath; - using bdddoc.core; using chocolatey.infrastructure.app.commands; using chocolatey.infrastructure.app.configuration; using chocolatey.infrastructure.app.services; @@ -58,7 +58,6 @@ public override void Context() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_noop_upgrading_a_package_that_has_available_upgrades : ScenariosBase { public override void Context() @@ -113,7 +112,6 @@ public void should_not_create_a_rollback() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_noop_upgrading_a_package_that_does_not_have_available_upgrades : ScenariosBase { public override void Context() @@ -161,14 +159,13 @@ public void should_not_create_a_rollback() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_noop_upgrading_a_package_that_does_not_exist : ScenariosBase { public override void Context() { base.Context(); Configuration.Noop = true; - Configuration.PackageNames = Configuration.Input = "nonexistingpackage"; + Configuration.PackageNames = Configuration.Input = "nonexistentpackage"; } public override void Because() @@ -182,7 +179,7 @@ public void should_contain_a_message_the_package_was_not_found() bool expectedMessage = false; foreach (var message in MockLogger.MessagesFor(LogLevel.Error).or_empty_list_if_null()) { - if (message.Contains("nonexistingpackage not installed. The package was not found with the source(s) listed")) expectedMessage = true; + if (message.Contains("nonexistentpackage not installed. The package was not found with the source(s) listed")) expectedMessage = true; } expectedMessage.ShouldBeTrue(); @@ -201,7 +198,6 @@ public void should_contain_a_message_that_no_packages_can_be_upgraded() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_an_existing_package_happy_path : ScenariosBase { private PackageResult _packageResult; @@ -305,12 +301,16 @@ public void should_match_the_upgrade_version_of_one_dot_one_dot_zero() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyBeforeModify_script_for_original_package() { MockLogger.contains_message("upgradepackage 1.0.0 Before Modification", LogLevel.Info).ShouldBeTrue(); } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyBeforeModify_before_chocolateyInstall() { MockLogger.MessagesFor(LogLevel.Info).or_empty_list_if_null() @@ -332,13 +332,14 @@ public void should_not_have_executed_chocolateyBeforeModify_script_for_new_packa } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyInstall_script_for_new_package() { MockLogger.contains_message("upgradepackage 1.1.0 Installed", LogLevel.Info).ShouldBeTrue(); } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_an_existing_package_with_prerelease_available_without_prerelease_specified : ScenariosBase { private PackageResult _packageResult; @@ -428,7 +429,6 @@ public void should_match_the_original_package_version() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_an_existing_package_with_prerelease_available_and_prerelease_specified : ScenariosBase { private PackageResult _packageResult; @@ -539,12 +539,16 @@ public void should_match_the_upgrade_version_of_the_new_beta() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyBeforeModify_script_for_original_package() { MockLogger.contains_message("upgradepackage 1.0.0 Before Modification", LogLevel.Info).ShouldBeTrue(); } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyBeforeModify_before_chocolateyInstall() { MockLogger.MessagesFor(LogLevel.Info).or_empty_list_if_null() @@ -566,13 +570,14 @@ public void should_not_have_executed_chocolateyBeforeModify_script_for_new_packa } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyInstall_script_for_new_package() { MockLogger.contains_message("upgradepackage 1.1.1-beta2 Installed", LogLevel.Info).ShouldBeTrue(); } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_an_existing_prerelease_package_without_prerelease_specified : ScenariosBase { private PackageResult _packageResult; @@ -685,12 +690,16 @@ public void should_match_the_upgrade_version_of_the_new_beta() } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyBeforeModify_script_for_original_package() { MockLogger.contains_message("upgradepackage 1.1.1-beta Before Modification", LogLevel.Info).ShouldBeTrue(); } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyBeforeModify_before_chocolateyInstall() { MockLogger.MessagesFor(LogLevel.Info).or_empty_list_if_null() @@ -712,14 +721,15 @@ public void should_not_have_executed_chocolateyBeforeModify_script_for_new_packa } [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_have_executed_chocolateyInstall_script_for_new_package() { MockLogger.contains_message("upgradepackage 1.1.1-beta2 Installed", LogLevel.Info).ShouldBeTrue(); } } - [Concern(typeof(ChocolateyUpgradeCommand))] - public class when_upgrading_an_existing_prerelease_package_with_prerelease_available_with_excludeprelease_and_without_prerelease_specified : ScenariosBase + public class when_upgrading_an_existing_prerelease_package_with_prerelease_available_with_excludeprerelease_and_without_prerelease_specified : ScenariosBase { private PackageResult _packageResult; @@ -809,10 +819,9 @@ public void should_only_find_the_last_stable_version() { _packageResult.Version.ShouldEqual("1.1.0"); } - } - - [Concern(typeof(ChocolateyUpgradeCommand))] - public class when_upgrading_an_existing_prerelease_package_with_allow_downgrade_with_excludeprelease_and_without_prerelease_specified : ScenariosBase + } + + public class when_upgrading_an_existing_prerelease_package_with_allow_downgrade_with_excludeprerelease_and_without_prerelease_specified : ScenariosBase { private PackageResult _packageResult; @@ -905,7 +914,6 @@ public void should_only_find_the_last_stable_version() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_force_upgrading_a_package : ScenariosBase { private PackageResult _packageResult; @@ -1015,7 +1023,6 @@ public void should_match_the_upgrade_version_of_one_dot_one_dot_zero() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_that_does_not_have_available_upgrades : ScenariosBase { private PackageResult _packageResult; @@ -1105,7 +1112,6 @@ public void should_match_the_existing_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_force_upgrading_a_package_that_does_not_have_available_upgrades : ScenariosBase { private PackageResult _packageResult; @@ -1196,13 +1202,12 @@ public void should_match_the_existing_version_of_one_dot_zero_dot_zero() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_packages_with_packages_config : ScenariosBase { public override void Context() { base.Context(); - var packagesConfig = "{0}\\context\\testing.packages.config".format_with(Scenario.get_top_level()); + var packagesConfig = "{0}{1}context{1}testing.packages.config".format_with(Scenario.get_top_level(), Path.DirectorySeparatorChar); Configuration.PackageNames = Configuration.Input = packagesConfig; } @@ -1218,7 +1223,8 @@ public void should_throw_an_error_that_it_is_not_allowed() } } - [Concern(typeof(ChocolateyUpgradeCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_upgrading_a_package_with_readonly_files : ScenariosBase { private PackageResult _packageResult; @@ -1318,7 +1324,8 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_upgrading_a_package_with_a_read_and_delete_share_locked_file : ScenariosBase { private PackageResult _packageResult; @@ -1425,7 +1432,8 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_upgrading_a_package_with_an_exclusively_locked_file : ScenariosBase { private PackageResult _packageResult; @@ -1526,7 +1534,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_added_files : ScenariosBase { private PackageResult _packageResult; @@ -1605,7 +1612,6 @@ public void should_match_the_upgrade_version_of_one_dot_one_dot_zero() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_changed_files : ScenariosBase { private PackageResult _packageResult; @@ -1613,7 +1619,7 @@ public class when_upgrading_a_package_with_changed_files : ScenariosBase public override void Context() { base.Context(); - var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.WriteAllText(fileChanged, "hellow"); } @@ -1626,7 +1632,7 @@ public override void Because() [Fact] public void should_update_the_changed_file() { - var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyInstall.ps1"); + var fileChanged = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "chocolateyinstall.ps1"); File.ReadAllText(fileChanged).ShouldNotEqual("hellow"); } @@ -1684,7 +1690,6 @@ public void should_match_the_upgrade_version_of_one_dot_one_dot_zero() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_that_does_not_exist : ScenariosBase { private PackageResult packageResult; @@ -1692,7 +1697,7 @@ public class when_upgrading_a_package_that_does_not_exist : ScenariosBase public override void Context() { base.Context(); - Configuration.PackageNames = Configuration.Input = "nonexistingpackage"; + Configuration.PackageNames = Configuration.Input = "nonexistentpackage"; } public override void Because() @@ -1715,7 +1720,7 @@ public void should_contain_a_message_the_package_was_not_found() bool expectedMessage = false; foreach (var message in MockLogger.MessagesFor(LogLevel.Error).or_empty_list_if_null()) { - if (message.Contains("nonexistingpackage not installed. The package was not found with the source(s) listed")) expectedMessage = true; + if (message.Contains("nonexistentpackage not installed. The package was not found with the source(s) listed")) expectedMessage = true; } expectedMessage.ShouldBeTrue(); @@ -1782,7 +1787,6 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_that_is_not_installed : ScenariosBase { private PackageResult _packageResult; @@ -1853,7 +1857,8 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_upgrading_a_package_that_is_not_installed_and_failing_on_not_installed : ScenariosBase { private PackageResult _packageResult; @@ -1941,7 +1946,8 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] + [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_upgrading_a_package_that_errors : ScenariosBase { private PackageResult packageResult; @@ -2059,7 +2065,6 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_dependencies_happy : ScenariosBase { public override void Context() @@ -2142,7 +2147,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_unavailable_dependencies : ScenariosBase { public override void Context() @@ -2263,7 +2267,6 @@ public void should_have_expected_error_in_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_unavailable_dependencies_ignoring_dependencies : ScenariosBase { public override void Context() @@ -2347,7 +2350,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_dependency_happy : ScenariosBase { public override void Context() @@ -2430,7 +2432,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_dependency_legacy_folder_version : ScenariosBase { public override void Context() @@ -2571,7 +2572,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_dependency_with_parent_that_depends_on_a_range_less_than_upgrade_version : ScenariosBase { public override void Context() @@ -2654,7 +2654,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_legacy_folder_dependency_with_parent_that_depends_on_a_range_less_than_upgrade_version : ScenariosBase { public override void Context() @@ -2789,7 +2788,6 @@ public void should_not_have_warning_package_result() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_config_transforms : ScenariosBase { private PackageResult _packageResult; @@ -2856,7 +2854,7 @@ public void should_match_the_upgrade_version_of_one_dot_one_dot_zero() _packageResult.Version.ShouldEqual("1.1.0"); } - // any file in a nuget package will overwrite an existing file + // any file in a nuget package will overwrite an existing file // on the file system - we subvert that by pulling the backup // if we've determined that there is an xdt file @@ -2885,7 +2883,6 @@ public void should_add_the_insertNew_value_in_the_config_due_to_XDT_InsertIfMiss } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_config_transforms_when_config_was_edited : ScenariosBase { private PackageResult _packageResult; @@ -2955,7 +2952,7 @@ public void should_match_the_upgrade_version_of_one_dot_one_dot_zero() _packageResult.Version.ShouldEqual("1.1.0"); } - // any file in a nuget package will overwrite an existing file + // any file in a nuget package will overwrite an existing file // on the file system - we subvert that by pulling the backup // if we've determined that there is an xdt file @@ -2990,7 +2987,6 @@ public void should_have_a_config_with_the_comment_from_the_original() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_a_package_with_no_sources_enabled : ScenariosBase { public override void Context() @@ -3017,7 +3013,6 @@ public void should_not_have_any_packages_upgraded() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_all_packages_happy_path : ScenariosBase { public override void Context() @@ -3054,7 +3049,6 @@ public void should_skip_packages_without_upgrades() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_all_packages_with_prereleases_installed : ScenariosBase { public override void Context() @@ -3102,7 +3096,6 @@ public void should_skip_packages_without_upgrades() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_all_packages_with_prereleases_installed_with_excludeprerelease_specified : ScenariosBase { public override void Context() @@ -3153,7 +3146,6 @@ public void should_skip_packages_without_upgrades() } } - [Concern(typeof(ChocolateyUpgradeCommand))] public class when_upgrading_all_packages_with_except : ScenariosBase { public override void Context() @@ -3182,5 +3174,356 @@ public void should_skip_packages_in_except_list() upgradePackageResult.Count.ShouldEqual(0, "upgradepackage should not be in the results list"); } } + + public class when_upgrading_an_existing_hook_package : ScenariosBase + { + private PackageResult _packageResult; + + public override void Context() + { + base.Context(); + Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + ".1.0.0" + Constants.PackageExtension); + Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0"); + Configuration.PackageNames = Configuration.Input = "scriptpackage.hook"; + Scenario.add_packages_to_source_location(Configuration, Configuration.Input + ".2.0.0" + Constants.PackageExtension); + } + + public override void Because() + { + Results = Service.upgrade_run(Configuration); + _packageResult = Results.FirstOrDefault().Value; + } + + [Fact] + public void should_upgrade_where_install_location_reports() + { + Directory.Exists(_packageResult.InstallLocation).ShouldBeTrue(); + } + + [Fact] + public void should_upgrade_a_package_in_the_lib_directory() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeTrue(); + } + + [Fact] + public void should_delete_the_rollback() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib-bkp", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeFalse(); + } + + [Fact] + public void should_upgrade_the_package() + { + var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension); + var package = new OptimizedZipPackage(packageFile); + package.Version.Version.to_string().ShouldEqual("2.0.0.0"); + } + + [Fact] + public void should_contain_a_warning_message_that_it_upgraded_successfully() + { + bool upgradedSuccessMessage = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("upgraded 1/1")) upgradedSuccessMessage = true; + } + + upgradedSuccessMessage.ShouldBeTrue(); + } + + [Fact] + public void should_contain_a_warning_message_with_old_and_new_versions() + { + bool upgradeMessage = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("You have scriptpackage.hook v1.0.0 installed. Version 2.0.0 is available based on your source")) upgradeMessage = true; + } + + upgradeMessage.ShouldBeTrue(); + } + + [Fact] + public void should_have_a_successful_package_result() + { + _packageResult.Success.ShouldBeTrue(); + } + + [Fact] + public void should_not_have_inconclusive_package_result() + { + _packageResult.Inconclusive.ShouldBeFalse(); + } + + [Fact] + public void should_not_have_warning_package_result() + { + _packageResult.Warning.ShouldBeFalse(); + } + + [Fact] + public void config_should_match_package_result_name() + { + _packageResult.Name.ShouldEqual(Configuration.PackageNames); + } + + [Fact] + public void should_match_the_upgrade_version_of_two_dot_zero_dot_zero() + { + _packageResult.Version.ShouldEqual("2.0.0"); + } + + [Fact] + public void should_have_a_hooks_folder_for_the_package() + { + var hooksDirectory = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty)); + + Directory.Exists(hooksDirectory).ShouldBeTrue(); + } + + [Fact] + public void should_install_hook_scripts_to_folder() + { + var hookScripts = new List { "pre-install-all.ps1", "post-install-all.ps1", "pre-upgrade-all.ps1", "post-upgrade-all.ps1", "pre-uninstall-all.ps1", "post-uninstall-all.ps1" }; + foreach (string scriptName in hookScripts) + { + var hookScriptPath = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty), scriptName); + File.ReadAllText(hookScriptPath).ShouldContain("Write-Output"); + } + } + + [Fact] + public void should_remove_files_not_in_upgrade_version() + { + var hookScriptPath = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty), "pre-install-doesnotexist.ps1"); + File.Exists(hookScriptPath).ShouldBeFalse(); + } + + [Fact] + public void should_install_new_files_in_upgrade_version() + { + var hookScriptPath = Path.Combine(Scenario.get_top_level(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty), "post-install-doesnotexist.ps1"); + File.Exists(hookScriptPath).ShouldBeTrue(); + } + } + + public class when_upgrading_an_existing_package_happy_path_with_hooks : ScenariosBase + { + private PackageResult _packageResult; + + public override void Context() + { + base.Context(); + Scenario.add_packages_to_source_location(Configuration, "scriptpackage.hook" + "*" + Constants.PackageExtension); + Scenario.install_package(Configuration, "scriptpackage.hook", "1.0.0"); + Configuration.PackageNames = Configuration.Input = "upgradepackage"; + } + + public override void Because() + { + Results = Service.upgrade_run(Configuration); + _packageResult = Results.FirstOrDefault().Value; + } + + [Fact] + public void should_upgrade_where_install_location_reports() + { + Directory.Exists(_packageResult.InstallLocation).ShouldBeTrue(); + } + + [Fact] + public void should_upgrade_a_package_in_the_lib_directory() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeTrue(); + } + + [Fact] + public void should_delete_the_rollback() + { + var packageDir = Path.Combine(Scenario.get_top_level(), "lib-bkp", Configuration.PackageNames); + + Directory.Exists(packageDir).ShouldBeFalse(); + } + + [Fact] + public void should_contain_newer_version_in_directory() + { + var shimFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, "tools", "console.exe"); + + File.ReadAllText(shimFile).ShouldEqual("1.1.0"); + } + + [Fact] + public void should_upgrade_the_package() + { + var packageFile = Path.Combine(Scenario.get_top_level(), "lib", Configuration.PackageNames, Configuration.PackageNames + Constants.PackageExtension); + var package = new OptimizedZipPackage(packageFile); + package.Version.Version.to_string().ShouldEqual("1.1.0.0"); + } + + [Fact] + public void should_contain_a_warning_message_that_it_upgraded_successfully() + { + bool upgradedSuccessMessage = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("upgraded 1/1")) upgradedSuccessMessage = true; + } + + upgradedSuccessMessage.ShouldBeTrue(); + } + + [Fact] + public void should_contain_a_warning_message_with_old_and_new_versions() + { + bool upgradeMessage = false; + foreach (var message in MockLogger.MessagesFor(LogLevel.Warn).or_empty_list_if_null()) + { + if (message.Contains("You have upgradepackage v1.0.0 installed. Version 1.1.0 is available based on your source")) upgradeMessage = true; + } + + upgradeMessage.ShouldBeTrue(); + } + + [Fact] + public void should_have_a_successful_package_result() + { + _packageResult.Success.ShouldBeTrue(); + } + + [Fact] + public void should_not_have_inconclusive_package_result() + { + _packageResult.Inconclusive.ShouldBeFalse(); + } + + [Fact] + public void should_not_have_warning_package_result() + { + _packageResult.Warning.ShouldBeFalse(); + } + + [Fact] + public void config_should_match_package_result_name() + { + _packageResult.Name.ShouldEqual(Configuration.PackageNames); + } + + [Fact] + public void should_match_the_upgrade_version_of_one_dot_one_dot_zero() + { + _packageResult.Version.ShouldEqual("1.1.0"); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_chocolateyBeforeModify_script_for_original_package() + { + MockLogger.contains_message("upgradepackage 1.0.0 Before Modification", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_chocolateyBeforeModify_before_chocolateyInstall() + { + MockLogger.MessagesFor(LogLevel.Info).or_empty_list_if_null() + .SkipWhile(p => !p.Contains("upgradepackage 1.0.0 Before Modification")) + .Any(p => p.EndsWith("upgradepackage 1.1.0 Installed")) + .ShouldBeTrue(); + } + + [Fact] + public void should_not_have_executed_chocolateyUninstall_script_for_original_package() + { + MockLogger.contains_message("upgradepackage 1.0.0 Uninstalled", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + public void should_not_have_executed_chocolateyBeforeModify_script_for_new_package() + { + MockLogger.contains_message("upgradepackage 1.1.0 Before Modification", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_chocolateyInstall_script_for_new_package() + { + MockLogger.contains_message("upgradepackage 1.1.0 Installed", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_all_hook_script() + { + MockLogger.contains_message("pre-install-all.ps1 hook ran for upgradepackage 1.1.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_all_hook_script() + { + MockLogger.contains_message("post-install-all.ps1 hook ran for upgradepackage 1.1.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_pre_upgradepackage_hook_script() + { + MockLogger.contains_message("pre-install-upgradepackage.ps1 hook ran for upgradepackage 1.1.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_post_upgradepackage_hook_script() + { + MockLogger.contains_message("post-install-upgradepackage.ps1 hook ran for upgradepackage 1.1.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_uninstall_hook_script() + { + MockLogger.contains_message("post-uninstall-all.ps1 hook ran for upgradepackage 1.1.0", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_installpackage_hook_script() + { + MockLogger.contains_message("pre-install-installpackage.ps1 hook ran for upgradepackage 1.1.0", LogLevel.Info).ShouldBeFalse(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_have_executed_beforemodify_hook_script_for_previous_version() + { + MockLogger.contains_message("pre-beforemodify-all.ps1 hook ran for upgradepackage 1.0.0", LogLevel.Info).ShouldBeTrue(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_not_have_executed_beforemodify_hook_script_for_upgrade_version() + { + MockLogger.contains_message("pre-beforemodify-all.ps1 hook ran for upgradepackage 1.1.0", LogLevel.Info).ShouldBeFalse(); + } + } } } diff --git a/src/chocolatey.tests/MockLogger.cs b/src/chocolatey.tests/MockLogger.cs index bec8a82463..5f31300805 100644 --- a/src/chocolatey.tests/MockLogger.cs +++ b/src/chocolatey.tests/MockLogger.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -80,7 +80,7 @@ public int contains_message_count(string expectedMessage, LogLevel level) } /// - /// Gets or sets a value indicating whether to log messages to console. + /// Gets or sets a value indicating whether to log messages to console. /// This is purely used in debugging purposes when it is not clear why a spec is failing. /// This should not have any usages in specs in committed code. /// diff --git a/src/chocolatey.tests/Properties/AssemblyInfo.cs b/src/chocolatey.tests/Properties/AssemblyInfo.cs index b27f84ad93..fba1bb22c9 100644 --- a/src/chocolatey.tests/Properties/AssemblyInfo.cs +++ b/src/chocolatey.tests/Properties/AssemblyInfo.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -17,7 +17,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. @@ -30,7 +30,7 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible +// Setting ComVisible to false makes the types in this assembly not visible [assembly: ComVisible(false)] @@ -41,11 +41,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] diff --git a/src/chocolatey.tests/TinySpec.cs b/src/chocolatey.tests/TinySpec.cs index 7774e65fb7..b4a527e92b 100644 --- a/src/chocolatey.tests/TinySpec.cs +++ b/src/chocolatey.tests/TinySpec.cs @@ -1,18 +1,18 @@ // ============================================================================== -// +// // Fervent Coder Copyright © 2011 - Released under the Apache 2.0 License -// +// // Copyright 2007-2008 The Apache Software Foundation. -// -// 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 +// 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. // ============================================================================== @@ -177,4 +177,4 @@ public ExpectedExceptionAttribute(string exceptionName) : base(exceptionName) } // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/src/chocolatey.tests/chocolatey.tests.csproj b/src/chocolatey.tests/chocolatey.tests.csproj index b3197b2dc3..fc02597fd8 100644 --- a/src/chocolatey.tests/chocolatey.tests.csproj +++ b/src/chocolatey.tests/chocolatey.tests.csproj @@ -50,8 +50,8 @@ MinimumRecommendedRules.ruleset - - ..\packages\log4net.2.0.3\lib\net40-client\log4net.dll + + ..\packages\log4net.2.0.12\lib\net40\log4net.dll ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll @@ -59,9 +59,9 @@ ..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll - + False - ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20210506\lib\net4\NuGet.Core.dll + ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20220901\lib\net4\NuGet.Core.dll False @@ -70,14 +70,13 @@ ..\packages\Should.1.1.12.0\lib\Should.dll - - ..\packages\SimpleInjector.2.5.0\lib\net40-client\SimpleInjector.dll - - - ..\packages\SimpleInjector.2.5.0\lib\net40-client\SimpleInjector.Diagnostics.dll + + ..\packages\SimpleInjector.2.8.3\lib\net40-client\SimpleInjector.dll + + @@ -88,6 +87,7 @@ + @@ -106,16 +106,19 @@ + + + - + @@ -125,6 +128,7 @@ + diff --git a/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs b/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs index 89994402f0..cfb9982993 100644 --- a/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs index abb7e0e225..ff955a763b 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -133,7 +133,7 @@ public void should_throw_when_key_is_set_without_a_source() { configuration.ApiKeyCommand.Key = "bob"; configuration.Sources = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -142,11 +142,11 @@ public void should_throw_when_key_is_set_without_a_source() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); } @@ -172,7 +172,7 @@ public void should_throw_when_key_is_removed_without_a_source() { configuration.ApiKeyCommand.Remove = true; configuration.Sources = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -181,11 +181,11 @@ public void should_throw_when_key_is_removed_without_a_source() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); } diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs index 46c006f94a..c377bdc012 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs index 1d4a1059cb..da75160718 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -126,7 +126,7 @@ public void should_throw_when_more_than_one_unparsed_arg_is_passed() reset(); unparsedArgs.Add("wtf"); unparsedArgs.Add("bbq"); - var errorred = false; + var errored = false; Exception error = null; try @@ -135,11 +135,11 @@ public void should_throw_when_more_than_one_unparsed_arg_is_passed() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldContain("A single features command must be listed"); @@ -209,7 +209,7 @@ public void should_throw_when_command_is_not_list_and_name_is_not_set() { configuration.FeatureCommand.Command = FeatureCommandType.unknown; configuration.FeatureCommand.Name = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -218,11 +218,11 @@ public void should_throw_when_command_is_not_list_and_name_is_not_set() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldEqual("When specifying the subcommand '{0}', you must also specify --name.".format_with(configuration.FeatureCommand.Command.to_string())); diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs index 4a3c75dd31..ce863513ea 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs index 6b28afd7fb..9f93bf3d55 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -235,6 +235,36 @@ public void should_add_short_version_of_password_to_the_option_set() { optionSet.Contains("p").ShouldBeTrue(); } + + [Fact] + public void should_add_pin_to_the_option_set() + { + optionSet.Contains("pinpackage").ShouldBeTrue(); + } + + [Fact] + public void should_add_long_version_of_pin_to_the_option_set() + { + optionSet.Contains("pin-package").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_pin_to_the_option_set() + { + optionSet.Contains("pin").ShouldBeTrue(); + } + + [Fact] + public void should_add_skip_hooks_to_the_option_set() + { + optionSet.Contains("skip-hooks").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_skip_hooks_to_the_option_set() + { + optionSet.Contains("skiphooks").ShouldBeTrue(); + } } public class when_handling_additional_argument_parsing : ChocolateyInstallCommandSpecsBase @@ -270,7 +300,7 @@ public override void Because() public void should_throw_when_packagenames_is_not_set() { configuration.PackageNames = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -279,11 +309,11 @@ public void should_throw_when_packagenames_is_not_set() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); } diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs index 6499bc59ed..d3c74a1376 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -62,12 +62,142 @@ public void should_implement_search() { results.ShouldContain("search"); } + + [Fact] + public void should_implement_find() + { + results.ShouldContain("find"); + } } + public class when_configurating_the_argument_parser_for_list_command : ChocolateyListCommandSpecsBase + { + private OptionSet optionSet; + + public override void Context() + { + base.Context(); + optionSet = new OptionSet(); + configuration.CommandName = "list"; + } + + public override void Because() + { + command.configure_argument_parser(optionSet, configuration); + } + + [Fact] + public void should_add_source_to_the_option_set() + { + optionSet.Contains("source").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_source_to_the_option_set() + { + optionSet.Contains("s").ShouldBeTrue(); + } + + [Fact, Obsolete("Local Only will be removed in v2.0.0 for the list command")] + public void should_add_localonly_to_the_option_set() + { + optionSet.Contains("localonly").ShouldBeTrue(); + } + + [Fact, Obsolete("Local Only will be removed in v2.0.0 for the list command")] + public void should_add_short_version_of_localonly_to_the_option_set() + { + optionSet.Contains("l").ShouldBeTrue(); + } + + [NUnit.Framework.Theory] + [NUnit.Framework.TestCase("localonly")] + [NUnit.Framework.TestCase("source")] + [NUnit.Framework.TestCase("user")] + [NUnit.Framework.TestCase("password")] + [NUnit.Framework.TestCase("cert")] + [NUnit.Framework.TestCase("certpassword")] + [NUnit.Framework.TestCase("approved-only")] + [NUnit.Framework.TestCase("download-cache-only")] + [NUnit.Framework.TestCase("disable-package-repository-optimizations")] + [Obsolete("Will be removed in v2.0.0 for the list command")] + public void should_add_deprecation_notice_to_option(string argument) + { + optionSet[argument].Description.ShouldContain("DEPRECATION NOTICE"); + } + + [Fact] + public void should_add_prerelease_to_the_option_set() + { + optionSet.Contains("prerelease").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_prerelease_to_the_option_set() + { + optionSet.Contains("pre").ShouldBeTrue(); + } + + [Fact] + public void should_add_includeprograms_to_the_option_set() + { + optionSet.Contains("includeprograms").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_includeprograms_to_the_option_set() + { + optionSet.Contains("i").ShouldBeTrue(); + } + + [Fact] + public void should_add_allversions_to_the_option_set() + { + optionSet.Contains("allversions").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_allversions_to_the_option_set() + { + optionSet.Contains("a").ShouldBeTrue(); + } + + [Fact, Obsolete("Will be removed in v2.0.0")] + public void should_add_user_to_the_option_set() + { + optionSet.Contains("user").ShouldBeTrue(); + } + + [Fact, Obsolete("Will be removed in v2.0.0")] + public void should_add_short_version_of_user_to_the_option_set() + { + optionSet.Contains("u").ShouldBeTrue(); + } + + [Fact, Obsolete("Will be removed in v2.0.0")] + public void should_add_password_to_the_option_set() + { + optionSet.Contains("password").ShouldBeTrue(); + } + + [Fact, Obsolete("Will be removed in v2.0.0")] + public void should_add_short_version_of_password_to_the_option_set() + { + optionSet.Contains("p").ShouldBeTrue(); + } + } + + [NUnit.Framework.TestFixture("search")] + [NUnit.Framework.TestFixture("find")] public class when_configurating_the_argument_parser : ChocolateyListCommandSpecsBase { private OptionSet optionSet; + public when_configurating_the_argument_parser(string commandName) + { + configuration.CommandName = commandName; + } + public override void Context() { base.Context(); @@ -162,6 +292,21 @@ public void should_add_short_version_of_password_to_the_option_set() { optionSet.Contains("p").ShouldBeTrue(); } + + [NUnit.Framework.Theory] + [NUnit.Framework.TestCase("localonly")] + [NUnit.Framework.TestCase("source")] + [NUnit.Framework.TestCase("user")] + [NUnit.Framework.TestCase("password")] + [NUnit.Framework.TestCase("cert")] + [NUnit.Framework.TestCase("certpassword")] + [NUnit.Framework.TestCase("approved-only")] + [NUnit.Framework.TestCase("download-cache-only")] + [NUnit.Framework.TestCase("disable-package-repository-optimizations")] + public void should_add_deprecation_notice_to_option(string argument) + { + optionSet[argument].Description.ShouldNotContain("DEPRECATION NOTICE"); + } } public class when_handling_additional_argument_parsing : ChocolateyListCommandSpecsBase @@ -199,6 +344,63 @@ public void should_leave_source_as_set() } } + public class when_noop_is_called_with_list_command : ChocolateyListCommandSpecsBase + { + public override void Context() + { + base.Context(); + configuration.CommandName = "list"; + } + + public override void Because() + { + command.noop(configuration); + } + + [Fact] + public void should_call_service_list_noop() + { + packageService.Verify(c => c.list_noop(configuration), Times.Once); + } + + [Fact] + public void should_report_deprecation_of_remote_sources() + { + MockLogger.Messages.Keys.ShouldContain("Warn"); + MockLogger.Messages["Warn"].ShouldContain(@"Using the list command with remote sources is deprecated and will be made +to only list locally installed packages in v2.0.0. Use the search, or find, +command to find packages on remote sources (such as the Chocolatey Community +Repository)."); + } + } + + public class when_noop_is_called_with_list_command_and_local_only : ChocolateyListCommandSpecsBase + { + public override void Context() + { + base.Context(); + configuration.CommandName = "list"; + configuration.ListCommand.LocalOnly = true; + } + + public override void Because() + { + command.noop(configuration); + } + + [Fact] + public void should_call_service_list_noop() + { + packageService.Verify(c => c.list_noop(configuration), Times.Once); + } + + [Fact] + public void should_not_report_any_warning_messages() + { + MockLogger.Messages.Keys.ShouldNotContain("Warn"); + } + } + public class when_noop_is_called : ChocolateyListCommandSpecsBase { public override void Because() @@ -211,6 +413,69 @@ public void should_call_service_list_noop() { packageService.Verify(c => c.list_noop(configuration), Times.Once); } + + [Fact] + public void should_not_report_any_warning_messages() + { + MockLogger.Messages.Keys.ShouldNotContain("Warn"); + } + } + + public class when_run_is_called_with_list_command : ChocolateyListCommandSpecsBase + { + public override void Context() + { + base.Context(); + configuration.CommandName = "list"; + } + + public override void Because() + { + command.run(configuration); + } + + [Fact] + public void should_call_service_list_run() + { + packageService.Verify(c => c.list_run(configuration), Times.Once); + } + + [Fact] + public void should_report_deprecation_of_remote_sources() + { + MockLogger.Messages.Keys.ShouldContain("Warn"); + MockLogger.Messages["Warn"].ShouldContain(@"Using the list command with remote sources is deprecated and will be made +to only list locally installed packages in v2.0.0. Use the search, or find, +command to find packages on remote sources (such as the Chocolatey Community +Repository)."); + } + } + + public class when_run_is_called_with_list_command_and_local_only : ChocolateyListCommandSpecsBase + { + public override void Context() + { + base.Context(); + configuration.CommandName = "list"; + configuration.ListCommand.LocalOnly = true; + } + + public override void Because() + { + command.run(configuration); + } + + [Fact] + public void should_call_service_list_run() + { + packageService.Verify(c => c.list_run(configuration), Times.Once); + } + + [Fact] + public void should_not_report_any_warning_messages() + { + MockLogger.Messages.Keys.ShouldNotContain("Warn"); + } } public class when_run_is_called : ChocolateyListCommandSpecsBase @@ -225,6 +490,62 @@ public void should_call_service_list_run() { packageService.Verify(c => c.list_run(configuration), Times.Once); } + + [Fact] + public void should_not_report_any_warning_messages() + { + MockLogger.Messages.Keys.ShouldNotContain("Warn"); + } + } + + public class when_outputting_help_message_for_list_command : ChocolateyListCommandSpecsBase + { + public override void Context() + { + base.Context(); + configuration.CommandName = "list"; + } + + public override void Because() + { + command.help_message(configuration); + } + + [Fact, Obsolete("Will be removed in v2.0.0")] + public void should_output_deprecation_notice_header() + { + MockLogger.Messages.Keys.ShouldContain("Warn"); + MockLogger.Messages["Warn"].ShouldContain("DEPRECATION NOTICE"); + } + + [Fact] + public void should_ouput_removal_in_v2_0_0() + { + MockLogger.Messages.Keys.ShouldContain("Warn"); + MockLogger.Messages["Warn"].ShouldContain(@" +Will be removed for the list command in v2.0.0."); + } + } + + [NUnit.Framework.TestFixture("search")] + [NUnit.Framework.TestFixture("find")] + public class when_outputting_help_message : ChocolateyListCommandSpecsBase + { + public when_outputting_help_message(string commandName) + { + configuration.CommandName = commandName; + } + + public override void Because() + { + command.help_message(configuration); + } + + [Fact] + public void should_not_output_warnings() + { + MockLogger.Messages.Keys.ShouldNotContain("Warn"); + } } } } diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs index b92bb5fd12..01bf43a1a0 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -307,7 +307,7 @@ public override void Because() public void should_throw_when_Name_is_not_set() { configuration.NewCommand.Name = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -316,11 +316,11 @@ public void should_throw_when_Name_is_not_set() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); } @@ -343,7 +343,7 @@ public override void Because() [Fact] public void should_call_service_noop() { - templateService.Verify(c => c.noop(configuration), Times.Once); + templateService.Verify(c => c.generate_noop(configuration), Times.Once); } } diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs index f32bb8304b..199f31c365 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -137,7 +137,7 @@ public override void Because() } [Fact] - public void should_call_service_oudated_run() + public void should_call_service_outdated_run() { packageService.Verify(c => c.outdated_run(configuration), Times.Once); } diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs index 4db0e87428..3c1209b8cc 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs index b1a2c6ab9d..eb98379abc 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs @@ -157,7 +157,7 @@ public void should_throw_when_more_than_one_unparsed_arg_is_passed() reset(); unparsedArgs.Add("wtf"); unparsedArgs.Add("bbq"); - var errorred = false; + var errored = false; Exception error = null; try @@ -166,11 +166,11 @@ public void should_throw_when_more_than_one_unparsed_arg_is_passed() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldContain("A single pin command must be listed"); @@ -277,7 +277,7 @@ public void should_throw_when_command_is_not_list_and_name_is_not_set() { configuration.PinCommand.Command = PinCommandType.add; configuration.PinCommand.Name = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -286,11 +286,11 @@ public void should_throw_when_command_is_not_list_and_name_is_not_set() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldEqual("When specifying the subcommand '{0}', you must also specify --name.".format_with(configuration.PinCommand.Command.to_string())); diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs index 238420715b..87988a9248 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -107,9 +107,9 @@ public void should_add_short_version_of_apikey_to_the_option_set() } [Fact] - public void should_add_short_version_of_timeout_to_the_option_set() + public void should_not_add_short_version_of_timeout_to_the_option_set() { - optionSet.Contains("t").ShouldBeTrue(); + optionSet.Contains("t").ShouldBeFalse(); } } @@ -150,6 +150,25 @@ public void should_set_the_source_to_default_feed_if_not_set_explicitly() configuration.Sources.ShouldEqual(ApplicationParameters.ChocolateyCommunityFeedPushSource); } + [Fact] + public void should_not_check_for_fallback_community_url() + { + reset(); + configuration.Sources = ""; + configSettingsService.Setup(c => c.get_api_key( + It.Is(config => config.Sources.is_equal_to(ApplicationParameters.ChocolateyCommunityFeedPushSourceOld)), + null)) + .Returns(apiKey); + because(); + + configuration.Sources.ShouldEqual(ApplicationParameters.ChocolateyCommunityFeedPushSource); + configSettingsService.Verify(c => c.get_api_key( + It.Is(config => config.Sources.is_equal_to(ApplicationParameters.ChocolateyCommunityFeedPushSourceOld)), + null), + Times.Never); + configuration.PushCommand.Key.ShouldNotEqual(apiKey); + } + [Fact] public void should_not_set_the_apiKey_if_source_is_not_found() { @@ -211,7 +230,7 @@ public override void Because() public void should_throw_when_source_is_not_set() { configuration.Sources = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -220,11 +239,11 @@ public void should_throw_when_source_is_not_set() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldContain("Source is required."); @@ -235,7 +254,7 @@ public void should_throw_when_apiKey_has_not_been_set_or_determined_for_a_https_ { configuration.Sources = "https://somewhere/out/there"; configuration.PushCommand.Key = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -244,11 +263,11 @@ public void should_throw_when_apiKey_has_not_been_set_or_determined_for_a_https_ } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldContain("ApiKey was not found"); @@ -284,7 +303,7 @@ public void should_throw_when_source_is_http_and_not_secure() configuration.Sources = "http://somewhere/out/there"; configuration.PushCommand.Key = "bob"; configuration.Force = false; - var errorred = false; + var errored = false; Exception error = null; try @@ -293,11 +312,11 @@ public void should_throw_when_source_is_http_and_not_secure() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldContain("WARNING! The specified source '{0}' is not secure".format_with(configuration.Sources)); diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs index b4d00c03d7..d6eab68b66 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs @@ -168,7 +168,7 @@ public void should_throw_when_more_than_one_unparsed_arg_is_passed() reset(); unparsedArgs.Add("wtf"); unparsedArgs.Add("bbq"); - var errorred = false; + var errored = false; Exception error = null; try @@ -177,11 +177,11 @@ public void should_throw_when_more_than_one_unparsed_arg_is_passed() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); error.Message.ShouldContain("A single sources command must be listed"); @@ -297,7 +297,7 @@ private void verify_exception_thrown_on_command(string expectedMessage) { configuration.SourceCommand.Command = SourceCommandType.add; - var errorred = false; + var errored = false; Exception error = null; try @@ -306,11 +306,11 @@ private void verify_exception_thrown_on_command(string expectedMessage) } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); var commandName = configuration.SourceCommand.Command.to_string(); diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs new file mode 100644 index 0000000000..223af9dc63 --- /dev/null +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs @@ -0,0 +1,308 @@ +// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2011 - 2017 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. + +namespace chocolatey.tests.infrastructure.app.commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using chocolatey.infrastructure.app.attributes; + using chocolatey.infrastructure.app.commands; + using chocolatey.infrastructure.app.configuration; + using chocolatey.infrastructure.app.domain; + using chocolatey.infrastructure.app.services; + using chocolatey.infrastructure.commandline; + using chocolatey.infrastructure.filesystem; + using Moq; + using Should; + + public class ChocolateyTemplateCommandSpecs + { + public abstract class ChocolateyTemplateCommandSpecsBase : TinySpec + { + protected ChocolateyTemplateCommand command; + protected Mock templateService = new Mock(); + protected ChocolateyConfiguration configuration = new ChocolateyConfiguration(); + + public override void Context() + { + command = new ChocolateyTemplateCommand(templateService.Object); + } + + public void reset() + { + templateService.ResetCalls(); + } + } + + public class when_implementing_command_for : ChocolateyTemplateCommandSpecsBase + { + private List results; + + public override void Because() + { + results = command.GetType().GetCustomAttributes(typeof(CommandForAttribute), false).Cast().Select(a => a.CommandName).ToList(); + } + + [Fact] + public void should_implement_help() + { + results.ShouldContain("template"); + results.ShouldContain("templates"); + } + } + + public class when_configurating_the_argument_parser : ChocolateyTemplateCommandSpecsBase + { + private OptionSet optionSet; + + public override void Context() + { + base.Context(); + optionSet = new OptionSet(); + } + + public override void Because() + { + command.configure_argument_parser(optionSet, configuration); + } + + [Fact] + public void should_add_name_to_the_option_set() + { + optionSet.Contains("name").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_name_to_the_option_set() + { + optionSet.Contains("n").ShouldBeTrue(); + } + } + + + public class when_handling_additional_argument_parsing : ChocolateyTemplateCommandSpecsBase + { + private readonly IList unparsedArgs = new List(); + private Action because; + + public override void Because() + { + because = () => command.handle_additional_argument_parsing(unparsedArgs, configuration); + } + + public new void reset() + { + configuration.TemplateCommand.Name = string.Empty; + configuration.TemplateCommand.Command = TemplateCommandType.unknown; + unparsedArgs.Clear(); + base.reset(); + } + + [Fact] + public void should_use_the_first_unparsed_arg_as_the_subcommand() + { + reset(); + unparsedArgs.Add("list"); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.list); + } + + [Fact] + public void should_throw_when_more_than_one_unparsed_arg_is_passed() + { + reset(); + unparsedArgs.Add("badcommand"); + unparsedArgs.Add("bbq"); + var errorred = false; + Exception error = null; + + try + { + because(); + } + catch (Exception ex) + { + errorred = true; + error = ex; + } + + errorred.ShouldBeTrue(); + error.ShouldNotBeNull(); + error.ShouldBeType(); + error.Message.ShouldContain("A single template command must be listed"); + } + + [Fact] + public void should_accept_list_as_the_subcommand() + { + reset(); + unparsedArgs.Add("list"); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.list); + } + + [Fact] + public void should_accept_uppercase_list_as_the_subcommand() + { + reset(); + unparsedArgs.Add("LIST"); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.list); + } + + [Fact] + public void should_accept_info_as_the_subcommand() + { + reset(); + unparsedArgs.Add("info"); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.info); + } + + [Fact] + public void should_accept_uppercase_info_as_the_subcommand() + { + reset(); + unparsedArgs.Add("INFO"); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.info); + } + + [Fact] + public void should_set_unrecognized_values_to_list_as_the_subcommand() + { + reset(); + unparsedArgs.Add("badcommand"); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.list); + } + + [Fact] + public void should_default_to_list_as_the_subcommand() + { + reset(); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.list); + } + + [Fact] + public void should_handle_passing_in_an_empty_string() + { + reset(); + unparsedArgs.Add(" "); + because(); + + configuration.TemplateCommand.Command.ShouldEqual(TemplateCommandType.list); + } + } + + public class when_handling_validation : ChocolateyTemplateCommandSpecsBase + { + private Action because; + + public override void Because() + { + because = () => command.handle_validation(configuration); + } + + [Fact] + public void should_continue_when_command_is_list_and_name_is_set() + { + configuration.TemplateCommand.Command = TemplateCommandType.list; + configuration.TemplateCommand.Name = "bob"; + because(); + } + + [Fact] + public void should_continue_when_command_is_list_and_name_is_not_set() + { + configuration.TemplateCommand.Command = TemplateCommandType.list; + configuration.TemplateCommand.Name = ""; + because(); + } + + [Fact] + public void should_throw_when_command_is_info_and_name_is_not_set() + { + configuration.TemplateCommand.Command = TemplateCommandType.info; + configuration.TemplateCommand.Name = ""; + var errorred = false; + Exception error = null; + + try + { + because(); + } + catch (Exception ex) + { + errorred = true; + error = ex; + } + + errorred.ShouldBeTrue(); + error.ShouldNotBeNull(); + error.ShouldBeType(); + error.Message.ShouldEqual("When specifying the subcommand '{0}', you must also specify --name.".format_with(configuration.TemplateCommand.Command.to_string())); + } + + [Fact] + public void should_continue_when_command_info_and_name_is_set() + { + configuration.TemplateCommand.Command = TemplateCommandType.info; + configuration.TemplateCommand.Name = "bob"; + because(); + } + } + + public class when_noop_is_called : ChocolateyTemplateCommandSpecsBase + { + public override void Because() + { + configuration.TemplateCommand.Command = TemplateCommandType.list; + command.noop(configuration); + } + + [Fact] + public void should_call_service_list_noop() + { + templateService.Verify(c => c.list_noop(configuration), Times.Once); + } + } + + public class when_run_is_called : ChocolateyTemplateCommandSpecsBase + { + public override void Because() + { + configuration.TemplateCommand.Command = TemplateCommandType.list; + command.run(configuration); + } + + [Fact] + public void should_call_service_list() + { + templateService.Verify(c => c.list(configuration), Times.Once); + } + } + } +} diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs index 5aaf8f7313..ecba458585 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -169,6 +169,18 @@ public void should_add_short_version_of_skippowershell_to_the_option_set() { optionSet.Contains("n").ShouldBeTrue(); } + + [Fact] + public void should_add_skip_hooks_to_the_option_set() + { + optionSet.Contains("skip-hooks").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_skip_hooks_to_the_option_set() + { + optionSet.Contains("skiphooks").ShouldBeTrue(); + } } public class when_handling_additional_argument_parsing : ChocolateyUninstallCommandSpecsBase @@ -204,7 +216,7 @@ public override void Because() public void should_throw_when_packagenames_is_not_set() { configuration.PackageNames = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -213,11 +225,11 @@ public void should_throw_when_packagenames_is_not_set() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); } diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs index 86f4b99cfe..a0a940b1b0 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs index 1663a863ac..50ba3eccf8 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -217,6 +217,36 @@ public void should_add_short_version_of_password_to_the_option_set() { optionSet.Contains("p").ShouldBeTrue(); } + + [Fact] + public void should_add_pin_to_the_option_set() + { + optionSet.Contains("pinpackage").ShouldBeTrue(); + } + + [Fact] + public void should_add_long_version_of_pin_to_the_option_set() + { + optionSet.Contains("pin-package").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_pin_to_the_option_set() + { + optionSet.Contains("pin").ShouldBeTrue(); + } + + [Fact] + public void should_add_skip_hooks_to_the_option_set() + { + optionSet.Contains("skip-hooks").ShouldBeTrue(); + } + + [Fact] + public void should_add_short_version_of_skip_hooks_to_the_option_set() + { + optionSet.Contains("skiphooks").ShouldBeTrue(); + } } public class when_handling_additional_argument_parsing : ChocolateyUpgradeCommandSpecsBase @@ -252,7 +282,7 @@ public override void Because() public void should_throw_when_packagenames_is_not_set() { configuration.PackageNames = ""; - var errorred = false; + var errored = false; Exception error = null; try @@ -261,11 +291,11 @@ public void should_throw_when_packagenames_is_not_set() } catch (Exception ex) { - errorred = true; + errored = true; error = ex; } - errorred.ShouldBeTrue(); + errored.ShouldBeTrue(); error.ShouldNotBeNull(); error.ShouldBeType(); } diff --git a/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs b/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs index 81df472ad5..c47a3efcce 100644 --- a/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs +++ b/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -67,6 +67,7 @@ public override void BeforeEachSpec() validateConfiguration = () => { }; helpMessage = () => { }; helpMessageContents.Clear(); + ConfigurationOptions.reset_options(); } } diff --git a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs index 72cb221b63..03d31f27c2 100644 --- a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -24,7 +24,7 @@ namespace chocolatey.tests.infrastructure.app.nuget using NuGet; using Should; - public class NugetCommonSpecs + public class NugetCommonSpecs { private class when_gets_remote_repository : TinySpec { @@ -51,7 +51,7 @@ public void should_create_repository_when_source_is_null() { Context(); configuration.Sources = null; - + because(); ((AggregateRepository)packageRepository).Repositories.Count().ShouldEqual(0); diff --git a/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs new file mode 100644 index 0000000000..ac7f21e30d --- /dev/null +++ b/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs @@ -0,0 +1,321 @@ +namespace chocolatey.tests.integration.infrastructure.app.services +{ + using System; + using System.Collections.Generic; + using System.Linq; + using chocolatey.infrastructure.app; + using chocolatey.infrastructure.app.configuration; + using chocolatey.infrastructure.app.services; + using chocolatey.infrastructure.services; + using Moq; + using Should; + using Assert = Should.Core.Assertions.Assert; + + public class ChocolateyConfigSettingsServiceSpecs + { + public abstract class ChocolateyConfigSettingsServiceSpecsBase : TinySpec + { + protected ChocolateyConfigSettingsService Service; + protected readonly Mock XmlService = new Mock(); + + public override void Context() + { + XmlService.ResetCalls(); + } + } + + public class when_ChocolateyConfigSettingsService_disables_available_feature : ChocolateyConfigSettingsServiceSpecsBase + { + public override void Because() + { + var config = new ChocolateyConfiguration() + { + FeatureCommand = new FeatureCommandConfiguration() + { + Name = ApplicationParameters.Features.ChecksumFiles + } + }; + + Service.feature_disable(config); + } + + public override void Context() + { + base.Context(); + + XmlService.Setup(x => x.deserialize(ApplicationParameters.GlobalConfigFileLocation)) + .Returns(new ConfigFileSettings + { + Features = new HashSet() + { + new ConfigFileFeatureSetting() + { + Name = ApplicationParameters.Features.ChecksumFiles + } + } + }); + + Service = new ChocolateyConfigSettingsService(XmlService.Object); + } + + [Fact] + public void should_not_report_feature_being_unsupported() + { + MockLogger.Messages["Warn"].ShouldNotContain("Feature '{0}' is not supported. Any change have no effect on running Chocolatey.".format_with(ApplicationParameters.Features.ChecksumFiles)); + } + + [Fact] + public void should_report_feature_being_disabled() + { + MockLogger.Messages.Keys.ShouldContain("Warn"); + MockLogger.Messages["Warn"].ShouldContain("Disabled {0}".format_with(ApplicationParameters.Features.ChecksumFiles)); + } + + [Fact] + public void should_serialize_feature_correctly() + { + XmlService.Verify(x => x.serialize(It.Is(config => + config.Features.Any(f => + f.Name == ApplicationParameters.Features.ChecksumFiles && f.SetExplicitly && !f.Enabled)), ApplicationParameters.GlobalConfigFileLocation), Times.Once); + } + } + + public class when_ChocolateyConfigSettingsService_disables_unknown_feature : ChocolateyConfigSettingsServiceSpecsBase + { + public override void Because() + { + } + + public override void Context() + { + base.Context(); + + XmlService.Setup(x => x.deserialize(ApplicationParameters.GlobalConfigFileLocation)) + .Returns(new ConfigFileSettings + { + Features = new HashSet() + }); + + Service = new ChocolateyConfigSettingsService(XmlService.Object); + } + + [Fact] + public void should_not_contain_any_warnings() + { + MockLogger.Messages.Keys.ShouldNotContain("Warn"); + } + + [Fact] + public void should_throw_exception_on_unknown_feature() + { + Assert.ThrowsDelegate action = () => + { + var config = new ChocolateyConfiguration() + { + FeatureCommand = new FeatureCommandConfiguration() + { + Name = "unknown" + } + }; + + Service.feature_disable(config); + }; + + Assert.Throws(action) + .Message.ShouldEqual("Feature 'unknown' not found"); + } + } + + public class when_ChocolateyConfigSettingsService_disables_unsupported_feature : ChocolateyConfigSettingsServiceSpecsBase + { + private const string FEATURE_NAME = "scriptsCheckLastExitCode"; + + public override void Because() + { + } + + public override void Context() + { + base.Context(); + + XmlService.Setup(x => x.deserialize(ApplicationParameters.GlobalConfigFileLocation)) + .Returns(new ConfigFileSettings + { + Features = new HashSet() + { + new ConfigFileFeatureSetting() + { + Name = FEATURE_NAME + } + } + }); + + Service = new ChocolateyConfigSettingsService(XmlService.Object); + } + + [Fact] + public void should_throw_exception_on_unsupported_feature() + { + Assert.Throws(() => + { + var config = new ChocolateyConfiguration() + { + FeatureCommand = new FeatureCommandConfiguration() + { + Name = FEATURE_NAME + } + }; + + Service.feature_disable(config); + }).Message.ShouldEqual("Feature '{0}' is not supported.".format_with(FEATURE_NAME)); + } + } + + public class when_ChocolateyConfigSettingsService_enables_available_feature : ChocolateyConfigSettingsServiceSpecsBase + { + public override void Because() + { + var config = new ChocolateyConfiguration() + { + FeatureCommand = new FeatureCommandConfiguration() + { + Name = ApplicationParameters.Features.ChecksumFiles + } + }; + + Service.feature_enable(config); + } + + public override void Context() + { + base.Context(); + + XmlService.Setup(x => x.deserialize(ApplicationParameters.GlobalConfigFileLocation)) + .Returns(new ConfigFileSettings + { + Features = new HashSet() + { + new ConfigFileFeatureSetting() + { + Name = ApplicationParameters.Features.ChecksumFiles + } + } + }); + + Service = new ChocolateyConfigSettingsService(XmlService.Object); + } + + [Fact] + public void should_not_report_feature_being_unsupported() + { + MockLogger.Messages["Warn"].ShouldNotContain("Feature '{0}' is not supported. Any change have no effect on running Chocolatey.".format_with(ApplicationParameters.Features.ChecksumFiles)); + } + + [Fact] + public void should_report_feature_being_enabled() + { + MockLogger.Messages.Keys.ShouldContain("Warn"); + MockLogger.Messages["Warn"].ShouldContain("Enabled {0}".format_with(ApplicationParameters.Features.ChecksumFiles)); + } + + [Fact] + public void should_serialize_feature_correctly() + { + XmlService.Verify(x => x.serialize(It.Is(config => + config.Features.Any(f => + f.Name == ApplicationParameters.Features.ChecksumFiles && f.SetExplicitly && f.Enabled)), ApplicationParameters.GlobalConfigFileLocation), Times.Once); + } + } + + public class when_ChocolateyConfigSettingsService_enables_unknown_feature : ChocolateyConfigSettingsServiceSpecsBase + { + public override void Because() + { + } + + public override void Context() + { + base.Context(); + + XmlService.Setup(x => x.deserialize(ApplicationParameters.GlobalConfigFileLocation)) + .Returns(new ConfigFileSettings + { + Features = new HashSet() + }); + + Service = new ChocolateyConfigSettingsService(XmlService.Object); + } + + [Fact] + public void should_not_contain_any_warnings() + { + MockLogger.Messages.Keys.ShouldNotContain("Warn"); + } + + [Fact] + public void should_throw_exception_on_unknown_feature() + { + Assert.ThrowsDelegate action = () => + { + var config = new ChocolateyConfiguration() + { + FeatureCommand = new FeatureCommandConfiguration() + { + Name = "unknown" + } + }; + + Service.feature_enable(config); + }; + + Assert.Throws(action) + .Message.ShouldEqual("Feature 'unknown' not found"); + } + } + + public class when_ChocolateyConfigSettingsService_enables_unsupported_feature : ChocolateyConfigSettingsServiceSpecsBase + { + private const string FEATURE_NAME = "scriptsCheckLastExitCode"; + + public override void Because() + { + } + + public override void Context() + { + base.Context(); + + XmlService.Setup(x => x.deserialize(ApplicationParameters.GlobalConfigFileLocation)) + .Returns(new ConfigFileSettings + { + Features = new HashSet() + { + new ConfigFileFeatureSetting() + { + Name = FEATURE_NAME + } + } + }); + + Service = new ChocolateyConfigSettingsService(XmlService.Object); + } + + [Fact] + public void should_throw_exception_on_unsupported_feature() + { + Assert.Throws(() => + { + var config = new ChocolateyConfiguration() + { + FeatureCommand = new FeatureCommandConfiguration() + { + Name = FEATURE_NAME + } + }; + + Service.feature_enable(config); + }).Message.ShouldEqual("Feature '{0}' is not supported.".format_with(FEATURE_NAME)); + } + } + } +} \ No newline at end of file diff --git a/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs new file mode 100644 index 0000000000..43317e0198 --- /dev/null +++ b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs @@ -0,0 +1,145 @@ +// Copyright © 2017 - 2022 Chocolatey Software, Inc +// Copyright © 2011 - 2017 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. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.services; +using Moq; +using NuGet; +using NUnit.Framework; +using Should; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + +namespace chocolatey.tests.infrastructure.app.services +{ + public class ChocolateyPackageServiceSpecs + { + public abstract class ChocolateyPackageServiceSpecsBase : TinySpec + { + protected ChocolateyPackageService Service; + protected Mock NugetService = new Mock(); + protected Mock PowershellService = new Mock(); + protected List SourceRunners = new List(); + protected Mock ShimGenerationService = new Mock(); + protected Mock FileSystem = new Mock(); + protected Mock RegistryService = new Mock(); + protected Mock ChocolateyPackageInformationService = new Mock(); + protected Mock FilesService = new Mock(); + protected Mock AutomaticUninstallerService = new Mock(); + protected Mock XmlService = new Mock(); + protected Mock ConfigTransformService = new Mock(); + + protected ChocolateyConfiguration Configuration = new ChocolateyConfiguration(); + + public override void Context() + { + NugetService.ResetCalls(); + PowershellService.ResetCalls(); + ShimGenerationService.ResetCalls(); + FileSystem.ResetCalls(); + RegistryService.ResetCalls(); + ChocolateyPackageInformationService.ResetCalls(); + FilesService.ResetCalls(); + AutomaticUninstallerService.ResetCalls(); + XmlService.ResetCalls(); + ConfigTransformService.ResetCalls(); + Service = new ChocolateyPackageService(NugetService.Object, PowershellService.Object, SourceRunners, ShimGenerationService.Object, FileSystem.Object, RegistryService.Object, ChocolateyPackageInformationService.Object, FilesService.Object, AutomaticUninstallerService.Object, XmlService.Object, ConfigTransformService.Object); + } + } + + public class when_ChocolateyPackageService_install_from_package_config_with_custom_sources : ChocolateyPackageServiceSpecsBase + { + protected Mock FeaturesRunner = new Mock(); + protected Mock NormalRunner = new Mock(); + private ConcurrentDictionary result; + + public override void Context() + { + base.Context(); + + Configuration.PackageNames = @"C:\test\packages.config"; + Configuration.Sources = @"C:\test"; + + NormalRunner.Setup(r => r.SourceType).Returns(SourceTypes.NORMAL); + FeaturesRunner.Setup(r => r.SourceType).Returns(SourceTypes.WINDOWS_FEATURES); + + var package = new Mock(); + var expectedResult = new ConcurrentDictionary(); + expectedResult.TryAdd("test-feature", new PackageResult(package.Object, "windowsfeatures", null)); + + FeaturesRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>())) + .Returns(expectedResult); + NormalRunner.Setup(r => r.install_run(It.IsAny(), It.IsAny>())) + .Returns(new ConcurrentDictionary()); + SourceRunners.AddRange(new[] { NormalRunner.Object, FeaturesRunner.Object }); + + FileSystem.Setup(f => f.get_full_path(Configuration.PackageNames)).Returns(Configuration.PackageNames); + FileSystem.Setup(f => f.file_exists(Configuration.PackageNames)).Returns(true); + + XmlService.Setup(x => x.deserialize(Configuration.PackageNames)) + .Returns(new PackagesConfigFileSettings + { + Packages = new HashSet + { + new PackagesConfigFilePackageSetting + { + Id = "test-feature", + Source = "windowsfeatures" + } + } + }); + } + + public override void Because() + { + result = Service.install_run(Configuration); + } + + [Test] + public void should_return_package_that_should_have_been_installed() + { + result.Keys.ShouldContain("test-feature"); + } + + [Test] + public void should_have_called_runner_for_windows_features_source() + { + FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames == "test-feature"), It.IsAny>()), Times.Once); + } + + [Test] + public void should_not_have_called_runner_for_windows_features_source_with_other_package_names() + { + FeaturesRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != "test-feature"), It.IsAny>()), Times.Never); + } + + [Test] + public void should_not_have_called_normal_source_runner_for_non_empty_packages() + { + // The normal source runners will be called with an argument + NormalRunner.Verify(r => r.install_run(It.Is(c => c.PackageNames != string.Empty), It.IsAny>()), Times.Never); + } + } + } +} diff --git a/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs index 469980fe7a..b6032c8bc2 100644 --- a/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs index 4cf8378767..a68b6d17b2 100644 --- a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs index 0d0f32bcd1..1868a3c700 100644 --- a/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -144,6 +144,6 @@ public void should_return_null_key() } } - //todo a subkey that exists only in 32 bit mode (must create it to test it though) + //todo: #2580 a subkey that exists only in 32 bit mode (must create it to test it though) } } diff --git a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs index 2f9eef87e5..82db549daa 100644 --- a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs @@ -1,428 +1,868 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc -// Copyright © 2011 - 2017 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. - -namespace chocolatey.tests.infrastructure.app.services -{ - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.app.templates; - using chocolatey.infrastructure.filesystem; - using Moq; - using NUnit.Framework; - using Should; - - public class TemplateServiceSpecs - { - public abstract class TemplateServiceSpecsBase : TinySpec - { - protected TemplateService service; - protected Mock fileSystem = new Mock(); - - public override void Context() - { - fileSystem.ResetCalls(); - - service = new TemplateService(fileSystem.Object); - } - } - - public class when_noop_is_called : TemplateServiceSpecsBase - { - private Action because; - private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); - - public override void Context() - { - base.Context(); - fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); - fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) - .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); - config.NewCommand.Name = "Bob"; - } - - public override void Because() - { - because = () => service.noop(config); - } - - public override void BeforeEachSpec() - { - MockLogger.reset(); - } - - [Fact] - public void should_log_current_directory_if_no_outputdirectory() - { - because(); - - var infos = MockLogger.MessagesFor(LogLevel.Info); - infos.Count.ShouldEqual(1); - infos[0].ShouldEqual("Would have generated a new package specification at c:\\chocolatey\\Bob"); - } - - [Fact] - public void should_log_output_directory_if_outputdirectory_is_specified() - { - config.OutputDirectory = "c:\\packages"; - - because(); - - var infos = MockLogger.MessagesFor(LogLevel.Info); - infos.Count.ShouldEqual(1); - infos[0].ShouldEqual("Would have generated a new package specification at c:\\packages\\Bob"); - } - } - - public class when_generate_file_from_template_is_called : TemplateServiceSpecsBase - { - private Action because; - private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); - private readonly TemplateValues templateValues = new TemplateValues(); - private readonly string template = "[[PackageName]]"; - private const string fileLocation = "c:\\packages\\bob.nuspec"; - private string fileContent; - - public override void Context() - { - base.Context(); - - fileSystem.Setup(x => x.write_file(It.Is((string fl) => fl == fileLocation), It.IsAny(), Encoding.UTF8)) - .Callback((string filePath, string fileContent, Encoding encoding) => this.fileContent = fileContent); - - templateValues.PackageName = "Bob"; - } - - public override void Because() - { - because = () => service.generate_file_from_template(config, templateValues, template, fileLocation, Encoding.UTF8); - } - - public override void BeforeEachSpec() - { - MockLogger.reset(); - } - - [Fact] - public void should_write_file_withe_replaced_tokens() - { - because(); - - var debugs = MockLogger.MessagesFor(LogLevel.Debug); - debugs.Count.ShouldEqual(1); - debugs[0].ShouldEqual("Bob"); - } - - [Fact] - public void should_log_info_if_regular_output() - { - config.RegularOutput = true; - - because(); - - var debugs = MockLogger.MessagesFor(LogLevel.Debug); - debugs.Count.ShouldEqual(1); - debugs[0].ShouldEqual("Bob"); - - var infos = MockLogger.MessagesFor(LogLevel.Info); - infos.Count.ShouldEqual(1); - infos[0].ShouldEqual(string.Format(@"Generating template to a file{0} at 'c:\packages\bob.nuspec'", Environment.NewLine)); - } - } - - public class when_generate_is_called_with_existing_directory : TemplateServiceSpecsBase - { - private Action because; - private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); - private string verifiedDirectoryPath; - - public override void Context() - { - base.Context(); - - fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); - fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) - .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); - fileSystem.Setup(x => x.directory_exists(It.IsAny())).Returns( - x => - { - verifiedDirectoryPath = x; - return true; - }); - - config.NewCommand.Name = "Bob"; - } - - public override void Because() - { - because = () => service.generate(config); - } - - public override void BeforeEachSpec() - { - MockLogger.reset(); - } - - [Fact] - public void should_throw_exception() - { - bool errored = false; - string errorMessage = string.Empty; - - try - { - because(); - } - catch (ApplicationException ex) - { - errored = true; - errorMessage = ex.Message; - } - - errored.ShouldBeTrue(); - errorMessage.ShouldEqual(string.Format("The location for the template already exists. You can:{0} 1. Remove 'c:\\chocolatey\\Bob'{0} 2. Use --force{0} 3. Specify a different name", Environment.NewLine)); - verifiedDirectoryPath.ShouldEqual("c:\\chocolatey\\Bob"); - } - - [Fact] - public void should_throw_exception_even_with_outputdirectory() - { - config.OutputDirectory = "c:\\packages"; - - bool errored = false; - string errorMessage = string.Empty; - - try - { - because(); - } - catch (ApplicationException ex) - { - errored = true; - errorMessage = ex.Message; - } - - errored.ShouldBeTrue(); - errorMessage.ShouldEqual(string.Format("The location for the template already exists. You can:{0} 1. Remove 'c:\\packages\\Bob'{0} 2. Use --force{0} 3. Specify a different name", Environment.NewLine)); - verifiedDirectoryPath.ShouldEqual("c:\\packages\\Bob"); - } - } - - public class when_generate_is_called : TemplateServiceSpecsBase - { - private Action because; - private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); - private readonly List files = new List(); - private readonly HashSet directoryCreated = new HashSet(StringComparer.InvariantCultureIgnoreCase); - private readonly UTF8Encoding utf8WithoutBOM = new UTF8Encoding(false); - - public override void Context() - { - base.Context(); - - fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); - fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) - .Returns( - (string a, string[] b) => - { - if (a.EndsWith("templates") && b[0] == "default") - { - return "templates\\default"; - } - return a + "\\" + b[0]; - }); - fileSystem.Setup(x => x.directory_exists(It.IsAny())).Returns(dirPath => dirPath.EndsWith("templates\\default")); - fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), Encoding.UTF8)) - .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); - fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), utf8WithoutBOM)) - .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); - fileSystem.Setup(x => x.delete_directory_if_exists(It.IsAny(), true)); - fileSystem.Setup(x => x.create_directory_if_not_exists(It.IsAny())).Callback( - (string directory) => - { - if (!string.IsNullOrWhiteSpace(directory)) - { - directoryCreated.Add(directory); - } - }); - fileSystem.Setup(x => x.get_files(It.IsAny(), "*.*", SearchOption.AllDirectories)).Returns(new[] { "templates\\default\\template.nuspec", "templates\\default\\random.txt" }); - fileSystem.Setup(x => x.get_directory_name(It.IsAny())).Returns(file => Path.GetDirectoryName(file)); - fileSystem.Setup(x => x.get_file_extension(It.IsAny())).Returns(file => Path.GetExtension(file)); - fileSystem.Setup(x => x.read_file(It.IsAny())).Returns(string.Empty); - - config.NewCommand.Name = "Bob"; - } - - public override void Because() - { - because = () => service.generate(config); - } - - public override void BeforeEachSpec() - { - MockLogger.reset(); - files.Clear(); - directoryCreated.Clear(); - } - - [Fact] - public void should_generate_all_files_and_directories() - { - because(); - - var directories = directoryCreated.ToList(); - directories.Count.ShouldEqual(2, "There should be 2 directories, but there was: " + string.Join(", ", directories)); - directories[0].ShouldEqual("c:\\chocolatey\\Bob"); - directories[1].ShouldEqual("c:\\chocolatey\\Bob\\tools"); - - files.Count.ShouldEqual(2, "There should be 2 files, but there was: " + string.Join(", ", files)); - files[0].ShouldEqual("c:\\chocolatey\\Bob\\__name_replace__.nuspec"); - files[1].ShouldEqual("c:\\chocolatey\\Bob\\random.txt"); - - MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\chocolatey\Bob'", Environment.NewLine)); - } - - [Fact] - public void should_generate_all_files_and_directories_even_with_outputdirectory() - { - config.OutputDirectory = "c:\\packages"; - - because(); - - var directories = directoryCreated.ToList(); - directories.Count.ShouldEqual(2, "There should be 2 directories, but there was: " + string.Join(", ", directories)); - directories[0].ShouldEqual("c:\\packages\\Bob"); - directories[1].ShouldEqual("c:\\packages\\Bob\\tools"); - - files.Count.ShouldEqual(2, "There should be 2 files, but there was: " + string.Join(", ", files)); - files[0].ShouldEqual("c:\\packages\\Bob\\__name_replace__.nuspec"); - files[1].ShouldEqual("c:\\packages\\Bob\\random.txt"); - - MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\packages\Bob'", Environment.NewLine)); - } - } - - public class when_generate_is_called_with_nested_folders : TemplateServiceSpecsBase - { - private Action because; - private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); - private readonly List files = new List(); - private readonly HashSet directoryCreated = new HashSet(StringComparer.InvariantCultureIgnoreCase); - private readonly UTF8Encoding utf8WithoutBOM = new UTF8Encoding(false); - - public override void Context() - { - base.Context(); - - fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); - fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) - .Returns( - (string a, string[] b) => - { - if (a.EndsWith("templates") && b[0] == "test") - { - return "templates\\test"; - } - return a + "\\" + b[0]; - }); - fileSystem.Setup(x => x.directory_exists(It.IsAny())).Returns(dirPath => dirPath.EndsWith("templates\\test")); - fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), Encoding.UTF8)) - .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); - fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), utf8WithoutBOM)) - .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); - fileSystem.Setup(x => x.delete_directory_if_exists(It.IsAny(), true)); - fileSystem.Setup(x => x.get_files(It.IsAny(), "*.*", SearchOption.AllDirectories)) - .Returns(new[] { "templates\\test\\template.nuspec", "templates\\test\\random.txt", "templates\\test\\tools\\chocolateyInstall.ps1", "templates\\test\\tools\\lower\\another.ps1" }); - fileSystem.Setup(x => x.create_directory_if_not_exists(It.IsAny())).Callback( - (string directory) => - { - if (!string.IsNullOrWhiteSpace(directory)) - { - directoryCreated.Add(directory); - } - }); - fileSystem.Setup(x => x.get_directory_name(It.IsAny())).Returns(file => Path.GetDirectoryName(file)); - fileSystem.Setup(x => x.get_file_extension(It.IsAny())).Returns(file => Path.GetExtension(file)); - fileSystem.Setup(x => x.read_file(It.IsAny())).Returns(string.Empty); - - config.NewCommand.Name = "Bob"; - config.NewCommand.TemplateName = "test"; - } - - public override void Because() - { - because = () => service.generate(config); - } - - public override void BeforeEachSpec() - { - MockLogger.reset(); - files.Clear(); - directoryCreated.Clear(); - } - - [Fact] - [WindowsOnly] - [Platform(Exclude = "Mono")] - public void should_generate_all_files_and_directories() - { - because(); - - var directories = directoryCreated.ToList(); - directories.Count.ShouldEqual(3, "There should be 3 directories, but there was: " + string.Join(", ", directories)); - directories[0].ShouldEqual("c:\\chocolatey\\Bob"); - directories[1].ShouldEqual("c:\\chocolatey\\Bob\\tools"); - directories[2].ShouldEqual("c:\\chocolatey\\Bob\\tools\\lower"); - - files.Count.ShouldEqual(4, "There should be 4 files, but there was: " + string.Join(", ", files)); - files[0].ShouldEqual("c:\\chocolatey\\Bob\\__name_replace__.nuspec"); - files[1].ShouldEqual("c:\\chocolatey\\Bob\\random.txt"); - files[2].ShouldEqual("c:\\chocolatey\\Bob\\tools\\chocolateyInstall.ps1"); - files[3].ShouldEqual("c:\\chocolatey\\Bob\\tools\\lower\\another.ps1"); - - MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\chocolatey\Bob'", Environment.NewLine)); - } - - [Fact] - [WindowsOnly] - [Platform(Exclude = "Mono")] - public void should_generate_all_files_and_directories_even_with_outputdirectory() - { - config.OutputDirectory = "c:\\packages"; - - because(); - - var directories = directoryCreated.ToList(); - directories.Count.ShouldEqual(3, "There should be 3 directories, but there was: " + string.Join(", ", directories)); - directories[0].ShouldEqual("c:\\packages\\Bob"); - directories[1].ShouldEqual("c:\\packages\\Bob\\tools"); - directories[2].ShouldEqual("c:\\packages\\Bob\\tools\\lower"); - - files.Count.ShouldEqual(4, "There should be 4 files, but there was: " + string.Join(", ", files)); - files[0].ShouldEqual("c:\\packages\\Bob\\__name_replace__.nuspec"); - files[1].ShouldEqual("c:\\packages\\Bob\\random.txt"); - files[2].ShouldEqual("c:\\packages\\Bob\\tools\\chocolateyInstall.ps1"); - files[3].ShouldEqual("c:\\packages\\Bob\\tools\\lower\\another.ps1"); - - MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\packages\Bob'", Environment.NewLine)); - } - } - } -} +// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2011 - 2017 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. + +namespace chocolatey.tests.infrastructure.app.services +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Text; + using chocolatey.infrastructure.app; + using chocolatey.infrastructure.app.configuration; + using chocolatey.infrastructure.app.services; + using chocolatey.infrastructure.app.templates; + using chocolatey.infrastructure.filesystem; + using chocolatey.infrastructure.services; + using Moq; + using NUnit.Framework; + using Should; + + public class TemplateServiceSpecs + { + public abstract class TemplateServiceSpecsBase : TinySpec + { + protected TemplateService service; + protected Mock fileSystem = new Mock(); + protected Mock xmlService = new Mock(); + + public override void Context() + { + fileSystem.ResetCalls(); + xmlService.ResetCalls(); + + service = new TemplateService(fileSystem.Object, xmlService.Object); + } + } + + public class when_generate_noop_is_called : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + + public override void Context() + { + base.Context(); + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); + config.NewCommand.Name = "Bob"; + } + + public override void Because() + { + because = () => service.generate_noop(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + public void should_log_current_directory_if_no_outputdirectory() + { + because(); + + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(1); + infos[0].ShouldEqual("Would have generated a new package specification at c:\\chocolatey\\Bob"); + } + + [Fact] + public void should_log_output_directory_if_outputdirectory_is_specified() + { + config.OutputDirectory = "c:\\packages"; + + because(); + + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(1); + infos[0].ShouldEqual("Would have generated a new package specification at c:\\packages\\Bob"); + } + } + + public class when_generate_file_from_template_is_called : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private readonly TemplateValues templateValues = new TemplateValues(); + private readonly string template = "[[PackageName]]"; + private const string fileLocation = "c:\\packages\\bob.nuspec"; + private string fileContent; + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.write_file(It.Is((string fl) => fl == fileLocation), It.IsAny(), Encoding.UTF8)) + .Callback((string filePath, string fileContent, Encoding encoding) => this.fileContent = fileContent); + + templateValues.PackageName = "Bob"; + } + + public override void Because() + { + because = () => service.generate_file_from_template(config, templateValues, template, fileLocation, Encoding.UTF8); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + public void should_write_file_withe_replaced_tokens() + { + because(); + + var debugs = MockLogger.MessagesFor(LogLevel.Debug); + debugs.Count.ShouldEqual(1); + debugs[0].ShouldEqual("Bob"); + } + + [Fact] + public void should_log_info_if_regular_output() + { + config.RegularOutput = true; + + because(); + + var debugs = MockLogger.MessagesFor(LogLevel.Debug); + debugs.Count.ShouldEqual(1); + debugs[0].ShouldEqual("Bob"); + + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(1); + infos[0].ShouldEqual(string.Format(@"Generating template to a file{0} at 'c:\packages\bob.nuspec'", Environment.NewLine)); + } + } + + public class when_generate_is_called_with_existing_directory : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private string verifiedDirectoryPath; + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); + fileSystem.Setup(x => x.directory_exists(It.IsAny())).Returns( + x => + { + verifiedDirectoryPath = x; + return true; + }); + + config.NewCommand.Name = "Bob"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + public void should_throw_exception() + { + bool errored = false; + string errorMessage = string.Empty; + + try + { + because(); + } + catch (ApplicationException ex) + { + errored = true; + errorMessage = ex.Message; + } + + errored.ShouldBeTrue(); + errorMessage.ShouldEqual(string.Format("The location for the template already exists. You can:{0} 1. Remove 'c:\\chocolatey\\Bob'{0} 2. Use --force{0} 3. Specify a different name", Environment.NewLine)); + verifiedDirectoryPath.ShouldEqual("c:\\chocolatey\\Bob"); + } + + [Fact] + public void should_throw_exception_even_with_outputdirectory() + { + config.OutputDirectory = "c:\\packages"; + + bool errored = false; + string errorMessage = string.Empty; + + try + { + because(); + } + catch (ApplicationException ex) + { + errored = true; + errorMessage = ex.Message; + } + + errored.ShouldBeTrue(); + errorMessage.ShouldEqual(string.Format("The location for the template already exists. You can:{0} 1. Remove 'c:\\packages\\Bob'{0} 2. Use --force{0} 3. Specify a different name", Environment.NewLine)); + verifiedDirectoryPath.ShouldEqual("c:\\packages\\Bob"); + } + } + + public class when_generate_is_called : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private readonly List files = new List(); + private readonly HashSet directoryCreated = new HashSet(StringComparer.InvariantCultureIgnoreCase); + private readonly UTF8Encoding utf8WithoutBOM = new UTF8Encoding(false); + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns( + (string a, string[] b) => + { + if (a.EndsWith("templates") && b[0] == "default") + { + return "templates\\default"; + } + return a + "\\" + b[0]; + }); + fileSystem.Setup(x => x.directory_exists(It.IsAny())).Returns(dirPath => dirPath.EndsWith("templates\\default")); + fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), Encoding.UTF8)) + .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); + fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), utf8WithoutBOM)) + .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); + fileSystem.Setup(x => x.delete_directory_if_exists(It.IsAny(), true)); + fileSystem.Setup(x => x.create_directory_if_not_exists(It.IsAny())).Callback( + (string directory) => + { + if (!string.IsNullOrWhiteSpace(directory)) + { + directoryCreated.Add(directory); + } + }); + fileSystem.Setup(x => x.get_files(It.IsAny(), "*.*", SearchOption.AllDirectories)).Returns(new[] { "templates\\default\\template.nuspec", "templates\\default\\random.txt" }); + fileSystem.Setup(x => x.get_directory_name(It.IsAny())).Returns(file => Path.GetDirectoryName(file)); + fileSystem.Setup(x => x.get_file_extension(It.IsAny())).Returns(file => Path.GetExtension(file)); + fileSystem.Setup(x => x.read_file(It.IsAny())).Returns(string.Empty); + + config.NewCommand.Name = "Bob"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + files.Clear(); + directoryCreated.Clear(); + } + + [Fact] + public void should_generate_all_files_and_directories() + { + because(); + + var directories = directoryCreated.ToList(); + directories.Count.ShouldEqual(2, "There should be 2 directories, but there was: " + string.Join(", ", directories)); + directories[0].ShouldEqual("c:\\chocolatey\\Bob"); + directories[1].ShouldEqual("c:\\chocolatey\\Bob\\tools"); + + files.Count.ShouldEqual(2, "There should be 2 files, but there was: " + string.Join(", ", files)); + files[0].ShouldEqual("c:\\chocolatey\\Bob\\__name_replace__.nuspec"); + files[1].ShouldEqual("c:\\chocolatey\\Bob\\random.txt"); + + MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\chocolatey\Bob'", Environment.NewLine)); + } + + [Fact] + public void should_generate_all_files_and_directories_even_with_outputdirectory() + { + config.OutputDirectory = "c:\\packages"; + + because(); + + var directories = directoryCreated.ToList(); + directories.Count.ShouldEqual(2, "There should be 2 directories, but there was: " + string.Join(", ", directories)); + directories[0].ShouldEqual("c:\\packages\\Bob"); + directories[1].ShouldEqual("c:\\packages\\Bob\\tools"); + + files.Count.ShouldEqual(2, "There should be 2 files, but there was: " + string.Join(", ", files)); + files[0].ShouldEqual("c:\\packages\\Bob\\__name_replace__.nuspec"); + files[1].ShouldEqual("c:\\packages\\Bob\\random.txt"); + + MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\packages\Bob'", Environment.NewLine)); + } + } + + public class when_generate_is_called_with_nested_folders : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private readonly List files = new List(); + private readonly HashSet directoryCreated = new HashSet(StringComparer.InvariantCultureIgnoreCase); + private readonly UTF8Encoding utf8WithoutBOM = new UTF8Encoding(false); + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns( + (string a, string[] b) => + { + if (a.EndsWith("templates") && b[0] == "test") + { + return "templates\\test"; + } + return a + "\\" + b[0]; + }); + fileSystem.Setup(x => x.directory_exists(It.IsAny())).Returns(dirPath => dirPath.EndsWith("templates\\test")); + fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), Encoding.UTF8)) + .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); + fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), utf8WithoutBOM)) + .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); + fileSystem.Setup(x => x.delete_directory_if_exists(It.IsAny(), true)); + fileSystem.Setup(x => x.get_files(It.IsAny(), "*.*", SearchOption.AllDirectories)) + .Returns(new[] { "templates\\test\\template.nuspec", "templates\\test\\random.txt", "templates\\test\\tools\\chocolateyInstall.ps1", "templates\\test\\tools\\lower\\another.ps1" }); + fileSystem.Setup(x => x.get_directories(It.IsAny(), "*.*", SearchOption.AllDirectories)) + .Returns(new[] { "templates\\test", "templates\\test\\tools", "templates\\test\\tools\\lower" }); + fileSystem.Setup(x => x.create_directory_if_not_exists(It.IsAny())).Callback( + (string directory) => + { + if (!string.IsNullOrWhiteSpace(directory)) + { + directoryCreated.Add(directory); + } + }); + fileSystem.Setup(x => x.get_directory_name(It.IsAny())).Returns(file => Path.GetDirectoryName(file)); + fileSystem.Setup(x => x.get_file_extension(It.IsAny())).Returns(file => Path.GetExtension(file)); + fileSystem.Setup(x => x.read_file(It.IsAny())).Returns(string.Empty); + + config.NewCommand.Name = "Bob"; + config.NewCommand.TemplateName = "test"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + files.Clear(); + directoryCreated.Clear(); + } + + [Fact] + public void should_generate_all_files_and_directories() + { + because(); + + var directories = directoryCreated.ToList(); + directories.Count.ShouldEqual(3, "There should be 3 directories, but there was: " + string.Join(", ", directories)); + directories[0].ShouldEqual("c:\\chocolatey\\Bob"); + directories[1].ShouldEqual("c:\\chocolatey\\Bob\\tools"); + directories[2].ShouldEqual("c:\\chocolatey\\Bob\\tools\\lower"); + + files.Count.ShouldEqual(4, "There should be 4 files, but there was: " + string.Join(", ", files)); + files[0].ShouldEqual("c:\\chocolatey\\Bob\\__name_replace__.nuspec"); + files[1].ShouldEqual("c:\\chocolatey\\Bob\\random.txt"); + files[2].ShouldEqual("c:\\chocolatey\\Bob\\tools\\chocolateyInstall.ps1"); + files[3].ShouldEqual("c:\\chocolatey\\Bob\\tools\\lower\\another.ps1"); + + MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\chocolatey\Bob'", Environment.NewLine)); + } + + [Fact] + public void should_generate_all_files_and_directories_even_with_outputdirectory() + { + config.OutputDirectory = "c:\\packages"; + + because(); + + var directories = directoryCreated.ToList(); + directories.Count.ShouldEqual(3, "There should be 3 directories, but there was: " + string.Join(", ", directories)); + directories[0].ShouldEqual("c:\\packages\\Bob"); + directories[1].ShouldEqual("c:\\packages\\Bob\\tools"); + directories[2].ShouldEqual("c:\\packages\\Bob\\tools\\lower"); + + files.Count.ShouldEqual(4, "There should be 4 files, but there was: " + string.Join(", ", files)); + files[0].ShouldEqual("c:\\packages\\Bob\\__name_replace__.nuspec"); + files[1].ShouldEqual("c:\\packages\\Bob\\random.txt"); + files[2].ShouldEqual("c:\\packages\\Bob\\tools\\chocolateyInstall.ps1"); + files[3].ShouldEqual("c:\\packages\\Bob\\tools\\lower\\another.ps1"); + + MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\packages\Bob'", Environment.NewLine)); + } + } + + public class when_generate_is_called_with_empty_nested_folders : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private readonly List files = new List(); + private readonly HashSet directoryCreated = new HashSet(StringComparer.InvariantCultureIgnoreCase); + private readonly UTF8Encoding utf8WithoutBOM = new UTF8Encoding(false); + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns( + (string a, string[] b) => + { + if (a.EndsWith("templates") && b[0] == "test") + { + return "templates\\test"; + } + return a + "\\" + b[0]; + }); + fileSystem.Setup(x => x.directory_exists(It.IsAny())).Returns(dirPath => dirPath.EndsWith("templates\\test")); + fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), Encoding.UTF8)) + .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); + fileSystem.Setup(x => x.write_file(It.IsAny(), It.IsAny(), utf8WithoutBOM)) + .Callback((string filePath, string fileContent, Encoding encoding) => files.Add(filePath)); + fileSystem.Setup(x => x.delete_directory_if_exists(It.IsAny(), true)); + fileSystem.Setup(x => x.get_files(It.IsAny(), "*.*", SearchOption.AllDirectories)) + .Returns(new[] { "templates\\test\\template.nuspec", "templates\\test\\random.txt", "templates\\test\\tools\\chocolateyInstall.ps1", "templates\\test\\tools\\lower\\another.ps1" }); + fileSystem.Setup(x => x.get_directories(It.IsAny(), "*.*", SearchOption.AllDirectories)) + .Returns(new[] { "templates\\test", "templates\\test\\tools", "templates\\test\\tools\\lower", "templates\\test\\empty", "templates\\test\\empty\\nested" }); + fileSystem.Setup(x => x.create_directory_if_not_exists(It.IsAny())).Callback( + (string directory) => + { + if (!string.IsNullOrWhiteSpace(directory)) + { + directoryCreated.Add(directory); + } + }); + fileSystem.Setup(x => x.get_directory_name(It.IsAny())).Returns(file => Path.GetDirectoryName(file)); + fileSystem.Setup(x => x.get_file_extension(It.IsAny())).Returns(file => Path.GetExtension(file)); + fileSystem.Setup(x => x.read_file(It.IsAny())).Returns(string.Empty); + + config.NewCommand.Name = "Bob"; + config.NewCommand.TemplateName = "test"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + files.Clear(); + directoryCreated.Clear(); + } + + [Fact] + public void should_generate_all_files_and_directories() + { + because(); + + var directories = directoryCreated.ToList(); + directories.Count.ShouldEqual(5, "There should be 5 directories, but there was: " + string.Join(", ", directories)); + directories[0].ShouldEqual("c:\\chocolatey\\Bob"); + directories[1].ShouldEqual("c:\\chocolatey\\Bob\\tools"); + directories[2].ShouldEqual("c:\\chocolatey\\Bob\\tools\\lower"); + directories[3].ShouldEqual("c:\\chocolatey\\Bob\\empty"); + directories[4].ShouldEqual("c:\\chocolatey\\Bob\\empty\\nested"); + + files.Count.ShouldEqual(4, "There should be 4 files, but there was: " + string.Join(", ", files)); + files[0].ShouldEqual("c:\\chocolatey\\Bob\\__name_replace__.nuspec"); + files[1].ShouldEqual("c:\\chocolatey\\Bob\\random.txt"); + files[2].ShouldEqual("c:\\chocolatey\\Bob\\tools\\chocolateyInstall.ps1"); + files[3].ShouldEqual("c:\\chocolatey\\Bob\\tools\\lower\\another.ps1"); + + MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\chocolatey\Bob'", Environment.NewLine)); + } + + [Fact] + public void should_generate_all_files_and_directories_even_with_outputdirectory() + { + config.OutputDirectory = "c:\\packages"; + + because(); + + var directories = directoryCreated.ToList(); + directories.Count.ShouldEqual(5, "There should be 5 directories, but there was: " + string.Join(", ", directories)); + directories[0].ShouldEqual("c:\\packages\\Bob"); + directories[1].ShouldEqual("c:\\packages\\Bob\\tools"); + directories[2].ShouldEqual("c:\\packages\\Bob\\tools\\lower"); + directories[3].ShouldEqual("c:\\packages\\Bob\\empty"); + directories[4].ShouldEqual("c:\\packages\\Bob\\empty\\nested"); + + files.Count.ShouldEqual(4, "There should be 4 files, but there was: " + string.Join(", ", files)); + files[0].ShouldEqual("c:\\packages\\Bob\\__name_replace__.nuspec"); + files[1].ShouldEqual("c:\\packages\\Bob\\random.txt"); + files[2].ShouldEqual("c:\\packages\\Bob\\tools\\chocolateyInstall.ps1"); + files[3].ShouldEqual("c:\\packages\\Bob\\tools\\lower\\another.ps1"); + + MockLogger.MessagesFor(LogLevel.Info).Last().ShouldEqual(string.Format(@"Successfully generated Bob package specification files{0} at 'c:\packages\Bob'", Environment.NewLine)); + } + } + + public class when_generate_is_called_with_defaulttemplatename_in_configuration_but_template_folder_doesnt_exist : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); + + config.NewCommand.Name = "Bob"; + config.DefaultTemplateName = "msi"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_use_null_value_for_template() + { + because(); + + config.NewCommand.TemplateName.ShouldBeNull(); + } + } + + public class when_generate_is_called_with_defaulttemplatename_in_configuration_and_template_folder_exists : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private string verifiedDirectoryPath; + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); + fileSystem.Setup(x => x.directory_exists(Path.Combine(ApplicationParameters.TemplatesLocation, "msi"))).Returns( + x => + { + verifiedDirectoryPath = x; + return true; + }); + + config.NewCommand.Name = "Bob"; + config.DefaultTemplateName = "msi"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_use_template_name_from_configuration() + { + because(); + + config.NewCommand.TemplateName.ShouldEqual("msi"); + } + } + + public class when_generate_is_called_with_defaulttemplatename_in_configuration_and_template_name_option_set : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private string verifiedDirectoryPath; + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); + fileSystem.Setup(x => x.directory_exists(Path.Combine(ApplicationParameters.TemplatesLocation, "zip"))).Returns( + x => + { + verifiedDirectoryPath = x; + return true; + }); + + config.NewCommand.Name = "Bob"; + config.NewCommand.TemplateName = "zip"; + config.DefaultTemplateName = "msi"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_use_template_name_from_command_line_option() + { + because(); + + config.NewCommand.TemplateName.ShouldEqual("zip"); + } + } + + public class when_generate_is_called_with_built_in_option_set : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private string verifiedDirectoryPath; + + public override void Context() + { + base.Context(); + + config.NewCommand.Name = "Bob"; + config.NewCommand.UseOriginalTemplate = true; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_use_null_value_for_template() + { + because(); + + config.NewCommand.TemplateName.ShouldBeNull(); + } + } + + public class when_generate_is_called_with_built_in_option_set_and_defaulttemplate_in_configuration : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private string verifiedDirectoryPath; + + public override void Context() + { + base.Context(); + + config.NewCommand.Name = "Bob"; + config.NewCommand.UseOriginalTemplate = true; + config.DefaultTemplateName = "msi"; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_use_null_value_for_template() + { + because(); + + config.NewCommand.TemplateName.ShouldBeNull(); + } + } + + public class when_generate_is_called_with_built_in_option_set_and_template_name_option_set_and_template_folder_exists : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private string verifiedDirectoryPath; + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); + fileSystem.Setup(x => x.directory_exists(Path.Combine(ApplicationParameters.TemplatesLocation, "zip"))).Returns( + x => + { + verifiedDirectoryPath = x; + return true; + }); + + config.NewCommand.Name = "Bob"; + config.NewCommand.TemplateName = "zip"; + config.NewCommand.UseOriginalTemplate = true; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_use_template_name_from_command_line_option() + { + because(); + + config.NewCommand.TemplateName.ShouldEqual("zip"); + } + } + + public class when_generate_is_called_with_built_in_option_set_and_template_name_option_set_and_defaulttemplatename_set_and_template_folder_exists : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + private string verifiedDirectoryPath; + + public override void Context() + { + base.Context(); + + fileSystem.Setup(x => x.get_current_directory()).Returns("c:\\chocolatey"); + fileSystem.Setup(x => x.combine_paths(It.IsAny(), It.IsAny())) + .Returns((string a, string[] b) => { return a + "\\" + b[0]; }); + fileSystem.Setup(x => x.directory_exists(Path.Combine(ApplicationParameters.TemplatesLocation, "zip"))).Returns( + x => + { + verifiedDirectoryPath = x; + return true; + }); + + config.NewCommand.Name = "Bob"; + config.NewCommand.TemplateName = "zip"; + config.DefaultTemplateName = "msi"; + config.NewCommand.UseOriginalTemplate = true; + } + + public override void Because() + { + because = () => service.generate(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + [WindowsOnly] + [Platform(Exclude = "Mono")] + public void should_use_template_name_from_command_line_option() + { + because(); + + config.NewCommand.TemplateName.ShouldEqual("zip"); + } + } + + public class when_list_noop_is_called : TemplateServiceSpecsBase + { + private Action because; + private readonly ChocolateyConfiguration config = new ChocolateyConfiguration(); + + public override void Because() + { + because = () => service.list_noop(config); + } + + public override void BeforeEachSpec() + { + MockLogger.reset(); + } + + [Fact] + public void should_log_template_location_if_no_template_name() + { + because(); + + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(1); + infos[0].ShouldEqual("Would have listed templates in {0}".format_with(ApplicationParameters.TemplatesLocation)); + } + + [Fact] + public void should_log_template_name_if_template_name() + { + config.TemplateCommand.Name = "msi"; + because(); + + var infos = MockLogger.MessagesFor(LogLevel.Info); + infos.Count.ShouldEqual(1); + infos[0].ShouldEqual("Would have listed information about {0}".format_with(config.TemplateCommand.Name)); + } + } + } +} diff --git a/src/chocolatey.tests/infrastructure.app/utility/ArgumentsUtilitySpecs.cs b/src/chocolatey.tests/infrastructure.app/utility/ArgumentsUtilitySpecs.cs new file mode 100644 index 0000000000..21c9ac2281 --- /dev/null +++ b/src/chocolatey.tests/infrastructure.app/utility/ArgumentsUtilitySpecs.cs @@ -0,0 +1,62 @@ +namespace chocolatey.tests.infrastructure.app.utility +{ + using chocolatey.infrastructure.app.utility; + using NUnit.Framework; + using Should; + + public class ArgumentsUtilitySpecs + { + public abstract class ArgumentsUtilitySpecsBase : TinySpec + { + public override void Context() + { + } + } + + [TestFixture("choco install bob --package-parameters-sensitive=\"/test=bill\"", true)] + [TestFixture("choco install bob -package-parameters-sensitive=\"/test=bill\"", true)] + [TestFixture("choco install bob --install-arguments-sensitive=\"/test=bill\"", true)] + [TestFixture("choco install bob -install-arguments-sensitive=\"/test=bill\"", true)] + [TestFixture("choco apikey -k secretKey -s secretSource", true)] + [TestFixture("choco config set --name=proxyPassword --value=secretPassword", true)] + [TestFixture("choco push package.nupkg -k=secretKey", true)] + [TestFixture("choco source add -n=test -u=bob -p bill", true)] + [TestFixture("choco source add -n=test -u=bob -p=bill", true)] + [TestFixture("choco source add -n=test -u=bob -password=bill", true)] + [TestFixture("choco source add -n=test -cert=text.pfx -cp secretPassword", true)] + [TestFixture("choco source add -n=test -cert=text.pfx -cp=secretPassword", true)] + [TestFixture("choco source add -n=test -cert=text.pfx -certpassword=secretPassword", true)] + [TestFixture("choco push package.nupkg -k secretKey", true)] + [TestFixture("choco push package.nupkg -k=secretKey", true)] + [TestFixture("choco push package.nupkg -key secretKey", true)] + [TestFixture("choco push package.nupkg -key=secretKey", true)] + [TestFixture("choco install bob -apikey=secretKey", true)] + [TestFixture("choco install bob -apikey secretKey", true)] + [TestFixture("choco install bob -api-key=secretKey", true)] + [TestFixture("choco install bob -api-key secretKey", true)] + [TestFixture("choco install bob", false)] + public class when_ArgumentsUtility_is_testing_for_sensitive_parameters : ArgumentsUtilitySpecsBase + { + private bool _result; + private bool _expectedResult; + private string _commandArguments; + + public when_ArgumentsUtility_is_testing_for_sensitive_parameters(string commandArguments, bool expectedResult) + { + _commandArguments = commandArguments; + _expectedResult = expectedResult; + } + + public override void Because() + { + _result = ArgumentsUtility.arguments_contain_sensitive_information(_commandArguments); + } + + [Fact] + public void should_return_expected_result() + { + _result.ShouldEqual(_expectedResult); + } + } + } +} diff --git a/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs new file mode 100644 index 0000000000..568e014955 --- /dev/null +++ b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs @@ -0,0 +1,74 @@ +// Copyright © 2021 - 2021 Chocolatey Software, Inc +// +// 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. + +namespace chocolatey.tests.infrastructure.app.utility +{ + using chocolatey.infrastructure.app.utility; + using chocolatey.infrastructure.app.configuration; + using chocolatey.infrastructure.platforms; + using NUnit.Framework; + using Should; + + public class PackageUtilitySpecs + { + public abstract class PackageUtilitySpecsBase : TinySpec + { + public override void Context() + { + } + } + + + [TestFixture("bob", "", true)] + [TestFixture("", "bob", true)] + [TestFixture("bob", "bob", false)] + [TestFixture("bob", "bob;separatedPackage", false)] + [TestFixture("bob", "C:\\chocolatey-packages\\bob\\bob.1.0.0.nupkg", false)] + [TestFixture("dependency", "C:\\chocolatey-packages\\bob\\bob.1.0.0.nupkg", true)] + [TestFixture("bob", "C:\\chocolatey-packages\\bob\\bob.nuspec", false)] + [TestFixture("dependency", "C:\\chocolatey-packages\\bob\\bob.nuspec", true)] + [TestFixture("bob", "\\bob", false)] + [TestFixture("dependency", "\\bob", true)] + [TestFixture("dependency", "bob", true)] + [TestFixture("dependency", "bob;separatedPackage", true)] + public class when_PackageUtility_is_checking_if_package_is_dependency : PackageUtilitySpecsBase + { + private readonly ChocolateyConfiguration _config = new ChocolateyConfiguration(); + private bool _result; + private bool _expectedResult; + private string _packageName; + + public when_PackageUtility_is_checking_if_package_is_dependency(string packageName, string configNames, bool expectedResult) + { + if (Platform.get_platform() != PlatformType.Windows) configNames = configNames.Replace("\\", "/"); + + _packageName = packageName; + _config.PackageNames = configNames; + _expectedResult = expectedResult; + } + + public override void Because() + { + _result = PackageUtility.package_is_a_dependency(_config, _packageName); + } + + [Fact] + public void should_return_expected_result() + { + _result.ShouldEqual(_expectedResult); + } + } + } +} diff --git a/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs b/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs index 8658297116..20fcbd3287 100644 --- a/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -658,7 +658,7 @@ public void should_error_when_any_choice_not_available_is_given() console.Verify(c => c.ReadLine(), Times.AtLeast(8)); } } - + public class when_prompting_answer_with_dash_with_interactivePrompt : InteractivePromptSpecsBase { private Func prompt; diff --git a/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs b/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs index ccd7f6e15b..f39191418f 100644 --- a/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -153,6 +153,6 @@ public void should_not_call_WaitForExit() { process.Verify(p => p.WaitForExit(It.IsAny()), Times.Never); } - } + } } } diff --git a/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs b/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs index d78484ce9c..eaf079d7a8 100644 --- a/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs b/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs index 026a6c0f6c..6a576e4776 100644 --- a/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs b/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs index f578e88c6f..4606592b51 100644 --- a/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs +++ b/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/cryptography/CrytpoHashProviderSpecs.cs b/src/chocolatey.tests/infrastructure/cryptography/CryptoHashProviderSpecs.cs similarity index 91% rename from src/chocolatey.tests/infrastructure/cryptography/CrytpoHashProviderSpecs.cs rename to src/chocolatey.tests/infrastructure/cryptography/CryptoHashProviderSpecs.cs index c9365da428..003248166c 100644 --- a/src/chocolatey.tests/infrastructure/cryptography/CrytpoHashProviderSpecs.cs +++ b/src/chocolatey.tests/infrastructure/cryptography/CryptoHashProviderSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -26,9 +26,9 @@ namespace chocolatey.tests.infrastructure.cryptography using Moq; using Should; - public class CrytpoHashProviderSpecs + public class CryptoHashProviderSpecs { - public abstract class CrytpoHashProviderSpecsBase : TinySpec + public abstract class CryptoHashProviderSpecsBase : TinySpec { protected CryptoHashProvider Provider; protected Mock FileSystem = new Mock(); @@ -39,7 +39,7 @@ public override void Context() } } - public class when_HashProvider_provides_a_hash : CrytpoHashProviderSpecsBase + public class when_HashProvider_provides_a_hash : CryptoHashProviderSpecsBase { private string result; private readonly string filePath = "c:\\path\\does\\not\\matter.txt"; @@ -66,7 +66,7 @@ public void should_provide_the_correct_hash_based_on_a_checksum() } } - public class when_HashProvider_attempts_to_provide_a_hash_for_a_file_over_2GB : CrytpoHashProviderSpecsBase + public class when_HashProvider_attempts_to_provide_a_hash_for_a_file_over_2GB : CryptoHashProviderSpecsBase { private string result; private readonly string filePath = "c:\\path\\does\\not\\matter.txt"; diff --git a/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs b/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs index cd57d316f8..792317b6e3 100644 --- a/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs +++ b/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs b/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs index 15e04a2017..560752ddaa 100644 --- a/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs +++ b/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs b/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs index 0eec729c0a..4bbc4e8f59 100644 --- a/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs +++ b/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs b/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs index a0bcf9736d..210516fb0e 100644 --- a/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs +++ b/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs b/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs index e60fe43e74..cd3c17b77e 100644 --- a/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs +++ b/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs b/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs index b3e02ebc0f..66c069d19b 100644 --- a/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs +++ b/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs b/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs index 9b502ca2ce..7fccd56dbe 100644 --- a/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs +++ b/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs b/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs index acdf73af88..61eab919b9 100644 --- a/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs +++ b/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs b/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs index 998c72cea5..cfb6cef6ca 100644 --- a/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs +++ b/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey.tests/packages.config b/src/chocolatey.tests/packages.config index e446ba1697..81ae8aa55c 100644 --- a/src/chocolatey.tests/packages.config +++ b/src/chocolatey.tests/packages.config @@ -1,10 +1,11 @@  - + + - + \ No newline at end of file diff --git a/src/chocolatey/AssemblyExtensions.cs b/src/chocolatey/AssemblyExtensions.cs index 4262bb997f..4f37aedb6b 100644 --- a/src/chocolatey/AssemblyExtensions.cs +++ b/src/chocolatey/AssemblyExtensions.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -16,9 +16,13 @@ namespace chocolatey { + using System; + using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; + using chocolatey.infrastructure.app.registration; + using chocolatey.infrastructure.logging; using infrastructure.adapters; /// @@ -86,5 +90,53 @@ public static string get_public_key_token(this AssemblyName assemblyName) return publicKeyToken.Select(x => x.ToString("x2")).Aggregate((x, y) => x + y); } + + public static IEnumerable get_loadable_types(this IAssembly assembly) + { + // Code originates from the following stack overflow answer: https://stackoverflow.com/a/11915414 + if (assembly == null) + { + throw new ArgumentNullException("assembly"); + } + + try + { + return assembly.GetTypes(); + } + catch (ReflectionTypeLoadException e) + { + return e.Types.Where(t => t != null); + } + } + + public static IEnumerable get_extension_modules(this IAssembly assembly) + { + var result = new List(); + + "chocolatey".Log().Debug("Gathering exported extension registration modules!"); + + var registrationTypes = assembly + .get_loadable_types() + .Where(t => t.IsClass && !t.IsAbstract && !t.IsGenericType && typeof(IExtensionModule).IsAssignableFrom(t)); + + foreach (var extensionType in registrationTypes) + { + try + { + var module = (IExtensionModule)Activator.CreateInstance(extensionType); + result.Add(module); + } + catch (Exception ex) + { + "chocolatey".Log().Error("Unable to activate extension module '{0}' in assembly '{1}'.\n Message:{2}", + extensionType.Name, + assembly.GetName().Name, + ex.Message); + "chocolatey".Log().Error(ChocolateyLoggers.LogFileOnly, ex.StackTrace); + } + } + + return result; + } } } diff --git a/src/chocolatey/EnumExtensions.cs b/src/chocolatey/EnumExtensions.cs index 772c5f0f5f..74096815b7 100644 --- a/src/chocolatey/EnumExtensions.cs +++ b/src/chocolatey/EnumExtensions.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -71,4 +71,4 @@ public static TEnum parse_enum_from_description(this string description) return default(TEnum); } } -} \ No newline at end of file +} diff --git a/src/chocolatey/FileSystemExtensions.cs b/src/chocolatey/FileSystemExtensions.cs new file mode 100644 index 0000000000..7c3dcf0bea --- /dev/null +++ b/src/chocolatey/FileSystemExtensions.cs @@ -0,0 +1,69 @@ +// Copyright © 2017 - 2022 Chocolatey Software, Inc +// Copyright © 2011 - 2017 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. + +namespace chocolatey +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using chocolatey.infrastructure.adapters; + using chocolatey.infrastructure.app; + using chocolatey.infrastructure.filesystem; + using chocolatey.infrastructure.logging; + using chocolatey.infrastructure.registration; + + public static class FileSystemExtensions + { + internal static IEnumerable get_extension_assemblies(this IFileSystem fileSystem) + { + var result = new List(); + + if (!fileSystem.directory_exists(ApplicationParameters.ExtensionsLocation)) + { + return result; + } + + var extensionDllFiles = fileSystem.get_files(ApplicationParameters.ExtensionsLocation, "*.dll", SearchOption.AllDirectories); + + foreach (var extensionFile in extensionDllFiles) + { + var name = fileSystem.get_file_name_without_extension(extensionFile); + + try + { + var assembly = AssemblyResolution.load_extension(name); + + if (assembly == null) + { + "chocolatey".Log().Warn("Unable to load extension from path {0}.\n The assembly is not signed with official key token.", extensionFile); + } + else + { + result.Add(assembly); + } + } + catch (Exception ex) + { + "chocolatey".Log().Error("Unable to load extension from path {0}.\n Message:{1}", extensionFile, ex.Message); + "chocolatey".Log().Error(ChocolateyLoggers.LogFileOnly, ex.StackTrace); + } + } + + return result.Distinct(); + } + } +} diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index 0ef58b8a68..c86309c094 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -1,4 +1,4 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 RealDimensions Software, LLC // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,9 +32,13 @@ namespace chocolatey using infrastructure.registration; using infrastructure.synchronization; using log4net; + #if !NoResources + using resources; + #endif + using Assembly = infrastructure.adapters.Assembly; using IFileSystem = infrastructure.filesystem.IFileSystem; using ILog = infrastructure.logging.ILog; @@ -66,19 +70,53 @@ public static GetChocolatey GetChocolatey(bool initializeLogging) } private static ResolveEventHandler _handler = null; + private static void add_assembly_resolver() { _handler = (sender, args) => { var requestedAssembly = new AssemblyName(args.Name); - // There are things that are ILMerged into Chocolatey. Anything with - // the right public key except licensed should use the choco/chocolatey assembly #if FORCE_CHOCOLATEY_OFFICIAL_KEY var chocolateyPublicKey = ApplicationParameters.OfficialChocolateyPublicKey; #else var chocolateyPublicKey = ApplicationParameters.UnofficialChocolateyPublicKey; #endif + + if (requestedAssembly.get_public_key_token().is_equal_to(chocolateyPublicKey)) + { + // Check if it is already loaded + var resolvedAssembly = AssemblyResolution.resolve_existing_assembly(requestedAssembly.Name, chocolateyPublicKey); + + if (resolvedAssembly != null) + { + return resolvedAssembly.UnderlyingType; + } + + if (Directory.Exists(ApplicationParameters.ExtensionsLocation)) + { + foreach (var extensionDll in Directory.EnumerateFiles(ApplicationParameters.ExtensionsLocation, requestedAssembly.Name + ".dll", SearchOption.AllDirectories)) + { + try + { + resolvedAssembly = AssemblyResolution.load_assembly(requestedAssembly.Name, extensionDll, chocolateyPublicKey); + + if (resolvedAssembly != null) + { + return resolvedAssembly.UnderlyingType; + } + } + catch (Exception ex) + { + // This catch statement is empty on purpose, we do + // not want to do anything if it fails to load. + } + } + } + } + + // There are things that are ILMerged into Chocolatey. Anything with + // the right public key except extensions should use the choco/chocolatey assembly if (requestedAssembly.get_public_key_token().is_equal_to(chocolateyPublicKey) && !requestedAssembly.Name.is_equal_to(ApplicationParameters.LicensedChocolateyAssemblySimpleName) && !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) @@ -277,7 +315,7 @@ public GetChocolatey RegisterContainerComponent(Lifesty /// Registers a container component. Does not require a dependency on Simple Injector. /// Will override existing component if registered. /// - /// The type of the ervice. + /// The type of the service. /// The implementation creator. /// This instance /// @@ -433,7 +471,7 @@ public int ListCount() public ChocolateyConfiguration GetConfiguration() { ensure_environment(); - + // ensure_original_configuration() already calls create_configuration() // so no need to repeat, just grab the result var configuration = ensure_original_configuration( diff --git a/src/chocolatey/ILogExtensions.cs b/src/chocolatey/ILogExtensions.cs index 0ed0200faa..0c9bd5a122 100644 --- a/src/chocolatey/ILogExtensions.cs +++ b/src/chocolatey/ILogExtensions.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -218,4 +218,4 @@ public static void Fatal(this ILog logger, ChocolateyLoggers logType, FuncDEBUG;TRACE prompt 4 + bin\Debug\chocolatey.xml pdbonly @@ -67,22 +68,22 @@ False ..\packages\AlphaFS.2.1.3\lib\net40\AlphaFS.dll - - ..\packages\log4net.2.0.3\lib\net40-client\log4net.dll + + ..\packages\log4net.2.0.12\lib\net40-client\log4net.dll False ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll - + False - ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20210506\lib\net4\NuGet.Core.dll + ..\..\lib\Chocolatey-NuGet.Core.2.11.0.20220901\lib\net4\NuGet.Core.dll - ..\..\lib\Rhino.Licensing\Rhino.Licensing.dll + ..\..\lib\Rhino.Licensing.1.4.1\lib\net40\Rhino.Licensing.dll - - ..\packages\SimpleInjector.2.5.0\lib\net40-client\SimpleInjector.dll + + ..\packages\SimpleInjector.2.8.3\lib\net40-client\SimpleInjector.dll @@ -113,9 +114,23 @@ Properties\SolutionVersion.cs + + + + + + + + + + + + + + @@ -145,6 +160,8 @@ + + @@ -171,9 +188,7 @@ - - @@ -359,7 +374,6 @@ Designer - @@ -386,7 +400,6 @@ - - "; diff --git a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs index 5c13575806..91ce63335e 100644 --- a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs +++ b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs b/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs index 5d2f597284..7d45c70d3c 100644 --- a/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs +++ b/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -16,13 +16,13 @@ namespace chocolatey.infrastructure.app.utility { - //todo: maybe find a better name/location for this + //todo: #2560 maybe find a better name/location for this public static class ArgumentsUtility { public static bool arguments_contain_sensitive_information(string commandArguments) { - //todo:this check is naive, we should switch to regex + //todo: #2561 this check is naive, we should switch to regex //this picks up cases where arguments are passed with '-' and '--' return commandArguments.contains("-install-arguments-sensitive") || commandArguments.contains("-package-parameters-sensitive") @@ -41,9 +41,7 @@ public static bool arguments_contain_sensitive_information(string commandArgumen || commandArguments.contains("-key=") || commandArguments.contains("-apikey") || commandArguments.contains("-api-key") - || commandArguments.contains("-apikey") - || commandArguments.contains("-api-key") ; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure.app/utility/HashCode.cs b/src/chocolatey/infrastructure.app/utility/HashCode.cs index cac40983e2..fc4b3227cc 100644 --- a/src/chocolatey/infrastructure.app/utility/HashCode.cs +++ b/src/chocolatey/infrastructure.app/utility/HashCode.cs @@ -72,4 +72,4 @@ private static int GetHashCode(T item) { return item == null ? 0 : item.GetHashCode(); } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs index dab306c2de..2c437339d2 100644 --- a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs +++ b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -17,6 +17,7 @@ namespace chocolatey.infrastructure.app.utility { using System; using configuration; + using platforms; public class PackageUtility { @@ -36,10 +37,10 @@ public static bool package_is_a_dependency(ChocolateyConfiguration config, strin { if (packageName.is_equal_to(package) || packageName.contains(package + ".") - || (packageName.contains(package) - && (packageName.contains(".nupkg") - || packageName.contains(".nuspec") - || packageName.contains("\\") + || (package.contains(packageName) + && (package.contains(".nupkg") + || package.contains(".nuspec") + || package.contains("{0}".format_with(Platform.get_platform() == PlatformType.Windows ? "\\" : "/")) ) ) ) diff --git a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs index 97a477215a..c0e28e11c9 100644 --- a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs @@ -63,7 +63,7 @@ private void check_usage_of_package_exit_code(ChocolateyConfiguration config, IC Message = @"When attempting to halt execution of a Chocolatey command based on a request for a system reboot, it is necessary to have the usePackageExitCodes feature enabled. Use the following command: - choco feature enable -name={0} + choco feature enable -name={0} to enable this feature (exit code 1). ".format_with(ApplicationParameters.Features.UsePackageExitCodes), Status = ValidationStatus.Error, diff --git a/src/chocolatey/infrastructure/adapters/Assembly.cs b/src/chocolatey/infrastructure/adapters/Assembly.cs index 2759d22692..9a0472a7c9 100644 --- a/src/chocolatey/infrastructure/adapters/Assembly.cs +++ b/src/chocolatey/infrastructure/adapters/Assembly.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -41,7 +41,7 @@ public string Location { get { return _assembly.Location; } } - + public string CodeBase { get { return _assembly.CodeBase; } @@ -76,23 +76,33 @@ public AssemblyName GetName() public Type GetType(String name) { return _assembly.GetType(name); - } - + } + public Type GetType(String name, bool throwOnError) { return _assembly.GetType(name,throwOnError); - } - + } + public Type GetType(String name, bool throwOnError, bool ignoreCase) { return _assembly.GetType(name,throwOnError, ignoreCase); } + public Type[] GetTypes() + { + return _assembly.GetTypes(); + } + public static IAssembly Load(byte[] rawAssembly) { return new Assembly(System.Reflection.Assembly.Load(rawAssembly)); - } - + } + + public static IAssembly Load(byte[] rawAssembly, byte[] rawSymbols) + { + return new Assembly(System.Reflection.Assembly.Load(rawAssembly, rawSymbols)); + } + public static IAssembly LoadFile(string path) { return new Assembly(System.Reflection.Assembly.LoadFile(path)); @@ -113,8 +123,8 @@ public static IAssembly GetExecutingAssembly() public static IAssembly GetCallingAssembly() { return new Assembly(System.Reflection.Assembly.GetCallingAssembly()); - } - + } + public static IAssembly GetEntryAssembly() { return new Assembly(System.Reflection.Assembly.GetEntryAssembly()); @@ -132,4 +142,4 @@ public static implicit operator Assembly(System.Reflection.Assembly value) } // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index 095b0f8bf7..7ff34714ca 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -348,7 +348,7 @@ private struct CONSOLE_SCREEN_BUFFER_INFO } /// - /// Defines the coordinates of a character cell in a console screen buffer. + /// Defines the coordinates of a character cell in a console screen buffer. /// The origin of the coordinate system (0,0) is at the top, left cell of the buffer. /// /// @@ -416,7 +416,7 @@ private enum StdHandle /// Retrieves the file type of the specified file. /// /// - /// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364960.aspx + /// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364960.aspx /// http://www.pinvoke.net/default.aspx/kernel32.getfiletype /// [DllImport("kernel32.dll")] diff --git a/src/chocolatey/infrastructure/adapters/CustomString.cs b/src/chocolatey/infrastructure/adapters/CustomString.cs index 1e58da4184..d0c33ebdbb 100644 --- a/src/chocolatey/infrastructure/adapters/CustomString.cs +++ b/src/chocolatey/infrastructure/adapters/CustomString.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/adapters/DateTime.cs b/src/chocolatey/infrastructure/adapters/DateTime.cs index 129020d618..8e9897e6e9 100644 --- a/src/chocolatey/infrastructure/adapters/DateTime.cs +++ b/src/chocolatey/infrastructure/adapters/DateTime.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/adapters/Environment.cs b/src/chocolatey/infrastructure/adapters/Environment.cs index fd3ce5bbc4..8a6745bd25 100644 --- a/src/chocolatey/infrastructure/adapters/Environment.cs +++ b/src/chocolatey/infrastructure/adapters/Environment.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs b/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs index 2dbeafff0c..3e5e30e094 100644 --- a/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs +++ b/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/adapters/IAssembly.cs b/src/chocolatey/infrastructure/adapters/IAssembly.cs index ca15946062..bb1caca0ff 100644 --- a/src/chocolatey/infrastructure/adapters/IAssembly.cs +++ b/src/chocolatey/infrastructure/adapters/IAssembly.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -51,12 +51,12 @@ public interface IAssembly /// /// Gets the location of the assembly as specified originally, for example, in an object. - /// + /// /// - /// + /// /// /// The location of the assembly as specified originally. - /// + /// /// /// string CodeBase { get; } @@ -86,6 +86,8 @@ public interface IAssembly Type GetType(String name, bool throwOnError, bool ignoreCase); + Type[] GetTypes(); + /// /// Loads the specified manifest resource from this assembly. /// @@ -143,4 +145,4 @@ public interface IAssembly } // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/adapters/IConsole.cs b/src/chocolatey/infrastructure/adapters/IConsole.cs index d2f50554cb..fc0f67be25 100644 --- a/src/chocolatey/infrastructure/adapters/IConsole.cs +++ b/src/chocolatey/infrastructure/adapters/IConsole.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -96,7 +96,7 @@ public interface IConsole /// Indicates whether the error output stream has been redirected from the standard error stream. /// bool IsErrorRedirected { get; } - + /// /// Indicates whether input has been redirected from the standard input stream. /// @@ -104,7 +104,7 @@ public interface IConsole System.ConsoleColor BackgroundColor { get; set; } System.ConsoleColor ForegroundColor { get; set; } - + int BufferWidth { get; set; } int BufferHeight { get; set; } void SetBufferSize(int width, int height); @@ -122,7 +122,7 @@ public interface IConsole int WindowLeft { get; set; } int WindowTop { get; set; } void SetWindowPosition(int width, int height); - + } // ReSharper restore InconsistentNaming diff --git a/src/chocolatey/infrastructure/adapters/IDateTime.cs b/src/chocolatey/infrastructure/adapters/IDateTime.cs index 36a44f4418..764c969e0d 100644 --- a/src/chocolatey/infrastructure/adapters/IDateTime.cs +++ b/src/chocolatey/infrastructure/adapters/IDateTime.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -40,4 +40,4 @@ public interface IDateTime } // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs b/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs index 649cbb6eac..1207b35629 100644 --- a/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs +++ b/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/adapters/IEnvironment.cs b/src/chocolatey/infrastructure/adapters/IEnvironment.cs index 5fdd915e17..8905923179 100644 --- a/src/chocolatey/infrastructure/adapters/IEnvironment.cs +++ b/src/chocolatey/infrastructure/adapters/IEnvironment.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -84,9 +84,9 @@ public interface IEnvironment /// /// Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string. - /// + /// /// - /// + /// /// /// A string with each environment variable replaced by its value. /// @@ -94,7 +94,7 @@ public interface IEnvironment /// is null. /// 1 string ExpandEnvironmentVariables(string name); - + /// /// Gets the environment variable. /// @@ -104,12 +104,12 @@ public interface IEnvironment /// /// Retrieves all environment variable names and their values from the current process. - /// + /// /// - /// + /// /// /// An that contains all environment variable names and their values; otherwise, an empty dictionary if no environment variables are found. - /// + /// /// /// The caller does not have the required permission to perform this operation. /// The buffer is out of memory. @@ -121,16 +121,16 @@ public interface IEnvironment /// /// The target. /// - /// + /// /// /// Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine. - /// + /// /// - /// + /// /// /// An object that contains all environment variable names and their values from the source specified by the parameter; otherwise, an empty dictionary if no environment variables are found. - /// + /// /// /// One of the values. /// The caller does not have the required permission to perform this operation for the specified value of . diff --git a/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs b/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs index ad0d7a2fec..3c3f8f0b74 100644 --- a/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs +++ b/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/adapters/IProcess.cs b/src/chocolatey/infrastructure/adapters/IProcess.cs index 6fcea7e481..4216902263 100644 --- a/src/chocolatey/infrastructure/adapters/IProcess.cs +++ b/src/chocolatey/infrastructure/adapters/IProcess.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -95,4 +95,4 @@ public interface IProcess : IDisposable } // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/adapters/Process.cs b/src/chocolatey/infrastructure/adapters/Process.cs index 1126796b0f..109c6d7267 100644 --- a/src/chocolatey/infrastructure/adapters/Process.cs +++ b/src/chocolatey/infrastructure/adapters/Process.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs b/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs index 6112ee51c6..9b60627d46 100644 --- a/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs +++ b/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -56,7 +56,7 @@ public static void SetHandler() private static bool Handler(SignalControlType signal) { - const string errorMessage = @"Exiting chocolatey abnormally. Please manually clean up anything that + const string errorMessage = @"Exiting chocolatey abnormally. Please manually clean up anything that was not finished."; switch (signal) { @@ -78,4 +78,4 @@ private static bool Handler(SignalControlType signal) return true; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index d9dacd5c6b..50679474d0 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -68,7 +68,7 @@ public static string prompt_for_confirmation(string prompt, IEnumerable .meets( c => !c.Any(String.IsNullOrWhiteSpace), (name, value) => { throw new ApplicationException("Some choices are empty. Please ensure you provide no empty choices."); }); - + Ensure .that(() => choices) .meets( @@ -85,7 +85,7 @@ public static string prompt_for_confirmation(string prompt, IEnumerable { Console.Write(prompt + "("); - } + } "chocolatey".Log().Info(shortPrompt ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Important, prompt); @@ -99,17 +99,17 @@ public static string prompt_for_confirmation(string prompt, IEnumerable { var choicePrompt = choice.is_equal_to(defaultChoice) ? shortPrompt ? - "[[{0}]{1}]".format_with(choice.Substring(0, 1).ToUpperInvariant(), choice.Substring(1, choice.Length - 1)) : + "[[{0}]{1}]".format_with(choice.Substring(0, 1).ToUpperInvariant(), choice.Substring(1, choice.Length - 1)) : "[{0}]".format_with(choice.ToUpperInvariant()) - : - shortPrompt ? + : + shortPrompt ? "[{0}]{1}".format_with(choice.Substring(0,1).ToUpperInvariant(), choice.Substring(1, choice.Length - 1)) : choice; if (counter != 1) Console.Write("/"); Console.Write(choicePrompt); } - + counter++; } @@ -132,8 +132,8 @@ public static string prompt_for_confirmation(string prompt, IEnumerable foreach (var pair in choiceDictionary) { var value = pair.Value.to_string(); - if (value.is_equal_to(selection) || - (allowShortAnswer && value.Substring(0, 1).is_equal_to(selection)) || + if (value.is_equal_to(selection) || + (allowShortAnswer && value.Substring(0, 1).is_equal_to(selection)) || (value.contains("-") && value.Substring(0, value.IndexOf("-")).trim_safe().is_equal_to(selection)) ) { @@ -195,4 +195,4 @@ public static string get_password(bool interactive) return password; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commandline/Options.cs b/src/chocolatey/infrastructure/commandline/Options.cs index 5807347995..07903eb2e2 100644 --- a/src/chocolatey/infrastructure/commandline/Options.cs +++ b/src/chocolatey/infrastructure/commandline/Options.cs @@ -1,4 +1,4 @@ - + // // Options.cs // @@ -14,10 +14,10 @@ // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -38,16 +38,16 @@ // A Getopt::Long-inspired option parsing library for C#. // // NDesk.Options.OptionSet is built upon a key/value table, where the -// key is a option format string and the value is a delegate that is +// key is a option format string and the value is a delegate that is // invoked when the format string is matched. // // Option format strings: -// Regex-like BNF Grammar: +// Regex-like BNF Grammar: // name: .+ // type: [=:] // sep: ( [^{}]+ | '{' .+ '}' )? // aliases: ( name type sep ) ( '|' name type sep )* -// +// // Each '|'-delimited name is an alias for the associated action. If the // format string ends in a '=', it has a required value. If the format // string ends in a ':', it has an optional value. If neither '=' or ':' @@ -93,7 +93,7 @@ // p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"}); // // The above would parse the argument string array, and would invoke the -// lambda expression three times, setting `verbose' to 3 when complete. +// lambda expression three times, setting `verbose' to 3 when complete. // It would also print out "A" and "B" to standard output. // The returned array would contain the string "extra". // @@ -210,7 +210,7 @@ private void AssertValid (int index) if (c.Option.OptionValueType == OptionValueType.Required && index >= values.Count) throw new OptionException (string.Format ( - c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName), + c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName), c.OptionName); } @@ -259,7 +259,7 @@ public Option Option { set {option = value;} } - public string OptionName { + public string OptionName { get {return name;} set {name = value;} } @@ -279,7 +279,7 @@ public OptionValueCollection OptionValues { } public enum OptionValueType { - None, + None, Optional, Required, } @@ -320,7 +320,7 @@ protected Option (string prototype, string description, int maxValueCount) throw new ArgumentException ( string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount), "maxValueCount"); - if (Array.IndexOf (names, "<>") >= 0 && + if (Array.IndexOf (names, "<>") >= 0 && ((names.Length == 1 && this.type != OptionValueType.None) || (names.Length > 1 && this.MaxValueCount > 1))) throw new ArgumentException ( @@ -383,7 +383,7 @@ private OptionValueType ParsePrototype () names [i] = name.Substring (0, end); if (type == '\0' || type == name [end]) type = name [end]; - else + else throw new ArgumentException ( string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]), "prototype"); @@ -614,7 +614,7 @@ public OptionSet Add (string prototype, string description, Action actio { if (action == null) throw new ArgumentNullException ("action"); - Option p = new ActionOption (prototype, description, 1, + Option p = new ActionOption (prototype, description, 1, delegate (OptionValueCollection v) { action (v [0]); }); base.Add (p); return this; @@ -629,7 +629,7 @@ public OptionSet Add (string prototype, string description, OptionAction Parse (IEnumerable arguments) OptionContext c = CreateOptionContext (); c.OptionIndex = -1; var def = GetOptionForName ("<>"); - var unprocessed = + var unprocessed = from argument in arguments where ++c.OptionIndex >= 0 && (process || def != null) ? process - ? argument == "--" + ? argument == "--" ? (process = false) : !Parse (argument, c) - ? def != null - ? Unprocessed (null, def, c, argument) + ? def != null + ? Unprocessed (null, def, c, argument) : true : false - : def != null + : def != null ? Unprocessed (null, def, c, argument) : true : true @@ -807,7 +807,7 @@ protected virtual bool Parse (string argument, OptionContext c) c.Option.Invoke (c); break; case OptionValueType.Optional: - case OptionValueType.Required: + case OptionValueType.Required: ParseValue (v, c); break; } @@ -826,24 +826,24 @@ protected virtual bool Parse (string argument, OptionContext c) { "chocolatey".Log().Warn("Parsing {0} resulted in error (converted to warning):{1} {2}".format_with(argument, Environment.NewLine, ex.Message)); } - + return false; } private void ParseValue (string option, OptionContext c) { if (option != null) - foreach (string o in c.Option.ValueSeparators != null + foreach (string o in c.Option.ValueSeparators != null ? option.Split (c.Option.ValueSeparators, StringSplitOptions.None) : new string[]{option}) { c.OptionValues.Add (o); } - if (c.OptionValues.Count == c.Option.MaxValueCount || + if (c.OptionValues.Count == c.Option.MaxValueCount || c.Option.OptionValueType == OptionValueType.Optional) c.Option.Invoke (c); else if (c.OptionValues.Count > c.Option.MaxValueCount) { throw new OptionException (localizer (string.Format ( - "Error: Found {0} option values when expecting {1}.", + "Error: Found {0} option values when expecting {1}.", c.OptionValues.Count, c.Option.MaxValueCount)), c.OptionName); } @@ -963,7 +963,7 @@ bool WriteOptionPrototype (TextWriter o, Option p, ref int written) Write (o, ref written, names [0]); } - for ( i = GetNextOptionIndex (names, i+1); + for ( i = GetNextOptionIndex (names, i+1); i < names.Length; i = GetNextOptionIndex (names, i+1)) { Write (o, ref written, ", "); Write (o, ref written, names [i].Length == 1 ? "-" : "--"); @@ -976,7 +976,7 @@ bool WriteOptionPrototype (TextWriter o, Option p, ref int written) Write (o, ref written, localizer ("[")); } Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description))); - string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0 + string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0 ? p.ValueSeparators [0] : " "; for (int c = 1; c < p.MaxValueCount; ++c) { @@ -1128,4 +1128,4 @@ private static int GetLineEnd (int start, int length, string description) } // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs index 6c20d01736..13ae4ed50b 100644 --- a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -80,4 +80,4 @@ public void Dispose() } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs index 02f03a4164..501d6ca7c3 100644 --- a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/commands/CommandExecutor.cs b/src/chocolatey/infrastructure/commands/CommandExecutor.cs index 2991e7c66c..99bc063b9c 100644 --- a/src/chocolatey/infrastructure/commands/CommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/CommandExecutor.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -119,7 +119,7 @@ bool waitForExit stdOutAction, stdErrAction, updateProcessPath, - allowUseWindow, + allowUseWindow, waitForExit ); } @@ -222,8 +222,8 @@ bool waitForExit } else { - "chocolatey".Log().Warn(ChocolateyLoggers.Important, () => @"Chocolatey timed out waiting for the command to finish. The timeout - specified (or the default value) was '{0}' seconds. Perhaps try a + "chocolatey".Log().Warn(ChocolateyLoggers.Important, () => @"Chocolatey timed out waiting for the command to finish. The timeout + specified (or the default value) was '{0}' seconds. Perhaps try a higher `--execution-timeout`? See `choco -h` for details.".format_with(waitForExitInSeconds)); } } @@ -253,4 +253,4 @@ private static void log_error(object sender, DataReceivedEventArgs e) if (e != null) "chocolatey".Log().Error(e.Data.escape_curly_braces()); } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commands/Execute.cs b/src/chocolatey/infrastructure/commands/Execute.cs index 45f0304c0b..5a5a4cfec1 100644 --- a/src/chocolatey/infrastructure/commands/Execute.cs +++ b/src/chocolatey/infrastructure/commands/Execute.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -67,7 +67,7 @@ public T command(Func function, T timeoutDefaultValue) var cancelToken = new CancellationTokenSource(); cancelToken.Token.ThrowIfCancellationRequested(); var task = Task.Factory.StartNew(function, cancelToken.Token); //,TaskCreationOptions.LongRunning| TaskCreationOptions.AttachedToParent); - + if (_timespan.TotalSeconds < 1d) { // 0 means infinite @@ -81,10 +81,10 @@ public T command(Func function, T timeoutDefaultValue) if (task.IsCompleted) return task.Result; cancelToken.Cancel(); - this.Log().Warn(ChocolateyLoggers.Important,() => @"Chocolatey timed out waiting for the command to finish. The timeout - specified (or the default value) was '{0}' seconds. Perhaps try a + this.Log().Warn(ChocolateyLoggers.Important,() => @"Chocolatey timed out waiting for the command to finish. The timeout + specified (or the default value) was '{0}' seconds. Perhaps try a higher `--execution-timeout`? See `choco -h` for details.".format_with(_timespan.TotalSeconds)); - + return timeoutDefaultValue; //T result = timeoutDefaultValue; @@ -118,7 +118,7 @@ public bool command(Action action) } else { - task.Wait(_timespan); + task.Wait(_timespan); } completed = task.IsCompleted; @@ -126,10 +126,10 @@ public bool command(Action action) if (!completed) { cancelToken.Cancel(); - this.Log().Warn(ChocolateyLoggers.Important, () => @"Chocolatey timed out waiting for the command to finish. The timeout - specified (or the default value) was '{0}' seconds. Perhaps try a + this.Log().Warn(ChocolateyLoggers.Important, () => @"Chocolatey timed out waiting for the command to finish. The timeout + specified (or the default value) was '{0}' seconds. Perhaps try a higher `--execution-timeout`? See `choco -h` for details.".format_with(_timespan.TotalSeconds)); - + } return completed; diff --git a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs index 33ca3d8d67..e1c3cc2d3e 100644 --- a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs +++ b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -71,7 +71,7 @@ private static void fill_args_dictionary(Dictionary propertyValu { foreach (var prop in properties.or_empty_list_if_null()) { - //todo: need a better way of handling + //todo: #2587 need a better way of handling if (prop.Name == "MachineSources") continue; if (prop.PropertyType.is_built_in_system_type()) @@ -126,4 +126,4 @@ private static string quote_arg_value_if_required(ExternalCommandArgument argume return argument.ArgumentValue; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commands/ExternalCommandArgument.cs b/src/chocolatey/infrastructure/commands/ExternalCommandArgument.cs index be82643bc7..670199782e 100644 --- a/src/chocolatey/infrastructure/commands/ExternalCommandArgument.cs +++ b/src/chocolatey/infrastructure/commands/ExternalCommandArgument.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -47,4 +47,4 @@ public struct ExternalCommandArgument /// public bool Required; } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commands/ICommand.cs b/src/chocolatey/infrastructure/commands/ICommand.cs index 10aa493bb7..125e93bad1 100644 --- a/src/chocolatey/infrastructure/commands/ICommand.cs +++ b/src/chocolatey/infrastructure/commands/ICommand.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/commands/ICommandExecutor.cs b/src/chocolatey/infrastructure/commands/ICommandExecutor.cs index 94805ca78c..00e4c393db 100644 --- a/src/chocolatey/infrastructure/commands/ICommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/ICommandExecutor.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -56,4 +56,4 @@ int execute( bool waitForExit ); } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/commands/IListCommand.cs b/src/chocolatey/infrastructure/commands/IListCommand.cs index a31f109927..871900318e 100644 --- a/src/chocolatey/infrastructure/commands/IListCommand.cs +++ b/src/chocolatey/infrastructure/commands/IListCommand.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs index 8a6daed325..17fe5de40b 100644 --- a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs +++ b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -82,4 +82,4 @@ public static string get_powershell_location(IFileSystem fileSystem) throw new FileNotFoundException("Unable to find suitable location for PowerShell. Searched the following locations: '{0}'".format_with(string.Join("; ", _powershellLocations))); } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/configuration/Config.cs b/src/chocolatey/infrastructure/configuration/Config.cs index 7637effd02..ccf56fd703 100644 --- a/src/chocolatey/infrastructure/configuration/Config.cs +++ b/src/chocolatey/infrastructure/configuration/Config.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -38,7 +38,7 @@ public static void initialize_with(ChocolateyConfiguration configuration) } /// - /// Gets the configuration settings. + /// Gets the configuration settings. /// DO NOT USE with API. Use `GetChocolatey` methods - accessing this directly in API can cause very bad side effects. /// /// diff --git a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs index 28c11aa4c4..81ac8f04df 100644 --- a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs +++ b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -109,14 +109,14 @@ public string hash_file(string filePath) } public string hash_byte_array(byte[] buffer) - { + { var hash = _hashAlgorithm.ComputeHash(buffer); return BitConverter.ToString(hash).Replace("-", string.Empty); } public string hash_stream(Stream inputStream) - { + { var hash = _hashAlgorithm.ComputeHash(inputStream); return BitConverter.ToString(hash).Replace("-", string.Empty); @@ -132,7 +132,7 @@ private static bool file_is_locked(Exception exception) return errorCode == ERROR_SHARING_VIOLATION || errorCode == ERROR_LOCK_VIOLATION; } - + public static string hash_value(string originalText, CryptoHashProviderType providerType) { @@ -144,4 +144,4 @@ public static string hash_value(string originalText, CryptoHashProviderType prov } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/cryptography/CryptoHashProviderType.cs b/src/chocolatey/infrastructure/cryptography/CryptoHashProviderType.cs index d91b35cdea..fd984f7c4b 100644 --- a/src/chocolatey/infrastructure/cryptography/CryptoHashProviderType.cs +++ b/src/chocolatey/infrastructure/cryptography/CryptoHashProviderType.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs index 8ee14b3a89..e37c9934ae 100644 --- a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs +++ b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -20,6 +20,7 @@ namespace chocolatey.infrastructure.cryptography using System.Security.Cryptography; using System.Text; using adapters; + using platforms; public class DefaultEncryptionUtility : IEncryptionUtility { @@ -30,7 +31,26 @@ public string encrypt_string(string cleartextValue) if (string.IsNullOrWhiteSpace(cleartextValue)) return null; var decryptedByteArray = Encoding.UTF8.GetBytes(cleartextValue); - var encryptedByteArray = ProtectedData.Protect(decryptedByteArray, _entropyBytes, DataProtectionScope.LocalMachine); + byte[] encryptedByteArray; + try + { + encryptedByteArray = ProtectedData.Protect(decryptedByteArray, _entropyBytes, DataProtectionScope.LocalMachine); + } + catch (Exception ex) + { + if (Platform.get_platform() != PlatformType.Windows && ex is CryptographicException) + { + this.Log().Warn(@"Could not encrypt with LocalMachine scope. +Falling back to CurrentUser scope for encryption. +This is can be because the machine keyfile cannot be written as a normal user. +Anything encrypted as CurrentUser can only be decrypted by your current user."); + encryptedByteArray = ProtectedData.Protect(decryptedByteArray, _entropyBytes, DataProtectionScope.CurrentUser); + } + else + { + throw; + } + } var encryptedString = Convert.ToBase64String(encryptedByteArray); return encryptedString; @@ -39,7 +59,26 @@ public string encrypt_string(string cleartextValue) public string decrypt_string(string encryptedString) { var encryptedByteArray = Convert.FromBase64String(encryptedString); - var decryptedByteArray = ProtectedData.Unprotect(encryptedByteArray, _entropyBytes, DataProtectionScope.LocalMachine); + byte[] decryptedByteArray; + + try + { + decryptedByteArray = ProtectedData.Unprotect(encryptedByteArray, _entropyBytes, DataProtectionScope.LocalMachine); + } + catch (Exception ex) + { + if (Platform.get_platform() != PlatformType.Windows && ex is CryptographicException) + { + this.Log().Warn(@"Could not decrypt with LocalMachine scope. +Falling back to CurrentUser scope for decryption. +Anything encrypted as CurrentUser can only be decrypted by your current user."); + decryptedByteArray = ProtectedData.Unprotect(encryptedByteArray, _entropyBytes, DataProtectionScope.CurrentUser); + } + else + { + throw; + } + } return Encoding.UTF8.GetString(decryptedByteArray); } diff --git a/src/chocolatey/infrastructure/cryptography/IHashProvider.cs b/src/chocolatey/infrastructure/cryptography/IHashProvider.cs index c5649fcead..9ca6221e78 100644 --- a/src/chocolatey/infrastructure/cryptography/IHashProvider.cs +++ b/src/chocolatey/infrastructure/cryptography/IHashProvider.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -50,4 +50,4 @@ public interface IHashProvider /// A computed hash of the array, based on the contents. string hash_byte_array(byte[] buffer); } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/events/EventManager.cs b/src/chocolatey/infrastructure/events/EventManager.cs index 6033b1c10f..8c59315c4e 100644 --- a/src/chocolatey/infrastructure/events/EventManager.cs +++ b/src/chocolatey/infrastructure/events/EventManager.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/events/IMessage.cs b/src/chocolatey/infrastructure/events/IMessage.cs index ecc8103592..3df8a7fcb4 100644 --- a/src/chocolatey/infrastructure/events/IMessage.cs +++ b/src/chocolatey/infrastructure/events/IMessage.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs index c3bee95d2c..a6d3111856 100644 --- a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs +++ b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -75,11 +75,11 @@ public static void extract_binary_file_from_assembly(IFileSystem fileSystem, IAs () => { fileSystem.create_directory_if_not_exists(fileSystem.get_directory_name(filePath)); - fileSystem.write_file(filePath, () => assembly.get_manifest_stream(manifestLocation)); - }, - errorMessage:"Unable to extract binary", - throwError: throwEror, - logWarningInsteadOfError: false, + fileSystem.write_file(filePath, () => assembly.get_manifest_stream(manifestLocation)); + }, + errorMessage:"Unable to extract binary", + throwError: throwEror, + logWarningInsteadOfError: false, logDebugInsteadOfError: !throwEror, isSilent: !throwEror); } @@ -117,4 +117,4 @@ public static void extract_all_resources_to_relative_directory(IFileSystem fileS } } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index a51b2ff999..9824290db3 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -151,7 +151,7 @@ public string get_executable_path(string executableName) // Always add empty, for when the executable name is enough. extensions.Add(string.Empty); - // Gets the path to an executable based on looking in current + // Gets the path to an executable based on looking in current // working directory, next to the running process, then among the // derivatives of Path and Pathext variables, applied in order. var searchPaths = new List(); @@ -168,14 +168,14 @@ public string get_executable_path(string executableName) } } - // If not found, return the same as passed in - it may work, + // If not found, return the same as passed in - it may work, // but possibly not. return executableName; } public string get_current_assembly_path() { - return Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", string.Empty); + return Assembly.GetExecutingAssembly().CodeBase.Replace(Platform.get_platform() == PlatformType.Windows ? "file:///" : "file://", string.Empty); } #endregion @@ -432,7 +432,7 @@ public void replace_file(string sourceFilePath, string destinationFilePath, stri // copy source file to destination this.Log().Trace("Copying '{0}' to '{1}'.".format_with(sourceFilePath, destinationFilePath)); copy_file(sourceFilePath, destinationFilePath, overwriteExisting: true); - + // delete source file try { @@ -649,7 +649,10 @@ public void create_directory(string directoryPath) public void move_directory(string directoryPath, string newDirectoryPath) { if (string.IsNullOrWhiteSpace(directoryPath) || string.IsNullOrWhiteSpace(newDirectoryPath)) throw new ApplicationException("You must provide a directory to move from or to."); - if (combine_paths(directoryPath, "").is_equal_to(combine_paths(Environment.GetEnvironmentVariable("SystemDrive"), ""))) throw new ApplicationException("Cannot move or delete the root of the system drive"); + + // Linux / macOS do not have a SystemDrive environment variable, instead, everything is under "/" + var systemDrive = Platform.get_platform() == PlatformType.Windows ? Environment.GetEnvironmentVariable("SystemDrive") : "/"; + if (combine_paths(directoryPath, "").is_equal_to(combine_paths(systemDrive, ""))) throw new ApplicationException("Cannot move or delete the root of the system drive"); try { @@ -741,7 +744,10 @@ public void delete_directory(string directoryPath, bool recursive, bool override public void delete_directory(string directoryPath, bool recursive, bool overrideAttributes, bool isSilent) { if (string.IsNullOrWhiteSpace(directoryPath)) throw new ApplicationException("You must provide a directory to delete."); - if (combine_paths(directoryPath, "").is_equal_to(combine_paths(Environment.GetEnvironmentVariable("SystemDrive"), ""))) throw new ApplicationException("Cannot move or delete the root of the system drive"); + + // Linux / macOS do not have a SystemDrive environment variable, instead, everything is under "/" + var systemDrive = Platform.get_platform() == PlatformType.Windows ? Environment.GetEnvironmentVariable("SystemDrive") : "/"; + if (combine_paths(directoryPath, "").is_equal_to(combine_paths(systemDrive, ""))) throw new ApplicationException("Cannot move or delete the root of the system drive"); if (overrideAttributes) { @@ -863,4 +869,4 @@ public Encoding get_file_encoding(string filePath) return enc; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/filesystem/FileSystem.cs b/src/chocolatey/infrastructure/filesystem/FileSystem.cs index c212b3f6db..5cd2b5e52b 100644 --- a/src/chocolatey/infrastructure/filesystem/FileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/FileSystem.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs index 186ee9d59a..ee3fb6049b 100644 --- a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -159,7 +159,7 @@ public interface IFileSystem /// File to check - FileInfo or some representation of FileInfo /// True if the file has the ReadOnly attribute marked, otherwise false bool is_readonly_file(dynamic file); - + /// /// Determines if a file is a hidden file /// @@ -248,7 +248,7 @@ public interface IFileSystem FileStream open_file_readonly(string filePath); /// - /// Opens a file exlusively + /// Opens a file exclusively /// /// Path to the file name /// A file stream object for use after accessing the file @@ -273,7 +273,7 @@ public interface IFileSystem /// Writes a stream to a specified file path. /// /// The file path. - /// A defferred function of getting the stream + /// A deferred function of getting the stream void write_file(string filePath, Func getStream); #endregion @@ -386,7 +386,7 @@ public interface IFileSystem /// /// The directory path. /// Would you like to delete the directories inside of this directory? Almost always true. - void delete_directory_if_exists(string directoryPath, bool recursive); + void delete_directory_if_exists(string directoryPath, bool recursive); /// /// Deletes a directory if it exists @@ -421,4 +421,4 @@ public interface IFileSystem /// The attributes. void ensure_file_attribute_removed(string path, FileAttributes attributes); } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/guards/Ensure.cs b/src/chocolatey/infrastructure/guards/Ensure.cs index dc775cd7b7..b10b6757e7 100644 --- a/src/chocolatey/infrastructure/guards/Ensure.cs +++ b/src/chocolatey/infrastructure/guards/Ensure.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -82,4 +82,4 @@ public void meets(Func ensureFunction, Action.Default.GetHashCode(Name) + + EqualityComparer.Default.GetHashCode(Version); + return hashCode; + } + } + + public override string ToString() + { + return "{0} v{1}".format_with(Name, Version); + } + } + + public enum ExtensionStatus + { + Unknown = 0, + Loaded, + Enabled = Loaded, + Disabled, + Failed + } +} diff --git a/src/chocolatey/infrastructure/information/ProcessInformation.cs b/src/chocolatey/infrastructure/information/ProcessInformation.cs index 1f9a2c146c..9412fc33b1 100644 --- a/src/chocolatey/infrastructure/information/ProcessInformation.cs +++ b/src/chocolatey/infrastructure/information/ProcessInformation.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -42,25 +42,25 @@ public static bool user_is_administrator() if (!isAdmin) { - // Processes subject to UAC actually have the Administrators group - // stripped out from the process, and will return false for any + // Processes subject to UAC actually have the Administrators group + // stripped out from the process, and will return false for any // check about being an administrator, including a check against - // the native `CheckTokenMembership` or `UserIsAdmin`. Instead we + // the native `CheckTokenMembership` or `UserIsAdmin`. Instead we // need to perform a not 100% answer on whether they are an admin // based on if we have a split token. // Crediting http://www.davidmoore.info/blog/2011/06/20/how-to-check-if-the-current-user-is-an-administrator-even-if-uac-is-on/ // and http://blogs.msdn.com/b/cjacks/archive/2006/10/09/how-to-determine-if-a-user-is-a-member-of-the-administrators-group-with-uac-enabled-on-windows-vista.aspx - // NOTE: from the latter (the original) - - // Note that this technique detects if the token is split or not. - // In the vast majority of situations, this will determine whether - // the user is running as an administrator. However, there are + // NOTE: from the latter (the original) - + // Note that this technique detects if the token is split or not. + // In the vast majority of situations, this will determine whether + // the user is running as an administrator. However, there are // other user types with advanced permissions which may generate a - // split token during an interactive login (for example, the - // Network Configuration Operators group). If you are using one of - // these advanced permission groups, this technique will determine - // the elevation type, and not the presence (or absence) of the + // split token during an interactive login (for example, the + // Network Configuration Operators group). If you are using one of + // these advanced permission groups, this technique will determine + // the elevation type, and not the presence (or absence) of the // administrator credentials. - "chocolatey".Log().Debug(@"User may be subject to UAC, checking for a split token (not 100% + "chocolatey".Log().Debug(@"User may be subject to UAC, checking for a split token (not 100% effective)."); int tokenInfLength = Marshal.SizeOf(typeof(int)); @@ -120,7 +120,7 @@ public static bool user_is_terminal_services() { return Environment.GetEnvironmentVariable("SESSIONNAME").to_string().contains("rdp-"); } - + public static bool user_is_remote() { return user_is_terminal_services() || Environment.GetEnvironmentVariable("SESSIONNAME").to_string() == string.Empty; @@ -160,7 +160,7 @@ BOOL WINAPI CheckTokenMembership( _In_ PSID SidToCheck, _Out_ PBOOL IsMember ); - + */ [DllImport("advapi32.dll", SetLastError = true)] @@ -175,8 +175,8 @@ BOOL WINAPI GetTokenInformation( _In_ DWORD TokenInformationLength, _Out_ PDWORD ReturnLength ); - - + + */ [DllImport("advapi32.dll", SetLastError = true)] private static extern bool GetTokenInformation(IntPtr tokenHandle, TokenInformationType tokenInformationClass, IntPtr tokenInformation, int tokenInformationLength, out int returnLength); @@ -231,4 +231,4 @@ enum TokenElevationType // ReSharper restore InconsistentNaming } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/information/VersionInformation.cs b/src/chocolatey/infrastructure/information/VersionInformation.cs index 6eae4aef46..f3aed7a37d 100644 --- a/src/chocolatey/infrastructure/information/VersionInformation.cs +++ b/src/chocolatey/infrastructure/information/VersionInformation.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -32,9 +32,22 @@ public static string get_current_assembly_version(IAssembly assembly = null) version = FileVersionInfo.GetVersionInfo(location).FileVersion; } + if (string.IsNullOrEmpty(version)) + { + var attributes= assembly.UnderlyingType.GetCustomAttributesData(); + foreach (var attribute in attributes) + { + if (attribute.to_string().Contains("AssemblyFileVersion")) + { + version = attribute.ConstructorArguments[0].Value.to_string(); + break; + } + } + } + return version; - } - + } + public static string get_current_informational_version(IAssembly assembly = null) { string version = null; @@ -46,7 +59,39 @@ public static string get_current_informational_version(IAssembly assembly = null version = FileVersionInfo.GetVersionInfo(location).ProductVersion; } + if (string.IsNullOrEmpty(version)) + { + var attributes = assembly.UnderlyingType.GetCustomAttributesData(); + foreach (var attribute in attributes) + { + if (attribute.to_string().Contains("AssemblyInformationalVersion")) + { + version = attribute.ConstructorArguments[0].Value.to_string(); + break; + } + } + } + return version; } + + public static string get_minimum_chocolatey_version(IAssembly assembly = null) + { + if (assembly == null) assembly = Assembly.GetExecutingAssembly(); + + var attributeData = assembly.UnderlyingType.GetCustomAttributesData(); + foreach (var attribute in attributeData) + { + if (attribute.to_string().Contains("MinimumChocolateyVersion")) + { + return attribute.ConstructorArguments[0].Value.to_string(); + } + } + + // It was in version 1.0.0 of Chocolatey where we started to worry about compatible versions + // so it makes sense to start with this as the default value, when there isn't a custom + // attribute on the assembly to say what the minimum required Chocolatey version is. + return "1.0.0"; + } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs b/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs index 878f4516df..109a4ebf32 100644 --- a/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs +++ b/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -27,10 +27,11 @@ public sealed class ChocolateyLicense public bool IsValid { get; set; } public bool AssemblyLoaded { get; set; } public IAssembly Assembly { get; set; } - //todo: get version + //todo: #2566 get version public string Version { get; set; } public string InvalidReason { get; set; } public DateTime? ExpirationDate { get; set; } + public bool IsCompatible { get; set; } public bool is_licensed_version() { diff --git a/src/chocolatey/infrastructure/licensing/ChocolateyLicenseType.cs b/src/chocolatey/infrastructure/licensing/ChocolateyLicenseType.cs index a993d7bd82..dedf5390ca 100644 --- a/src/chocolatey/infrastructure/licensing/ChocolateyLicenseType.cs +++ b/src/chocolatey/infrastructure/licensing/ChocolateyLicenseType.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/licensing/License.cs b/src/chocolatey/infrastructure/licensing/License.cs index bd21caac81..d6c87a8f6d 100644 --- a/src/chocolatey/infrastructure/licensing/License.cs +++ b/src/chocolatey/infrastructure/licensing/License.cs @@ -1,4 +1,4 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 RealDimensions Software, LLC // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,6 @@ namespace chocolatey.infrastructure.licensing using information; using logging; using registration; - using Environment = System.Environment; public static class License { @@ -32,40 +31,57 @@ public static ChocolateyLicense validate_license() { try { - #if FORCE_CHOCOLATEY_OFFICIAL_KEY var chocolateyPublicKey = ApplicationParameters.OfficialChocolateyPublicKey; #else var chocolateyPublicKey = ApplicationParameters.UnofficialChocolateyPublicKey; #endif - var licensedAssembly = AssemblyResolution.resolve_or_load_assembly(ApplicationParameters.LicensedChocolateyAssemblySimpleName, chocolateyPublicKey, ApplicationParameters.LicensedAssemblyLocation); + var licensedAssembly = AssemblyResolution.load_extension(ApplicationParameters.LicensedChocolateyAssemblySimpleName); + + if (licensedAssembly == null) + { + throw new ApplicationException("Unable to load licensed assembly."); + } - if (licensedAssembly == null) throw new ApplicationException("Unable to load licensed assembly."); license.AssemblyLoaded = true; license.Assembly = licensedAssembly; license.Version = VersionInformation.get_current_informational_version(licensedAssembly); + + // The licensed assembly is installed, check its supported Chocolatey versions and/or the assembly + // version so we can attempt to determine whether it's compatible with this version of Chocolatey. + var minimumChocolateyVersionString = VersionInformation.get_minimum_chocolatey_version(licensedAssembly); + "chocolatey".Log().Debug("Minimum Chocolatey Version: '{0}'".format_with(minimumChocolateyVersionString)); + var currentChocolateyVersionString = VersionInformation.get_current_assembly_version(); + "chocolatey".Log().Debug("Current Chocolatey Version: '{0}'".format_with(currentChocolateyVersionString)); + var currentChocolateyLicensedVersionString = VersionInformation.get_current_assembly_version(licensedAssembly); + "chocolatey".Log().Debug("Current Chocolatey Licensed Version: '{0}'".format_with(currentChocolateyLicensedVersionString)); + + var minimumChocolateyVersion = new Version(minimumChocolateyVersionString); + var currentChocolateyVersion = new Version(currentChocolateyVersionString); + var currentChocolateyLicensedVersion = new Version(currentChocolateyLicensedVersionString); + + license.IsCompatible = true; + + if (currentChocolateyVersion < minimumChocolateyVersion || (minimumChocolateyVersion == Version.Parse("1.0.0") && currentChocolateyLicensedVersion.Major < 4)) + { + license.IsCompatible = false; + } + 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}'. - The error message itself may be helpful:{1} {2}".format_with( - ApplicationParameters.LicensedAssemblyLocation, - Environment.NewLine, - ex.Message - )); - "chocolatey".Log().Warn(ChocolateyLoggers.Important,@" Install the Chocolatey Licensed Extension package with - `choco install chocolatey.extension` to remove this license warning. - TRIALS: If you have a trial license, you cannot use the above command - as is and be successful. You need to download nupkgs from the links in - the trial email as your license will not be registered on the licensed - repository. Please reference - https://docs.chocolatey.org/en-us/licensed-extension/setup#how-do-i-install-the-trial-edition - for specific instructions."); + @"A valid Chocolatey license was found, but the chocolatey.licensed.dll assembly could not be loaded: + {0} +Ensure that the chocolatey.licensed.dll exists at the following path: + '{1}'".format_with(ex.Message, ApplicationParameters.LicensedAssemblyLocation)); + + "chocolatey".Log().Warn( + ChocolateyLoggers.Important, + @"To resolve this, install the Chocolatey Licensed Extension package with + `choco install chocolatey.extension`"); } } diff --git a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs index cc89540cf2..c322b2cafa 100644 --- a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs +++ b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -31,7 +31,8 @@ public static ChocolateyLicense validate() { var chocolateyLicense = new ChocolateyLicense { - LicenseType = ChocolateyLicenseType.Unknown + LicenseType = ChocolateyLicenseType.Unknown, + IsCompatible = true }; var regularLogOutput = determine_if_regular_output_for_logging(); @@ -52,7 +53,7 @@ public static ChocolateyLicense validate() { if (Directory.GetFiles(licenseDirectory).Length != 0) { - "chocolatey".Log().Error(regularLogOutput ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly, @"Files found in directory '{0}' but not a + "chocolatey".Log().Error(regularLogOutput ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly, @"Files found in directory '{0}' but not a valid license file. License should be named '{1}'.".format_with(licenseDirectory, licenseFileName)); "chocolatey".Log().Warn(ChocolateyLoggers.Important,@" Rename license file to '{0}' to allow commercial features.".format_with(licenseFileName)); } @@ -62,12 +63,12 @@ public static ChocolateyLicense validate() // - user put the license file in the top level location and/or forgot to rename it if (File.Exists(Path.Combine(ApplicationParameters.InstallLocation, licenseFileName)) || File.Exists(Path.Combine(ApplicationParameters.InstallLocation, licenseFileName + ".txt"))) { - "chocolatey".Log().Error(regularLogOutput ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly, @"Chocolatey license found in the wrong location. File must be located at + "chocolatey".Log().Error(regularLogOutput ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly, @"Chocolatey license found in the wrong location. File must be located at '{0}'.".format_with(ApplicationParameters.LicenseFileLocation)); "chocolatey".Log().Warn(regularLogOutput ? ChocolateyLoggers.Important : ChocolateyLoggers.LogFileOnly, @" Move license file to '{0}' to allow commercial features.".format_with(ApplicationParameters.LicenseFileLocation)); } } - + // no IFileSystem at this point if (File.Exists(licenseFile)) { @@ -124,9 +125,6 @@ public static ChocolateyLicense validate() chocolateyLicense.ExpirationDate = license.ExpirationDate; chocolateyLicense.Name = license.Name; chocolateyLicense.Id = license.UserId.to_string(); - - //todo: if it is expired, provide a warning. - // one month after it should stop working } else { diff --git a/src/chocolatey/infrastructure/logging/AggregateLog.cs b/src/chocolatey/infrastructure/logging/AggregateLog.cs index 4dc3e85e76..0397399d25 100644 --- a/src/chocolatey/infrastructure/logging/AggregateLog.cs +++ b/src/chocolatey/infrastructure/logging/AggregateLog.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs b/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs index 6680266d07..ce208998fd 100644 --- a/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs +++ b/src/chocolatey/infrastructure/logging/ChocolateyLoggers.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/ILog.cs b/src/chocolatey/infrastructure/logging/ILog.cs index 611d1f01a2..fdb825ff78 100644 --- a/src/chocolatey/infrastructure/logging/ILog.cs +++ b/src/chocolatey/infrastructure/logging/ILog.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/Log.cs b/src/chocolatey/infrastructure/logging/Log.cs index 6a517c07a9..b3ab3801bb 100644 --- a/src/chocolatey/infrastructure/logging/Log.cs +++ b/src/chocolatey/infrastructure/logging/Log.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -77,4 +77,4 @@ public static ILog GetLoggerFor(string objectName) } // ReSharper restore InconsistentNaming -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs index 77a103fd0b..0953d107cd 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -55,7 +55,7 @@ private static IConsole Console private const string IMPORTANT_LOGGING_COLORED_APPENDER = "ImportantLoggingColoredConsoleAppender"; /// - /// Pulls xml configuration from embedded location and applies it. + /// Pulls xml configuration from embedded location and applies it. /// Then it configures a file appender to the specified output directory if one is provided. /// /// The output directory. @@ -63,7 +63,7 @@ private static IConsole Console public static void configure(string outputDirectory = null, params string[] excludeLoggerNames) { GlobalContext.Properties["pid"] = System.Diagnostics.Process.GetCurrentProcess().Id; - + var xmlConfigFile = Path.Combine(ApplicationParameters.InstallLocation, "log4net.config.xml"); if (File.Exists(xmlConfigFile)) { @@ -87,7 +87,7 @@ public static void configure(string outputDirectory = null, params string[] excl } configure_info_logging_colors(); - + if (!string.IsNullOrWhiteSpace(outputDirectory)) { set_file_appender(outputDirectory, excludeLoggerNames); @@ -417,4 +417,4 @@ public static void configure_additional_log_file(string logFileLocation) } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/logging/Log4NetLog.cs b/src/chocolatey/infrastructure/logging/Log4NetLog.cs index ffd40ccd02..264c0a31e2 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetLog.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetLog.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/LogLevelType.cs b/src/chocolatey/infrastructure/logging/LogLevelType.cs index 4ba977c588..5ecc0e0fdd 100644 --- a/src/chocolatey/infrastructure/logging/LogLevelType.cs +++ b/src/chocolatey/infrastructure/logging/LogLevelType.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/LogMessage.cs b/src/chocolatey/infrastructure/logging/LogMessage.cs index 3b9235cca0..661d67263a 100644 --- a/src/chocolatey/infrastructure/logging/LogMessage.cs +++ b/src/chocolatey/infrastructure/logging/LogMessage.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/LogSinkLog.cs b/src/chocolatey/infrastructure/logging/LogSinkLog.cs index b2d8215853..d5701e7198 100644 --- a/src/chocolatey/infrastructure/logging/LogSinkLog.cs +++ b/src/chocolatey/infrastructure/logging/LogSinkLog.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/NullLog.cs b/src/chocolatey/infrastructure/logging/NullLog.cs index e304f4c9c5..10eac489ea 100644 --- a/src/chocolatey/infrastructure/logging/NullLog.cs +++ b/src/chocolatey/infrastructure/logging/NullLog.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/logging/TraceLog.cs b/src/chocolatey/infrastructure/logging/TraceLog.cs index c82eb956b7..a9d52b4496 100644 --- a/src/chocolatey/infrastructure/logging/TraceLog.cs +++ b/src/chocolatey/infrastructure/logging/TraceLog.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -76,7 +76,7 @@ private void enable_system_net_logging() waitForInitializationThread.Join(); } } - + enable_trace_source("s_WebTraceSource", logging, this); //System.Net enable_trace_source("s_HttpListenerTraceSource", logging, this); //System.Net.HttpListener enable_trace_source("s_SocketsTraceSource", logging, this); //System.Net.Sockets @@ -125,4 +125,4 @@ public override void Flush() { } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/platforms/Platform.cs b/src/chocolatey/infrastructure/platforms/Platform.cs index 790148784f..5c9d003160 100644 --- a/src/chocolatey/infrastructure/platforms/Platform.cs +++ b/src/chocolatey/infrastructure/platforms/Platform.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -59,7 +59,7 @@ public static PlatformType get_platform() return PlatformType.Mac; case PlatformID.Unix: - // Well, there are chances MacOSX is reported as Unix instead of MacOSX. + // Well, there are chances macOS is reported as Unix instead of macOS (MacOSX). // Instead of platform check, we'll do a feature checks (Mac specific root folders) if (file_system.directory_exists("/Applications") & file_system.directory_exists("/System") @@ -85,7 +85,7 @@ public static string get_name() case PlatformType.Linux: return "Linux"; case PlatformType.Mac: - return "OS X"; + return "macOS"; case PlatformType.Windows: return get_windows_name(get_version()); default: @@ -157,7 +157,7 @@ private static string get_windows_name(Version version) /* https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833.aspx - + typedef struct _OSVERSIONINFOEX { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; @@ -207,4 +207,4 @@ _Inout_ LPOSVERSIONINFO lpVersionInfo // ReSharper restore InconsistentNaming } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/platforms/PlatformType.cs b/src/chocolatey/infrastructure/platforms/PlatformType.cs index b54b822477..366d67db5c 100644 --- a/src/chocolatey/infrastructure/platforms/PlatformType.cs +++ b/src/chocolatey/infrastructure/platforms/PlatformType.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/powershell/PoshHost.cs b/src/chocolatey/infrastructure/powershell/PoshHost.cs index 9bc58e3757..40dda2c793 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHost.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHost.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -41,7 +41,7 @@ public class PoshHost : PSHost // others // http://stackoverflow.com/questions/16329448/hosting-powershell-powershell-vs-runspace-vs-runspacepool-vs-pipeline - // + // public int ExitCode { get; set; } public Exception HostException { get; set; } @@ -56,7 +56,7 @@ public PoshHost(ChocolateyConfiguration configuration) } /// - /// Grabs the current version of PowerShell from the registry + /// Grabs the current version of PowerShell from the registry /// /// /// We can cheat because we require at least v2, which takes us down to just the check for v3 @@ -70,7 +70,7 @@ private Version get_current_version() { version = new Version(majorMinor.Value); } - + return version; } @@ -138,4 +138,4 @@ public override void ExitNestedPrompt() #endregion } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs index fb7a9d1e09..17ed8f272b 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -28,19 +28,19 @@ public class PoshHostRawUserInterface : PSHostRawUserInterface public override ConsoleColor BackgroundColor { - get { return Console.BackgroundColor; } + get { return Console.BackgroundColor; } set { Console.BackgroundColor = value; } } public override ConsoleColor ForegroundColor { - get { return Console.ForegroundColor; } + get { return Console.ForegroundColor; } set { Console.ForegroundColor = value; } } public override Size BufferSize { - get { return new Size(Console.BufferWidth, Console.BufferHeight); } + get { return new Size(Console.BufferWidth, Console.BufferHeight); } set { Console.SetBufferSize(value.Width, value.Height); } } @@ -48,7 +48,7 @@ public override Size BufferSize public override int CursorSize { - get { return Console.CursorSize; } + get { return Console.CursorSize; } set { Console.CursorSize = value; } } @@ -68,19 +68,19 @@ public override Size MaxWindowSize } public override Coordinates WindowPosition { - get { return new Coordinates(Console.WindowLeft, Console.WindowTop); } + get { return new Coordinates(Console.WindowLeft, Console.WindowTop); } set { Console.SetWindowPosition(value.X, value.Y); } } public override Size WindowSize { - get { return new Size(Console.WindowWidth, Console.WindowHeight); } + get { return new Size(Console.WindowWidth, Console.WindowHeight); } set { Console.SetWindowSize(value.Width, value.Height); } } public override string WindowTitle { - get { return Console.Title; } + get { return Console.Title; } set { Console.Title = value; } } diff --git a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs index 11924fee2e..0b80d3f472 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -75,7 +75,7 @@ public override SecureString ReadLineAsSecureString() return secureStringPlainText.to_secure_string(); } - + public override void Write(string value) { this.Log().Info(value.escape_curly_braces()); @@ -133,7 +133,7 @@ public override void WriteDebugLine(string message) private bool hasLoggedStartProgress = false; public override void WriteProgress(long sourceId, ProgressRecord record) - { + { if (record.PercentComplete == -1) return; if (!hasLoggedStartProgress) @@ -182,7 +182,7 @@ public override Dictionary Prompt(string caption, string messa { selection = ReadLine(); } - + if (selection == null) return null; results[field.Name] = PSObject.AsPSObject(selection); diff --git a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs index 95f5e98475..f3ad618fbb 100644 --- a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs +++ b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -17,9 +17,11 @@ namespace chocolatey.infrastructure.registration { using System; + using System.Collections.Concurrent; using System.Linq; using System.Threading; using adapters; + using chocolatey.infrastructure.app; using filesystem; public class AssemblyResolution @@ -27,6 +29,8 @@ public class AssemblyResolution private const int LOCK_RESOLUTION_TIMEOUT_SECONDS = 5; private static readonly object _lockObject = new object(); + private static readonly ConcurrentDictionary _loadedAssemblies = new ConcurrentDictionary(); + /// /// Resolves or loads an assembly. If an assembly is already loaded, no need to reload it. /// @@ -35,7 +39,20 @@ public class AssemblyResolution /// The assembly file location. Typically the path to the DLL on disk. /// An assembly /// Unable to enter synchronized code to determine assembly loading - public static IAssembly resolve_or_load_assembly(string assemblySimpleName, string publicKeyToken, string assemblyFileLocation) + public static IAssembly resolve_or_load_assembly(string assemblySimpleName, string publicKeyToken, string assemblyFileLocation) { + return resolve_or_load_assembly(assemblySimpleName, publicKeyToken, assemblyFileLocation, false); + } + + /// + /// Resolves or loads an assembly. If an assembly is already loaded, no need to reload it. + /// + /// Simple Name of the assembly, such as "chocolatey" + /// The public key token. + /// The assembly file location. Typically the path to the DLL on disk. + /// Whether any existing library that has previously been loaded should be ignored or not. + /// An assembly + /// Unable to enter synchronized code to determine assembly loading + public static IAssembly resolve_or_load_assembly(string assemblySimpleName, string publicKeyToken, string assemblyFileLocation, bool ignoreExisting = false) { var lockTaken = false; try @@ -48,25 +65,168 @@ public static IAssembly resolve_or_load_assembly(string assemblySimpleName, stri } IAssembly resolvedAssembly = null; + if (lockTaken) { try { - foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetName().Name.is_equal_to(assemblySimpleName)).or_empty_list_if_null()) + if (!ignoreExisting) + { + resolvedAssembly = resolve_assembly(assemblySimpleName, publicKeyToken); + } + + if (resolvedAssembly == null) { - if (string.IsNullOrWhiteSpace(publicKeyToken) || assembly.GetName().get_public_key_token().is_equal_to(publicKeyToken)) + var tempAssembly = Assembly.Load(FileSystem.read_binary_file_into_byte_array(assemblyFileLocation)); + + if (tempAssembly == null) { - "AssemblyResolver".Log().Debug("Returning loaded assembly type for '{0}'".format_with(assemblySimpleName)); - resolvedAssembly = Assembly.set_assembly(assembly); + return null; + } + + if (string.IsNullOrWhiteSpace(publicKeyToken) || tempAssembly.GetName().get_public_key_token().is_equal_to(publicKeyToken)) + { + "chocolatey".Log().Debug("Loading up '{0}' assembly type from '{1}'".format_with(assemblySimpleName, assemblyFileLocation)); + resolvedAssembly = tempAssembly; + _loadedAssemblies.TryAdd(assemblySimpleName.to_lower(), resolvedAssembly); + + if (assemblySimpleName.is_equal_to("choco")) + { + _loadedAssemblies.TryAdd("chocolatey", resolvedAssembly); + } + else if (assemblySimpleName.is_equal_to("chocolatey")) + { + _loadedAssemblies.TryAdd("choco", resolvedAssembly); + } + } + } + } + finally + { + Monitor.Pulse(_lockObject); + Monitor.Exit(_lockObject); + } + } + + return resolvedAssembly; + } + + public static IAssembly load_assembly(string assemblySimpleName, string assemblyFileLocation, params string[] publicKeyTokens) + { + if (publicKeyTokens == null || publicKeyTokens.Length == 0) + { + publicKeyTokens = new[] { string.Empty }; + } + + var lockTaken = false; + try + { + Monitor.TryEnter(_lockObject, TimeSpan.FromSeconds(LOCK_RESOLUTION_TIMEOUT_SECONDS), ref lockTaken); + } + catch (Exception) + { + throw new Exception("Unable to enter synchronized code to determine assembly loading"); + } + + IAssembly resolvedAssembly = null; + + if (lockTaken) + { + try + { + IAssembly tempAssembly; +#if FORCE_OFFICIAL_KEY + tempAssembly = Assembly.Load(FileSystem.read_binary_file_into_byte_array(assemblyFileLocation)); +#else + var symbolFile = System.IO.Path.ChangeExtension(assemblyFileLocation, ".pdb"); + if (System.IO.File.Exists(symbolFile)) + { + tempAssembly = Assembly.Load( + FileSystem.read_binary_file_into_byte_array(assemblyFileLocation), + FileSystem.read_binary_file_into_byte_array(symbolFile)); + } + else + { + tempAssembly = Assembly.Load(FileSystem.read_binary_file_into_byte_array(assemblyFileLocation)); + } +#endif + + if (tempAssembly == null) + { + return null; + } + + foreach (var publicKeyToken in publicKeyTokens) + { + if (string.IsNullOrWhiteSpace(publicKeyToken) || tempAssembly.GetName().get_public_key_token().is_equal_to(publicKeyToken)) + { + "chocolatey".Log().Debug("Loading up '{0}' assembly type from '{1}'".format_with(assemblySimpleName, assemblyFileLocation)); + resolvedAssembly = tempAssembly; + + _loadedAssemblies.TryAdd(assemblySimpleName.to_lower(), resolvedAssembly); + + if (assemblySimpleName.is_equal_to("choco")) + { + _loadedAssemblies.TryAdd("chocolatey", resolvedAssembly); + } + else if (assemblySimpleName.is_equal_to("chocolatey")) + { + _loadedAssemblies.TryAdd("choco", resolvedAssembly); + } + break; } } + } + finally + { + Monitor.Pulse(_lockObject); + Monitor.Exit(_lockObject); + } + } - if (resolvedAssembly == null) + return resolvedAssembly; + } + + /// + /// Resolves or loads an assembly. If an assembly is already loaded, no need to reload it. + /// + /// Simple Name of the assembly, such as "chocolatey" + /// The public key tokens the assembly may be signed with. + /// + /// An assembly + /// Unable to enter synchronized code to determine assembly loading + public static IAssembly resolve_existing_assembly(string assemblySimpleName, params string[] publicKeyTokens) + { + if (publicKeyTokens == null || publicKeyTokens.Length == 0) + { + publicKeyTokens = new[] { string.Empty }; + } + + var lockTaken = false; + try + { + Monitor.TryEnter(_lockObject, TimeSpan.FromSeconds(LOCK_RESOLUTION_TIMEOUT_SECONDS), ref lockTaken); + } + catch (Exception) + { + throw new Exception("Unable to enter synchronized code to determine assembly loading"); + } + + IAssembly resolvedAssembly = null; + + if (lockTaken) + { + try + { + foreach (var publicKeyToken in publicKeyTokens) { - "AssemblyResolver".Log().Debug("Loading up '{0}' assembly type from '{1}'".format_with(assemblySimpleName, assemblyFileLocation)); - // avoid locking by reading in the bytes of the file and then passing that to Assembly.Load - resolvedAssembly = Assembly.Load(FileSystem.read_binary_file_into_byte_array(assemblyFileLocation)); + resolvedAssembly = resolve_assembly(assemblySimpleName, publicKeyToken); + + if (resolvedAssembly != null) + { + break; + } } } finally @@ -78,5 +238,57 @@ public static IAssembly resolve_or_load_assembly(string assemblySimpleName, stri return resolvedAssembly; } + + private static IAssembly resolve_assembly(string assemblySimpleName, string publicKeyToken) + { + IAssembly resolvedAssembly = null; + + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetName().Name.is_equal_to(assemblySimpleName)).or_empty_list_if_null()) + { + if (string.IsNullOrWhiteSpace(publicKeyToken) || assembly.GetName().get_public_key_token().is_equal_to(publicKeyToken)) + { + "chocolatey".Log().Debug("Returning loaded assembly type for '{0}'".format_with(assemblySimpleName)); + resolvedAssembly = Assembly.set_assembly(assembly); + break; + } + } + + IAssembly tempAssembly; + + if (_loadedAssemblies.TryGetValue(assemblySimpleName.to_lower(), out tempAssembly)) + { + if (string.IsNullOrWhiteSpace(publicKeyToken) || tempAssembly.GetName().get_public_key_token().is_equal_to(publicKeyToken)) + { + "chocolatey".Log().Debug("Returning loaded assembly type for '{0}'".format_with(assemblySimpleName)); + resolvedAssembly = tempAssembly; + } + } + + return resolvedAssembly; + } + + public static IAssembly load_extension(string assemblySimpleName) + { +#if FORCE_CHOCOLATEY_OFFICIAL_KEY + var chocolateyPublicKey = ApplicationParameters.OfficialChocolateyPublicKey; +#else + var chocolateyPublicKey = ApplicationParameters.UnofficialChocolateyPublicKey; +#endif + + var fullName = "{0}, Version=0.0.0.0, Culture=neutral, PublicKeyToken={1}".format_with( + assemblySimpleName, + chocolateyPublicKey); + + // We use Reflection Assembly Load directly to allow .NET assembly resolving + // to handle everything. + var assembly = System.Reflection.Assembly.Load(fullName); + + if (assembly != null) + { + return Assembly.set_assembly(assembly); + } + + return null; + } } } diff --git a/src/chocolatey/infrastructure/registration/Bootstrap.cs b/src/chocolatey/infrastructure/registration/Bootstrap.cs index 8882adbb87..899af62b65 100644 --- a/src/chocolatey/infrastructure/registration/Bootstrap.cs +++ b/src/chocolatey/infrastructure/registration/Bootstrap.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -79,4 +79,4 @@ public static void shutdown() { } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs index c4fab2639b..d89f6c875c 100644 --- a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs +++ b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -30,8 +30,8 @@ public static void set_protocol(ChocolateyConfiguration config, bool provideWarn { try { - // We can't address the protocols directly when built with .NET - // Framework 4.0. However if someone is running .NET 4.5 or + // We can't address the protocols directly when built with .NET + // Framework 4.0. However if someone is running .NET 4.5 or // greater, they have in-place upgrades for System.dll, which // will allow us to set these protocols directly. const SecurityProtocolType tls11 = (SecurityProtocolType)TLS_1_1; @@ -41,15 +41,15 @@ public static void set_protocol(ChocolateyConfiguration config, bool provideWarn catch (Exception) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; - //todo: provide this warning with the ability to opt out of seeing it again so we can move it up to more prominent visibility and not just the verbose log + //todo: #2585 provide this warning with the ability to opt out of seeing it again so we can move it up to more prominent visibility and not just the verbose log if (provideWarning) { "chocolatey".Log().Warn(ChocolateyLoggers.Verbose, @" !!WARNING!! -Choco prefers to use TLS v1.2 if it is available, but this client is - running on .NET 4.0, which uses an older SSL. It's using TLS 1.0 or - earlier, which makes it susceptible to BEAST and also doesn't - implement the 1/n-1 record splitting mitigation for Cipher-Block +Choco prefers to use TLS v1.2 if it is available, but this client is + running on .NET 4.0, which uses an older SSL. It's using TLS 1.0 or + earlier, which makes it susceptible to BEAST and also doesn't + implement the 1/n-1 record splitting mitigation for Cipher-Block Chaining. Upgrade to at least .NET 4.5 at your earliest convenience. For more information you should visit https://www.howsmyssl.com/"); diff --git a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs index 066f13196d..e1b5b0e8ef 100644 --- a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs +++ b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -18,9 +18,13 @@ namespace chocolatey.infrastructure.registration { using System; using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; using System.Reflection; using app; using app.registration; + using chocolatey.infrastructure.information; + using chocolatey.infrastructure.licensing; using logging; using SimpleInjector; @@ -38,15 +42,15 @@ public static class SimpleInjectorContainer #else private static bool _verifyContainer = false; #endif - - public static bool VerifyContainer { + + public static bool VerifyContainer + { get { return _verifyContainer; } - set { _verifyContainer = value; } + set { _verifyContainer = value; } } - /// - /// Add a component registry class to the container. + /// Add a component registry class to the container. /// Must have `public void RegisterComponents(Container container)` /// and a parameterless constructor. /// @@ -72,11 +76,13 @@ private static Container initialize() container.Options.ConstructorResolutionBehavior = new SimpleInjectorContainerResolutionBehavior(originalConstructorResolutionBehavior); var binding = new ContainerBinding(); - binding.RegisterComponents(container); + var extensions = binding.RegisterComponents(container); + + // TODO: Remove once we can do a breaking release, ie 2.0.0 foreach (var componentRegistry in _componentRegistries) { - load_component_registry(componentRegistry, container); + load_component_registry(componentRegistry, container, extensions); } if (_verifyContainer) container.Verify(); @@ -89,26 +95,34 @@ private static Container initialize() /// /// The component registry. /// The container. - private static void load_component_registry(Type componentRegistry, Container container) + private static void load_component_registry(Type componentRegistry, Container container, IEnumerable extensions) { if (componentRegistry == null) { - "chocolatey".Log().Warn(ChocolateyLoggers.Important, -@"Unable to register licensed components. This is likely related to a + if (!extensions.Any(e => e.Name.is_equal_to("chocolatey.licensed"))) + { + "chocolatey".Log().Warn(ChocolateyLoggers.Important, + @"Unable to register licensed components. This is likely related to a missing or outdated licensed DLL."); + } return; } try { - object componentClass = Activator.CreateInstance(componentRegistry); - - componentRegistry.InvokeMember( - REGISTER_COMPONENTS_METHOD, - BindingFlags.InvokeMethod, - null, - componentClass, - new Object[] { container } - ); + if (!extensions.Any(e => e.Name.is_equal_to(componentRegistry.Assembly.GetName().Name))) + { + var registrations = container.GetCurrentRegistrations(); + + object componentClass = Activator.CreateInstance(componentRegistry); + + componentRegistry.InvokeMember( + REGISTER_COMPONENTS_METHOD, + BindingFlags.InvokeMethod, + null, + componentClass, + new Object[] { container } + ); + } } catch (Exception ex) { diff --git a/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs b/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs index 4befb7fe5d..6b66bf9cee 100644 --- a/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs +++ b/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -67,4 +67,4 @@ orderby constructor.GetParameters().Count() descending return _originalBehavior.GetConstructor(serviceType, implementationType); } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/results/IResult.cs b/src/chocolatey/infrastructure/results/IResult.cs index 79de6bfed0..0c42a4359f 100644 --- a/src/chocolatey/infrastructure/results/IResult.cs +++ b/src/chocolatey/infrastructure/results/IResult.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/results/PackageResult.cs b/src/chocolatey/infrastructure/results/PackageResult.cs index 109ab06deb..7c7066c037 100644 --- a/src/chocolatey/infrastructure/results/PackageResult.cs +++ b/src/chocolatey/infrastructure/results/PackageResult.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -29,8 +29,8 @@ public sealed class PackageResult : Result public bool Inconclusive { get { return _messages.Value.Any(x => x.MessageType == ResultType.Inconclusive); } - } - + } + public bool Warning { get { return _messages.Value.Any(x => x.MessageType == ResultType.Warn); } @@ -63,7 +63,7 @@ public PackageResult(IPackage package, string installLocation, string source = n } } - + var rp = Package as DataServicePackage; if (rp != null && rp.DownloadUrl != null) { @@ -88,4 +88,4 @@ public PackageResult(string name, string version, string installLocation, string Source = source; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/results/PowerShellExecutionResults.cs b/src/chocolatey/infrastructure/results/PowerShellExecutionResults.cs index 25f22e5204..089fb62039 100644 --- a/src/chocolatey/infrastructure/results/PowerShellExecutionResults.cs +++ b/src/chocolatey/infrastructure/results/PowerShellExecutionResults.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/results/Result.cs b/src/chocolatey/infrastructure/results/Result.cs index 94e446f91c..e6588a7b8b 100644 --- a/src/chocolatey/infrastructure/results/Result.cs +++ b/src/chocolatey/infrastructure/results/Result.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/results/ResultMessage.cs b/src/chocolatey/infrastructure/results/ResultMessage.cs index abb56a3da6..057b6f2730 100644 --- a/src/chocolatey/infrastructure/results/ResultMessage.cs +++ b/src/chocolatey/infrastructure/results/ResultMessage.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/results/ResultType.cs b/src/chocolatey/infrastructure/results/ResultType.cs index c7012d8cd8..909e724659 100644 --- a/src/chocolatey/infrastructure/results/ResultType.cs +++ b/src/chocolatey/infrastructure/results/ResultType.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs index 5ed99e2559..6a166b4eb0 100644 --- a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs +++ b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -54,4 +54,4 @@ public IDisposable subscribe(Action handleEvent, Action return subscription; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/services/IDateTimeService.cs b/src/chocolatey/infrastructure/services/IDateTimeService.cs index 9c2bc45616..3dd754dd27 100644 --- a/src/chocolatey/infrastructure/services/IDateTimeService.cs +++ b/src/chocolatey/infrastructure/services/IDateTimeService.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs b/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs index 49b90b6796..8c8f8f6e63 100644 --- a/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs +++ b/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/services/IRegularExpressionService.cs b/src/chocolatey/infrastructure/services/IRegularExpressionService.cs index 577db78baf..62efa275b1 100644 --- a/src/chocolatey/infrastructure/services/IRegularExpressionService.cs +++ b/src/chocolatey/infrastructure/services/IRegularExpressionService.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/services/RegularExpressionService.cs b/src/chocolatey/infrastructure/services/RegularExpressionService.cs index 0ac1d87be4..e4a9397b56 100644 --- a/src/chocolatey/infrastructure/services/RegularExpressionService.cs +++ b/src/chocolatey/infrastructure/services/RegularExpressionService.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/services/SystemDateTimeService.cs b/src/chocolatey/infrastructure/services/SystemDateTimeService.cs index 0772c934fd..e3447330b3 100644 --- a/src/chocolatey/infrastructure/services/SystemDateTimeService.cs +++ b/src/chocolatey/infrastructure/services/SystemDateTimeService.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs b/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs index f74665072e..d08b77219f 100644 --- a/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs +++ b/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. diff --git a/src/chocolatey/infrastructure/services/XmlService.cs b/src/chocolatey/infrastructure/services/XmlService.cs index 7e9da544c2..f5086c58a9 100644 --- a/src/chocolatey/infrastructure/services/XmlService.cs +++ b/src/chocolatey/infrastructure/services/XmlService.cs @@ -24,7 +24,6 @@ namespace chocolatey.infrastructure.services using System.Xml.Serialization; using cryptography; using filesystem; - using logging; using tolerance; using synchronization; @@ -90,6 +89,8 @@ public XmlType deserialize(string xmlFilePath, int retryCount) // If there's no errors and it's valid, go ahead and replace the bad file with the backup. if (validConfig != null) { + // Close fileReader so that we can copy the file without it being locked. + fileReader.Close(); _fileSystem.copy_file(xmlFilePath + ".backup", xmlFilePath, overwriteExisting: true); } diff --git a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs index dc8f3a2d0c..a78ca21f15 100644 --- a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs +++ b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -93,7 +93,7 @@ public static void enter(Action action, int timeout) } /// - /// Enters the Global Mutext + /// Enters the Global Mutex /// /// The return type /// The function to perform. @@ -114,7 +114,7 @@ public static T enter(Func func, int timeout) { if (func != null) returnValue = func.Invoke(); } - + return returnValue; } diff --git a/src/chocolatey/infrastructure/tasks/ITask.cs b/src/chocolatey/infrastructure/tasks/ITask.cs index ac2bdf25e1..c331cb9ed9 100644 --- a/src/chocolatey/infrastructure/tasks/ITask.cs +++ b/src/chocolatey/infrastructure/tasks/ITask.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -16,9 +16,12 @@ namespace chocolatey.infrastructure.tasks { + using chocolatey.infrastructure.app.attributes; + /// /// Interface for all runners. /// + [MultiService] public interface ITask { /// diff --git a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs index 14f37fa96f..8c1e4028d0 100644 --- a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs +++ b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -61,5 +61,16 @@ private static IDictionary create_dictionary_from_configuration< return propertyDictionary; } + + public static IEnumerable get_tokens(string textWithTokens, string tokenPrefix = "[[", string tokenSuffix = "]]") + { + var regexMatches = Regex.Matches(textWithTokens, "{0}(?\\w+){1}" + .format_with(Regex.Escape(tokenPrefix), Regex.Escape(tokenSuffix)) + ); + foreach (Match regexMatch in regexMatches) + { + yield return regexMatch.Groups["key"].to_string(); + } + } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs index 27e371da9e..3a96745d2f 100644 --- a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs +++ b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs @@ -1,13 +1,13 @@ // Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -100,7 +100,7 @@ public static T retry(int numberOfTries, Func function, int waitDurationMi "chocolatey".Log().Error(logLocation, "Maximum tries of {0} reached. Throwing error.".format_with(numberOfTries)); throw; } - + int retryWait = waitDurationMilliseconds + (i*increaseRetryByMilliseconds); var exceptionMessage = debugging ? ex.ToString() : ex.Message; @@ -109,7 +109,7 @@ public static T retry(int numberOfTries, Func function, int waitDurationMi Environment.NewLine, exceptionMessage, retryWait, - i, + i, numberOfTries)); Thread.Sleep(retryWait); } @@ -194,4 +194,4 @@ public static T try_catch_with_logging_exception(Func function, string err return returnValue; } } -} \ No newline at end of file +} diff --git a/src/chocolatey/infrastructure/validations/IValidation.cs b/src/chocolatey/infrastructure/validations/IValidation.cs index 19a0cf9310..c0aab571e8 100644 --- a/src/chocolatey/infrastructure/validations/IValidation.cs +++ b/src/chocolatey/infrastructure/validations/IValidation.cs @@ -1,4 +1,4 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2022 Chocolatey Software, Inc // Copyright © 2011 - 2017 RealDimensions Software, LLC // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,10 +18,12 @@ namespace chocolatey.infrastructure.validations { using System.Collections.Generic; using app.configuration; + using chocolatey.infrastructure.app.attributes; /// /// Interface for all validations /// + [MultiService] public interface IValidation { /// diff --git a/src/chocolatey/infrastructure/xml/XmlCData.cs b/src/chocolatey/infrastructure/xml/XmlCData.cs index 825f726f01..08fcab75be 100644 --- a/src/chocolatey/infrastructure/xml/XmlCData.cs +++ b/src/chocolatey/infrastructure/xml/XmlCData.cs @@ -1,13 +1,13 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2017 - 2021 Chocolatey Software, Inc // Copyright © 2011 - 2017 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. @@ -42,7 +42,7 @@ public static implicit operator XmlCData(string value) } /// - /// Allow direct assigment to string + /// Allow direct assignment to string /// string str = cdata; /// /// diff --git a/src/chocolatey/packages.config b/src/chocolatey/packages.config index b3a3019a63..b3af30a6eb 100644 --- a/src/chocolatey/packages.config +++ b/src/chocolatey/packages.config @@ -1,12 +1,10 @@  - - + - - + \ No newline at end of file diff --git a/src/chocolatey/targets/Microsoft.Application.targets b/src/chocolatey/targets/Microsoft.Application.targets deleted file mode 100644 index cca48b2987..0000000000 --- a/src/chocolatey/targets/Microsoft.Application.targets +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - False - True - False - $(ExeProjectOutputDirInsideProjectDefault) - $(MSBuildProjectDirectory) - $(OutDir)_PublishedApplications\$(MSBuildProjectName) - False - False - True - False - - - - - $(PrepareForRunDependsOn); - - - $(PrepareForRunDependsOn); - _CopyExeApplication; - _BuiltExeOutputGroupOutput - - - - - - - - - - - - - - - - $(CleanDependsOn); - CleanExeProjectOutputDir; - - - - - - - - - - - - - - - - - - - - - - _CopyExeApplicationLegacy; - - - $(OnBefore_CopyExeApplicationDefault); - - - - - - <_CopyExeApplicationDependsOn Condition="'$(_CopyExeApplicationDependsOn)'==''"> - $(OnBefore_CopyExeApplication); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test.bat b/test.bat deleted file mode 100644 index 70cf4f6974..0000000000 --- a/test.bat +++ /dev/null @@ -1,38 +0,0 @@ -@echo off - -::Project UppercuT - http://uppercut.googlecode.com -::No edits to this file are required - http://uppercut.pbwiki.com - -if '%2' NEQ '' goto usage -if '%3' NEQ '' goto usage -if '%1' == '/?' goto usage -if '%1' == '-?' goto usage -if '%1' == '?' goto usage -if '%1' == '/help' goto usage - -SET DIR=%cd% -SET BUILD_DIR=%~d0%~p0% -SET NANT="%BUILD_DIR%lib\Nant\nant.exe" -SET build.config.settings="%DIR%\.uppercut" - -%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\compile.step" -D:build.config.settings=%build.config.settings% - -if %ERRORLEVEL% NEQ 0 goto errors - -%NANT% /logger:"NAnt.Core.DefaultLogger" /nologo /f:"%BUILD_DIR%.build\analyzers\test.step" %1 -D:build.config.settings=%build.config.settings% - -if %ERRORLEVEL% NEQ 0 goto errors - -goto finish - -:usage -echo. -echo Usage: test.bat -echo Usage: test.bat all - to run all tests -echo. -goto finish - -:errors -EXIT /B %ERRORLEVEL% - -:finish diff --git a/tests/Vagrantfile b/tests/Vagrantfile new file mode 100644 index 0000000000..fec687b61a --- /dev/null +++ b/tests/Vagrantfile @@ -0,0 +1,66 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "StefanScherer/windows_2019" + config.vm.boot_timeout = 600 + + # windows + config.vm.guest = :windows + config.windows.halt_timeout = 60 + config.windows.set_work_network = true + + # winrm + config.vm.communicator = 'winrm' + config.winrm.username = 'vagrant' + config.winrm.password = 'vagrant' + # https://github.com/hashicorp/vagrant/issues/6430 + config.winrm.retry_limit = 30 + config.winrm.retry_delay = 10 + + config.vm.network :forwarded_port, guest: 5985, host: 14985, id: 'winrm', auto_correct: true + config.vm.network :forwarded_port, guest: 3389, host: 14389, id: 'rdp', auto_correct: true + + config.vm.provider "virtualbox" do |vb| + vb.gui = true + vb.memory = 4096 + vb.cpus = 2 + vb.linked_clone = true + vb.customize ['modifyvm', :id, '--vram', '128'] + end + config.vm.provider "hyperv" do |h| + h.memory = 4096 + h.cpus = 2 + h.linked_clone = true + h.enable_checkpoints = false + end + + config.vm.synced_folder '../', '/chocoRoot' + + config.vm.provision "shell", inline: <<-SHELL + cscript c:/windows/system32/slmgr.vbs /rearm | Out-Null + Set-ExecutionPolicy Bypass -Scope Process -Force + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + + Write-Host "We are going to install some prerequisites now. This could take some time" + $null = choco install dotnet3.5 git pester visualstudio2019community visualstudio2019-workload-manageddesktop -y + Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1 + Update-SessionEnvironment + Write-Host "Done installing software, now copying files" + $null = robocopy c:/chocoRoot c:/code/choco /mir + Push-Location c:/code/choco + Write-Host "Files have been copied, beginning build process. You may see some red warning text regarding VsVersionToYearString, this can be safely ignored" + $CakeOutput = ./build.bat + if ($LastExitCode -ne 0) { + Set-Content c:/chocoRoot/buildOutput.txt -Value $CakeOutput + Write-Host "The build has failed. Please see the buildOutput.txt file at the root of the repository for details" + exit $LastExitCode + } + + Write-Host "Build complete. Executing tests." + # $env:TEST_KITCHEN = 1 + $env:VM_RUNNING = 1 + ./Invoke-Tests.ps1 + SHELL +end diff --git a/tests/chocolatey-tests/BundledApplications.Tests.ps1 b/tests/chocolatey-tests/BundledApplications.Tests.ps1 new file mode 100644 index 0000000000..bb41c55a55 --- /dev/null +++ b/tests/chocolatey-tests/BundledApplications.Tests.ps1 @@ -0,0 +1,30 @@ +Import-Module helpers/common-helpers + +Describe 'Ensuring correct version of is installed' -Tag BundledApplications -ForEach @( + @{ Name = 'shimgen' ; Version = '1.0.0' ; ChocolateyVersion = '1.0.0' ; IsSigned = $true } + @{ Name = '7z' ; Version = '21.07' ; ChocolateyVersion = '1.1.0' ; IsSigned = $false } +) -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan "1.0.0")) { + Context ' is correctly installed' -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan $ChocolateyVersion)) { + BeforeAll { + # Because we're not modifying the install in any way, there is no need to Initialize-ChocolateyTestInstall + $ToolPath = "$env:ChocolateyInstall/tools/$Name.exe" + # TODO: Encapsulate in an environment variable once kitchen-pester has new version - https://github.com/chocolatey/choco/issues/2692 + $Thumbprint = '83AC7D88C66CB8680BCE802E0F0F5C179722764B' + } + + It 'Should be in Chocolatey tools directory' { + $ToolPath | Should -Exist + } + + It 'Should be appropriately signed' -Skip:(-not $IsSigned) { + $signature = Get-AuthenticodeSignature -FilePath $ToolPath + $signature.Status | Should -Be 'Valid' + $signature.SignerCertificate.Thumbprint | Should -Be $Thumbprint + } + + It 'Should be version ' { + $fileInfo = Get-ChildItem $ToolPath + $fileInfo.VersionInfo.ProductVersion | Should -Be $Version + } + } +} diff --git a/tests/chocolatey-tests/TestCertificate.pfx b/tests/chocolatey-tests/TestCertificate.pfx new file mode 100644 index 0000000000..cee0be1c53 Binary files /dev/null and b/tests/chocolatey-tests/TestCertificate.pfx differ diff --git a/tests/chocolatey-tests/chocolatey.Tests.ps1 b/tests/chocolatey-tests/chocolatey.Tests.ps1 new file mode 100644 index 0000000000..de3a47c88a --- /dev/null +++ b/tests/chocolatey-tests/chocolatey.Tests.ps1 @@ -0,0 +1,368 @@ +Import-Module helpers/common-helpers + +Describe "Ensuring Chocolatey is correctly installed" -Tag Environment, Chocolatey { + BeforeDiscovery { + $ChocolateyDirectoriesToCheck = @( + "$env:ChocolateyInstall\helpers" + "$env:ChocolateyInstall\extensions\chocolatey" + "$env:ChocolateyInstall\bin" + ) + $StrongNamingKeyFilesToCheck = @( + "$env:ChocolateyInstall\choco.exe" + "$env:ChocolateyInstall\extensions\chocolatey\chocolatey.licensed.dll" + ) + $RemovedShims = @( + "\bin\cpack.exe" + "\bin\cver.exe" + ) + $PowerShellFiles = Get-ChildItem -Path $ChocolateyDirectoriesToCheck -Include "*.ps1", "*.psm1" -Recurse -ErrorAction Ignore + # For certain test scenarious we run, there are additional files available in the bin directory. + # These files should not be tested as part of the signing check. + $ExecutableFiles = Get-ChildItem -Path $ChocolateyDirectoriesToCheck -Include "*.exe", "*.dll" -Recurse -ErrorAction Ignore | Where-Object Name -NotMatch 'driver\.exe$' + $StrongNamingKeyFiles = Get-ChildItem -Path $StrongNamingKeyFilesToCheck -ErrorAction Ignore + } + + BeforeAll { + # TODO: Both this thumbprint and strong name key should be in an environment variable. Update when new kitchen-pester is available. - https://github.com/chocolatey/choco/issues/2692 + $ChocolateyThumbprint = '83AC7D88C66CB8680BCE802E0F0F5C179722764B' + $ChocolateyStrongNameKey = '79d02ea9cad655eb' + # These lines are part of testing the issue + # https://github.com/chocolatey/choco/issues/2233 + # to see if the nuget.config is not created by + # chocolatey. + $path = "$env:APPDATA\NuGet\nuget.config" + if (Test-Path $path) { + Remove-Item $path + } + $null = Invoke-Choco outdated + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context 'Chocolatey' { + It 'exists in $env:ChocolateyInstall folder' { + Join-Path $env:ChocolateyInstall -ChildPath "choco.exe" | Should -Exist + } + + It "has <_> available on PATH" -ForEach @("choco.exe"; "cinst.exe"; "cpush.exe") { + $executable = $_ + $pathList = $env:PATH -split ";" + $found = $false + foreach ($path in $pathList) { + $found = Test-Path (Join-Path $path $executable) + if ($found) { + break + } + } + + $found | Should -BeTrue + } + + It 'has Chocolatey in the /lib folder' { + Join-Path $env:ChocolateyInstall "lib/chocolatey" | Should -Exist + } + + It 'has added choco.exe to the bin folder' { + Join-Path $env:ChocolateyInstall "bin/choco.exe" | Should -Exist + } + + It 'has added the bin folder to PATH' { + $env:PATH.Split(';') | Should -Contain (Join-Path $env:ChocolateyInstall "bin") + } + + It "Outputs the version when run with --version" { + $Output = Invoke-Choco --version + $script:CurrentVersion = $Output.String + $Output.ExitCode | Should -Be 0 + $LastExitCode | Should -Be 0 + ($Output.String -split '-' | Select-Object -First 1) -as [version] | Should -BeTrue + } + + # Only FossOnly for this one, as we do not want to get the version + # from an existing --version output + It "Displays the current version and instructions for help when run without arguments" -Tag FossOnly { + if (-not $script:CurrentVersion) { + $script:CurrentVersion = Invoke-Choco --version | ForEach-Object String + } + + # We can not use `Invoke-Choco` in this case + # as it sets the --allow-unofficial argument + # that causes the expected output to not show up + $choco = Get-ChocoPath + + $Output = & $choco + + $LastExitCode | Should -Be 1 + + $Output | Should -Contain "Chocolatey v$($script:CurrentVersion)" + $Output | Should -Contain "Please run 'choco -?' or 'choco -?' for help menu." + } + } + + # This is skipped when not run in CI because it modifies the local system. + # Issue: https://github.com/chocolatey/choco/issues/2233 + It "Does not create nuget configuration file in application data" -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta"))) { + $path | Should -Not -Exist + } + + # This is skipped when not run in CI because it requires signed executables. + Context "File signing (<_.FullName>)" -Foreach @($PowerShellFiles; $ExecutableFiles; $StrongNamingKeyFiles) -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan "1.0.0"))) { + BeforeAll { + $FileUnderTest = $_ + $SignerCert = (Get-AuthenticodeSignature (Get-ChocoPath)).SignerCertificate + $Cert = "$PWD\cert.cer" + # Write out the certificate + [IO.File]::WriteAllBytes($Cert, $SignerCert.export([security.cryptography.x509certificates.x509contenttype]::cert)) + # Trust the certificate + Import-Certificate -FilePath $Cert -CertStoreLocation 'Cert:\CurrentUser\TrustedPublisher\' + Remove-Item -Path $Cert -Force -ErrorAction Ignore + } + + AfterAll { + Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force + } + + It "Should be signed with our certificate" -Skip:($_.Name -like 'package*.exe') { + $authenticodeSignature = Get-AuthenticodeSignature $FileUnderTest + $authenticodeSignature.Status | Should -Be 'Valid' + $authenticodeSignature.SignerCertificate.Thumbprint | Should -Be $ChocolateyThumbprint + } + + It "Should be strongly named with our strong name key" -Skip:($_ -notin $StrongNamingKeyFilesToCheck) { + $Token = [System.Reflection.AssemblyName]::GetAssemblyName($FileUnderTest.FullName).FullName -replace ".+PublicKeyToken=(?\w+)", '$1' + $Token | Should -Be $ChocolateyStrongNameKey + } + + # This is FossOnly for now as there are some undetermined errors here that do not seem to present inside of Chocolatey. https://gitlab.com/chocolatey/build-automation/chocolatey-test-kitchen/-/issues/39 + It "Should be able to run the script in AllSigned mode" -Skip:($_ -notin $PowerShellFiles) -Tag FossOnly { + $expectedErrors = 0 + $command = "Import-Module $FileUnderTest -ErrorAction SilentlyContinue; exit `$error.count" + & powershell.exe -noprofile -ExecutionPolicy AllSigned -command $command 2>$null + $LastExitCode | Should -BeExactly $expectedErrors + } + } + + Context "PowerShell script formatting (<_.FullName>)" -Foreach $PowerShellFiles { + BeforeAll { + $FileUnderTest = $_ + } + + It "Should have a Byte Order Mark" { + $encoding = Test-ByteOrderMark -Path $FileUnderTest + $encoding | Should -Be ([System.Text.Encoding]::UTF8) + } + + It "Should have 'CRLF' Line Endings" { + (Get-Content $FileUnderTest -Raw) -match '([^\r]\n|\r[^\n])' | Should -BeFalse + } + } + + # These tests are not a true test of PowerShell v2 compatibility as -Version 2 does not guarantee that things run exactly as in a PowerShell 2 instance, but it is as close as we can get in a testing environment. + # Full proper testing on v2 would require a VM with only v2 installed. + # This is skipped when not run in CI because it modifies the local system. + Context "PowerShell v2 compatibility" -Skip:(-not $env:TEST_KITCHEN) { + BeforeAll { + # TODO: This doesn't work on client OSes (might be Install-WindowsOptionalFeature). Make sure this works on both server and client. + Install-WindowsFeature powershell-v2 + # TODO: This doesn't work on Windows server. + # $null = Invoke-Choco install dotnet3.5 + # $null = Invoke-Choco install MicrosoftWindowsPowerShellV2 -s windowsfeatures + } + + # This is Foss only as PowerShell running under version 2 doesn't have .net available and can't import the Licensed DLL. + # Tests on Windows 7 show no issues with running Chocolatey under Windows 7 with PowerShell v2 aside from issues surrounding TLS versions that we cannot resolve without an upgrade to Windows 7. + It "Imports ChocolateyInstaller module successfully in PowerShell v2" -Tag FossOnly { + $command = 'Import-Module $env:ChocolateyInstall\helpers\chocolateyInstaller.psm1;exit $error.count' + & powershell.exe -Version 2 -noprofile -command $command + $LastExitCode | Should -BeExactly 0 + } + + It "Imports ChocolateyProfile module successfully in PowerShell v2" { + $command = 'Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1;exit $error.count' + & powershell.exe -Version 2 -noprofile -command $command + $LastExitCode | Should -BeExactly 0 + } + } + + # This is skipped when not run in CI because it modifies the local system. + Context 'License warning is worded properly' -Tag FossOnly -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0'))) { + BeforeAll { + $null = Invoke-Choco install chocolatey-license-business -y + $Output = Invoke-Choco list -lo + } + + AfterAll { + $null = Invoke-Choco uninstall chocolatey-license-business -y + } + + It 'Should display warning' { + $Output.Lines | Should -Contain 'A valid chocolatey license was found, but the chocolatey.licensed.dll assembly could not be loaded:' + $Output.Lines | Should -Contain 'Ensure that the chocolatey.licensed.dll exists at the following path:' + $Output.Lines | Should -Contain 'To resolve this, install the Chocolatey Licensed Extension package with' + $Output.Lines | Should -Contain '`choco install chocolatey.extension`' + } + } + + # This is skipped when not run in CI because it modifies the local system. + Context 'PowerShell Profile comments updated correctly' -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0'))) { + BeforeAll { + Remove-Item $Profile.CurrentUserCurrentHost -ErrorAction Ignore + New-Item $Profile.CurrentUserCurrentHost -Force + $chocolatey = (Invoke-Choco list chocolatey -lo -r --exact).Lines | ConvertFrom-ChocolateyOutput -Command List + $null = Invoke-Choco install chocolatey -f --version $chocolatey.Version + } + + AfterAll { + Remove-Item $Profile.CurrentUserCurrentHost -ErrorAction Ignore + } + + It 'should update profile successfully' { + $ProfileContents = Get-Content $Profile.CurrentUserCurrentHost -Raw + $expectedLines = @( + '# Import the Chocolatey Profile that contains the necessary code to enable' + '# tab-completions to function for `choco`.' + '# Be aware that if you are missing these lines from your profile, tab completion' + '# for `choco` will not function.' + '# See https://ch0.co/tab-completion for details.' + ) -join '\r?\n' + $ProfileContents | Should -Match $expectedLines + } + } + + # This is skipped when not run in CI because it modifies the local system. + Context 'PowerShell Profile properly updated when Windows thinks a 5 byte file is signed' -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan '1.1.0'))) { + BeforeAll { + New-Item $Profile.CurrentUserCurrentHost -Force + "" | Set-Content -Path $Profile.CurrentUserCurrentHost -Encoding UTF8 + $chocolatey = (Invoke-Choco list chocolatey -lo -r --exact).Lines | ConvertFrom-ChocolateyOutput -Command List + } + + AfterAll { + Remove-Item $Profile.CurrentUserCurrentHost -ErrorAction Ignore + } + + It 'should not report the profile being signed' { + $ProfileFile = Get-ChildItem $Profile.CurrentUserCurrentHost + $ProfileFile.Length | Should -Be 5 -Because 'The Profile should have been set to mostly empty UTF8BOM file...' + $ProfileSignature = Get-AuthenticodeSignature $Profile.CurrentUserCurrentHost + if ($ProfileSignature.Status -ne 'Valid') { + Set-ItResult -Skipped -Because 'Windows is not detecting the profile as signed.' + } + $output = Invoke-Choco install chocolatey -f --version $chocolatey.Version + $output.Lines | Should -Not -Contain 'WARNING: Not setting tab completion: File is Authenticode signed at' + } + } + + # This is skipped when not run in CI because it requires signed executables + Context 'Ensure we shims during upgrade' -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0'))) -Foreach @( + @{ + RemovedShims = $RemovedShims + Signed = $true + Removal = "remove signed" + } + @{ + RemovedShims = $RemovedShims + Signed = $false + Removal = "keep unsigned" + } + ) { + BeforeAll { + $chocolatey = (Invoke-Choco list chocolatey -lo -r --exact).Lines | ConvertFrom-ChocolateyOutput -Command List + + foreach ($shim in $RemovedShims) { + $shimToRemove = "$env:ChocolateyInstall$shim" + Remove-Item $shimToRemove -ErrorAction Ignore + if ($signed) { + Copy-Item -Path $env:ChocolateyInstall/bin/choco.exe -Destination $shimToRemove + } + else { + New-Item $shimToRemove -Force -ItemType File + } + } + + $Output = Invoke-Choco install chocolatey -f --version $chocolatey.Version --no-progress + } + + It 'should exit Success (0)' { + $Output.ExitCode | Should -Be 0 + } + + It 'should shim <_> on upgrade' -ForEach $RemovedShims { + "$env:ChocolateyInstall$_" | Should -Not:$signed -Exist -Because $Output.String + } + + It 'should report keeping <_> during upgrade' -ForEach $RemovedShims -Skip:$signed { + $Output.Lines | Should -Contain "WARNING: Shim found in $env:ChocolateyInstall$_, but was not signed. Ignoring Removal..." -Because $Output.String + } + } + + Context 'Ensure a corrupted config file does not cause errors' -Tag ConfigFile -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.1.0')) { + BeforeAll { + $ChocolateyConfigLocation = "$env:ChocolateyInstall/config/chocolatey.config" + $BadContent = "BadFile" + # Make sure we have a chocolatey config file + $null = Invoke-Choco outdated + $BadContent | Out-File -FilePath $ChocolateyConfigLocation + $Output = Invoke-Choco outdated + } + + It 'Exits with Success (0)' { + $Output.ExitCode | Should -Be 0 + } + + It 'Should remove the invalid configuration file' { + $ChocolateyConfigLocation | Should -Not -FileContentMatch "$BadContent" + } + } + + # This is skipped when not run in CI because it modifies the local system. + Context 'Get-FileEncoding works under <_>' -Tag PowerShell7 -Foreach @( + 'pwsh' + 'powershell' + ) -Skip:((-not $env:TEST_KITCHEN) -or (-not (Test-ChocolateyVersionEqualOrHigherThan '1.1.0'))) { + BeforeAll { + New-ChocolateyInstallSnapshot + # TODO: Internalize pwsh and powershell packages... + $pwshInstall = Invoke-Choco install $_ -y -s https://community.chocolatey.org/api/v2/ + $ChocoUnzipped = "$(Get-TempDirectory)$(New-Guid)" + $modulePath = "$ChocoUnzipped/tools/chocolateySetup.psm1" + + if (Test-Path $ChocoUnzipped) { + Remove-Item $ChocoUnzipped -Force -Recurse + } + + Expand-ZipArchive -Source $env:ChocolateyInstall/lib/chocolatey/chocolatey.nupkg -Destination $ChocoUnzipped + + if (-not (Test-Path $modulePath)) { + throw "Something has happened that the module doesn't exist at $modulePath. Please see directory contents for more information: $(Get-ChildItem $ChocoUnzipped -Recurse -Force | ForEach-Object { $_.FullName } | Out-String)" + } + + $Command = @" + Import-Module $modulePath -Force + & (Get-Module chocolateySetup) { + Get-FileEncoding $modulePath + } + exit `$error.Count +"@ + Import-Module $env:ChocolateyInstall/helpers/ChocolateyProfile.psm1 + Update-SessionEnvironment + } + + AfterAll { + if (Test-Path $ChocoUnzipped) { + Remove-Item $ChocoUnzipped -Force -Recurse + } + $null = Invoke-Choco uninstall $_ -y -s https://community.chocolatey.org/api/v2/ --force-dependencies + Remove-ChocolateyInstallSnapshot + } + + It 'LastExitCode should be Success (0)' { + & $_ -NoProfile -Command $Command + $LASTEXITCODE | Should -Be 0 + } + } +} diff --git a/tests/chocolatey-tests/chocolateyProfile.Tests.ps1 b/tests/chocolatey-tests/chocolateyProfile.Tests.ps1 new file mode 100644 index 0000000000..862188693e --- /dev/null +++ b/tests/chocolatey-tests/chocolateyProfile.Tests.ps1 @@ -0,0 +1,74 @@ +Import-Module helpers/common-helpers +Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" + +Describe "Chocolatey Profile" -Tag Chocolatey, Profile, Environment { + # Because we're not modifying the install in any way, there is no need to Initialize-ChocolateyTestInstall + BeforeDiscovery { + $ExportNotPresent = $true + if (Test-ChocolateyVersionEqualOrHigherThan -Version "0.10.16-beta") { + $ExportNotPresent = $false + } + } + + Context "Tab Completion" { + It "Should Exist" { + Test-Path Function:\TabExpansion | Should -BeTrue + } + + It "Should have overridden TabExpansion with a new scriptblock including ChocolateyTabExpansion" { + [bool]((Get-Command TabExpansion).ScriptBlock -match "ChocolateyTabExpansion") | Should -BeTrue + } + + It "Should list completions for Top Level Commands" { + $Command = "choco " + $Completions = (TabExpansion2 -inputScript $Command -cursorColumn $Command.Length).CompletionMatches.CompletionText + + # These should be first + $Completions[0] | Should -Be "-?" + $Completions[1] | Should -Be "search" + + # TODO: Determine why these lines are commented out. Remove if not needed, get working otherwise. + <# Completions don't contain aliases, etc + foreach ($Command in $( + $(choco --help) -match " \* (?\w+) -" -replace " \* (?\w+) -.+", '$1' + )) { + $Completions | Should -Contain $Command + } + #> + } + + It "Should list completions for Pin" { + $Command = "choco pin " + $Completions = (TabExpansion2 -inputScript $Command -cursorColumn $Command.Length).CompletionMatches.CompletionText + + $Completions[0] | Should -Be "list" + $Completions[1] | Should -Be "add" + $Completions[2] | Should -Be "remove" + } + + It "Should correctly complete partial completions" -Skip:$ExportNotPresent { + $Command = "choco ex" + [array]$Completions = (TabExpansion2 -inputScript $Command -cursorColumn $Command.Length).CompletionMatches.CompletionText + + $Completions[0] | Should -Be "export" + } + + It "Should list completions for Export" -Skip:$ExportNotPresent { + $Command = "choco export " + $Completions = (TabExpansion2 -inputScript $Command -cursorColumn $Command.Length).CompletionMatches.CompletionText + + $Completions[0] | Should -Be "--include-version-numbers" + $Completions[1] | Should -Be "--output-file-path=''" + } + + It "Should list completions for Template" { + $Command = "choco template " + $Completions = (TabExpansion2 -inputScript $Command -cursorColumn $Command.Length).CompletionMatches.CompletionText + + $Completions[0] | Should -Be "list" + $Completions[1] | Should -Be "info" + $Completions[2] | Should -Be "-?" + $Completions[3] | Should -Be "--name=''" + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-apikey.Tests.ps1 b/tests/chocolatey-tests/commands/choco-apikey.Tests.ps1 new file mode 100644 index 0000000000..9b2d540324 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-apikey.Tests.ps1 @@ -0,0 +1,233 @@ +param( + # The command to test. + [string[]]$Command = @( + "apikey" + "setapikey" + ) +) + +Import-Module helpers/common-helpers + +Describe "choco <_>" -ForEach $Command -Tag Chocolatey, ApiKeyCommand { + BeforeAll { + Initialize-ChocolateyTestInstall + $CurrentCommand = $_ + + $expectedLicenseHeader = Get-ExpectedChocolateyHeader + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Running $CurrentCommand with no sources configured" { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Only displays chocolatey name with version" { + + $Output.String | Should -Match "(?m)^$expectedLicenseHeader(\s*|\s*Chocolatey is not an official build.*)$" + } + } + + Context "Running $CurrentCommand with no sources configured with source parameter" { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand --source "https://not-existing.test.com/api" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Only displays chocolatey name with version" { + $Output.String | Should -Match "(?m)^$expectedLicenseHeader(\s*|\s*Chocolatey is not an official build.*)$" + } + } + + Context "Add single api key" -ForEach @( + @{ + Key = '--key' + Source = '--source' + } + @{ + Key = '--apikey' + Source = '--source' + } + @{ + Key = '--api-key' + Source = '--source' + } + @{ + Key = '-k' + Source = '-s' + }) { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand $Key "test-api" $Source "https://test.com/api/$($Key)" + + $ConfigFileContent = [xml](Get-Content $env:ChocolateyInstall\config\chocolatey.config) + $apiKeys = @($ConfigFileContent.chocolatey.apiKeys.apiKeys) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays a message with the key being added" { + $Output.Lines | Should -Contain "Added apiKey for https://test.com/api/$($Key)" + } + + It "Adds the apikey in the file" { + $key = $Key + $config = $apiKeys.Where{ $_.source -eq "https://test.com/api/$key" } + $config | Should -HaveCount 1 + $config.key | Should -Not -BeNullOrEmpty # The key is encryped, so we don't test the value + } + } + + Context "Update single api key" -ForEach @( + @{ + Key = '--key' + Source = '--source' + } + @{ + Key = '--apikey' + Source = '--source' + } + @{ + Key = '--api-key' + Source = '--source' + } + @{ + Key = '-k' + Source = '-s' + }) { + BeforeAll { + # Make sure an API Key already exist + $null = Invoke-Choco $CurrentCommand --key "test-old" --source "https://test.com/api/$($Key)" + + $Output = Invoke-Choco $CurrentCommand $Key "test-api-updated" $Source "https://test.com/api/$($Key)" + + $ConfigFileContent = [xml](Get-Content $env:ChocolateyInstall\config\chocolatey.config) + $apiKeys = @($ConfigFileContent.chocolatey.apiKeys.apiKeys) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays a message with the key being added" { + $Output.Lines | Should -Contain "Updated apiKey for https://test.com/api/$($Key)" + } + + # Skipping for now, may need to read the file twice to compare the values + It "Adds the apikey in the file" -Skip { + $key = $Key + $config = $apiKeys.Where{ $_.source -eq "https://test.com/api/$key" } + $config | Should -HaveCount 1 + $config.key | Should -Not -BeNullOrEmpty # The key is encryped, so we don't test the value + } + } + + Context "Remove single api key" -ForEach @( + '--rem' + '--remove' + ) { + BeforeAll { + # Make sure an API Key already exist + $null = Invoke-Choco $CurrentCommand --key "test-removal" --source "https://remove.test.com/api" + + $Output = Invoke-Choco $CurrentCommand --source "https://remove.test.com/api" $_ + + $ConfigFileContent = [xml](Get-Content $env:ChocolateyInstall\config\chocolatey.config) + [array]$apiKeys = $ConfigFileContent.chocolatey.apiKeys.apiKeys + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays a message with the key being removed" { + $Output.Lines | Should -Contain "Removed ApiKey for https://remove.test.com/api" + } + + # Skipping for now, may need to read the file twice to compare the values + It "Removed apikey do not exist in file" -Skip { + $config = $apiKeys.Where{ $_.source -eq "https://remove.test.com/api" } + $config | Should -BeNullOrEmpty + + } + } + + Context "Remove non-existing api key" { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand --source "https://non-existing.test.com/api" --remove + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays a message with ApiKey not found" { + $Output.Lines | Should -Contain "ApiKey was not found for https://non-existing.test.com/api" + } + } + + Context "Remove api key without specifying source" { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand --key "some-key" --remove + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays a message about source being required" { + $Output.Lines | Should -Contain "You must specify 'source' to remove an API key." + } + } + + Context "Returns configured apikey source by source name" { + BeforeAll { + $null = Invoke-Choco $CurrentCommand --key "test-api-key" --source "https://test.com/api" + + $Output = Invoke-Choco $CurrentCommand --source "https://test.com/api" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays a message with the configured apikey" { + $Output.Lines | Should -Contain "https://test.com/api - (Authenticated)" + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-config.Tests.ps1 b/tests/chocolatey-tests/commands/choco-config.Tests.ps1 new file mode 100644 index 0000000000..85dbd4be52 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-config.Tests.ps1 @@ -0,0 +1,346 @@ +Import-Module helpers/common-helpers + +Describe "choco config" -Tag Chocolatey, ConfigCommand { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + + $InitialConfiguration = ([xml](Get-Content $env:ChocolateyInstall\config\chocolatey.config)).chocolatey + $expectedLicenseHeader = Get-ExpectedChocolateyHeader + } + + BeforeDiscovery { + $isLicensed = Test-PackageIsEqualOrHigher "chocolatey.extension" "0.0.0" + + $TestedFeatures = @( + "checksumFiles" + "autoUninstaller" + "allowGlobalConfirmation" + "failOnAutoUninstaller" + "failOnStandardError" + "allowEmptyChecksums" + "allowEmptyChecksumsSecure" + "powershellHost" + "logEnvironmentValues" + "virusCheck" + "failOnInvalidOrMissingLicense" + "ignoreInvalidOptionsSwitches" + "usePackageExitCodes" + "useEnhancedExitCodes" + "exitOnRebootDetected" + "useFipsCompliantChecksums" + "showNonElevatedWarnings" + "showDownloadProgress" + "stopOnFirstPackageFailure" + "useRememberedArgumentsForUpgrades" + "ignoreUnfoundPackagesOnUpgradeOutdated" + "skipPackageUpgradesWhenNotInstalled" + "removePackageInformationOnUninstall" + "logWithoutColor" + "logValidationResultsOnWarnings" + "usePackageRepositoryOptimizations" + ) + + $TestedConfigs = @( + "cacheLocation" + "containsLegacyPackageInstalls" + "commandExecutionTimeoutSeconds" + "proxy" + "proxyUser" + "proxyPassword" + "webRequestTimeoutSeconds" + "proxyBypassList" + "proxyBypassOnLocal" + "upgradeAllExceptions" + "defaultTemplateName" + ) + + if ($isLicensed) { + $TestedConfigs += @( + "virusCheckMinimumPositives" + "virusScannerType" + "genericVirusScannerPath" + "genericVirusScannerArgs" + "genericVirusScannerValidExitCodes" + "genericVirusScannerTimeoutInSeconds" + "maximumDownloadRateBitsPerSecond" + "serviceInstallsDefaultUserName" + "serviceInstallsDefaultUserPassword" + "backgroundServiceAllowedCommands" + "centralManagementServiceUrl" + "centralManagementReportPackagesTimerIntervalInSeconds" + "centralManagementReceiveTimeoutInSeconds" + "centralManagementSendTimeoutInSeconds" + "centralManagementCertificateValidationMode" + "centralManagementMaxReceiveMessageSizeInBytes" + "centralManagementClientCommunicationSaltAdditivePassword" + "centralManagementServiceCommunicationSaltAdditivePassword" + "centralManagementDeploymentCheckTimerIntervalInSeconds" + ) + } + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Listing all default configuration values" { + BeforeAll { + $Output = Invoke-Choco config list + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays Settings section" { + $Output.Lines | Should -Contain "Settings" + } + + It "Displays Sources section" { + $Output.Lines | Should -Contain "Sources" + } + + It "Displays Features" { + $Output.Lines | Should -Contain "Features" + } + + It "Displays API Keys section" { + $Output.Lines | Should -Contain "API Keys" + } + + It "Displays note about choco <_>" -ForEach @( + "source" + "feature" + ) { + $Output.Lines | Should -Contain "NOTE: Use choco $_ to interact with $($_)s." + } + + It "Displays note about choco apikey" { + $Output.Lines | Should -Contain "NOTE: Api Keys are not shown through this command." + $Output.Lines | Should -Contain "Use choco apikey to interact with API keys." + } + + It "Displays Available Setting <_>" -ForEach @( + "cacheLocation = |" + "containsLegacyPackageInstalls = true |" + "commandExecutionTimeoutSeconds = 2700 |" + "proxy = |" + "proxyUser = |" + "proxyPassword = |" + "webRequestTimeoutSeconds = 30 |" + "proxyBypassList = |" + "proxyBypassOnLocal = true |" + "upgradeAllExceptions = |" + "defaultTemplateName = |" + ) { + $Output.String | Should -MatchExactly ([Regex]::Escape($_)) + } + + # Only community repository URL will be set on 0.10.16 and above + # Issue: https://github.com/chocolatey/choco/issues/2231 + It "Displays Available Sources - " -ForEach @( + @{ + Name = "chocolatey" + Source = if (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta") { "https://community.chocolatey.org/api/v2/" } else { "https://chocolatey.org/api/v2/" } + } + ) { + $Output.String | Should -MatchExactly "$Name( \[Disabled\])? - $([Regex]::Escape($Source))\s*\|" + } + + It "Displays Available Feature <_>" -ForEach $TestedFeatures { + $Output.String | Should -Match "\[[ x]\] $_ -" + } + } + + Context "Getting a configuration setting (<_>)" -ForEach $TestedConfigs { + BeforeAll { + $Output = Invoke-Choco config get $_ + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays value of config" { + $Output.Lines | Should -Contain $InitialConfiguration.SelectSingleNode("//config/add[@key='$_']").Value + } + } + + Context "Getting a configuration setting by argument (<_>)" -ForEach $TestedConfigs { + BeforeAll { + $Output = Invoke-Choco config get --name $_ + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays value of config" { + $Output.Lines | Should -Contain $InitialConfiguration.SelectSingleNode("//config/add[@key='$_']").Value + } + } + + Context "Getting a configuration setting that doesn't exist" { + BeforeAll { + $Output = Invoke-Choco config get noConfigValue + } + + It "Exits with failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs an error indicating that there's no config by that name" { + $Output.Lines | Should -Contain "No configuration value by the name 'noConfigValue'" + } + } + + Context "Setting a configuration setting (cacheLocation)" { + BeforeAll { + $Output = Invoke-Choco config set cacheLocation "C:\temp\choco" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $configs = @($ConfigFileContent.chocolatey.config.add) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays config value updated" { + $Output.Lines | Should -Contain "Updated cacheLocation = C:\temp\choco" + } + + It "Updates value in config file" { + $value = $configs.Where{ $_.key -eq "cacheLocation" } + $value | Should -HaveCount 1 + $value.value | Should -Be "C:\temp\choco" + } + } + + Context "Setting a configuration setting not available by default (newConfiguration)" { + BeforeAll { + $Output = Invoke-Choco config set --name newConfiguration --value some-value + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $configs = @($ConfigFileContent.chocolatey.config.add) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays config value Added" { + $Output.Lines | Should -Contain "Added newConfiguration = some-value" + } + + It "Adds new value in config file" { + $value = $configs.Where{ $_.key -eq "newConfiguration" } + $value | Should -HaveCount 1 + $value.value | Should -Be "some-value" + } + } + + Context "Unsetting configuration setting (cacheLocation)" { + BeforeAll { + $Output = Invoke-Choco config unset cacheLocation + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $configs = @($ConfigFileContent.chocolatey.config.add) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays config value Added" { + $Output.Lines | Should -Contain "Unset cacheLocation" + } + + It "Updates value in config file" { + $value = $configs.Where{ $_.key -eq "cacheLocation" } + $value | Should -HaveCount 1 + $value.value | Should -BeNullOrEmpty + } + } + + Context "Unsetting configuration setting (newConfiguration)" { + BeforeAll { + # Ensure the configuration value is available + Invoke-Choco config set newConfiguration some-value | Out-Null + + $Output = Invoke-Choco config unset --name newConfiguration + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $configs = @($ConfigFileContent.chocolatey.config.add) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays config value Added" { + $Output.Lines | Should -Contain "Unset newConfiguration" + } + + It "Adds new value in config file" { + $value = $configs.Where{ $_.key -eq "newConfiguration" } + $value | Should -HaveCount 1 + $value.value | Should -BeNullOrEmpty + } + } + + Context "Unsetting a configuration that doesn't exist" { + BeforeAll { + $Output = Invoke-Choco config unset not-existing + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $configs = @($ConfigFileContent.chocolatey.config.add) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedLicenseHeader + } + + It "Displays config value Added" { + $Output.Lines | Should -Contain "Nothing to change. Config already set." + } + + It "No value is added to file" { + $value = $configs.Where{ $_.key -eq "not-existing" } + $value | Should -HaveCount 0 + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-deprecated.Tests.ps1 b/tests/chocolatey-tests/commands/choco-deprecated.Tests.ps1 new file mode 100644 index 0000000000..1ef836046f --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-deprecated.Tests.ps1 @@ -0,0 +1,85 @@ +Import-Module helpers/common-helpers + +Describe "choco deprecated shims" -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan "1.0.0")) -Tag Chocolatey, DeprecatedShims { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + BeforeDiscovery { + $DeprecatedShims = @( + @{ Command = 'help'; Deprecation = 'none' } + @{ Command = 'install'; Deprecation = 'cinst' } + @{ Command = 'push'; Deprecation = 'cpush' } + @{ Command = 'list'; Deprecation = 'clist' } + @{ Command = 'search'; Deprecation = 'none' } + @{ Command = 'uninstall'; Deprecation = 'cuninst' } + @{ Command = 'upgrade'; Deprecation = 'cup' } + ) + } + + Context 'help for command mentions that is deprecated' -Foreach $DeprecatedShims { + BeforeAll { + # -? needs to be wrapped in quotes or PowerShell consumes it on us. + $Output = Invoke-Choco $Command "-?" + } + + Context 'help command deprecation notice' -Skip:($Command -ne 'help') { + It 'should list the shims deprecated' { + $Output.Lines | Should -Contain 'The shims `chocolatey`, `cinst`, `clist`, `cpush`, `cuninst` and `cup` are deprecated.' + } + + It 'should list deprecation as being in 2.0.0' { + $Output.Lines | Should -Contain 'removed in v2.0.0 of Chocolatey.' + } + } + + It 'should contain DEPRECATION NOTICE' -Skip:($Command -eq 'search') { + $Output.Lines | Should -Contain 'DEPRECATION NOTICE' + } + + It 'should mention is deprecated' -Skip:($Deprecation -eq 'none') { + $Output.Lines | Should -Contain "Starting in v2.0.0 the shortcut ``$Deprecation`` will be removed and can not be used" + $Output.Lines | Should -Contain "use the full command going forward (``choco $Command``)." + } + + It 'should show deprecation in usage' -Skip:($Command -notin 'search', 'list') { + $Output.Lines | Should -Contain 'clist [] (DEPRECATED, will be removed in v2.0.0)' + } + } +} + +Describe "Deprecated Chocolatey Helper Commands" -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan "1.0.0")) -Tag Chocolatey, DeprecatedHelpers { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + + $PackageName = New-Guid + $HelperUnderTest = "Get-BinRoot" + $null = Invoke-Choco new $PackageName --version 1.0.0 + $TemplateOutput = Get-ChildItem -Path $PackageName -Recurse | Select-String -Pattern 'Get-BinRoot' + $HelperUnderTest > "$PackageName/tools/chocolateyInstall.ps1" + $null = Invoke-Choco pack "$PackageName/$PackageName.nuspec" + $Output = Invoke-Choco install $PackageName --source . -y + } + + AfterAll { + Remove-Item "./$PackageName" -Recurse -Force -ErrorAction Ignore + Remove-ChocolateyTestInstall + } + It 'should not mention Get-BinRoot in any of the generated files' { + $TemplateOutput | Should -BeNullOrEmpty -Because 'Get-BinRoot has been deprecated and removed from the template' + } + + It 'should exit success (0)' { + $Output.ExitCode | Should -Be 0 + } + + It 'should warn that Get-BinRoot is deprecated' { + $Output.Lines | Should -Contain 'WARNING: Get-BinRoot was deprecated in v1 and will be removed in v2. It has been replaced with Get-ToolsLocation (starting with v0.9.10), however many packages no longer require a special separate directory since package folders no longer have versions on them. Some do though and should continue to use Get-ToolsLocation.' + } +} diff --git a/tests/chocolatey-tests/commands/choco-export.Tests.ps1 b/tests/chocolatey-tests/commands/choco-export.Tests.ps1 new file mode 100644 index 0000000000..55a7f487a1 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-export.Tests.ps1 @@ -0,0 +1,469 @@ +Import-Module helpers/common-helpers + +Describe "choco export" -Tag Chocolatey, ExportCommand { + BeforeDiscovery { + # We create a temporary directory to export + # any configurations to, this works faster + # than creating/removing snapshots between each context + # step. + if (!(Test-Path "C:\temp")) { + New-Item -Path "C:\temp" -ItemType Directory + } + } + + BeforeAll { + $expectedHeader = Get-ExpectedChocolateyHeader + Initialize-ChocolateyTestInstall + + # TODO: Consolidate these recurring package lists - https://github.com/chocolatey/choco/issues/2691 + # Let us install some known packages + $null = @( + 'installpackage=1.0.0' + 'upgradepackage=1.1.1-beta' + 'package.extension=1.0.0' + 'package.template=1.0.0' + ) | ForEach-Object { + $splits = $_.Split('=') + Invoke-Choco install $splits[0] --version $splits[1] --confirm + } + + New-ChocolateyInstallSnapshot -SetWorkDir + } + + AfterAll { + Remove-ChocolateyTestInstall + + if (Test-Path "C:\temp") { + Remove-Item -Recurse -Path "C:\temp" + } + } + + Context "Listing help section" { + BeforeDiscovery { + $supportedArguments = @( + @{ + Arguments = "-o, --output-file-path=VALUE" + Description = "Output File Path - the path to where the list of currently installed`npackages should be saved. Defaults to packages.config." + } + @{ + Arguments = "--include-version-numbers, --include-version" + Description = "Include Version numbers - controls whether or not version numbers for`neach package appear in generated file. Defaults to false." + } + ) + + $examples = @( + "choco export" + "choco export --include-version-numbers" + "choco export `"'c:\temp\packages.config'`"" + "choco export `"'c:\temp\packages.config'`" --include-version-numbers" + "choco export -o=`"'c:\temp\packages.config'`"" + "choco export -o=`"'c:\temp\packages.config'`" --include-version-numbers" + "choco export --output-file-path=`"'c:\temp\packages.config'`"" + "choco export --output-file-path=`"'c:\temp\packages.config'`" --include-version-numbers" + ) + + $supportedExitCodes = @( + "- 0: operation was successful, no issues detected" + "- -1 or 1: an error has occurred" + ) + } + + BeforeAll { + # No need to create a new snapshot here + $Output = Invoke-Choco export --help + $Output.Lines = $Output.Lines + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays description of command" { + $Output.Lines | Should -Contain "Export Command" + $Output.Lines | Should -Contain "Export all currently installed packages to a file." + $Output.Lines | Should -Contain "This is especially helpful when re-building a machine that was created" + $Output.Lines | Should -Contain "using Chocolatey. Export all packages to a file, and then re-install" + $Output.Lines | Should -Contain "those packages onto new machine using ``choco install packages.config``." + } + + It "Displays command usage" { + $Output.Lines | Should -Contain "choco export []" + } + + It "Displays example '<_>'" -Foreach $examples { + $Output.Lines | Should -Contain $_ + } + + It "Displays supported exit codes" -Foreach $supportedExitCodes { + $Output.Lines | Should -Contain $_ + } + + It "Displays supported option and switches " -Foreach $supportedArguments { + $Output.Lines | Should -Contain $Arguments + } + + It "Displays description of option and switches " -Foreach $supportedArguments { + $Description -split "`n" | ForEach-Object { + $Output.Lines | Should -Contain $_ + } + } + } + + Context "Runs export without additional arguments" { + BeforeDiscovery { + # TODO: Consolidate these recurring package lists - https://github.com/chocolatey/choco/issues/2691 + # We set this here, so we can reuse them between different contexts + $expectedExports = @( + "chocolatey" + "installpackage" + "upgradepackage" + "package.extension" + "package.template" + ) + } + + BeforeAll { + if (Test-Path "packages.config") { + Remove-Item "packages.config" + } + $expectedPath = "packages.config" + + $Output = Invoke-Choco export + } + + It "Exits with success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # NOTE: There is no output other than the header, and possibly the unofficial statement + It "Displays chocolatey version header" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Exports expected package '<_>'" -Foreach $expectedExports { + $expectedPath | Should -FileContentMatch "" + } + } + + Context "Runs export with including versions (<_>)" -Foreach @("--include-version-numbers", "--include-version") { + BeforeDiscovery { + # TODO: Consolidate these recurring package lists - https://github.com/chocolatey/choco/issues/2691 + # We set this here, so we can reuse them between different contexts + $expectedExports = @( + @{ + Name = "installpackage" + Version = "1.0.0" + } + @{ + Name = "upgradepackage" + Version = "1.1.1-beta" + } + @{ + Name = "package.extension" + Version = "1.0.0" + } + @{ + Name = "package.template" + Version = "1.0.0" + } + ) + } + + BeforeAll { + $expectedPath = "packages.config" + + # This is in case we are running the test directly + # which in that case this file will not exist. + # We don't care about the content, encoding, only the presence + if (!(Test-Path $expectedPath)) { + "Not Important" | Set-Content -Path $expectedPath + } + + $Output = Invoke-Choco export $_ + } + + It "Exits with success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # NOTE: There is no output other than the header, and possibly the unofficial statement + It "Displays chocolatey version header" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Exports expected package '' with version ''" -Foreach $expectedExports { + $expectedPath | Should -FileContentMatch "" + } + + It "Creates backup of previous package.config file" { + # We are not interested in the content, only that it gets created + "$expectedPath.backup" | Should -Exist + } + } + + Context "Runs export with output path" { + BeforeDiscovery { + # TODO: Consolidate these recurring package lists - https://github.com/chocolatey/choco/issues/2691 + # We set this here, so we can reuse them between different contexts + $expectedExports = @( + "chocolatey" + "installpackage" + "upgradepackage" + "package.extension" + "package.template" + ) + } + + BeforeAll { + $expectedPath = "C:\temp\packages.config" + + if (Test-Path $expectedPath) { + Remove-Item $expectedPath + } + + $Output = Invoke-Choco export $expectedPath + } + + It "Exits with success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # NOTE: There is no output other than the header, and possibly the unofficial statement + It "Displays chocolatey version header" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Exports expected package '<_>'" -Foreach $expectedExports { + $expectedPath | Should -FileContentMatch "" + } + } + + Context "Runs export with including versions (<_>)" -Foreach @("--include-version-numbers", "--include-version") { + BeforeDiscovery { + # TODO: Consolidate these recurring package lists - https://github.com/chocolatey/choco/issues/2691 + # We set this here, so we can reuse them between different contexts + $expectedExports = @( + @{ + Name = "installpackage" + Version = "1.0.0" + } + @{ + Name = "upgradepackage" + Version = "1.1.1-beta" + } + @{ + Name = "package.extension" + Version = "1.0.0" + } + @{ + Name = "package.template" + Version = "1.0.0" + } + ) + } + + BeforeAll { + $expectedPath = "C:\temp\packages.config" + + # This is in case we are running the test directly + # which in that case this file will not exist. + # We don't care about the content, encoding, only the presence + if (!(Test-Path $expectedPath)) { + "Not Important" | Set-Content -Path $expectedPath + } + + $Output = Invoke-Choco export $expectedPath $_ + } + + It "Exits with success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # NOTE: There is no output other than the header, and possibly the unofficial statement + It "Displays chocolatey version header" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Exports expected package '' with version ''" -Foreach $expectedExports { + $expectedPath | Should -FileContentMatch "" + } + + It "Creates backup of previous package.config file" { + # We are not interested in the content, only that it gets created + "$expectedPath.backup" | Should -Exist + } + } + + Context "Runs export with output path argument '<_>" -Foreach @("--output-file-path={0}"; "-o {0}") { + BeforeDiscovery { + # TODO: Consolidate these recurring package lists - https://github.com/chocolatey/choco/issues/2691 + # We set this here, so we can reuse them between different contexts + $expectedExports = @( + "chocolatey" + "installpackage" + "upgradepackage" + "package.extension" + "package.template" + ) + } + + BeforeAll { + $expectedPath = "C:\temp\packages.config" + + if (Test-Path $expectedPath) { + Remove-Item $expectedPath + } + + $Output = Invoke-Choco export ($_ -f $expectedPath) + } + + It "Exits with success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # NOTE: There is no output other than the header, and possibly the unofficial statement + It "Displays chocolatey version header" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Exports expected package '<_>'" -Foreach $expectedExports { + $expectedPath | Should -FileContentMatch "" + } + } + + Context "Runs export with path argument () including versions ()" -Foreach @( + @{ + PathArgument = "--output-file-path={0}" + VersionsArgument = "--include-version-numbers" + } + @{ + PathArgument = "--output-file-path={0}" + VersionsArgument = "--include-version" + } + @{ + PathArgument = "-o {0}" + VersionsArgument = "--include-version-numbers" + } + @{ + PathArgument = "-o {0}" + VersionsArgument = "--include-version-numbers" + } + ) { + BeforeDiscovery { + # TODO: Consolidate these recurring package lists - https://github.com/chocolatey/choco/issues/2691 + # We set this here, so we can reuse them between different contexts + $expectedExports = @( + @{ + Name = "installpackage" + Version = "1.0.0" + } + @{ + Name = "upgradepackage" + Version = "1.1.1-beta" + } + @{ + Name = "package.extension" + Version = "1.0.0" + } + @{ + Name = "package.template" + Version = "1.0.0" + } + ) + } + + BeforeAll { + $expectedPath = "C:\temp\packages.config" + + # This is in case we are running the test directly + # which in that case this file will not exist. + # We don't care about the content, encoding, only the presence + if (!(Test-Path $expectedPath)) { + "Not Important" | Set-Content -Path $expectedPath + } + + $Output = Invoke-Choco export ($PathArgument -f $expectedPath) $VersionsArgument + } + + It "Exits with success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # NOTE: There is no output other than the header, and possibly the unofficial statement + It "Displays chocolatey version header" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Exports expected package '' with version ''" -Foreach $expectedExports { + $expectedPath | Should -FileContentMatch "" + } + + It "Creates backup of previous package.config file" { + # We are not interested in the content, only that it gets created + "$expectedPath.backup" | Should -Exist + } + } + + Context "Exporting to a path that do not exist" { + BeforeAll { + if (Test-Path "$(Get-TempDirectory)TestInvalidPath") { + Remove-Item -Recurse -Path "$(Get-TempDirectory)TestInvalidPath" + } + + $Output = Invoke-Choco export "$(Get-TempDirectory)TestInvalidPath\packages.config" + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Reports unable to export packages" { + $Output.Lines | Should -Contain "Error exporting currently installed packages:" + + # Actual error after above line can be localized on a computer, + # as such, it is not tested here. + } + } + + Context "Exporting with a misspelled argument name" { + BeforeAll { + # Just to be certain that we allow misspelled names + Enable-ChocoFeature ignoreInvalidOptionsSwitches # Usually this is enabled by default, but just to be sure + $path = "C:\temp\packages.config" + if (Test-Path "$path") { + Remove-Item -Recurse -Path "$path" + } + + $Output = Invoke-Choco export --outpu-file-path=$path + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Reports unable to export packages" { + $Output.Lines | Should -Contain "Error exporting currently installed packages:" + + # Actual error after above line can be localized on a computer, + # as such, it is not tested here. + } + } + + Context "Exporting with a misspelled argument name and disallowing unknown switches" { + BeforeAll { + Restore-ChocolateyInstallSnapshot -SetWorkDir + Disable-ChocoFeature ignoreInvalidOptionsSwitches + + $Output = Invoke-Choco export --include-version-numers + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays help page" { + # We just use the summary for asserting whether help page was shown or not + $Output.Lines | Should -Contain "Export all currently installed packages to a file." + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-feature.Tests.ps1 b/tests/chocolatey-tests/commands/choco-feature.Tests.ps1 new file mode 100644 index 0000000000..34de48fea6 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-feature.Tests.ps1 @@ -0,0 +1,215 @@ +param( + # The command to test. + [string[]]$Command = @( + "feature" + "features" + ) +) + +Import-Module helpers/common-helpers + +Describe "choco <_>" -ForEach $Command -Tag Chocolatey, FeatureCommand { + BeforeDiscovery { + $CurrentFeatures = ([xml](Get-Content $env:ChocolateyInstall\config\chocolatey.config)).chocolatey.features.feature + } + + BeforeAll { + $CommandUnderTest = $_ + Initialize-ChocolateyTestInstall + + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Listing Features" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + Invoke-Choco $_ disable "--name=logValidationResultsOnWarnings" + + $Output = Invoke-Choco $_ + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Lists available features" { + # Skip "Chocolatey vVersion" line + $lines = $Output.Lines[1..($Output.Lines.Count - 1)] | Where-Object { + # Filter out unofficial disclaimer and blank lines + $_ -and ($_ -notmatch "^\s*(Chocolatey|If you|now be in)") + } + + $lines | Should -Match "^\[(?[x ])\] (?\w+) - (?.+)$" + } + + It "Lists '<_.Name>' feature" -TestCases $CurrentFeatures { + # Using just $Name in this case do not work + ($Output.Lines -match "\[[x ]\] $($_.Name) -").Count | Should -Be 1 + } + + # This test have a will fail on licensed extension due to the + # configuration file will not yet have the necessary configuration + # values to compare with populated. + It "Contains no features not in the $($CurrentFeatures.Count) features listed in the config file" -TestCases @{Names = $CurrentFeatures.Name; Command = $_ } -Tag FossOnly { + $data = Invoke-Choco $Command --limitoutput + $featureNames = ($data.Lines | ConvertFrom-ChocolateyOutput -Command "Feature").Name + $featureNames | Should -BeIn $Names + } + } + + Context "Adjusting Feature Settings" { + BeforeDiscovery { + # Get the features this way so we're working with the entire list, and not just what was in the config file initially. + # We additionally want to ignore any presence of removed features + # as these are not intended to work as expected, even when present. + $FeaturesToTest = (Invoke-Choco feature list -r).Lines | ConvertFrom-ChocolateyOutput -Command Feature | Where-Object Name -ne 'scriptsCheckLastExitCode' + } + + BeforeAll { + Restore-ChocolateyInstallSnapshot + } + + Context "Enabling <_.Name> feature" -Foreach $FeaturesToTest { + BeforeAll { + $Name = $_.Name + # Disable feature before trying to enable it. + $null = Invoke-Choco $CommandUnderTest disable --name $Name + $Output = Invoke-Choco $CommandUnderTest enable --name $Name + } + + It 'Exits with Success (0)' { + $Output.ExitCode | Should -Be 0 -Because $Output.String + } + + It 'Outputs correctly' { + $Output.Lines | Should -Contain "Enabled $Name" + } + } + + Context "Disabling <_.Name> feature" -Foreach $FeaturesToTest { + BeforeAll { + $Name = $_.Name + # Enable feature before trying to enable it. + $null = Invoke-Choco $CommandUnderTest enable --name $Name + $Output = Invoke-Choco $CommandUnderTest disable --name $Name + } + + It 'Exits with Success (0)' { + $Output.ExitCode | Should -Be 0 -Because $Output.String + } + + It 'Outputs correctly' { + $Output.Lines | Should -Contain "Disabled $Name" + } + } + } + + Context "Disabling usePackageRepositoryOptimizations" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco $_ enable --name usePackageRepositoryOptimizations + + $Output = Invoke-Choco $_ disable --name usePackageRepositoryOptimizations + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs a message indicating that it disabled the feature" { + $Output.Lines | Should -Contain "Disabled usePackageRepositoryOptimizations" + } + + It "Disables the feature in the file" { + $ConfigFileContent.chocolatey.features.feature.Where{ $_.Name -eq 'usePackageRepositoryOptimizations' }.enabled | Should -Be "false" + } + } + + Context "Enabling showDownloadProgress" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco $_ disable --name showDownloadProgress + + $Output = Invoke-Choco $_ enable --name showDownloadProgress + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs a message indicating that it enabled the feature" { + $Output.Lines | Should -Contain "Enabled showDownloadProgress" + } + + It "Enables the feature in the file" { + $ConfigFileContent.chocolatey.features.feature.Where{ $_.Name -eq 'showDownloadProgress' }.enabled | Should -Be "true" + } + } + + Context "Disabling failOnInvalidOrMissingLicense" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco $_ enable --name failOnInvalidOrMissingLicense + + $Output = Invoke-Choco $_ disable --name failOnInvalidOrMissingLicense + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs a message indicating that it disabled the feature" { + $Output.Lines | Should -Contain "Disabled failOnInvalidOrMissingLicense" + } + + It "Disables the feature in the file" { + $ConfigFileContent.chocolatey.features.feature.Where{ $_.Name -eq 'failOnInvalidOrMissingLicense' }.enabled | Should -Be "false" + } + } + + Context "Enabling a non-existant feature" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco $_ enable --name nonExistingFeature + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs a message indicating it didn't find the feature in question" { + $Output.String | Should -Match "Feature 'nonExistingFeature' not found" + } + } + + Context "Disabling a non-existant feature" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco $_ disable --name nonExistingFeature + $TestedExitCode = $LastExitCode + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs a message indicating it didn't find the feature in question" { + $Output.String | Should -Match "Feature 'nonExistingFeature' not found" + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-help.Tests.ps1 b/tests/chocolatey-tests/commands/choco-help.Tests.ps1 new file mode 100644 index 0000000000..f8e01f256c --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-help.Tests.ps1 @@ -0,0 +1,93 @@ +param( + # Which help command to test + [string[]]$Command = @( + "--help" + "-?" + "-help" + ), + + # Commands that don't have full help + [string[]]$SkipCommand = @( + "unpackself" # Out of spec + "version" # Deprecated + "update" # Deprecated + "support" # This should be tested seperately + ) +) +Import-Module helpers/common-helpers + +BeforeDiscovery { + $AllTopLevelCommands = (Invoke-Choco $Command[0]).Lines -match " \* (?\w+) -" -replace " \* (?\w+) -.+", '$1' + $TopLevelCommands = $AllTopLevelCommands.Where{$_ -notin $SkipCommand} +} + +Describe "choco help sections with command <_>" -ForEach $Command -Tag Chocolatey, HelpCommand { + BeforeDiscovery { + $helpArgument = $_ + } + + BeforeAll { + $helpArgument = $_ + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Top Level Help" { + BeforeAll { + $Output = Invoke-Choco $_ $helpArgument + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs the Top-Level Help" { + $Output.Lines | Should -Contain "Commands" + $Output.Lines | Should -Contain "Default Options and Switches" + } + } + + Context "choco <_> $helpArgument" -Foreach $TopLevelCommands { + BeforeDiscovery { + $comandsWithoutExitCodes = @( + "help" + "download" + "synchronize" + "sync" + "optimize" + ) + } + + BeforeAll { + $Output = Invoke-Choco $_ $helpArgument + } + + It "'choco <_> $helpArgument' exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs help for <_>" { + $Output.Lines | Should -Not -BeNullOrEmpty + } + + It "Outputs Usage for <_>" -Skip:$($_ -match "help") { + $Output.Lines | Should -Contain "Usage" + } + + It "Outputs Examples for <_>" -Skip:$($_ -match "help") { + $Output.Lines | Should -Contain "Examples" + } + + It "Outputs Exit Codes for <_>" -Skip:$($_ -in $comandsWithoutExitCodes) { + $Output.Lines | Should -Contain "Exit Codes" + } + + It "Outputs Options and Switches for <_>" { + $Output.Lines | Should -Contain "Options and Switches" + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-info.Tests.ps1 b/tests/chocolatey-tests/commands/choco-info.Tests.ps1 new file mode 100644 index 0000000000..1356d18aa9 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-info.Tests.ps1 @@ -0,0 +1,163 @@ +Import-Module helpers/common-helpers + +Describe "choco info" -Tag Chocolatey, InfoCommand { + BeforeDiscovery { + $licensedProxyFixed = Test-PackageIsEqualOrHigher 'chocolatey.extension' 2.2.0-beta -AllowMissingPackage + } + + BeforeAll { + Initialize-ChocolateyTestInstall + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Listing package information when package can be found" { + BeforeDiscovery { + $infoItems = @( + @{ Title = "Tags"; Value = "mvcmusicstore-web SPACE_SEPARATED" } + @{ Title = "Summary"; Value = "Mvc Music Store Website" } + @{ Title = "Description"; Value = "This is the code that releases the website" } + ) + } + + BeforeAll { + $Output = Invoke-Choco info mvcmusicstore-web + $Output.Lines = $Output.Lines + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays with value <Value>" -ForEach $infoItems { + $Output.Lines | Should -Contain "${Title}: $Value" + } + + It "Displays published date in format M/DD/YYYY" { + $Output.String | Should -Match "Published: (?<month>\d{1,2})\/(?<day>\d{1,2})\/(?<year>\d{4})" + } + + It "Displays the title of the package" { + $line = $Output.Lines | Select-String "Title" + $line | Should -Not -BeNullOrEmpty + $line | Should -Match "Title: Mvc Music Store Web" + } + } + + Context "Listing package information when package can not be found (Enhanced Exit Code: <Enhanced>)" -ForEach @( + @{ + Enhanced = $false + ExitCode = 0 + } + @{ + Enhanced = $true + ExitCode = 2 + } + ) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + if ($Enhanced) { + Enable-ChocolateyFeature useEnhancedExitCodes + } + else { + Disable-ChocolateyFeature useEnhancedExitCodes + } + + $Output = Invoke-Choco info unavailable + } + + It "Exists with Failure (<ExitCode>)" { + $Output.ExitCode | Should -Be $ExitCode + } + + It "Displays no packages could be found" { + $Output.Lines | Should -Contain "0 packages found." + } + } + + # Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/530 (NOTE: Proxy bypassing also works on Chocolatey FOSS) + Context "Listing package information when using proxy and proxy bypass list in config" -Skip:(!$licensedProxyFixed) { + BeforeDiscovery { + $infoItems = @( + @{ Title = "Tags"; Value = "mvcmusicstore db" } + @{ Title = "Summary"; Value = "Mvc Music Store Database" } + @{ Title = "Description"; Value = "This is the code that releases the database" } + @{ Title = "Release Notes"; Value = "v1.2.0 - Updated Migration" } + ) + } + + BeforeAll { + Restore-ChocolateyInstallSnapshot + $null = Invoke-Choco config set --name=proxy --value="https://invalid.chocolatey.org/" + $null = Invoke-Choco config set --name=proxyBypassList --value="hermes.chocolatey.org" + + $Output = Invoke-Choco info mvcmusicstore-db + $Output.Lines = $Output.Lines + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the package mvcmusicstore-db 1.2.0" { + $Output.Lines | Should -Contain "mvcmusicstore-db 1.2.0" + } + + It "Displays <Title> with value <Value>" -ForEach $infoItems { + $Output.Lines | Should -Contain "${Title}: $Value" + } + } + + # Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/530 (NOTE: Proxy bypassing also works on Chocolatey FOSS) + Context "Listing package information when using proxy and proxy bypass list on command" -Skip:(!$licensedProxyFixed) { + BeforeDiscovery { + $infoItems = @( + @{ Title = "Tags"; Value = "mvcmusicstore db" } + @{ Title = "Summary"; Value = "Mvc Music Store Database" } + @{ Title = "Description"; Value = "This is the code that releases the database" } + @{ Title = "Release Notes"; Value = "v1.2.0 - Updated Migration" } + ) + } + + BeforeAll { + Restore-ChocolateyInstallSnapshot + $null = Invoke-Choco config set --name=proxy --value="https://invalid.chocolatey.org/" + + $Output = Invoke-Choco info mvcmusicstore-db "--proxy-bypass-list=hermes.chocolatey.org" + $Output.Lines = $Output.Lines + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the package mvcmusicstore-db 1.2.0" { + $Output.Lines | Should -Contain "mvcmusicstore-db 1.2.0" + } + + It "Displays <Title> with value <Value>" -ForEach $infoItems { + $Output.Lines | Should -Contain "${Title}: $Value" + } + } + + Context "Listing package information about local side by side installed package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + $null = Invoke-Choco install 'isdependency' --confirm --sxs + + $Output = Invoke-Choco info 'isdependency' --local-only + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs a warning message that installed side by side package is deprecated" { + $Output.Lines | Should -Contain "isdependency has been installed as a side by side installation." -Because $Output.String + $Output.Lines | Should -Contain "Side by side installations are deprecated and is pending removal in v2.0.0." -Because $Output.String + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-install.Tests.ps1 b/tests/chocolatey-tests/commands/choco-install.Tests.ps1 new file mode 100644 index 0000000000..7f47f481d3 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-install.Tests.ps1 @@ -0,0 +1,1597 @@ +Import-Module helpers/common-helpers + +# https://github.com/chocolatey/choco/blob/master/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs + +Describe "choco install" -Tag Chocolatey, InstallCommand { + BeforeDiscovery { + $isLicensed30OrMissingVersion = Test-PackageIsEqualOrHigher 'chocolatey.extension' '3.0.0-beta' -AllowMissingPackage + $licensedProxyFixed = Test-PackageIsEqualOrHigher 'chocolatey.extension' 2.2.0-beta -AllowMissingPackage + # The destination alias was implemented in Chocolatey v0.10.16/0.11.0, + # but was not implemenented in Chocolatey Licensed at the time. + # Implementation in Chocolatey Licensed is scheduled for v3.0.0. + $destinationAliasAvailable = $isLicensed30OrMissingVersion -and (Test-ChocolateyVersionEqualOrHigherThan '0.10.16-beta') + $hasBeforeInstallBlock = $isLicensed30OrMissingVersion -and (Test-ChocolateyVersionEqualOrHigherThan '0.11.0') + } + + BeforeAll { + Initialize-ChocolateyTestInstall + + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Using NOOP when installing a Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $Output = Invoke-Choco install $PackageUnderTest --noop + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + + It "Displays that it would have used Nuget to install a package" { + $Output.Lines | Should -Contain "Chocolatey would have used NuGet to install packages (if they are not already installed):" + } + + It "Displays that it would have run a PowerShell script" { + $Output.Lines | Should -Contain "Would have run 'chocolateyinstall.ps1':" + } + + It "Doesn't show that it would have run a BeforeModify script" { + $Output.Lines | Should -Not -Contain "Would have run 'chocolateyBeforeModify.ps1':" + } + } + + Context "Using NOOP when installing a Package that doesn't exist" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "somethingnonexisting" + + $Output = Invoke-Choco install $PackageUnderTest --noop + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + + It "Displays that it would have used Nuget to install a package" { + $Output.Lines | Should -Contain "Chocolatey would have used NuGet to install packages (if they are not already installed):" + } + + It "Shows that it was unable to find this package" { + $Output.Lines | Should -Contain "$PackageUnderTest not installed. The package was not found with the source(s) listed." + } + } + + Context "Installing a Package (Happy Path)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed a package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Exist + } + + # We are skipping this for now, until we have stabilized the directory + # path reporting functionality. There are times that this test will + # fail due to Chocolatey not reporting the path. + # This failure seems to happen randomly, and is therefore not a + # reliable test we can make. + It "Outputs the installation directory (which should exist)" -Skip { + $directoryPath = "$env:ChocolateyInstall\lib\$PackageUnderTest" + $lineRegex = [regex]::Escape($directoryPath) + + $foundPath = $Output.Lines -match $lineRegex + $foundPath | Should -Not -BeNullOrEmpty + $foundPath | Should -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Creates a Console Shim in the Bin Directory" { + "$env:ChocolateyInstall\bin\console.exe" | Should -Exist + } + + It "Creates a Graphical Shim in the Bin Directory" { + "$env:ChocolateyInstall\bin\graphical.exe" | Should -Exist + } + + It "Does not create a Shim for Ignored Executable in the Bin Directory" { + "$env:ChocolateyInstall\bin\not.installed.exe" | Should -Not -Exist + } + + It "Does not create a Shim for Ignored Executable (with mismatched case) in the Bin Directory" { + "$env:ChocolateyInstall\bin\casemismatch.exe" | Should -Not -Exist + } + + It "Does not create an extensions folder for the package" { + "$env:ChocolateyInstall\extensions\$PackageUnderTest" | Should -Not -Exist + } + + It "Contains the output of the ChocolateyInstall.ps1 script" { + $Output.Lines | Should -Contain "Ya!" + } + + It "Outputs a message showing that installation was successful" { + $Output.String | Should -Match "Chocolatey installed 1/1 packages\." + } + } + + Context "Installing a Package with Packages.config" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + @" +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="installpackage" /> + <package id="hasdependency" version="1.0.0" /> + <package id="missingpackage" /> + <package id="upgradepackage" version="1.0.0" + installArguments="hi" + packageParameters="yo" forceX86="true" allowMultipleVersions="false" + ignoreDependencies="true" + /> +</packages> +"@ | Out-File -FilePath $env:CHOCOLATEY_TEST_PACKAGES_PATH\test.packages.config -Encoding utf8 + + $Output = Invoke-Choco install $env:CHOCOLATEY_TEST_PACKAGES_PATH\test.packages.config --confirm + } + + AfterAll { + $null = Invoke-Choco uninstall installpackage hasdependency upgradepackage -x --confirm + } + + It "Exits with Failure (1), due to the missing 'missingpackage'" { + $Output.ExitCode | Should -Be 1 + } + + It "Installs the package '<_>' in the Lib directory" -ForEach @("InstallPackage"; "HasDependency"; "IsDependency"; "UpgradePackage") { + "$env:ChocolateyInstall\lib\$_" | Should -Exist + } + + It "Outputs a message indicating that it installed N-1 packages successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 5/6 packages. 1 packages failed." + } + + It "Outputs a message indicating that UpgradePackage with the expected version was installed" { + $Output.Lines | Should -Contain "upgradepackage 1.0.0 Installed" + } + + It "Outputs a message indicating that '<_>' package was installed" -ForEach @( + "The install of installpackage was successful." + "hasdependency 1.0.0 Installed" + "isexactversiondependency 1.0.0 Installed" + "isdependency 1.1.0 Installed" + "upgradepackage 1.0.0 Installed" + ) { + $Output.Lines | Should -Contain $_ + } + + It "Outputs a message indicating that missingpackage was not installed" { + $Output.Lines | Should -Contain "missingpackage not installed. The package was not found with the source(s) listed." + } + + Context "packages.config containing all options" { + BeforeAll { + @" +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package + id="installpackage" + prerelease="true" + overrideArguments="true" + notSilent="true" + allowDowngrade="true" + forceDependencies="true" + skipAutomationScripts="true" + user="user" + password="string" + cert="cert" + certPassword="string" + ignoreChecksums="true" + allowEmptyChecksums="true" + allowEmptyChecksumsSecure="true" + requireChecksums="true" + downloadChecksum="downloadChecksum" + downloadChecksum64="downloadChecksum64" + downloadChecksumType="downloadChecksumType" + downloadChecksumType64="downloadChecksumType64" + ignorePackageExitCodes="true" + usePackageExitCodes="true" + stopOnFirstFailure="true" + exitWhenRebootDetected="true" + ignoreDetectedReboot="true" + disableRepositoryOptimizations="true" + acceptLicense="true" + confirm="true" + limitOutput="true" + cacheLocation="Z:\" + failOnStderr="true" + useSystemPowershell="true" + noProgress="true" + force="true" + executionTimeout="1000" + /> +</packages> +"@ | Out-File $env:CHOCOLATEY_TEST_PACKAGES_PATH\alloptions.packages.config -Encoding utf8 + + $Output = Invoke-Choco install $env:CHOCOLATEY_TEST_PACKAGES_PATH\alloptions.packages.config --confirm --verbose --debug + + # This is based on two observations: The addition explicitly outputs that it's the Package Configuration. + # The configuration output is about 80 lines. + $StartOfPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration Start:") + $EndOfPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration End") + + $PackageConfigurationOutput = $Output.Lines[$StartofPackageConfiguration..$EndOfPackageConfiguration] -join [Environment]::NewLine + } + + # We are explicitly passing in a bad username and password here. + # Therefore it cannot find the package to install and fails the install. + # That doesn't matter because we just need to test that the configuration is set properly. + It "Should exit Failure (1)" { + $Output.ExitCode | Should -Be 1 -Because $Output.String + } + + It "Should contain the expected configuration option (<Option>) set correctly (<ExpectedValue>)" -ForEach @( + @{ Option = "Prerelease" ; ExpectedValue = "True" } + @{ Option = "OverrideArguments" ; ExpectedValue = "True" } + @{ Option = "NotSilent" ; ExpectedValue = "True" } + @{ Option = "AllowDowngrade" ; ExpectedValue = "True" } + @{ Option = "ForceDependencies" ; ExpectedValue = "True" } + # SkipAutomationScripts sets configuration option SkipPackageInstallProvider + @{ Option = "SkipPackageInstallProvider" ; ExpectedValue = "True" } + # User is expanded to Username + @{ Option = "Username" ; ExpectedValue = "user" } + # Password should *not* be output in the logging + # @{ Option = "Password" ; ExpectedValue = "string" } + # Cert is expanded to Certificate + @{ Option = "Certificate" ; ExpectedValue = "cert" } + # CertPassword should *not* be output in the logging + # @{ Option = "CertPassword" ; ExpectedValue = "string" } + # IgnoreChecksums sets ChecksumFiles to False + @{ Option = "ChecksumFiles" ; ExpectedValue = "False" } + # RequireChecksums is evaluated after allowing empty. It sets both allow options to False + # @{ Option = "RequireChecksums" ; ExpectedValue = "True" } + @{ Option = "AllowEmptyChecksums" ; ExpectedValue = "False" } + @{ Option = "AllowEmptyChecksumsSecure" ; ExpectedValue = "False" } + @{ Option = "DownloadChecksum" ; ExpectedValue = "downloadChecksum" } + @{ Option = "DownloadChecksum64" ; ExpectedValue = "downloadChecksum64" } + @{ Option = "DownloadChecksumType" ; ExpectedValue = "downloadChecksumType" } + @{ Option = "DownloadChecksumType64" ; ExpectedValue = "downloadChecksumType64" } + # UsePackageExitCodes and IgnorePackageExitCodes set the same setting, but are opposite of each other. + # UsePackageExitCodes is evaluated last, so takes precidence. + # @{ Option = "IgnorePackageExitCodes" ; ExpectedValue = "True" } + @{ Option = "UsePackageExitCodes" ; ExpectedValue = "True" } + # StopOnFirstFailure is expanded to StopOnFirstPackageFailure + @{ Option = "StopOnFirstPackageFailure" ; ExpectedValue = "True" } + # ExitWhenRebootDetected and IgnoreDetectedReboot both set ExitOnRebootDetected. + # IgnoreDetectedReboot is evaluated last, so takes precidence. + # @{ Option = "ExitWhenRebootDetected" ; ExpectedValue = "True" } + # @{ Option = "IgnoreDetectedReboot" ; ExpectedValue = "True" } + @{ Option = "ExitOnRebootDetected" ; ExpectedValue = "False" } + # DisableRepositoryOptimizations sets UsePackageRepositoryOptimizations to false + @{ Option = "UsePackageRepositoryOptimizations" ; ExpectedValue = "False" } + @{ Option = "AcceptLicense" ; ExpectedValue = "True" } + # Confirm is negated into PromptForConfirmation + @{ Option = "PromptForConfirmation" ; ExpectedValue = "False" } + # LimitOutput is negated into Regular Output + @{ Option = "RegularOutput" ; ExpectedValue = "False" } + @{ Option = "CacheLocation" ; ExpectedValue = "Z:\\" } + @{ Option = "FailOnStandardError" ; ExpectedValue = "True" } + # UseSystemPowerShell sets UsePowerShellHost to False + @{ Option = "UsePowerShellHost" ; ExpectedValue = "False" } + # NoProgress sets ShowDownloadProgress to False + @{ Option = "ShowDownloadProgress" ; ExpectedValue = "False" } + @{ Option = "Force" ; ExpectedValue = "True" } + # ExecutionTimeout is expanded to CommandExecutionTimeoutSeconds + @{ Option = "CommandExecutionTimeoutSeconds" ; ExpectedValue = "1000" } + ) { + $PackageConfigurationOutput | Should -Match "$Option='$ExpectedValue'" + } + } + } + + Context "Installing a Package that is already installed" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + + $Output = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should still have a package in the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Exist + } + + It "Should still have the expected version installed" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a message indicating that it was unable to install any package(s)" { + $Output.Lines | Should -Contain "$PackageUnderTest v1.0.0 already installed." + $Output.Lines | Should -Contain "Chocolatey installed 0/1 packages." + } + + It "Outputs a message about using --force to reinstall" { + # Warning gets repeated in the summary + $Output.String | Should -Match 'Use --force to reinstall' + } + } + + Context "Force Installing a Package that is already installed" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + "FileNotOverwritten" | Add-Content -Path "$env:ChocolateyInstall\lib\$PackageUnderTest\tools\chocolateyInstall.ps1" + + $Output = Invoke-Choco install $PackageUnderTest --version 1.0.0 --force --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should install the package in the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Exist + } + + It "Should still have the expected version installed" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Should remove and readd the package files in the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\tools\chocolateyInstall.ps1" | Should -Not -FileContentMatch "FileNotOverwritten" + } + + It "Deletes the rollback files" { + "$env:ChocolateyInstall\lib-bkp\$PackageUnderTest" | Should -Not -Exist + } + + It "Outputs a message indicating that it installed the package successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Force Installing a Package that is already installed (that errors)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + "FileNotOverwritten" | Add-Content -Path "$env:ChocolateyInstall\lib\$PackageUnderTest\tools\chocolateyInstall.ps1" + + $Output = Invoke-Choco install $PackageUnderTest --version 1.0.0 --force --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should install the package in the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Exist + } + + It "Should still have the expected version installed" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Should remove and readd the package files in the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\tools\chocolateyInstall.ps1" | Should -Not -FileContentMatch "FileNotOverwritten" + } + + It "Deletes the rollback files" { + "$env:ChocolateyInstall\lib-bkp\$PackageUnderTest" | Should -Not -Exist + } + + It "Outputs a message indicating that it installed the package successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Force Installing a Package that is already installed (with a read/delete locked file)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + Invoke-Choco install $PackageUnderTest --confirm + + $LockedFile = [System.IO.File]::Open( + "$env:ChocolateyInstall\lib\$PackageUnderTest\tools\chocolateyInstall.ps1", + "OpenOrCreate", + "ReadWrite", + "Read, Delete" + ) + + $Output = Invoke-Choco install installpackage --force --confirm + } + + AfterAll { + $LockedFile.Close() + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Has successfully retained an install of the original package" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\" + } + + It "Has successfully retained the original version" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + # This behaviour was fixed in 0.10.16 + It "Should not have been able to delete the rollback" -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta")) { + "$env:ChocolateyInstall\lib-bkp\$PackageUnderTest" | Should -Exist + } + + It "Outputs a message showing that installation succeeded." { + $Output.String | Should -Match "Chocolatey installed 1/1 packages\." + } + } + + Context "Force Installing a Package that is already installed (with an exclusively locked file)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + Invoke-Choco install $PackageUnderTest --confirm + + $LockedFile = [System.IO.File]::Open( + "$env:ChocolateyInstall\lib\$PackageUnderTest\tools\chocolateyInstall.ps1", + "OpenOrCreate", + "ReadWrite", + "None" + ) + + $Output = Invoke-Choco install installpackage --force --confirm + } + + AfterAll { + $LockedFile.Close() + } + + It "Exits with Success (0)" -Tag FossOnly { + $Output.ExitCode | Should -Be 0 + } + + It "Exits with Failure (1)" -Tag Licensed { + $Output.ExitCode | Should -Be 1 + } + + It "Has successfully retained an install of the original package" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\" + } + + It "Has successfully retained the original version" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Should not have been able to delete the rollback" -Tag FossOnly { + "$env:ChocolateyInstall\lib-bkp\$PackageUnderTest" | Should -Exist + } + + It "Should have been able to delete the rollback" -Tag Licensed { + "$env:ChocolateyInstall\lib-bkp\$PackageUnderTest" | Should -Not -Exist + } + + It "Outputs a message showing that installation succeeded." { + $Output.String | Should -Match "Chocolatey installed 0/1 packages\." + } + } + + Context "Installing a Package that exists (with a version that does not)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $Output = Invoke-Choco install $PackageUnderTest --version 1.0.1 --confirm + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + + It "Outputs a message showing that installation failed." { + $Output.String | Should -Match "Chocolatey installed 0/1 packages\." + } + } + + Context "Installing a Package that does not exist" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "nonexisting" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + + It "Outputs a message showing that installation failed." { + $Output.String | Should -Match "Chocolatey installed 0/1 packages\." + } + } + + Context "Installing a Package that errors" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "badpackage" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Failure (-1)" { + $Output.ExitCode | Should -Be -1 + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + + It "Puts the package in the lib-bad directory" { + "$env:ChocolateyInstall\lib-bad\$PackageUnderTest" | Should -Exist + } + + It "Outputs a message showing that installation failed." { + $Output.String | Should -Match "Chocolatey installed 0/1 packages\." + } + } + + Context "Installing a Package that has non-terminating errors" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco feature disable -n failOnStandardError + + $PackageUnderTest = "nonterminatingerror" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed a package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0" + } + + It "Outputs a message showing that installation was successful" { + $Output.String | Should -Match "Chocolatey installed 1/1 packages\." + } + } + + Context "Installing a Package that has non-terminating errors (with fail on STDERR)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco feature enable -n FailOnStandardError + + $PackageUnderTest = "nonterminatingerror" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + + It "Puts the package in the lib-bad directory" { + "$env:ChocolateyInstall\lib-bad\$PackageUnderTest" | Should -Exist + } + + It "Outputs a message showing that installation failed." { + $Output.String | Should -Match "Chocolatey installed 0/1 packages\." + } + } + + Context "Installing a side-by-side Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $Output = Invoke-Choco install $PackageUnderTest --confirm --allowmultipleversions + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed a package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a warning message about side by side installs are deprecated" { + $Output.Lines | Should -Contain "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String + } + + It "Outputs a message indicating that it installed the package successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Switching a normal Package to a side-by-side Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco install $PackageUnderTest --confirm + + $Output = Invoke-Choco install $PackageUnderTest --confirm --force --allowmultipleversions + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist + } + + It "Removed the previous version of the package from the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Not -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a warning message about side by side installs are deprecated" { + $Output.Lines | Should -Contain "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String + } + + It "Outputs a message indicating that it installed the package successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Switching a side-by-side Package to a normal Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco install $PackageUnderTest --confirm --allowmultipleversion + + $Output = Invoke-Choco install $PackageUnderTest --confirm --force + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Does not output a warning message about side by side installs are deprecated" { + $Output.Lines | Should -Not -Contain "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String + } + + It "Does not output a warning message that installed side by side package is deprecated" { + $Output.Lines | Should -Not -Contain "installpackage has been installed as a side by side installation." -Because $Output.String + $Output.Lines | Should -Not -Contain "Side by side installations are deprecated and is pending removal in v2.0.0." -Because $Output.String + } + + It "Outputs a message indicating that it installed the package successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Installing a Package with dependencies (Happy Path)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "hasdependency" + + $Output = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installed the dependency to the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Exist + } + + It "Installs the expected version of the dependency" { + "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" + $XML.package.metadata.version | Should -Be "1.1.0" + } + + It "Outputs a message indicating that it installed the package(s) successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 3/3 packages." + } + } + + Context "Force Installing a Package that is already installed (with dependencies)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "hasdependency" + $null = Invoke-Choco install isdependency --version 1.1.0 --confirm + $null = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + + $Output = Invoke-Choco install $PackageUnderTest --force --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installed the exact same version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Has still got the dependency to the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Exist + } + + It "Should not have upgraded the dependency in the lib directory" { + "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" + $XML.package.metadata.version | Should -Be "1.1.0" + } + + It "Outputs a message indicating that it installed the package(s) successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Force Installing a Package that is already installed (forcing dependencies)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "hasdependency" + $null = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + + $Output = Invoke-Choco install $PackageUnderTest --force --forcedependencies --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installed the exact same version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Has still got the dependency to the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Exist + } + + It "Should have installed the floating dependency in the lib directory with the latest appropriate version" { + "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" + $XML.package.metadata.version | Should -Be "1.1.0" + } + + It "Has still got the exactdependency to the lib directory" { + "$env:ChocolateyInstall\lib\isexactversiondependency" | Should -Exist + } + + It "Should have installed the exact exactdependency in the lib directory" { + "$env:ChocolateyInstall\lib\isexactversiondependency\isexactversiondependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isexactversiondependency\isexactversiondependency.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a message indicating that it installed the package(s) successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 3/3 packages." + } + } + + Context "Force Installing a Package that is already installed (ignoring dependencies)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "hasdependency" + $null = Invoke-Choco install isdependency --version 1.0.0 --confirm + $null = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + + $Output = Invoke-Choco install $PackageUnderTest --force --ignoredependencies --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installed the exact same version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Has still got the floating dependency installed to the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Exist + } + + It "Should not have upgraded the floating dependency in the lib directory" { + "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Has still got the exact dependency installed to the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Exist + } + + It "Should not have upgraded the exact dependency in the lib directory" { + "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a message indicating that it installed the package(s) successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Force Installing a Package that is already installed (forcing and ignoring dependencies)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "hasdependency" + $null = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm + + $Output = Invoke-Choco install $PackageUnderTest --force --ignoredependencies --forcedependencies --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installed the exact same version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + # This only gets removed on Open Source + It "Has removed the floating dependency installed in the lib directory" -Tag FossOnly { + "$env:ChocolateyInstall\lib\isdependency" | Should -Not -Exist + } + + # This only gets removed on Open Source + It "Has removed the exact dependency installed in the lib directory" -Tag FossOnly { + "$env:ChocolateyInstall\lib\isdependency" | Should -Not -Exist + } + + It "Outputs a message indicating that it installed the package(s) successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Installing a Package (with dependencies that cannot be found)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "ismissingpackage" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Not -Exist + } + + It "Outputs a message indicating that it failed to install the package" { + $Output.Lines | Should -Contain "Chocolatey installed 0/1 packages. 1 packages failed." + } + } + + Context "Installing a Package (ignoring dependencies that cannot be found)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "hasdependency" + + $Output = Invoke-Choco install $PackageUnderTest --version 1.0.0 --confirm --ignoredependencies + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Has installed a package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Exist + } + + It "Installed the right version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Doesn't install the package to the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Not -Exist + } + + It "Outputs a message indicating that it install the package" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + # TODO: Need to get this test working + Context "Installing a Package that depends on a newer version of an installed dependency" -Skip { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + Invoke-Choco install "isdependency" --version 1.0.0 --confirm + $PackageUnderTest = "hasdependency" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installed the exact same version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "2.1.0" + } + + It "Has the dependency installed in the lib directory" { + "$env:ChocolateyInstall\lib\isdependency" | Should -Exist + } + + It "Upgraded the dependency in the lib directory" { + "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" + $XML.package.metadata.version | Should -Be "2.1.0" + } + + It "Outputs a message indicating that it installed the package(s) successfully" { + $Output.Lines | Should -Contain "Chocolatey installed 3/3 packages." + } + } + + Context "Installing a Package that depends on a newer version of an installed dependency (that is unavailable)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install "hasdependency" --version 1.0.0 --confirm + $PackageUnderTest = "hasoutofrangedependency" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Has not installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Not -Exist + } + + It "Outputs a message indicating that it failed to install the package(s)" { + $Output.Lines | Should -Contain "Chocolatey installed 0/1 packages. 1 packages failed." + } + } + + Context "Installing a Package that depends on a newer version of an installed dependency (that is unavailable, ignoring dependencies)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install "hasdependency" --version 1.0.0 --confirm + $PackageUnderTest = "hasoutofrangedependency" + + $Output = Invoke-Choco install $PackageUnderTest --confirm --ignoredependencies + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Has installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installed the right version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "2.0.3" + } + + It "Outputs a message indicating that it successfully installed the package(s)" { + $Output.Lines | Should -Contain "Chocolatey installed 1/1 packages." + } + } + + Context "Force Installing a Package that depends on a newer version of an installed dependency (that is unavailable, forcing depedencies)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install "hasdependency" --version 1.0.0 --confirm + $PackageUnderTest = "hasoutofrangedependency" + + $Output = Invoke-Choco install $PackageUnderTest --confirm --force --forcedependencies + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Has not installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Not -Exist + } + + It "Has not upgraded the dependency" { + "$env:ChocolateyInstall\lib\hasdependency\hasdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\hasdependency\hasdependency.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a message indicating that it failed to install the package(s)" { + $Output.Lines | Should -Contain "Chocolatey installed 0/1 packages. 1 packages failed." + $Output.String | Should -Match "Unable to resolve dependency 'hasdependency" + } + } + + # TODO: Add tests for version handling when dependency is specified as a lower + # version than what is available (hasoutofrangedependency v2.0.0 should cover this) + + # TODO: Add tests for version handling when dependency is specifies as a + # version that is between available versions (hasoutofrangedependency v2.0.1 should cover this) + + # TODO: Add tests for version handling when dependency is specified as a + # version that has an exact version that do not exist (hasoutofrangedependency v2.0.2 should cover this) + + Context "Installing a Package that depends on a newer version of a package than an existing package has with that dependency" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install isdependency --version 2.1.0 --confirm + $PackageUnderTest = "conflictingdependency" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Has installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Has upgraded the dependency" { + "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\isdependency\isdependency.nuspec" + $XML.package.metadata.version | Should -Be "2.1.0" + } + + It "Outputs a message indicating that it succeeded to install the package(s)" { + $Output.Lines | Should -Contain "Chocolatey installed 2/2 packages." + } + } + + Context "Installing a Package from a nupkg file" { + BeforeAll { + $snapshotPath = New-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + New-ChocolateyTestPackage ` + -TestPath "$PSScriptRoot\testpackages" ` + -Name $PackageUnderTest ` + -Version "1.0.0" + + $PackagePath = "$($snapshotPath.PackagesPath)\$PackageUnderTest.1.0.0.nupkg" + + $Output = Invoke-Choco install $PackagePath --confirm --params '/ParameterOne:FirstOne /ParameterTwo:AnotherOne' + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed a package to the lib directory" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Exist + } + + # We are skipping this for now, until we have stabilized the directory + # path reporting functionality. There are times that this test will + # fail due to Chocolatey not reporting the path. + # This failure seems to happen randomly, and is therefore not a + # reliable test we can make. + It "Outputs the installation directory" -Skip { + $directoryPath = "$env:ChocolateyInstall\lib\$PackageUnderTest" + $lineRegex = [regex]::Escape($directoryPath) + + $Output.String | Should -Match "$lineRegex" + } + + It "Has created the installation directory" { + $Output.Lines -Match "$([Regex]::Escape((Join-Path $env:ChocolateyInstall "lib\$PackageUnderTest")))" | Should -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$PackageUnderTest\$PackageUnderTest.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Creates a Console Shim in the Bin Directory" { + "$env:ChocolateyInstall\bin\console.exe" | Should -Exist + } + + It "Creates a Graphical Shim in the Bin Directory" { + "$env:ChocolateyInstall\bin\graphical.exe" | Should -Exist + } + + It "Does not create a Shim for Ignored Executable in the Bin Directory" { + "$env:ChocolateyInstall\bin\not.installed.exe" | Should -Not -Exist + } + + It "Does not create a Shim for Ignored Executable (with mismatched case) in the Bin Directory" { + "$env:ChocolateyInstall\bin\casemismatch.exe" | Should -Not -Exist + } + + It "Does not create an extensions folder for the package" { + "$env:ChocolateyInstall\extensions\$PackageUnderTest" | Should -Not -Exist + } + + It "Contains the output of the ChocolateyInstall.ps1 script" { + $Output.Lines | Should -Contain "Ya!" + } + + # https://github.com/chocolatey/choco/issues/2089 + It "Reports the Package Parameters expected" { + $Output.Lines | Should -Contain "Package Parameters:" + $Output.Lines | Should -Contain "ParameterOne - FirstOne" + $Output.Lines | Should -Contain "ParameterTwo - AnotherOne" + } + + It "Outputs a message showing that installation was successful" { + $Output.String | Should -Match "Chocolatey installed 1/1 packages\." + } + } + + Context "Installing a Pure Portable Package" { + BeforeAll { + $snapshotPath = New-ChocolateyInstallSnapshot + $PackageUnderTest = 'pureportable' + + $Output = Invoke-Choco install $PackageUnderTest + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs a message showing that installation was successful" { + $Output.String | Should -Match "Chocolatey installed 1/1 packages\." + } + + It "Outputs installation to the correct location" { + $Output.Lines | Should -Contain "Software installed to '$($env:ChocolateyInstall)\lib\$PackageUnderTest'" + } + } + + # TODO: Create tests surrounding this stubbed out test + Context "Installing a Package with config transforms" -Skip { + BeforeAll { + Restore-ChocolateyInstallSnapshot + } + } + + Context "Installing a Package with no sources enabled" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + Disable-ChocolateySource -All + + $PackageUnderTest = "installpackage" + + $Output = Invoke-Choco install $PackageUnderTest --confirm + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs a message indicating that there were no sources enabled" { + $Output.String | Should -Match "Installation was NOT successful. There are no sources enabled for" + } + + It "Does not install a package" { + "$env:ChocolateyInstall\lib\$PackageUnderTest" | Should -Not -Exist + } + } + + # Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/530 (NOTE: Proxy bypassing also works on Chocolatey FOSS) + Context "Installing a Package with proxy and proxy bypass list" -Skip:(!$licensedProxyFixed) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + $null = Invoke-Choco config set --name=proxy --value="https://invalid.chocolatey.org/" + $null = Invoke-Choco config set --name=proxyBypassList --value="hermes.chocolatey.org" + + $Output = Invoke-Choco install installpackage --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays package files install completed" { + $Output.Lines | Should -Contain "installpackage package files install completed. Performing other installation steps." + } + } + + # Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/530 (NOTE: Proxy bypassing also works on Chocolatey FOSS) + Context "Installing a Package with proxy and proxy bypass list on command" -Skip:(!$licensedProxyFixed) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + $null = Invoke-Choco config set --name=proxy --value="https://invalid.chocolatey.org/" + + $Output = Invoke-Choco install installpackage --confirm "--proxy-bypass-list=hermes.chocolatey.org" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays package files install completed" { + $Output.Lines | Should -Contain "installpackage package files install completed. Performing other installation steps." + } + } + + # TODO: Need to figure out how to test out toggling proxy bypassing on the + # source itself. This should be possible to do with the hermes source, + # but we need to extract the source, user and password before we can + # do that. + + # Issue: https://github.com/chocolatey/choco/issues/2203 + # Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/552 + Context "Installing a Package with Embedded Zip Archive and using -UnzipLocation" -Skip:(!$destinationAliasAvailable) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco install get-chocolateyunzip-test --version 0.0.2 --confirm + } + + AfterAll { + $null = Invoke-Choco uninstall get-chocolateyunzip-test --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # TODO: Background service only works with Chocolatey Licensed Extension. Assess moving this test to CLE test suite + It "Runs under background Service" -Tag Background { + $Output.Lines | Should -Contain 'Running in background mode' + } + + It "Displays installed message" { + $Output.Lines | Should -Contain "The install of get-chocolateyunzip-test was successful." + } + } + + # Issue: https://github.com/chocolatey/chocolatey-licensed-issues/issues/284 + Context "Installing a Package with Embedded Zip Archive and specifying destination <Name>" -ForEach @( + @{ Name = 'Root of UNC share' ; Path = '\\localhost\c$\' } + @{ Name = 'UNC share path' ; Path = '\\localhost\c$\temp\' } + @{ Name = 'Root of drive with trailing slash' ; Path = 'C:\' } + @{ Name = 'Root of drive without trailing slash' ; Path = 'C:' } + @{ Name = 'Windows System32' ; Path = 'C:\Windows\System32' } + @{ Name = 'Non-existentfolder' ; Path = "$(Get-TempDirectory)$(New-Guid)" } + ) { + param($Name, $Path) + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco install get-chocolateyunzip-custom-paths --params "'/Destination:$Path'" --confirm + $packageFile = Join-Path -Path $Path -ChildPath 'get-chocolateyunzip-custom-paths.txt' + } + + AfterAll { + $null = Invoke-Choco uninstall get-chocolateyunzip-custom-paths --confirm + $null = Remove-Item $packageFile -Force -ErrorAction Ignore + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + # TODO: Background service only works with Chocolatey Licensed Extension. Assess moving this test to CLE test suite + It "Runs under background Service" -Tag Background { + $Output.Lines | Should -Contain 'Running in background mode' + } + + It "Displays installed message" { + $Output.Lines | Should -Contain "The install of get-chocolateyunzip-custom-paths was successful." + } + + It "Installed the file as expected" { + $packageFile | Should -Exist -Because "Package was instructed to be installed to $Path." + } + } + + Context "Installing commercial package with custom commandlets" -Tag FossOnly { + BeforeAll { + New-ChocolateyInstallSnapshot + + $Output = Invoke-Choco install get-chocolateyunzip-licensed --confirm + } + + It "Exits with Failure (-1)" { + $Output.ExitCode | Should -Be -1 + } + } + + Context "Installing license only package on open source" -Tag FossOnly { + BeforeAll { + New-ChocolateyInstallSnapshot + + $Output = Invoke-Choco install business-only-license --confirm + } + + It "Exits with Failure (-1)" { + $Output.ExitCode | Should -Be -1 + } + + It "Outputs warning message about needing commercial edition" { + $Output.Lines | Should -Contain "WARNING: Package Requires Commercial License - Installation cannot continue as Package Builder use require endpoints to be licensed with Chocolatey Licensed Extension v3.0.0+ (chocolatey.extension). Please see error below for details and correction instructions." + } + + It "Outputs error message about needing commercial edition" { + $Output.Lines | Should -Contain "ERROR: This package requires a commercial edition of Chocolatey as it was built/internalized with commercial features. Please install the license and install/upgrade to Chocolatey Licensed Extension v3.0.0+ as per https://docs.chocolatey.org/en-us/licensed-extension/setup." + } + } + + Context "Installing package with beforeInstall scriptblock defined" -Skip:(!$hasBeforeInstallBlock) { + BeforeAll { + New-ChocolateyInstallSnapshot + Remove-Item "$env:ChocolateyInstall\logs\*" -ErrorAction Ignore + + $Output = Invoke-Choco install hasbeforeinstallblock --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs string defined in before installation block" { + $Output.Lines | Should -Contain "Running necessary Pre-Install step" + } + + It "Logs beforeInstall block in log file" { + "$env:ChocolateyInstall\logs\chocolatey.log" | Should -FileContentMatchMultiline "\s*-?beforeInstall:? '[\s\r\n]*# This is just to notify that the before install script[\s\r\n]*# block have been ran[\s\r\n]*Write-Host `"Running necessary Pre-Install step`"[\s\r\n]*'" + } + } + + Context "Installing package with circular dependencies" -Tag CircularDependency { + BeforeAll { + Restore-ChocolateyInstallSnapshot -SetWorkDir + + $result1 = Invoke-Choco install circulardependency1 -y + $result2 = Invoke-Choco install circulardependency2 -y + } + + It "Exits with Failure (1)" { + $result1.ExitCode | Should -Be 1 + $result2.ExitCode | Should -Be 1 + } + + It "should identify a circular dependency" { + $result1.Lines | Should -Contain "Circular dependency detected 'circulardependency1 0.0.1 => circulardependency2 0.0.1 => circulardependency1 0.0.1'." + $result2.Lines | Should -Contain "Circular dependency detected 'circulardependency2 0.0.1 => circulardependency1 0.0.1 => circulardependency2 0.0.1'." + } + } + + Context "Install '<Package>' package with (<Command>) specified" -ForEach @( + @{ Command = '--pin' ; Package = 'installpackage' ; Contains = $true } + @{ Command = '' ; Package = 'installpackage' ; Contains = $false } + @{ Command = '' ; Package = 'packages.config' ; Contains = $true } + ) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + if ($Package -eq 'packages.config') { + @" +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="installpackage" pinPackage="true" /> +</packages> +"@ | Set-Content $PWD/packages.config + } + + $null = Invoke-Choco install $Package $Command --confirm + $Output = Invoke-Choco pin list + } + + It "Output should include pinned package" { + if ($Contains) { + $Output.String | Should -Match "installpackage|1.0.0" + } + else { + $Output.String | Should -Not -Match "installpackage|1.0.0" + } + } + } + + Context "Installing package that extracts local zip archive while disabling logging" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco install zip-log-disable-test --verbose --debug -y + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Does not output extracted file path '<_>'" -ForEach @('tools\'; 'tools\chocolateybeforemodify.ps1'; 'tools\chocolateyinstall.ps1'; 'tools\chocolateyuninstall.ps1'; 'zip-log-disable-test.nuspec') { + $Output.String | Should -Not -Match "- $([regex]::Escape($_))" + } + } + + Context "Installing package that extracts external zip archive while disabling logging" -Tag Internal { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco install zip-log-disable-test-external --verbose --debug -y + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Does not output extracted file path '<_>'" -ForEach @('tools\'; 'tools\chocolateybeforemodify.ps1'; 'tools\chocolateyinstall.ps1'; 'tools\chocolateyuninstall.ps1'; 'zip-log-disable-test.nuspec') { + $Output.String | Should -Not -Match "- $([regex]::Escape($_))" + } + } + + Context "Installing package that makes use of new Get Chocolatey Path helper" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + Enable-ChocolateySource -Name 'local' + + $Output = Invoke-Choco install test-chocolateypath -y + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 -Because $Output.String + } + + It "Outputs message <_>" -ForEach @( + 'Package Path in Install Script: <installPath>\lib\test-chocolateypath' + 'Install Path in Install Script: <installPath>' + ) { + $Output.Lines | Should -Contain "$($_ -replace '<installPath>',$env:ChocolateyInstall)" -Because $Output.String + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-list.Tests.ps1 b/tests/chocolatey-tests/commands/choco-list.Tests.ps1 new file mode 100644 index 0000000000..c5f273735b --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-list.Tests.ps1 @@ -0,0 +1,417 @@ +<# + .Synopsis + Tests for `choco list` and aliases + + .Link + https://github.com/chocolatey/choco/blob/master/src/chocolatey.tests.integration/scenarios/ListScenarios.cs +#> +param( + # Which command to test (used for testing aliases instead of the base command, 'list') + [string[]]$Command = @( + "list" + "find" + "search" + ) +) + +Import-Module helpers/common-helpers + +Describe "choco <_>" -ForEach $Command -Tag Chocolatey, ListCommand, SearchCommand, FindCommand { + BeforeDiscovery { + $licensedProxyFixed = Test-PackageIsEqualOrHigher 'chocolatey.extension' 2.2.0-beta -AllowMissingPackage + } + + BeforeAll { + Initialize-ChocolateyTestInstall -Source $PSScriptRoot\testpackages + Invoke-Choco install installpackage --version 1.0.0 --confirm + Invoke-Choco install upgradepackage --version 1.0.0 --confirm + $VersionRegex = "[^v]\d+\.\d+\.\d+" + # Ensure that we remove any compatibility package before running the tests + $null = Invoke-Choco uninstall chocolatey-compatibility.extension -y --force + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Searching packages with no filter (Happy Path)" { + BeforeAll { + $Output = Invoke-Choco $_ + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Lists available packages once" { + # Possible that I need to add a second source to make this valid + $Output.String | Should -Match "upgradepackage" + } + + It "Contains packages and versions with a space between them" { + $Output.Lines | Should -Contain "upgradepackage 1.1.0" + } + + It "Should not contain pipe-delimited values" { + $Output.Lines | Should -Not -Contain "upgradepackage|1.1.0" + } + + It "Should contain a summary" { + $Output.String | Should -Match "\d+ packages found" + } + } + + Context "Searching for a particular package" { + BeforeAll { + $Output = Invoke-Choco $_ upgradepackage + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Contains packages and versions with a space between them" { + $Output.Lines | Should -Contain "upgradepackage 1.1.0" + } + + It "Does not contain available packages that do not match" { + $Output.Lines | Should -Not -Contain "installpackage 1.0.0" + } + + It "Should contain a summary" { + $Output.Lines | Should -Contain "1 packages found." + } + } + + Context "Searching all available packages" { + BeforeAll { + $Output = Invoke-Choco $_ --AllVersions + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Shows each instance of an available package" { + ($Output.Lines -like "upgradepackage*").Count | Should -Be 2 + } + + It "Contains packages and versions with a space between them" { + $Output.Lines | Should -Contain "upgradepackage 1.0.0" + } + + It "Should not contain pipe-delimited packages and versions" { + $Output.Lines | Should -Not -Contain "upgradepackage|1.0.0" + } + + It "Should contain a summary" { + $Output.String | Should -Match "\d+ packages found" + } + } + + Context "Searching all available packages (allowing prerelease)" { + BeforeAll { + $Output = Invoke-Choco $_ --AllVersions --PreRelease + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Shows each instance of an available package" { + # Due to a bug (https://github.com/chocolatey/choco/issues/2763) Sometimes all upgradepackage packages aren't returned + # This works around that issue by testing that we got up to 4 results, and tests that a query for the package directly does return all 4 + ($Output.Lines -like "upgradepackage*").Count | Should -BeLessOrEqual 4 + ((Invoke-Choco $_ upgradepackage --AllVersions --PreRelease).Lines -like "upgradepackage*").Count | Should -Be 4 + } + + It "Contains packages and versions with a space between them" { + ($Output.Lines -like "upgradepackage *").Count | Should -BeLessOrEqual 4 + } + + It "Should not contain pipe-delimited packages and versions" { + ($Output.Lines -like "upgradepackage|*").Count | Should -Be 0 + } + + It "Should contain a summary" { + $Output.String | Should -Match "\d+ packages found" + } + } + + # Issue: https://github.com/chocolatey/choco/issues/1843 + Context "Searching exact package with displaying all versions" -Skip:(-Not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta-233")) { + BeforeAll { + $Output = Invoke-Choco $_ upgradepackage --AllVersions --exact + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Shows version <_> of the package" -ForEach @("1.1.0"; "1.0.0") { + $Output.Lines | Should -Contain "upgradepackage $_" + } + } + + # Issue: https://github.com/chocolatey/choco/issues/1843 + Context "List installed package with exact and side-by-side loading" -Skip:(-Not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta-233")) { + BeforeAll { + $null = Invoke-Choco install isdependency --version 2.0.0 --confirm + $null = Invoke-Choco install isdependency --version 1.1.0 --allow-multiple-versions --confirm + + $Output = Invoke-Choco $_ isdependency --AllVersions --exact --local-only + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Shows version <_> of local package" -ForEach @("2.0.0"; "1.1.0") { + $Output.Lines | Should -Contain "isdependency $_" + } + + It "Outputs a warning message that installed side by side package is deprecated" { + $Output.Lines | Should -Contain "isdependency has been installed as a side by side installation." + $Output.Lines | Should -Contain "Side by side installations are deprecated and is pending removal in v2.0.0." + } + } + + Context "Searching packages with Verbose" { + BeforeAll { + $Output = Invoke-Choco $_ --Verbose + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should contain packages and version with a space between them" { + $Output.Lines | Should -Contain "upgradepackage 1.1.0" + } + + It "Should contain a description" { + $Output.String | Should -Match "Description:" + } + + It "Should contain a download count" { + $Output.String | Should -Match "Number of Downloads:" + } + + It "Should not contain pipe-delimited packages and versions" { + $Output.Lines | Should -Not -Contain "upgradepackage|1.1.0" + } + + It "Should contain a summary" { + $Output.String | Should -Match "\d+ packages found." + } + } + + Context "Listing local packages" { + BeforeAll { + $Output = Invoke-Choco $_ --LocalOnly + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should contain packages and version with a space between them" { + $Output.Lines | Should -Contain "upgradepackage 1.0.0" + } + + It "Should not contain pipe-delimited packages and versions" { + $Output.Lines | Should -Not -Contain "upgradepackage|1.0.0" + } + + It "Should contain a summary" { + $Output.String | Should -Match "\d+ packages installed" + } + } + + Context "Listing local packages (limiting output)" { + BeforeAll { + $Output = Invoke-Choco $_ --LocalOnly --LimitOutput + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should not contain packages and version with a space between them" { + $Output.Lines | Should -Not -Contain "upgradepackage 1.0.0" + } + + It "Should contain pipe-delimited packages and versions" { + $Output.Lines | Should -Contain "upgradepackage|1.0.0" + } + + It "Should not contain a summary" { + $Output.String | Should -Not -Match "\d+ packages installed" + } + } + + Context "Listing local packages (limiting output, ID only)" { + BeforeAll { + $Output = Invoke-Choco $_ --LocalOnly --IdOnly + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should contain package name(s)" { + $Output.Lines | Should -Contain "upgradepackage" + } + + It "Should not contain any version numbers" { + $Output.String | Should -Not -Match $VersionRegex + } + } + + Context "Listing packages with no sources enabled" { + BeforeAll { + Disable-ChocolateySource -All + + $Output = Invoke-Choco $_ --LimitOutput + } + + AfterAll { + $null = Invoke-Choco source enable --Name TestSource + $null = Invoke-Choco source enable --Name hermes + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs an appropriate message to indicate the failure to search no sources, and nothing else" { + $Output.String | Should -MatchExactly "^Unable to search for packages when there are no sources enabled for[\r\n]* packages and none were passed as arguments.$" + } + } + + Context "Searching for an exact package" { + BeforeAll { + $Output = Invoke-Choco $_ exactpackage --Exact + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should contain packages and version with a space between them" { + $Output.Lines | Should -Contain "exactpackage 1.0.0" + } + + It "Should not contain packages that don't exactly match" { + $Output.String | Should -Not -Match "exactpackage\.dontfind" + } + + It "Should contain a summary" { + $Output.Lines | Should -Contain "1 packages found." + } + } + + Context "Searching for an exact package with zero results" { + BeforeAll { + $Output = Invoke-Choco $_ exactpackage123 --Exact + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 # This is fine? + } + + It "Should not have any results" { + $Output.String | Should -Not -Match $VersionRegex + } + + It "Should not contain packages that don't exactly match" { + $Output.String | Should -Not -Match "exactpackage\.dontfind" + } + + It "Should contain a summary" { + $Output.Lines | Should -Contain "0 packages found." + } + } + + # Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/530 (NOTE: Proxy bypassing also works on Chocolatey FOSS) + Context "Listing packages on source using proxy and proxy bypass list" -Skip:(!$licensedProxyFixed) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + $null = Invoke-Choco config set --name=proxy --value="https://invalid.chocolatey.org/" + $null = Invoke-Choco config set --name=proxyBypassList --value="hermes.chocolatey.org" + + $Output = Invoke-Choco $_ mvc + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the package <_>" -ForEach @("mvcmusicstore-db 1.2.0"; "mvcmusicstore-web 1.2.0") { + $Output.Lines | Should -Contain $_ + } + + It "Displays amount of packages found" { + $Output.Lines | Should -Contain "2 packages found." + } + } + + # Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/530 (NOTE: Proxy bypassing also works on Chocolatey FOSS) + Context "Listing packages on source using proxy and proxy bypass list on command" -Skip:(!$licensedProxyFixed) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + $null = Invoke-Choco config set --name=proxy --value="https://invalid.chocolatey.org/" + + $Output = Invoke-Choco $_ mvc "--proxy-bypass-list=hermes.chocolatey.org" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the package <_>" -ForEach @("mvcmusicstore-db 1.2.0"; "mvcmusicstore-web 1.2.0") { + $Output.Lines | Should -Contain $_ + } + + It "Displays amount of packages found" { + $Output.Lines | Should -Contain "2 packages found." + } + } + + # Issue: https://github.com/chocolatey/choco/issues/2304 + Context "Listing packages with exact and all version displayed without pre-release argument" -Skip:(-Not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta-233")) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco $_ --exact --all-versions isexactversiondependency + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should list package isexactversiondependency v<_>" -ForEach @("1.0.1"; "1.0.0"; "2.0.0"; "1.1.0") { + $Output.Lines | Should -Contain "isexactversiondependency $_" + } + + It "Should not list package isexactversiondependency v<_>" -ForEach @("1.0.0-beta") { + $Output.Lines | Should -Not -Contain "isexactversiondependency $_" + } + } + + Context "Listing packages with exact, all versions and pre-release arguments" -Skip:(-Not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta-233")) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco $_ --exact --all-versions --prerelease isexactversiondependency + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Should list package isexactversiondependency v<_>" -ForEach @("1.0.1"; "1.0.0"; "2.0.0"; "1.1.0"; "1.0.0-beta") { + $Output.Lines | Should -Contain "isexactversiondependency $_" + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-new.Tests.ps1 b/tests/chocolatey-tests/commands/choco-new.Tests.ps1 new file mode 100644 index 0000000000..a9eb9411d6 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-new.Tests.ps1 @@ -0,0 +1,160 @@ +Import-Module helpers/common-helpers + +$defaultTemplateFiles = @( + "_TODO.txt" + "default-package.nuspec" + "ReadMe.md" + "tools\chocolateyinstall.ps1" + "tools\chocolateybeforemodify.ps1" + "tools\chocolateyuninstall.ps1" + "tools\LICENSE.txt" + "tools\VERIFICATION.txt" +) + +$EmptyFolders = @( + "EmptyFolder1" + "EmptyFolder2\EmptySubFolder" +) +Describe "choco new" -Tag Chocolatey, NewCommand { + BeforeAll { + Initialize-ChocolateyTestInstall + + $expectedHeader = Get-ExpectedChocolateyHeader + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Create new package with default template" { + BeforeAll { + New-ChocolateyInstallSnapshot -SetWorkDir + + $Output = Invoke-Choco new default-package + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays the directory created" { + $Output.Lines | Should -Contain "Creating a new package specification at $PWD\default-package" + } + + It "Displays the file path to <_>" -ForEach $defaultTemplateFiles { + $Output.Lines | Should -Contain "at '$PWD\default-package\$_'" + } + + It "Creates expected file at <_>" -ForEach $defaultTemplateFiles { + "$PWD\default-package\$_" | Should -Exist + } + + It "Do not contain `$uninstalled variable" -Skip:$(-not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta")) { + "$PWD\default-package\tools\chocolateyuninstall.ps1" | Should -Not -FileContentMatch "[$]uninstalled\s*=\s*[$]false" + } + + # Issue: https://github.com/chocolatey/choco/issues/1364 + It "Create nuspec without BOM inserted" -Skip:$(-not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta")) { + $bom = Test-ByteOrderMark -Path "$PWD\default-package\default-package.nuspec" + $bom | Should -BeFalse + } + + It "Creates powershell scripts with UTF-8 BOM" { + $scripts = Get-ChildItem "$PWD\default-package" -Filter "*.ps1" -Recurse + + $scripts | ForEach-Object { + $encoding = Test-ByteOrderMark -Path $_.FullName + + $encoding | Should -Be ([System.Text.Encoding]::UTF8) + } + } + } + + Context "Create new package with default template, specifying as automatic package, custom version, custom maintainer and custom url" { + BeforeAll { + Restore-ChocolateyInstallSnapshot -SetWorkDir + + $Output = Invoke-Choco new override --auto --version=5.2.1 '--maintainer="Test User"' url=https://test-url.com + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Creates metadata with version set as 5.2.1" { + "override\override.nuspec" | Should -FileContentMatchExactly "<version>5\.2\.1</version>" + } + + It "Creates metadata with owners set as Test User" { + "override\override.nuspec" | Should -FileContentMatchExactly "<owners>Test User</owners>" + } + + It "Creates metadata with note about being an automatic package" { + "override\override.nuspec" | Should -FileContentMatchExact "\*\*Please Note\*\*: This is an automatically updated package\." + } + + # The following test is currently being skipped on 0.10.15 due to a bug + # in the program that causes the key-value pairs not being replaced. + It "Creates install script with download url set to https://test-url.com" -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta")) { + "override\tools\chocolateyinstall.ps1" | Should -FileContentMatchExactly "\`$url\s*= 'https://test-url.com'" + } + + Context "Create new package with a custom template" { + BeforeAll { + Restore-ChocolateyInstallSnapshot -SetWorkDir + $null = Invoke-Choco install package.template -y + + $Output = Invoke-Choco new custom-package --template package + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Creates the file or directory <_>" -ForEach @( + "chocolateyinstall.ps1" + "notice.txt" + "tools" # This folder always gets created by Chocolatey + ) { + "custom-package\$_" | Should -Exist + } + + It "Does not create any files in tools folder" { + "custom-package\tools\*" | Should -Not -Exist + } + } + } + + # https://github.com/chocolatey/choco/issues/1003 + Context "Create new package with template containing empty folders" -Foreach @{ EmptyFolders = $EmptyFolders } { + BeforeAll { + New-ChocolateyInstallSnapshot -SetWorkDir + + $null = Invoke-Choco install zip.template + foreach ($Folder in $EmptyFolders) { + New-Item $env:ChocolateyInstall\templates\zip\$Folder -ItemType Directory -Force + } + $Output = Invoke-Choco new emptyfolder --template=zip + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Creates the empty folders expected (<_>)" -ForEach $EmptyFolders { + "$PWD\emptyfolder\$_" | Should -Exist + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-outdated.Tests.ps1 b/tests/chocolatey-tests/commands/choco-outdated.Tests.ps1 new file mode 100644 index 0000000000..982caff380 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-outdated.Tests.ps1 @@ -0,0 +1,44 @@ +Import-Module helpers/common-helpers + +Describe "choco outdated" -Tag Chocolatey, OutdatedCommand { + BeforeAll { + Initialize-ChocolateyTestInstall + # Pin all of the Chocolatey packages + @( + 'chocolatey' + 'chocolatey.extension' + 'chocolatey-agent' + 'chocolatey-management-database' + 'chocolatey-management-service' + 'chocolatey-management-web' + ) | ForEach-Object { + $null = Invoke-Choco pin add -n $_ + } + Invoke-Choco install upgradepackage --version 1.0.0 --confirm + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "outdated ignore-pinned uses correct enhanced exit codes" -Foreach @( + @{ Argument = '' ; ExitCode = 2 } + @{ Argument = '--ignore-pinned' ; ExitCode = 0 } + ) -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.1.0')) { + BeforeAll { + Disable-ChocolateyFeature -Name showNonElevatedWarnings + Enable-ChocolateyFeature -Name allowGlobalConfirmation, useRememberedArgumentsForUpgrades, useEnhancedExitCodes + $null = Invoke-Choco pin add -n upgradepackage + $Output = Invoke-Choco outdated $Argument + } + + It 'Exits with correct exit code (<ExitCode>)' { + $Output.ExitCode | Should -Be $ExitCode -Because $Output.String + } + + It 'Outputs properly' { + $Output.Lines | Should -Not:($ExitCode -eq 0) -Contain 'upgradepackage|1.0.0|1.1.0|true' + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-pack.Tests.ps1 b/tests/chocolatey-tests/commands/choco-pack.Tests.ps1 new file mode 100644 index 0000000000..09cf641cce --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-pack.Tests.ps1 @@ -0,0 +1,370 @@ +Import-Module helpers/common-helpers + +$successPack = @('basic'; 'basic-dependencies'; "cdata"; "full") +# Required elements, that can also not be empty +$missingFailures = @('id'; 'version'; 'authors'; 'description') +# Elements that can not be set to an empty string, but are not required +$emptyFailures = @( + "projectUrl" + "projectSourceUrl" + "docsUrl" + "bugTrackerUrl" + "mailingListUrl" + "iconUrl" + "licenseUrl" +) +# Elements that will return an invalid failure (usually due to serialization) +$invalidFailures = @( + $emptyFailures | ForEach-Object { + @{id = $_; message = "Invalid URI: The format of the URI could not be determined." } + } + @{id = "version"; message = "'INVALID' is not a valid version string." } + @{id = "no-content"; message = "Cannot create a package that has no dependencies nor content." } + @{id = "id"; message = "The package ID 'invalid id' contains invalid characters. Examples of valid package IDs include 'MyPackage' and 'MyPackage.Sample'." } + @{id = "requirelicenseacceptance"; message = "Enabling license acceptance requires a license url." } +) + +Describe "choco pack" -Tag Chocolatey, PackCommand { + BeforeAll { + $testPackageLocation = "$(Get-TempDirectory)ChocolateyTests\packages" + Initialize-ChocolateyTestInstall -Source $testPackageLocation + + Push-Location "$PSScriptRoot\testnuspecs" + $expectedHeader = Get-ExpectedChocolateyHeader + + # NOTE: Only functions that changes any configuration value, + # or state uses the 'Restore-ChocolateyInstallSnapshot' helper. + # In other cases we do not need it, and can do manual + # push/pop. + } + + AfterAll { + # Remove all packaged nupkg files + Get-ChildItem "*.nupkg" -Recurse | ForEach-Object { + Remove-Item $_.FullName + } + + Pop-Location + + Remove-ChocolateyTestInstall + } + + Context "No nuspec file available" { + BeforeAll { + $Output = Invoke-Choco pack + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs Error Message" { + $Output.String | Should -Match "No \.nuspec files \(or more than 1\) were found to build in .*Please specify the \.nuspec file or try in a different directory\." + } + } + + Context "Package <_> metadata in current directory" -ForEach $successPack { + BeforeAll { + Push-Location $_ + $Output = Invoke-Choco pack + Pop-Location + } + + It "'choco pack' exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays created package message" { + $Output.String | Should -Match "Successfully created package.*\.nupkg" + } + + It "Creates nuget package" { + "$_\$_.1.0.0.nupkg" | Should -Exist + } + } + + Context "Package <_> metadata with path" -ForEach $successPack { + BeforeAll { + $Output = Invoke-Choco pack "$_\$_.nuspec" + } + + It "'choco pack' exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays created package message" { + $Output.String | Should -Match "Successfully created package.*\.nupkg" + } + + It "Creates nuget package" { + "$_.1.0.0.nupkg" | Should -Exist + } + } + + Context "Package with required elements" { + BeforeAll { + $Output = Invoke-Choco pack "required.nuspec" + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays required error message for <_>" -ForEach $missingFailures { + $Output.Lines | Should -Contain "$_ is required." + } + + It "Does not create the nuget package" { + "required.1.0.0.nupkg" | Should -Not -Exist + } + } + + Context "Package with empty elements" { + BeforeAll { + $Output = Invoke-Choco pack "empty.nuspec" + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays empty error message for <_>" -ForEach $emptyFailures { + $Output.Lines | Should -Contain "$_ cannot be empty." + } + + It "Does not create the nuget package" { + "empty.1.0.0.nupkg" | Should -Not -Exist + } + } + + # This empty element must be in a seperate nuspec file as it will be a serializing error + Context "Package with empty requireLicenseAcceptance" { + BeforeAll { + $Output = Invoke-Choco pack "empty-requireLicenseAcceptance.nuspec" + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays serialize error" { + $Output.Lines | Should -Contain "The 'http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd:requireLicenseAcceptance' element is invalid - The value '' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:boolean' - The string '' is not a valid Boolean value." + } + + It "Does not create the nuget package" { + "requireLicenseAcceptance.1.0.0.nupkg" | Should -Not -Exist + } + } + + Context "Package with missing elements" { + BeforeAll { + $Output = Invoke-Choco pack "missing.nuspec" + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays possible element message <_>" -ForEach $missingFailures { + $Output.String | Should -Match "The element 'metadata' in namespace.*has incomplete content\..*$_" + } + + It "Does not create the nuget package" { + "missing.1.0.0.nupkg" | Should -Not -Exist + } + } + + Context "Package with invalid <_.id>" -ForEach $invalidFailures { + BeforeAll { + $Output = Invoke-Choco pack "invalid-$($_.id).nuspec" + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays error message '$($_.message)'" { + $Output.Lines | Should -Contain $_.message + } + + It "Does not create the nuget package" { + "invalid-$($_.id).1.0.0.nupkg" | Should -Not -Exist + } + } + + Context "Package with invalid character '&'" { + BeforeAll { + $Output = Invoke-Choco pack "invalid-character-and.nuspec" + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays error message" { + $Output.Lines | Should -Contain "An error occurred while parsing EntityName. Line 8, position 69." + } + + It "Does not create the nuget package" { + "invalid-character-and.1.0.0.nupkg" | Should -Not -Exist + } + } + + Context "Package with invalid character '<'" { + BeforeAll { + $Output = Invoke-Choco pack "invalid-character-lesser.nuspec" + } + + It "'choco pack' exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays error message" { + $Output.Lines | Should -Contain "Name cannot begin with the '.' character, hexadecimal value 0x2E. Line 8, position 69." + } + + It "Does not create the nuget package" { + "invalid-character-lesser.1.0.0.nupkg" | Should -Not -Exist + } + } + + Context "Package with version override" { + BeforeAll { + $Output = Invoke-Choco pack "basic/basic.nuspec" --version="3.0.4" + } + + It "'choco pack' exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays created package message" { + $Output.String | Should -Match "Successfully created package.*\.nupkg" + } + + It "Does create the nuget package" { + "basic.3.0.4.nupkg" | Should -Exist + } + } + + Context "Package with custom space out directory" -ForEach @( + '--out', '--outdir', '--outputdirectory', '--output-directory' + ) { + BeforeAll { + $OutDirectory = "$(Get-TempDirectory)ChocoPackOutput" + if (Test-Path $OutDirectory) { + Remove-Item "$OutDirectory\*.nupkg" -ErrorAction SilentlyContinue + } + else { + New-Item -ItemType Directory -Path $OutDirectory + } + + $Output = Invoke-Choco pack "basic/basic.nuspec" $_ $OutDirectory + } + + It "'choco pack' exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays created package message" { + $Output.Lines | Should -Contain "Successfully created package '$OutDirectory\basic.1.0.0.nupkg'" + } + + It "Does create the nuget package" { + "$OutDirectory\basic.1.0.0.nupkg" | Should -Exist + } + } + + Context "Package with custom equals out directory" -ForEach @( + '--out={0}', '--outdir={0}', '--outputdirectory={0}', '--output-directory={0}' + ) { + BeforeAll { + $OutDirectory = "$(Get-TempDirectory)ChocoPackOutput" + if (Test-Path $OutDirectory) { + Remove-Item "$OutDirectory\*.nupkg" -ErrorAction SilentlyContinue + } + + $Output = Invoke-Choco pack "basic/basic.nuspec" ($_ -f $OutDirectory) + } + + It "'choco pack' exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays Chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays created package message" { + $Output.Lines | Should -Contain "Successfully created package '$OutDirectory\basic.1.0.0.nupkg'" + } + + It "Does create the nuget package" { + "$OutDirectory\basic.1.0.0.nupkg" | Should -Exist + } + } + + # Issue: https://github.com/chocolatey/choco/issues/2166 + Context "Package with forward slash" -Skip:(-Not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta")) { + BeforeAll { + Restore-ChocolateyInstallSnapshot -SetWorkDir + + $Output = Invoke-Choco pack "$PSScriptRoot\testnuspecs\forward-slash\forward-slash.nuspec" "--output-directory=$PWD" + } + + It "Displays created package message" { + $Output.Lines | Should -Contain "Successfully created package '$PWD\forward-slash.1.0.0.nupkg'" + } + + It "Does create the nuget package" { + "$PWD\forward-slash.1.0.0.nupkg" | Should -Exist + } + + It "Extract archive with correct paths" { + # We leave the extraction here, as we test for the existence + # in a previous test, + # otherwise if the extraction fails, so will the previous test + Expand-ZipArchive "$PWD\forward-slash.1.0.0.nupkg" "archiveContents" + "$PWD\archiveContents\tools\purpose.txt" | Should -Exist + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-pin.Tests.ps1 b/tests/chocolatey-tests/commands/choco-pin.Tests.ps1 new file mode 100644 index 0000000000..94dad8eca7 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-pin.Tests.ps1 @@ -0,0 +1,188 @@ +Import-Module helpers/common-helpers + +# https://github.com/chocolatey/choco/blob/master/src/chocolatey.tests.integration/scenarios/PinScenarios.cs + +Describe "choco pin" -Tag Chocolatey, PinCommand { + BeforeAll { + $testPackageLocation = "$(Get-TempDirectory)ChocolateyTests\packages" + Initialize-ChocolateyTestInstall -Source $testPackageLocation + + Invoke-Choco install installpackage --version 1.0.0 -confirm + Invoke-Choco install upgradepackage --version 1.0.0 -confirm + + New-ChocolateyInstallSnapshot + + $listSuffix = "" + if (Test-PackageIsEqualOrHigher "chocolatey.extension" "0.0.0") { + # Licensed edition adds an extra `|` at the end + $listSuffix = "|" + } + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Listing Pins with no Pins" { + BeforeAll { + $Output = Invoke-Choco pin list --limitoutput + } + + It "Exits with ExitCode 0" { + $Output.ExitCode | Should -Be 0 + } + + It "Has no Pins listed" { + $Output.Lines | Should -BeNullOrEmpty + } + } + + Context "Listing Pins with an existing Pin" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco pin add --name upgradepackage + + $Output = Invoke-Choco pin list --limitoutput + } + + It "Exits with ExitCode 0" { + $Output.ExitCode | Should -Be 0 + } + + It "Lists the new Pin" { + $Output.Lines | Should -Contain "upgradepackage|1.0.0$listSuffix" + } + } + + Context "Listing Pins with existing Pins" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco pin add --name upgradepackage + $null = Invoke-Choco pin add --name installpackage + + $Output = Invoke-Choco pin list --limitoutput + } + + It "Exits with ExitCode 0" { + $Output.ExitCode | Should -Be 0 + } + + It "Lists the Pins" { + $Output.Lines | Should -Contain "upgradepackage|1.0.0$listSuffix" + $Output.Lines | Should -Contain "installpackage|1.0.0$listSuffix" + } + } + + Context "Setting a Pin for an installed Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco pin add --name upgradepackage + $CurrentPins = Invoke-Choco pin list --LimitOutput | ForEach-Object Lines + } + + It "Exits with ExitCode 0" { + $Output.ExitCode | Should -Be 0 + } + + It "Sets the Pin" { + $Output.Lines | Should -Contain "Successfully added a pin for upgradepackage v1.0.0." + $CurrentPins | Should -Contain "upgradepackage|1.0.0$listSuffix" + } + } + + Context "Setting a Pin for an already pinned Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco pin add --name upgradepackage + + $Output = Invoke-Choco pin add --name upgradepackage + $CurrentPins = Invoke-Choco pin list --LimitOutput | ForEach-Object Lines + } + + It "Exits with ExitCode 0" { + $Output.ExitCode | Should -Be 0 + } + + It "Changes Nothing" { + $Output.Lines | Should -Contain "Nothing to change. Pin already set or removed." + $CurrentPins | Should -Contain "upgradepackage|1.0.0$listSuffix" + } + } + + Context "Setting a Pin for a non-installed Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco pin add --name whatisthis + $CurrentPins = Invoke-Choco pin list --LimitOutput | ForEach-Object Lines + } + + It "Exits with ExitCode 1" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs a message indicating the failure" { + $Output.Lines | Should -Contain "Unable to find package named 'whatisthis' to pin. Please check to ensure it is installed." + } + + It "Hasn't pinned the package" { + $CurrentPins | Should -Not -Match "whatisthis" + } + } + + Context "Removing a Pin for a pinned Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco pin add --name upgradepackage + + $Output = Invoke-Choco pin remove --name upgradepackage + $CurrentPins = Invoke-Choco pin list --LimitOutput | ForEach-Object Lines + } + + It "Exits with ExitCode 0" { + $Output.ExitCode | Should -Be 0 + } + + It "Removed the Pin" { + $Output.Lines | Should -Contain "Successfully removed a pin for upgradepackage v1.0.0." + $CurrentPins | Should -Not -Match "^upgradepackage" + } + } + + Context "Removing a Pin for an unpinned Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco pin remove --name upgradepackage + } + + It "Exits with ExitCode 0" { + $Output.ExitCode | Should -Be 0 + } + + It "Changes Nothing" { + $Output.Lines | Should -Contain "Nothing to change. Pin already set or removed." + } + } + + Context "Removing a Pin for a non-installed Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Output = Invoke-Choco pin remove -n whatisthis + } + + It "Exits with ExitCode 1" { + $Output.ExitCode | Should -Be 1 + } + + It "Outputs a message indicating the failure" { + $Output.Lines | Should -Contain "Unable to find package named 'whatisthis' to pin. Please check to ensure it is installed." + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-push.Tests.ps1 b/tests/chocolatey-tests/commands/choco-push.Tests.ps1 new file mode 100644 index 0000000000..b2f39a1803 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-push.Tests.ps1 @@ -0,0 +1,125 @@ +Import-Module helpers/common-helpers + +Describe "choco push" -Tag Chocolatey, PushCommand -Skip:($null -eq $env:API_KEY) { + BeforeDiscovery { + $isLicensed30OrMissingVersion = Test-PackageIsEqualOrHigher 'chocolatey.extension' '3.0.0-beta' -AllowMissingPackage + $licensedProxyFixed = Test-PackageIsEqualOrHigher 'chocolatey.extension' 2.2.0-beta -AllowMissingPackage + # The destination alias was implemented in Chocolatey v0.10.16/0.11.0, + # but was not implemenented in Chocolatey Licensed at the time. + # Implementation in Chocolatey Licensed is scheduled for v3.0.0. + $destinationAliasAvailable = $isLicensed30OrMissingVersion -and (Test-ChocolateyVersionEqualOrHigherThan '0.10.16-beta') + $hasBeforeInstallBlock = $isLicensed30OrMissingVersion -and (Test-ChocolateyVersionEqualOrHigherThan '0.11.0') + } + + BeforeAll { + # Ideally this comes from an environment variable, but that's proving harder to put into the tests than is desired. + $ApiKey = $env:API_KEY + # Using Chocolatey Community Repository for pushing as choco-test could be blown away at any time, and we'd have to reset up the user and packages. + $RepositoryToUse = if ($env:PUSH_REPO) { + $env:PUSH_REPO + } + else { + "https://push.chocolatey.org" + } + Initialize-ChocolateyTestInstall + + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Pushing package version that already exists" { + BeforeAll { + $snapshotPath = New-ChocolateyInstallSnapshot + + $PackageUnderTest = "chocolatey-dummy-package" + $VersionUnderTest = "1.0.0" + + $NewChocolateyTestPackage = @{ + TestPath = "$PSScriptRoot\testpackages" + Name = $PackageUnderTest + Version = $VersionUnderTest + } + New-ChocolateyTestPackage @NewChocolateyTestPackage + + $PackagePath = "$($snapshotPath.PackagesPath)\$PackageUnderTest.$VersionUnderTest.nupkg" + + $Output = Invoke-Choco push $PackagePath --source $RepositoryToUse --api-key $ApiKey + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Should Report the actual cause of the error" { + $Output.Lines | Should -Contain "Attempting to push $PackageUnderTest.$VersionUnderTest.nupkg to $RepositoryToUse" + $Output.Lines | Should -Contain "An error has occurred. It's possible the package version already exists on the repository or a nuspec element is invalid. See error below..." + $Output.String | Should -Match "Failed to process request. '" + $Output.Lines | Should -Contain "The remote server returned an error: (409) Conflict.." + } + } + + Context "Pushing package description more than 4000 characters" { + BeforeAll { + $snapshotPath = New-ChocolateyInstallSnapshot + + $PackageUnderTest = "too-long-description" + $VersionUnderTest = "1.0.0" + + $NewChocolateyTestPackage = @{ + TestPath = "$PSScriptRoot\testpackages" + Name = $PackageUnderTest + Version = $VersionUnderTest + } + New-ChocolateyTestPackage @NewChocolateyTestPackage + + $PackagePath = "$($snapshotPath.PackagesPath)\$PackageUnderTest.$VersionUnderTest.nupkg" + + $Output = Invoke-Choco push $PackagePath --source $RepositoryToUse --api-key $ApiKey + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Should Report the actual cause of the error" { + $Output.Lines | Should -Contain "Attempting to push $PackageUnderTest.$VersionUnderTest.nupkg to $RepositoryToUse" + $Output.Lines | Should -Contain "An error has occurred. It's possible the package version already exists on the repository or a nuspec element is invalid. See error below..." + $Output.String | Should -Match "Failed to process request. '" + $Output.Lines | Should -Contain "The remote server returned an error: (409) Conflict.." + } + } + + Context "Pushing package title more than 256 characters" { + BeforeAll { + $snapshotPath = New-ChocolateyInstallSnapshot + + $PackageUnderTest = "too-long-title" + $VersionUnderTest = "1.0.0" + + $NewChocolateyTestPackage = @{ + TestPath = "$PSScriptRoot\testpackages" + Name = $PackageUnderTest + Version = $VersionUnderTest + } + New-ChocolateyTestPackage @NewChocolateyTestPackage + + $PackagePath = "$($snapshotPath.PackagesPath)\$PackageUnderTest.$VersionUnderTest.nupkg" + + $Output = Invoke-Choco push $PackagePath --source $RepositoryToUse --api-key $ApiKey + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Should Report the actual cause of the error" { + $Output.Lines | Should -Contain "Attempting to push $PackageUnderTest.$VersionUnderTest.nupkg to $RepositoryToUse" + $Output.Lines | Should -Contain "An error has occurred. It's possible the package version already exists on the repository or a nuspec element is invalid. See error below..." + $Output.String | Should -Match "Failed to process request. '" + $Output.Lines | Should -Contain "The remote server returned an error: (409) Conflict.." + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-removed.Tests.ps1 b/tests/chocolatey-tests/commands/choco-removed.Tests.ps1 new file mode 100644 index 0000000000..1a05b06f4f --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-removed.Tests.ps1 @@ -0,0 +1,101 @@ +Import-Module helpers/common-helpers + +Describe "Ensuring removed things are removed" -Tag Removed, Chocolatey { + BeforeAll { + Initialize-ChocolateyTestInstall + # Ensure that we do not have any compatibility layer package installed + $null = Invoke-Choco uninstall chocolatey-compatibility.extension -y --force + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context 'Helper function (<FunctionName>)' -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0')) -Foreach @( + @{ FunctionName = 'Write-FileUpdateLog' } + @{ FunctionName = 'Write-ChocolateySuccess' } + @{ FunctionName = 'Write-ChocolateyFailure' } + @{ FunctionName = 'Install-ChocolateyDesktopLink' } + ) { + BeforeAll { + $TestScript = @' +$packageName = $env:ChocolateyPackageName +Write-Host "Checking for command $packageName" +$command = Get-Command $packageName -All +Write-Host "Found: $($command.Count)" +exit $command.Count +'@ + $snapshotPath = New-ChocolateyInstallSnapshot + Push-Location $snapshotPath.PackagesPath + $null = Invoke-Choco new "$FunctionName" --version 1.0.0 + $TestScript > $FunctionName/tools/chocolateyInstall.ps1 + $null = Invoke-Choco pack "$FunctionName/$FunctionName.nuspec" + $Output = Invoke-Choco install "$FunctionName" --source $snapshotPath.PackagesPath + Pop-Location + } + + It 'Exits with Success (0)' { + $Output.ExitCode | Should -Be 0 + } + + It 'Reports the correct command name' { + $Output.Lines | Should -Contain "Checking for command $FunctionName" -Because "Expected output to contain information: $($Output.String)" + } + + It 'Reports the correct number found (0)' { + $Output.Lines | Should -Contain "Found: 0" -Because "Expected output to contain information: $($Output.String)" + } + } + + Context 'Ensure -t removed from push commands help message' -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0')) { + BeforeAll { + $Output = Invoke-Choco push -? + } + + It 'No longer reports the -t flag' { + $Output.Lines | Should -Not -Contain '\s-t=VALUE' + } + } + + Context 'Ensure choco push apikey fallback removal' -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0')) { + BeforeAll { + $null = Invoke-Choco new testPackage --version 1.0.0 + $null = Invoke-Choco pack testPackage/testPackage.nuspec + $null = Invoke-Choco apikey add -s https://chocolatey.org -k None + $Output = Invoke-Choco push ./testPackage.1.0.0.nupkg + } + + It 'Exits with Failure (1)' { + $Output.ExitCode | Should -Be 1 + } + + It 'Reports missing API key' { + $Output.Lines | Should -Contain "An ApiKey was not found for 'https://push.chocolatey.org/'. You must either set an api key in the configuration or specify one with --api-key." + } + } + + Context 'Ensure <Command> removed from Chocolatey' -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0')) -Foreach @( + @{ Command = 'update' } + @{ Command = 'version' } + ) { + BeforeAll { + $Output = Invoke-Choco $Command + } + + It 'Exits with Failure (1)' { + $Output.ExitCode | Should -Be 1 + } + + It "Reports that the command doesn't exist" { + $Output.Lines | Should -Contain "Could not find a command registered that meets '$Command'." + } + } + + It 'Does not have shim (<Name>) created' -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.0.0')) -ForEach @( + @{ Name = 'cver' } + @{ Name = 'cpack' } + ) { + Get-ChildItem -Path $env:ChocolateyInstall -Name "$Name.exe" -Recurse -ErrorAction SilentlyContinue | Should -HaveCount 0 + } +} diff --git a/tests/chocolatey-tests/commands/choco-source.Tests.ps1 b/tests/chocolatey-tests/commands/choco-source.Tests.ps1 new file mode 100644 index 0000000000..e08183a04a --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-source.Tests.ps1 @@ -0,0 +1,428 @@ +param( + # The command to test. + [string[]]$Command = @( + "source" + "sources" + ) +) + +Import-Module helpers/common-helpers + +Describe "choco <_>" -ForEach $Command -Tag Chocolatey, SourceCommand { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + + $CurrentCommand = $_ + $expectedHeader = Get-ExpectedChocolateyHeader + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Add single unauthenticated source" -ForEach @( + @{ + SourceName = "dummy-long" + Name = "--name" + Source = "--source" + } + @{ + SourceName = "dummy-short" + Name = "-n" + Source = "-s" + } + ) { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand add $_.Name $_.SourceName $_.Source "https://test.com/api" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source added" { + $Output.Lines | Should -Contain "Added $($_.SourceName) - https://test.com/api (Priority 0)" + } + + It "Updates configuration with source" { + $sourceName = $_.SourceName + $config = $sources.Where{ $_.id -eq $sourceName } + $config | Should -HaveCount 1 + $config.id | Should -Be $sourceName + $config.value | Should -Be "https://test.com/api" + $config.disabled | Should -Be "false" # We can not use ps $false here + $config.bypassProxy | Should -Be "false" + $config.adminOnly | Should -Be "false" + $config.priority | Should -Be 0 + $config.user | Should -BeNullOrEmpty + } + } + + Context "Add single unauthenticated source with priority" { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand add --name "dummy-long" --source "https://priority.test.com/api" --priority 1 + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source added" { + $Output.Lines | Should -Contain "Updated dummy-long - https://priority.test.com/api (Priority 1)" + } + + It "Updates configuration with source" { + $config = $sources.Where{ $_.id -eq "dummy-long" } + $config | Should -HaveCount 1 + $config.id | Should -Be "dummy-long" + $config.value | Should -Be "https://priority.test.com/api" + $config.disabled | Should -Be "false" # We can not use ps $false here + $config.bypassProxy | Should -Be "false" + $config.adminOnly | Should -Be "false" + $config.priority | Should -Be 1 + $config.user | Should -BeNullOrEmpty + } + } + + Context "Add single authenticated source with user+pass" -ForEach @( + @{ + SourceName = "dummy-auth-long" + User = "--user" + Pass = "--password" + } + @{ + SourceName = "dummy-auth-short" + User = "-u" + Pass = "-p" + } + ) { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand add --name $_.SourceName --source "https://auth.test.com/api" $_.User "test-kitchen" $_.Pass "dummy-password" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source added" { + $Output.Lines | Should -Contain "Added $($_.SourceName) - https://auth.test.com/api (Priority 0)" + } + + It "Updates configuration with source" { + $sourceName = $_.SourceName + $config = $sources.Where{ $_.id -eq $sourceName } + $config | Should -HaveCount 1 + $config.id | Should -Be $sourceName + $config.value | Should -Be "https://auth.test.com/api" + $config.disabled | Should -Be "false" # We can not use ps $false here + $config.bypassProxy | Should -Be "false" + $config.adminOnly | Should -Be "false" + $config.priority | Should -Be 0 + $config.user | Should -Be "test-kitchen" + $config.password | Should -Not -BeNullOrEmpty # Value is encoded + } + } + + Context "Add single authenticated source with certificate" -ForEach @( + @{ + SourceName = "dummy-cert-auth-long" + Cert = "--cert" + Pass = "--certpassword" + } + @{ + SourceName = "dummy-cert-auth-short" + Cert = "--cert" + Pass = "--cp" + } + ) { + BeforeAll { + $CertPath = "$PSScriptRoot\TestCertificate.pfx" + $Output = Invoke-Choco $CurrentCommand add --name $_.SourceName --source "https://auth.test.com/api" $_.Cert "`"$CertPath`"" $_.Pass "TestPassword" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source added" { + $Output.Lines | Should -Contain "Added $($_.SourceName) - https://auth.test.com/api (Priority 0)" + } + + It "Updates configuration with source" { + $sourceName = $_.SourceName + $config = $sources.Where{ $_.id -eq $sourceName } + $config | Should -HaveCount 1 + $config.id | Should -Be $sourceName + $config.value | Should -Be "https://auth.test.com/api" + $config.disabled | Should -Be "false" # We can not use ps $false here + $config.bypassProxy | Should -Be "false" + $config.adminOnly | Should -Be "false" + $config.priority | Should -Be 0 + $config.user | Should -BeNullOrEmpty "test-kitchen" + $config.password | Should -BeNullOrEmpty + $config.certificate | Should -Be $CertPath + $config.certificatePassword | Should -Not -BeNullOrEmpty # Value is encoded + } + } + + Context "Removing named source" { + BeforeAll { + Invoke-Choco $CurrentCommand add --name "dummy-removal" --source "https://test.com/api" + + $Output = Invoke-Choco $CurrentCommand remove --name "dummy-removal" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source removed" { + $Output.Lines | Should -Contain "Removed dummy-removal" + } + + It "Removes source from configuration" { + $config = $sources.Where{ $_.id -eq "dummy-removal" } + $config | Should -BeNullOrEmpty + } + } + + Context "Add local directory source" { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand add --name "dummy-local" --source "C:\packages" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source added" { + $Output.Lines | Should -Contain "Added dummy-local - C:\packages (Priority 0)" + } + + It "Updates configuration with source" { + $config = $sources.Where{ $_.id -eq "dummy-local" } + $config | Should -HaveCount 1 + $config.id | Should -Be "dummy-local" + $config.value | Should -Be "C:\packages" + $config.disabled | Should -Be "false" # We can not use ps $false here + $config.bypassProxy | Should -Be "false" + $config.adminOnly | Should -Be "false" + $config.priority | Should -Be 0 + $config.user | Should -BeNullOrEmpty + $config.password | Should -BeNullOrEmpty + } + } + + Context "Adding source with invalid argument" { + BeforeAll { + $Output = Invoke-Choco $CurrentCommand add --name "dummy-invalid" --source "C:\packages" --user "test-kitchen" --pass "no matter" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source added" { + $Output.Lines | Should -Contain "A single sources command must be listed. Please see the help menu for those commands" + } + } + + Context "Lists configured sources" { + BeforeAll { + # Prepare by ensuring some sources are added + Invoke-Choco $CurrentCommand add --name "dummy-remote" --source "https://remote.test.com/api" + Invoke-Choco $CurrentCommand add --name "dummy-local" --source "C:\packages\Local" + Invoke-Choco $CurrentCommand add --name "dummy-auth" --source "https://auth.test.com/api" --user "test-kitchen" --password "test-password" + Invoke-Choco $CurrentCommand add --name "dummy-priority" --source "https://pri.test.com/api" --priority 5 + + $Output = Invoke-Choco $CurrentCommand list + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays expected sources" { + $Output.Lines | Should -Contain "dummy-remote - https://remote.test.com/api | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False." + $Output.Lines | Should -Contain "dummy-local - C:\packages\Local | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False." + $Output.Lines | Should -Contain "dummy-auth - https://auth.test.com/api (Authenticated)| Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False." + $Output.Lines | Should -Contain "dummy-priority - https://pri.test.com/api | Priority 5|Bypass Proxy - False|Self-Service - False|Admin Only - False." + } + } + + Context "Removing missing source" { + BeforeAll { + # Make sure the source is removed + Invoke-Choco $CurrentCommand remove --name "not-existing" + + $Output = Invoke-Choco $CurrentCommand remove --name "not-existing" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays message about no change made" { + $Output.Lines | Should -Contain "Nothing to change. Config already set." + } + } + + Context "Disabling existing source" { + BeforeAll { + # Ensure source is enabled + Invoke-Choco $CurrentCommand enable --name "chocolatey" + + $Output = Invoke-Choco $CurrentCommand disable --name "chocolatey" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source disabled" { + $Output.Lines | Should -Contain "Disabled chocolatey" + } + + It "Updates configuration with source" { + $config = $sources.Where{ $_.id -eq "chocolatey" } + $config | Should -HaveCount 1 + $config.id | Should -Be "chocolatey" + $config.disabled | Should -Be "true" # We can not use ps $false here + } + } + + Context "Enabling existing source" { + BeforeAll { + # Ensure source is disabled + Invoke-Choco $CurrentCommand disable --name "chocolatey" + + $Output = Invoke-Choco $CurrentCommand enable --name "chocolatey" + + [xml]$ConfigFileContent = Get-Content $env:ChocolateyInstall\config\chocolatey.config + $sources = @($ConfigFileContent.chocolatey.sources.source) + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays source enabled" { + $Output.Lines | Should -Contain "Enabled chocolatey" + } + + It "Updates configuration with source" { + $config = $sources.Where{ $_.id -eq "chocolatey" } + $config | Should -HaveCount 1 + $config.id | Should -Be "chocolatey" + $config.disabled | Should -Be "false" # We can not use ps $false here + } + } + + Context "Disabling missing source" { + BeforeAll { + # Ensure source is not available + Invoke-Choco $CurrentCommand remove --name "not-existing" + + $Output = Invoke-Choco $CurrentCommand disable --name "not-existing" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays no change made" { + $Output.Lines | Should -Contain "Nothing to change. Config already set." + } + } + + Context "Enabling missing source" { + BeforeAll { + # Ensure source is not available + Invoke-Choco $CurrentCommand remove --name "not-existing" + + $Output = Invoke-Choco $CurrentCommand enable --name "not-existing" + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays chocolatey name with version" { + $Output.Lines | Should -Contain $expectedHeader + } + + It "Displays no change made" { + $Output.Lines | Should -Contain "Nothing to change. Config already set." + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-template.Tests.ps1 b/tests/chocolatey-tests/commands/choco-template.Tests.ps1 new file mode 100644 index 0000000000..b699fea6fc --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-template.Tests.ps1 @@ -0,0 +1,299 @@ +Import-Module helpers/common-helpers + +Describe "choco <_>" -ForEach @( + "template" + "templates" +) -Tag Chocolatey, TemplateCommand { + BeforeDiscovery { + + } + + BeforeAll { + Initialize-ChocolateyTestInstall + + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Running without subcommand specified" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $Output = Invoke-Choco $_ + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the templates expected" { + $Output.Lines | Should -Contain 'msi 1.0.2' + $Output.Lines | Should -Contain 'zip 1.0.0' + } + + It "Displays how many custom templates are available" { + $Output.Lines | Should -Contain "2 Custom templates found at $env:ChocolateyInstall\templates" + } + } + + Context "Running with list subcommand" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $Output = Invoke-Choco $_ list + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the templates expected" { + $Output.Lines | Should -Contain 'msi 1.0.2' + $Output.Lines | Should -Contain 'zip 1.0.0' + } + + It "Displays how many custom templates are available" { + $Output.Lines | Should -Contain "2 Custom templates found at $env:ChocolateyInstall\templates" + } + } + + Context "Running with info subcommand specified with no additional parameters" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $Output = Invoke-Choco $_ info + } + + It "Exits with Failure (1)" { + $Output.ExitCode | Should -Be 1 + } + + It "Displays error with correct format" { + $Output.Lines | Should -Contain "When specifying the subcommand 'info', you must also specify --name." + } + } + + Context "Running with info subcommand specified with --name parameters" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $Output = Invoke-Choco $_ info --name msi + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays template information" { + $Output.Lines | Should -Contain "Template name: msi" + $Output.Lines | Should -Contain "Version: 1.0.2" + $Output.Lines | Should -Contain "Default template: False" + $Output.Lines | Should -Contain "Summary: MSI Chocolatey template" + $Output.Lines | Should -Contain "### Chocolatey MSI template" + $Output.Lines | Should -Contain "This adds a template for MSI packages." + $Output.Lines | Should -Contain "List of files:" + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\msi\msi.nuspec" + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\msi\ReadMe.md" + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\msi\tools\chocolateybeforemodify.ps1" + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\msi\tools\chocolateyinstall.ps1" + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\msi\tools\chocolateyuninstall.ps1" + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\msi\tools\LICENSE.txt" + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\msi\tools\VERIFICATION.txt" + } + + It "Displays section of parameters" { + $Output.Lines | Should -Contain 'List of Parameters:' + } + + It "Displays parameter name <_>" -Foreach @('PackageNameLower'; 'PackageVersion'; 'MaintainerRepo'; 'MaintainerName'; 'PackageName'; 'AutomaticPackageNotesNuspec'; 'AutomaticPackageNotesInstaller'; 'Url'; 'Url64'; 'Checksum'; 'Checksum64'; 'SilentArgs') { + $Output.Lines | Should -Contain $_ + } + + It "Created parameters file for msi" { + "$env:ChocolateyInstall\templates\msi\.parameters" | Should -Exist + } + + It "Does not create parameters file for zip" { + "$env:ChocolateyInstall\templates\zip\.parameters" | Should -Not -Exist + } + } + + Context "Running with no subcommand specified with --name parameter" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $Output = Invoke-Choco $_ --name msi + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays template name and version" { + $Output.Lines | Should -Contain "msi 1.0.2" + } + } + + Context "Running without subcommand specified after default template name is specified" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $null = Invoke-Choco config set defaultTemplateName zip + + $Output = Invoke-Choco $_ + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the templates marking the default as expected" { + $Output.Lines | Should -Contain '* zip 1.0.0' + $Output.Lines | Should -Contain 'Built-in template is not default, it can be specified if the --built-in parameter is used' + } + + It "Displays how many custom templates are available" { + $Output.Lines | Should -Contain "2 Custom templates found at $env:ChocolateyInstall\templates" + } + } + + Context "Running without subcommand specified after an invalid default template name is specified" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $null = Invoke-Choco config set defaultTemplateName zp + + $Output = Invoke-Choco $_ + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays the templates marking the default as expected" { + $Output.Lines | Should -Contain 'zip 1.0.0' + $Output.Lines | Should -Contain 'Built-in template is default.' + } + + It "Displays how many custom templates are available" { + $Output.Lines | Should -Contain "2 Custom templates found at $env:ChocolateyInstall\templates" + } + } + + Context 'Running <_> with verbose argument' { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Invoke-Choco install msi.template zip.template + + $Output = Invoke-Choco $_ --verbose + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Displays <Name> template information" -ForEach @( + @{ + Name = 'msi' + Lines = @( + 'Template name: msi' + 'Version: 1.0.2' + 'Default template: False' + 'Summary: MSI Chocolatey template' + '### Chocolatey MSI template' + 'This adds a template for MSI packages.' + 'List of files:' + ) + } + @{ + Name = 'zip' + Lines = @( + 'Template name: zip' + 'Version: 1.0.0' + 'Default template: False' + 'Summary: Zip Chocolatey template' + '### Chocolatey Zip template' + 'This adds a template for archive (zipped) packages.' + 'List of files:' + ) + } + ) { + $Lines | ForEach-Object { + $Output.Lines | Should -Contain $_ -Because $Output.String + } + } + + It "Displays <Name> template information for files" -Foreach @( + @{ + Name = 'msi' + Files = @( + 'msi\msi.nuspec' + 'msi\ReadMe.md' + 'msi\tools\chocolateybeforemodify.ps1' + 'msi\tools\chocolateyinstall.ps1' + 'msi\tools\chocolateyuninstall.ps1' + 'msi\tools\LICENSE.txt' + 'msi\tools\VERIFICATION.txt' + ) + } + @{ + Name = 'zip' + Files = @( + 'zip\zip.nuspec' + 'zip\ReadMe.md' + 'zip\tools\chocolateybeforemodify.ps1' + 'zip\tools\chocolateyinstall.ps1' + 'zip\tools\LICENSE.txt' + 'zip\tools\VERIFICATION.txt' + ) + } + ) { + $Files | ForEach-Object { + $Output.Lines | Should -Contain "$env:ChocolateyInstall\templates\$_" -Because $Output.String + } + } + + It "Displays how many custom templates are available" { + $Output.Lines | Should -Contain "2 Custom templates found at $env:ChocolateyInstall\templates" + } + + It "Displays section of parameters" { + $items = $Output.Lines | Where-Object { $_ -eq 'List of Parameters:' } + $items | Should -HaveCount 2 -Because $Output.String + } + + It "Displays parameter name <_>" -Foreach @('PackageNameLower'; 'PackageVersion'; 'MaintainerRepo'; 'MaintainerName'; 'PackageName'; 'AutomaticPackageNotesNuspec'; 'AutomaticPackageNotesInstaller'; 'Url'; 'Url64'; 'Checksum'; 'Checksum64') { + $parameter = $_ + $items = $Output.Lines | Where-Object { $_ -eq $parameter } + $items | Should -HaveCount 2 -Because $Output.String + } + + It "Displays parameter name <_>" -Foreach @('SilentArgs') { + $parameter = $_ + $items = $Output.Lines | Where-Object { $_ -eq $parameter } + $items | Should -HaveCount 1 -Because $Output.String + } + + It "Created parameters file for <_>" -Foreach @('msi', 'zip') { + "$env:ChocolateyInstall\templates\$_\.parameters" | Should -Exist + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 b/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 new file mode 100644 index 0000000000..218db2401c --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-uninstall.Tests.ps1 @@ -0,0 +1,68 @@ +Import-Module helpers/common-helpers + +Describe "choco uninstall" -Tag Chocolatey, UninstallCommand { + BeforeAll { + Initialize-ChocolateyTestInstall + + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Uninstalling a side-by-side Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco upgrade $PackageUnderTest --confirm --allowmultipleversions + + $Output = Invoke-Choco uninstall $PackageUnderTest --confirm + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Removed a package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Not -Exist + "$env:ChocolateyInstall\lib-bad\$($PackageUnderTest).1.0.0" | Should -Not -Exist + } + + It "Outputs a warning message that installed side by side package is deprecated" { + $Output.Lines | Should -Contain "$PackageUnderTest has been installed as a side by side installation." -Because $Output.String + $Output.Lines | Should -Contain "Side by side installations are deprecated and is pending removal in v2.0.0." -Because $Output.String + } + + It "Outputs a message indicating that it uninstalled the package successfully" { + $Output.Lines | Should -Contain "Chocolatey uninstalled 1/1 packages." -Because $Output.String + } + } + + Context "Uninstalling package that makes use of new Get Chocolatey Path helper" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + Enable-ChocolateySource -Name 'local' + + $null = Invoke-Choco install test-chocolateypath -y + + $Output = Invoke-Choco uninstall test-chocolateypath -y + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 -Because $Output.String + } + + It "Outputs message <_>" -ForEach @( + 'Package Path in Before Modify Script: <installPath>\lib\test-chocolateypath' + 'Install Path in Before Modify Script: <installPath>' + 'Package Path in Uninstall Script: <installPath>\lib\test-chocolateypath' + 'Install Path in Uninstall Script: <installPath>' + ) { + $Output.Lines | Should -Contain ($_ -replace '<installPath>',$env:ChocolateyInstall) -Because $Output.String + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 b/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 new file mode 100644 index 0000000000..593c1fdee2 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-upgrade.Tests.ps1 @@ -0,0 +1,237 @@ +Import-Module helpers/common-helpers + +Describe "choco upgrade" -Tag Chocolatey, UpgradeCommand { + BeforeAll { + Initialize-ChocolateyTestInstall + + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Upgrading a side-by-side Package (non-existing)" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $Output = Invoke-Choco upgrade $PackageUnderTest --confirm --allowmultipleversions + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed a package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a warning message about side by side installs are deprecated" { + $Output.Lines | Should -Contain "Upgrading the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String + } + + It "Outputs a message indicating that it upgraded the package successfully" { + $Output.Lines | Should -Contain "Chocolatey upgraded 1/1 packages." -Because $Output.String + } + } + + Context "Switching a normal Package to a side-by-side Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco install $PackageUnderTest --confirm + + $Output = Invoke-Choco upgrade $PackageUnderTest --confirm --force --allowmultipleversions + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0" | Should -Exist + } + + It "Removed the previous version of the package from the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Not -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest).1.0.0\$($PackageUnderTest).1.0.0.nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Outputs a warning message about side by side installs are deprecated" { + $Output.Lines | Should -Contain "Upgrading the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String + } + + It "Outputs a message indicating that it upgraded the package successfully" { + $Output.Lines | Should -Contain "Chocolatey upgraded 1/1 packages." -Because $Output.String + } + } + + Context "Switching a side-by-side Package to a normal Package" { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $PackageUnderTest = "installpackage" + + $null = Invoke-Choco install $PackageUnderTest --confirm --allowmultipleversion + + $Output = Invoke-Choco upgrade $PackageUnderTest --confirm --force + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Installed the package to the lib directory" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)" | Should -Exist + } + + It "Installs the expected version of the package" { + "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" | Should -Exist + [xml]$XML = Get-Content "$env:ChocolateyInstall\lib\$($PackageUnderTest)\$($PackageUnderTest).nuspec" + $XML.package.metadata.version | Should -Be "1.0.0" + } + + It "Does not output a warning message about side by side installs are deprecated" { + $Output.Lines | Should -Not -Contain "Upgrading the same package with multiple versions is deprecated and will be removed in v2.0.0." -Because $Output.String + } + + It "Does not output a warning message that installed side by side package is deprecated" { + $Output.Lines | Should -Not -Contain "installpackage has been installed as a side by side installation." -Because $Output.String + $Output.Lines | Should -Not -Contain "Side by side installations are deprecated and is pending removal in v2.0.0." -Because $Output.String + } + + It "Outputs a message indicating that it upgraded the package successfully" { + $Output.Lines | Should -Contain "Chocolatey upgraded 1/1 packages." -Because $Output.String + } + } + + Context "Upgrade package with (<Command>) specified" -ForEach @( + @{ Command = '--pin' ; Contains = $true } + @{ Command = '' ; Contains = $false } + ) { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $Package = 'upgradepackage' + $null = Invoke-Choco install $Package --version 1.0.0 --confirm + $null = Invoke-Choco upgrade $Package $Command --confirm + $Output = Invoke-Choco pin list + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Output should include pinned package" { + if ($Contains) { + $Output.String | Should -Match "$Package|1.1.0" + } + else { + $Output.String | Should -Not -Match "$Package|1.1.0" + } + } + } + + Context "Upgrading packages while remembering arguments with only one package using arguments" -Tag Internal { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Enable-ChocolateyFeature useRememberedArgumentsForUpgrades + $null = Invoke-Choco install curl --package-parameters="'/CurlOnlyParam'" --version="7.77.0" --ia="'/CurlIAParam'" --x86 -y + $null = Invoke-Choco install wget --version=1.21.1 -y + + $Output = Invoke-Choco upgrade all -y --debug + } + + It 'Exits with Success (0)' { + $Output.ExitCode | Should -Be 0 + } + + It 'Outputs running curl script with correct arguments' { + $line = $Output.Lines | Where-Object { $_ -match "packageScript.*curl\\tools" } | Select-Object -Last 1 + + $line | Should -Not -BeNullOrEmpty + $line | Should -MatchExactly "\/CurlIAParam" + $line | Should -MatchExactly "\/CurlOnlyParam" + $line | Should -Match "-forceX86" + } + + It 'Outputs running wget script with correct arguments' { + $line = $Output.Lines | Where-Object { $_ -match "packageScript.*wget\\tools" } + + $line | Should -Not -BeNullOrEmpty + $line | Should -Match "installArguments:? ''" + $line | Should -Match "packageParameters:? ''" + $line | Should -Not -Match "-forceX86" + } + } + + # We exclude this test when running CCM, as it will install and remove + # the firefox package which is used through other tests that will be affected. + Context "Upgrading packages while remembering arguments with multiple packages using arguments" -Tag CCMExcluded, Internal, VMOnly { + BeforeAll { + Restore-ChocolateyInstallSnapshot + + $null = Enable-ChocolateyFeature useRememberedArgumentsForUpgrades + $null = Invoke-Choco install curl --package-parameters="'/CurlOnlyParam'" --version="7.77.0" --ia="'/CurlIAParam'" --forcex86 -y + $null = Invoke-Choco install wget --version=1.21.1 -y --forcex86 + $null = Invoke-Choco install firefox --version=99.0.1 --package-parameters="'/l=eu'" -y --ia="'/RemoveDistributionDir=true'" + + $Output = Invoke-Choco upgrade all -y --debug + } + + AfterAll { + $null = Invoke-Choco uninstall firefox -y + } + + It 'Exits with Success (0)' { + $Output.ExitCode | Should -Be 0 + } + + It 'Outputs running curl script with correct arguments' { + $line = $Output.Lines | Where-Object { $_ -match "packageScript.*curl\\tools" } | Select-Object -Last 1 + + $line | Should -Not -BeNullOrEmpty + $line | Should -Match "installArguments:? '/CurlIAParam'" + $line | Should -Match "packageParameters:? '/CurlOnlyParam'" + $line | Should -Match "-forceX86" + } + + It 'Outputs running wget script with correct arguments' { + $line = $Output.Lines | Where-Object { $_ -match "packageScript.*wget\\tools" } | Select-Object -Last 1 + + $line | Should -Not -BeNullOrEmpty + $line | Should -Match "installArguments:? ''" + $line | Should -Match "packageParameters:? ''" + $line | Should -Match "-forceX86" + } + + It 'Outputs firefox using eu as language locale' { + $Output.Lines | Should -Contain "Using locale 'eu'..." -Because $Output.String + } + + It 'Outputs running firefox script with correct arguments' { + $line = $Output.Lines | Where-Object { $_ -match "packageScript.*firefox\\tools" } + + $line | Should -Not -BeNullOrEmpty + $line | Should -Match "installArguments:? '\/RemoveDistributionDir=true'" + $line | Should -Match "packageParameters:? '\/l=eu'" + $line | Should -Not -Match "-forceX86" + } + } +} diff --git a/tests/chocolatey-tests/commands/choco-version.Tests.ps1 b/tests/chocolatey-tests/commands/choco-version.Tests.ps1 new file mode 100644 index 0000000000..b31734c831 --- /dev/null +++ b/tests/chocolatey-tests/commands/choco-version.Tests.ps1 @@ -0,0 +1,53 @@ +Import-Module helpers/common-helpers + +Describe "choco version" -Tag Chocolatey, VersionCommand -Skip:(Test-ChocolateyVersionEqualOrHigherThan "1.0.0") { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "Version" { + BeforeAll { + $Output = Invoke-Choco version + } + + It "Exits successfully (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Reports that the command is deprecated" { + $Output.String | Should -Match "command is deprecated" + } + + # Issue: https://github.com/chocolatey/choco/issues/2048 + It "Tells the user about 'choco outdated'" -Skip:$((-not (Test-ChocolateyVersionEqualOrHigherThan "0.10.16-beta"))) { + $Output.String | Should -Match "choco outdated" + } + } + + Context "Help Documentation (<_>)" -Foreach @("--help", "-?", "-help") { + BeforeAll { + $Output = Invoke-Choco version $_ + } + + It "Exits successfully (0)" { + $Output.ExitCode | Should -Be 0 + } + + It "Outputs Help for Version" { + $Output.String | Should -Match "Version Command" + } + + It "Outputs Options and Switches" { + $Output.Lines | Should -Contain "Options and Switches" + } + + It "Warns that the command is deprecated" { + $Output.String | Should -Match "has been deprecated" + } + } +} diff --git a/tests/chocolatey-tests/commands/testnuspecs/basic-dependencies/basic-dependencies.nuspec b/tests/chocolatey-tests/commands/testnuspecs/basic-dependencies/basic-dependencies.nuspec new file mode 100644 index 0000000000..2a5a5b84c9 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/basic-dependencies/basic-dependencies.nuspec @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>basic-dependencies</id> + <version>1.0.0</version> + <authors>Author</authors> + <description>Not empty</description> + <dependencies> + <dependency id="basic" /> + </dependencies> + </metadata> + <files /> +</package> \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/basic/basic.nuspec b/tests/chocolatey-tests/commands/testnuspecs/basic/basic.nuspec new file mode 100644 index 0000000000..3867b40dd2 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/basic/basic.nuspec @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>basic</id> + <version>1.0.0</version> + <authors>Author</authors> + <description>Not empty</description> + </metadata> +</package> \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/basic/tools/purpose.txt b/tests/chocolatey-tests/commands/testnuspecs/basic/tools/purpose.txt new file mode 100644 index 0000000000..3c4934fc41 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/basic/tools/purpose.txt @@ -0,0 +1 @@ +This package is used to verify a pack command can be used, with the minimum amount of information given. diff --git a/tests/chocolatey-tests/commands/testnuspecs/cdata/cdata.nuspec b/tests/chocolatey-tests/commands/testnuspecs/cdata/cdata.nuspec new file mode 100644 index 0000000000..945291ea22 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/cdata/cdata.nuspec @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>cdata</id> + <version>1.0.0</version> + <authors>Author</authors> + <description><![CDATA[ + The text inside this description should + be valid even when & and < is being used. + ]]></description> + <dependencies> + <dependency id="basic" /> + </dependencies> + </metadata> + <files /> +</package> \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/description-long.nuspec b/tests/chocolatey-tests/commands/testnuspecs/description-long.nuspec new file mode 100644 index 0000000000..3ea5e02806 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/description-long.nuspec @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>description-long</id> + <version>1.0.0</version> + <authors>Author</authors> + <description>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nunc eget lorem dolor sed viverra ipsum nunc aliquet. Integer vitae justo eget magna fermentum iaculis. Non curabitur gravida arcu ac tortor dignissim convallis. Rhoncus dolor purus non enim praesent. Curabitur vitae nunc sed velit dignissim. Sapien pellentesque habitant morbi tristique senectus et netus. Purus gravida quis blandit turpis cursus. Ut tortor pretium viverra suspendisse potenti nullam. Amet est placerat in egestas erat. Senectus et netus et malesuada fames. Amet consectetur adipiscing elit pellentesque habitant morbi. Elementum nisi quis eleifend quam adipiscing. Arcu ac tortor dignissim convallis aenean et tortor at. + +Feugiat pretium nibh ipsum consequat nisl vel pretium lectus. Erat imperdiet sed euismod nisi porta. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Et ligula ullamcorper malesuada proin libero. Orci dapibus ultrices in iaculis nunc sed augue. Odio eu feugiat pretium nibh ipsum consequat nisl vel pretium. Non blandit massa enim nec dui nunc mattis enim. Etiam sit amet nisl purus in mollis nunc. Commodo sed egestas egestas fringilla. Cras adipiscing enim eu turpis. Ornare arcu dui vivamus arcu felis. Pharetra vel turpis nunc eget lorem dolor. + +Tortor dignissim convallis aenean et. Lobortis elementum nibh tellus molestie. Lectus proin nibh nisl condimentum id. Massa id neque aliquam vestibulum morbi blandit cursus risus. Quam elementum pulvinar etiam non. Nullam non nisi est sit amet. Fringilla urna porttitor rhoncus dolor purus. Elementum sagittis vitae et leo. Est placerat in egestas erat imperdiet sed. Consequat ac felis donec et odio pellentesque diam volutpat commodo. Velit ut tortor pretium viverra suspendisse potenti nullam ac tortor. Id leo in vitae turpis massa sed elementum tempus. Consequat nisl vel pretium lectus. Enim sit amet venenatis urna cursus eget. + +Facilisis mauris sit amet massa vitae. Dictum at tempor commodo ullamcorper a lacus vestibulum sed. Ut aliquam purus sit amet luctus venenatis. Eleifend donec pretium vulputate sapien. Vulputate dignissim suspendisse in est. Ornare arcu dui vivamus arcu felis. In ornare quam viverra orci sagittis. Nunc lobortis mattis aliquam faucibus purus in massa tempor nec. Aliquam id diam maecenas ultricies mi. Varius vel pharetra vel turpis nunc eget lorem. Ultrices vitae auctor eu augue ut lectus. Egestas congue quisque egestas diam in. + +Enim praesent elementum facilisis leo vel fringilla est. Tortor condimentum lacinia quis vel eros donec ac. Sit amet consectetur adipiscing elit pellentesque habitant morbi. Eget lorem dolor sed viverra. Purus in mollis nunc sed id semper. Enim praesent elementum facilisis leo vel fringilla est ullamcorper eget. Nec ultrices dui sapien eget mi proin sed. Commodo viverra maecenas accumsan lacus vel. Libero nunc consequat interdum varius sit. Sociis natoque penatibus et magnis dis parturient montes. Enim ut sem viverra aliquet eget sit amet tellus. Diam vel quam elementum pulvinar etiam non quam. Massa enim nec dui nunc mattis enim ut tellus. Donec adipiscing tristique risus nec feugiat. In vitae turpis massa sed. Risus nec feugiat in fermentum posuere urna nec tincidunt. + +Nulla facilisi nullam vehicula ipsum a arcu cursus vitae. Netus et malesuada fames ac turpis. Dolor magna eget est lorem ipsum dolor sit amet. Vitae justo eget magna fermentum iaculis eu non diam phasellus. Nunc mi ipsum faucibus vitae aliquet nec ullamcorper sit. Aenean et tortor at risus viverra adipiscing at in tellus. Quam elementum pulvinar etiam non quam lacus suspendisse. Tortor id aliquet lectus proin nibh nisl condimentum id venenatis. Commodo odio aenean sed adipiscing diam donec adipiscing tristique. Massa eget egestas purus viverra. Gravida quis blandit turpis cursus in hac. Sit amet consectetur adipiscing elit pellentesque. Aliquam ut porttitor leo a diam sollicitudin tempor. + +Leo vel orci porta non pulvinar neque laoreet suspendisse. Sagittis eu volutpat odio facilisis mauris. Sollicitudin ac orci phasellus egestas tellus rutrum tellus. Tellus integer feugiat scelerisque varius morbi. Tincidunt praesent semper feugiat nibh. Enim nec dui nunc mattis enim ut. Sit amet nisl purus in mollis. Eget duis at tellus at urna condimentum mattis pellentesque. Amet mattis vulputate enim nulla aliquet porttitor lacus luctus. Porttitor lacus luctus accumsan tortor posuere ac. Tristique senectus et netus et malesuada fames. Auctor urna nunc id cursus metus aliquam eleifend. Amet porttitor eget dolor morbi non arcu risus quis. Eu non diam phasellus vestibulum lorem sed risus ultricies tristique. Facilisis gravida neque convallis a cras semper auctor neque. Praesent semper feugiat nibh sed pulvinar proin gravida hendrerit. Sit amet massa vitae tortor. +</description> + <dependencies> + <dependency id="basic" /> + </dependencies> + </metadata> + <files /> +</package> \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/empty-requireLicenseAcceptance.nuspec b/tests/chocolatey-tests/commands/testnuspecs/empty-requireLicenseAcceptance.nuspec new file mode 100644 index 0000000000..bde1fb5593 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/empty-requireLicenseAcceptance.nuspec @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>basic-dependencies</id> + <version>1.0.0</version> + <authors>Author</authors> + <requireLicenseAcceptance></requireLicenseAcceptance> + <description>Not empty</description> + <dependencies> + <dependency id="basic" /> + </dependencies> + </metadata> + <files /> +</package> \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/empty.nuspec b/tests/chocolatey-tests/commands/testnuspecs/empty.nuspec new file mode 100644 index 0000000000..3d117c12ad --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/empty.nuspec @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>emtpy</id> + <version>1.0.0</version> + <authors>Author</authors> + <projectUrl></projectUrl> + <iconUrl></iconUrl> + <licenseUrl></licenseUrl> + <projectSourceUrl></projectSourceUrl> + <docsUrl></docsUrl> + <mailingListUrl></mailingListUrl> + <bugTrackerUrl></bugTrackerUrl> + <description>Test Description</description> + <dependencies> + <dependency id="basic" /> + </dependencies> + </metadata> + <files /> +</package> \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/forward-slash/forward-slash.nuspec b/tests/chocolatey-tests/commands/testnuspecs/forward-slash/forward-slash.nuspec new file mode 100644 index 0000000000..a602714908 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/forward-slash/forward-slash.nuspec @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>forward-slash</id> + <version>1.0.0</version> + <authors>Author</authors> + <description>Not empty</description> + </metadata> + <files> + <file src="tools/**" target="tools" /> + </files> +</package> diff --git a/tests/chocolatey-tests/commands/testnuspecs/forward-slash/tools/purpose.txt b/tests/chocolatey-tests/commands/testnuspecs/forward-slash/tools/purpose.txt new file mode 100644 index 0000000000..b6134bcda2 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/forward-slash/tools/purpose.txt @@ -0,0 +1,3 @@ +This package is for testing that nuspec files containing a file segment with a forward slash create a nupkg file with the correct file structure. + +Related to issue: https://github.com/chocolatey/choco/issues/2166 \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/full/full.nuspec b/tests/chocolatey-tests/commands/testnuspecs/full/full.nuspec new file mode 100644 index 0000000000..17f9358c98 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/full/full.nuspec @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> +<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> + <metadata> + <id>full</id> + <version>1.0.0</version> + <packageSourceUrl>https://github.com/chocolatey-community/chocolatey-coreteampackages/tree/master/automatic/juju</packageSourceUrl> + <owners>chocolatey-community,AdmiringWorm</owners> + <title>Juju + Canonical Ltd. + https://juju.is/ + https://cdn.jsdelivr.net/gh/chocolatey-community/chocolatey-coreteampackages@aec5c9771a5f607dc5549f803405aa8d3cb87a7d/icons/juju.png + © 2021 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd. + https://github.com/juju/juju/blob/develop/LICENCE + false + https://github.com/juju/juju + https://juju.is/docs + https://bugs.launchpad.net/juju + juju admin console cloud services foss cross-platform cli + Model-driven operations for hybrid cloud services commandline + + https://discourse.charmhub.io/t/juju-2-9-0-release-notes/4525 + + + + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/full/tools/purpose.txt b/tests/chocolatey-tests/commands/testnuspecs/full/tools/purpose.txt new file mode 100644 index 0000000000..ef297c582d --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/full/tools/purpose.txt @@ -0,0 +1,2 @@ +The purpose of this package is that when all of the valid nuspec elements are specified, the package can be created. +The package metadata is based on a package already available on the Community Repository. diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-bugtrackerurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-bugtrackerurl.nuspec new file mode 100644 index 0000000000..dcad416365 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-bugtrackerurl.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-bugtrackerurl + 1.0.0 + Author + invalid bug tracker url + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-character-and.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-character-and.nuspec new file mode 100644 index 0000000000..77d4640118 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-character-and.nuspec @@ -0,0 +1,14 @@ + + + + + invalid-characters-and + 1.0.0 + Author + This metadata file contains the invalid character &. + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-character-lesser.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-character-lesser.nuspec new file mode 100644 index 0000000000..fa44be3672 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-character-lesser.nuspec @@ -0,0 +1,14 @@ + + + + + invalid-characters-lesser + 1.0.0 + Author + This metadata file contains the invalid character <. + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-docsurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-docsurl.nuspec new file mode 100644 index 0000000000..c70723779c --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-docsurl.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-docsurl + 1.0.0 + Author + invalid docs url + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-iconurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-iconurl.nuspec new file mode 100644 index 0000000000..2456b0d040 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-iconurl.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-iconurl + 1.0.0 + Author + invalid icon url + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-id.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-id.nuspec new file mode 100644 index 0000000000..4f20c139b3 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-id.nuspec @@ -0,0 +1,14 @@ + + + + + invalid id + 1.0.0 + Author + Not empty + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-licenseUrl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-licenseUrl.nuspec new file mode 100644 index 0000000000..a44af0bf9f --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-licenseUrl.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-licenseurl + 1.0.0 + Author + invalid license url + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-mailinglisturl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-mailinglisturl.nuspec new file mode 100644 index 0000000000..e36bad8fcb --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-mailinglisturl.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-mailinglisturl + 1.0.0 + Author + invalid mailing list url + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-no-content.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-no-content.nuspec new file mode 100644 index 0000000000..6a775d8936 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-no-content.nuspec @@ -0,0 +1,11 @@ + + + + + invalid-no-content + 1.0.0 + Author + Not empty + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-projectsourceurl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-projectsourceurl.nuspec new file mode 100644 index 0000000000..48dc17149b --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-projectsourceurl.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-projectsourceurl + 1.0.0 + Author + invalid project source url + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-projecturl.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-projecturl.nuspec new file mode 100644 index 0000000000..7494913f13 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-projecturl.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-projecturl + 1.0.0 + Author + invalid project url + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-requireLicenseAcceptance.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-requireLicenseAcceptance.nuspec new file mode 100644 index 0000000000..0fb0d7b045 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-requireLicenseAcceptance.nuspec @@ -0,0 +1,15 @@ + + + + + invalid-licenseurl + 1.0.0 + Author + true + Test Description + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/invalid-version.nuspec b/tests/chocolatey-tests/commands/testnuspecs/invalid-version.nuspec new file mode 100644 index 0000000000..13bdf10aca --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/invalid-version.nuspec @@ -0,0 +1,14 @@ + + + + + invalid-version + INVALID + Author + Not empty + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/missing.nuspec b/tests/chocolatey-tests/commands/testnuspecs/missing.nuspec new file mode 100644 index 0000000000..ceafbdc008 --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/missing.nuspec @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testnuspecs/required.nuspec b/tests/chocolatey-tests/commands/testnuspecs/required.nuspec new file mode 100644 index 0000000000..3479e65ecb --- /dev/null +++ b/tests/chocolatey-tests/commands/testnuspecs/required.nuspec @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testpackages/.gitignore b/tests/chocolatey-tests/commands/testpackages/.gitignore new file mode 100644 index 0000000000..fbe7bcd18e --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/.gitignore @@ -0,0 +1 @@ +*.nupkg \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec b/tests/chocolatey-tests/commands/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec new file mode 100644 index 0000000000..36aea10a50 --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/chocolatey-dummy-package/1.0.0/chocolatey-dummy-package.nuspec @@ -0,0 +1,18 @@ + + + + + chocolatey-dummy-package + 1.0.0 + chocolatey-dummy-package + Chocolatey Software + https://github.com/chocolatey + https://chocolatey.org/assets/images/nupkg/chocolateyicon.png + chocolatey-dummy-package + This is a purposely empty dummy package for testing choco push functionality + This is a purposely empty dummy package for testing choco push functionality + + + + + diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/installpackage.nuspec b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/installpackage.nuspec new file mode 100644 index 0000000000..5f9b69016d --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/installpackage.nuspec @@ -0,0 +1,17 @@ + + + + installpackage + 1.0.0 + installpackage + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + __REPLACE__ + installpackage admin + + + + + \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/Casemismatch.exe.ignore b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/Casemismatch.exe.ignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/casemismatch.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/casemismatch.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 new file mode 100644 index 0000000000..af5bb142e8 --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyBeforeModify.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Before Modification" \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..793673411c --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyinstall.ps1 @@ -0,0 +1,16 @@ +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$PackageParameters = Get-PackageParameters +"simple file" | Out-File "$toolsDir\simplefile.txt" -force + +Write-Output "This is $packageName v$packageVersion being installed to `n $packageFolder" +Write-Host "Ya!" +Write-Debug "A debug message" +Write-Verbose "Yo!" +Write-Warning "A warning!" + +Write-Output "$packageName v$packageVersion has been installed to `n $packageFolder" + +Write-Host "Package Parameters:" +foreach ($key in $PackageParameters.Keys) { + Write-Host "$key - $($PackageParameters[$key])" +} diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/console.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/console.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe.gui b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/graphical.exe.gui new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe.ignore b/tests/chocolatey-tests/commands/testpackages/installpackage/1.0.0/tools/not.installed.exe.ignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/chocolatey-tests/commands/testpackages/too-long-description/1.0.0/too-long-description.nuspec b/tests/chocolatey-tests/commands/testpackages/too-long-description/1.0.0/too-long-description.nuspec new file mode 100644 index 0000000000..d59514875e --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/too-long-description/1.0.0/too-long-description.nuspec @@ -0,0 +1,30 @@ + + + + + too-long-description + 1.0.0 + chocolatey-dummy-package + Chocolatey Software + https://github.com/chocolatey + https://chocolatey.org/assets/images/nupkg/chocolateyicon.png + chocolatey-dummy-package + This is a purposely empty dummy package for testing choco push functionality + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nunc eget lorem dolor sed viverra ipsum nunc aliquet. Integer vitae justo eget magna fermentum iaculis. Non curabitur gravida arcu ac tortor dignissim convallis. Rhoncus dolor purus non enim praesent. Curabitur vitae nunc sed velit dignissim. Sapien pellentesque habitant morbi tristique senectus et netus. Purus gravida quis blandit turpis cursus. Ut tortor pretium viverra suspendisse potenti nullam. Amet est placerat in egestas erat. Senectus et netus et malesuada fames. Amet consectetur adipiscing elit pellentesque habitant morbi. Elementum nisi quis eleifend quam adipiscing. Arcu ac tortor dignissim convallis aenean et tortor at. + +Feugiat pretium nibh ipsum consequat nisl vel pretium lectus. Erat imperdiet sed euismod nisi porta. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Et ligula ullamcorper malesuada proin libero. Orci dapibus ultrices in iaculis nunc sed augue. Odio eu feugiat pretium nibh ipsum consequat nisl vel pretium. Non blandit massa enim nec dui nunc mattis enim. Etiam sit amet nisl purus in mollis nunc. Commodo sed egestas egestas fringilla. Cras adipiscing enim eu turpis. Ornare arcu dui vivamus arcu felis. Pharetra vel turpis nunc eget lorem dolor. + +Tortor dignissim convallis aenean et. Lobortis elementum nibh tellus molestie. Lectus proin nibh nisl condimentum id. Massa id neque aliquam vestibulum morbi blandit cursus risus. Quam elementum pulvinar etiam non. Nullam non nisi est sit amet. Fringilla urna porttitor rhoncus dolor purus. Elementum sagittis vitae et leo. Est placerat in egestas erat imperdiet sed. Consequat ac felis donec et odio pellentesque diam volutpat commodo. Velit ut tortor pretium viverra suspendisse potenti nullam ac tortor. Id leo in vitae turpis massa sed elementum tempus. Consequat nisl vel pretium lectus. Enim sit amet venenatis urna cursus eget. + +Facilisis mauris sit amet massa vitae. Dictum at tempor commodo ullamcorper a lacus vestibulum sed. Ut aliquam purus sit amet luctus venenatis. Eleifend donec pretium vulputate sapien. Vulputate dignissim suspendisse in est. Ornare arcu dui vivamus arcu felis. In ornare quam viverra orci sagittis. Nunc lobortis mattis aliquam faucibus purus in massa tempor nec. Aliquam id diam maecenas ultricies mi. Varius vel pharetra vel turpis nunc eget lorem. Ultrices vitae auctor eu augue ut lectus. Egestas congue quisque egestas diam in. + +Enim praesent elementum facilisis leo vel fringilla est. Tortor condimentum lacinia quis vel eros donec ac. Sit amet consectetur adipiscing elit pellentesque habitant morbi. Eget lorem dolor sed viverra. Purus in mollis nunc sed id semper. Enim praesent elementum facilisis leo vel fringilla est ullamcorper eget. Nec ultrices dui sapien eget mi proin sed. Commodo viverra maecenas accumsan lacus vel. Libero nunc consequat interdum varius sit. Sociis natoque penatibus et magnis dis parturient montes. Enim ut sem viverra aliquet eget sit amet tellus. Diam vel quam elementum pulvinar etiam non quam. Massa enim nec dui nunc mattis enim ut tellus. Donec adipiscing tristique risus nec feugiat. In vitae turpis massa sed. Risus nec feugiat in fermentum posuere urna nec tincidunt. + +Nulla facilisi nullam vehicula ipsum a arcu cursus vitae. Netus et malesuada fames ac turpis. Dolor magna eget est lorem ipsum dolor sit amet. Vitae justo eget magna fermentum iaculis eu non diam phasellus. Nunc mi ipsum faucibus vitae aliquet nec ullamcorper sit. Aenean et tortor at risus viverra adipiscing at in tellus. Quam elementum pulvinar etiam non quam lacus suspendisse. Tortor id aliquet lectus proin nibh nisl condimentum id venenatis. Commodo odio aenean sed adipiscing diam donec adipiscing tristique. Massa eget egestas purus viverra. Gravida quis blandit turpis cursus in hac. Sit amet consectetur adipiscing elit pellentesque. Aliquam ut porttitor leo a diam sollicitudin tempor. + +Leo vel orci porta non pulvinar neque laoreet suspendisse. Sagittis eu volutpat odio facilisis mauris. Sollicitudin ac orci phasellus egestas tellus rutrum tellus. Tellus integer feugiat scelerisque varius morbi. Tincidunt praesent semper feugiat nibh. Enim nec dui nunc mattis enim ut. Sit amet nisl purus in mollis. Eget duis at tellus at urna condimentum mattis pellentesque. Amet mattis vulputate enim nulla aliquet porttitor lacus luctus. Porttitor lacus luctus accumsan tortor posuere ac. Tristique senectus et netus et malesuada fames. Auctor urna nunc id cursus metus aliquam eleifend. Amet porttitor eget dolor morbi non arcu risus quis. Eu non diam phasellus vestibulum lorem sed risus ultricies tristique. Facilisis gravida neque convallis a cras semper auctor neque. Praesent semper feugiat nibh sed pulvinar proin gravida hendrerit. Sit amet massa vitae tortor. + + + + + diff --git a/tests/chocolatey-tests/commands/testpackages/too-long-title/1.0.0/too-long-title.nuspec b/tests/chocolatey-tests/commands/testpackages/too-long-title/1.0.0/too-long-title.nuspec new file mode 100644 index 0000000000..536fa5bf3d --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/too-long-title/1.0.0/too-long-title.nuspec @@ -0,0 +1,18 @@ + + + + + too-long-title + 1.0.0 + chocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-packagechocolatey-dummy-package + Chocolatey Software + https://github.com/chocolatey + https://chocolatey.org/assets/images/nupkg/chocolateyicon.png + chocolatey-dummy-package + This is a purposely empty dummy package for testing choco push functionality + This is a purposely empty dummy package for testing choco push functionality + + + + + diff --git a/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..cd1f15bd37 --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/chocolateyinstall.ps1 @@ -0,0 +1,12 @@ + +$ErrorActionPreference = 'Stop'; +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" + +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + destination = "$toolsDir\extraction" + file = "$toolsDir\zip-log-disable-test.zip" + disableLogging= $true +} + +Get-ChocolateyUnzip @packageArgs diff --git a/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip new file mode 100644 index 0000000000..0d949ab396 Binary files /dev/null and b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/tools/zip-log-disable-test.zip differ diff --git a/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec new file mode 100644 index 0000000000..4703bf281d --- /dev/null +++ b/tests/chocolatey-tests/commands/testpackages/zip-log-disable-test/zip-log-disable-test.nuspec @@ -0,0 +1,15 @@ + + + + + zip-log-disable-test + 1.0.0 + zip-log-disable-test (Install) + __REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__ + zip-log-disable-test SPACE_SEPARATED + Package used to test disabling verbose file log for zip extraction + + + + + diff --git a/tests/chocolatey-tests/features/Hooks.Tests.ps1 b/tests/chocolatey-tests/features/Hooks.Tests.ps1 new file mode 100644 index 0000000000..74d7ce5292 --- /dev/null +++ b/tests/chocolatey-tests/features/Hooks.Tests.ps1 @@ -0,0 +1,93 @@ +Import-Module helpers/common-helpers + +Describe "choco hooks tests" -Tag Chocolatey, HooksFeature { + BeforeDiscovery { + $Flags = @( + @{ Flag = '' ; RunsHooks = $true ; Command = 'install' ; ExitCode = 0 } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'install' ; ExitCode = 0 } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'install' ; ExitCode = 0 } + + @{ Flag = '' ; RunsHooks = $true ; Command = 'uninstall' ; ExitCode = 0 } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'uninstall' ; ExitCode = 0 } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'uninstall' ; ExitCode = 0 } + + @{ Flag = '' ; RunsHooks = $true ; Command = 'upgrade' ; ExitCode = -1 } + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'upgrade' ; ExitCode = 0 } + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'upgrade' ; ExitCode = -1 } + + ) + } + BeforeAll { + Initialize-ChocolateyTestInstall + # Add the hooks package to the test install so that it is available in each snapshot. + $null = Invoke-Choco install scriptpackage.hook --version 1.0.0 + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context ' hooks with flag: ' -ForEach $Flags { + BeforeAll { + Restore-ChocolateyInstallSnapshot + $Package = 'upgradepackage' + + if ($Command -ne 'install') { + $ver = if ($Command -eq 'upgrade') { + '1.0.0' + } + else { + '1.1.0' + } + $null = Invoke-Choco install $Package --version $ver --no-progress + } + + $Output = Invoke-Choco $Command $Package $Flag --no-progress + } + + # Uninstall/Upgrade exit -1: https://github.com/chocolatey/choco/issues/2822 + It "Exits with expected value ()" { + $Output.ExitCode | Should -Be $ExitCode -Because $Output.String + } + + It "Should execute hooks ()" { + $Version = '1.1.0' + + $Messages = @( + if ($Command -eq 'uninstall') { + "pre-uninstall-all.ps1 hook ran for $Package $Version" + "post-uninstall-all.ps1 hook ran for $Package $Version" + "pre-uninstall-$Package.ps1 hook ran for $Package $Version" + "post-uninstall-$Package.ps1 hook ran for $Package $Version" + "pre-beforemodify-all.ps1 hook ran for $Package $Version" + "post-beforemodify-all.ps1 hook ran for $Package $Version" + "pre-beforemodify-$Package.ps1 hook ran for $Package $Version" + "post-beforemodify-$Package.ps1 hook ran for $Package $Version" + } + else { + "pre-install-all.ps1 hook ran for $Package $Version" + "post-install-all.ps1 hook ran for $Package $Version" + "pre-install-$Package.ps1 hook ran for $Package $Version" + "post-install-$Package.ps1 hook ran for $Package $Version" + } + + if ($Command -eq 'upgrade') { + "pre-beforemodify-all.ps1 hook ran for $Package 1.0.0" + "pre-beforemodify-$Package.ps1 hook ran for $Package 1.0.0" + } + ) + + foreach ($msg in $Messages) { + if ($RunsHooks) { + $Output.Lines | Should -Contain $msg -Because $Output.String + } + else { + $Output.Lines | Should -Not -Contain $msg -Because $Output.String + } + } + + $Output.Lines | Should -Not -Contain "pre-$Command-doesnotexist.ps1 hook ran for $Package $Version" -Because $Output.String + } + } +} diff --git a/tests/chocolatey-tests/features/PythonSource.Tests.ps1 b/tests/chocolatey-tests/features/PythonSource.Tests.ps1 new file mode 100644 index 0000000000..f98462719f --- /dev/null +++ b/tests/chocolatey-tests/features/PythonSource.Tests.ps1 @@ -0,0 +1,37 @@ +Import-Module helpers/common-helpers + +# This is skipped when not run in CI because it modifies the local system. +Describe "Python Source" -Tag Chocolatey, UpgradeCommand, PythonSource -Skip:(-not $env:TEST_KITCHEN) { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + # TODO: Internalize Python and most dependencies. (KB perhaps not internalized due to excessive size...) + $null = Invoke-Choco install python3 --source https://community.chocolatey.org/api/v2/ + } + + AfterAll { + $null = Invoke-Choco uninstall python3 --remove-dependencies + Remove-ChocolateyTestInstall + } + + Context "upgrade " -Foreach @( + @{ Argument = 'all' ; ExitCode = 1 ; Count = 0 } + @{ Argument = 'wheel' ; ExitCode = 0 ; Count = 1 } + ) -Skip:(-not (Test-ChocolateyVersionEqualOrHigherThan '1.1.0')) { + BeforeAll { + # For some reason under kitchen-pester we don't have pip on the path. This might be due to our snapshotting... + Import-Module $env:ChocolateyInstall/helpers/ChocolateyProfile.psm1 + Update-SessionEnvironment + $Output = Invoke-Choco upgrade $Argument --source=python + } + + It 'Exits with correct exit code ()' { + $Output.ExitCode | Should -Be $ExitCode + } + + It 'Outputs properly' { + $Output.Lines | Should -Not:($ExitCode -eq 0) -Contain 'The all keyword is not available for alternate sources' + $Output.Lines | Should -Contain "Chocolatey upgraded $Count/$Count packages." + } + } +} diff --git a/tests/helpers/common-helpers.psm1 b/tests/helpers/common-helpers.psm1 new file mode 100644 index 0000000000..f17f9b7d0a --- /dev/null +++ b/tests/helpers/common-helpers.psm1 @@ -0,0 +1,28 @@ +#requires -version 3 + +if (-not ("NuGet.Versioning.VersionRange" -as [Type])) { + Add-Type -Path $PSScriptRoot\common\NuGet.Versioning.dll +} + +# Common variables setup +$script:snapshots = [System.Collections.Generic.Queue[hashtable]]::new() +$script:snapshotStack = @() +$script:ChocoCommandHeaders = @{ + "List" = @("Name", "Version") + "PinList" = @("Name", "Version") + "SourceList" = @("Name", "Url", "1", "2", "3", "Priority", "BypassProxy", "SelfService", "AdminOnly") + "Feature" = @("Name", "State", "Description") +} +$script:features = $null +$script:LicenseType = $null +$script:chocolateyTestLocation = $null +$script:originalChocolateyInstall = $env:ChocolateyInstall + +Get-ChildItem -Path $PSScriptRoot\common -Filter *.ps1 -Recurse | ForEach-Object { . $_.FullName } + +# Prepare information that will be useful for troubleshooting. +$Output = Invoke-Choco list -lo +# Saving to log file as those are currently the only files picked up by Team City +$Output.Lines | Out-File $env:ChocolateyInstall\Logs\LocalPackages.log +# Removing any existing snapshot logs to enable local testing without needing to clean the snapshot folder +Remove-Item -Path $env:ChocolateyInstall\snapshot -Force -Recurse -ErrorAction Ignore diff --git a/tests/helpers/common/Archives/Expand-ZipArchive.ps1 b/tests/helpers/common/Archives/Expand-ZipArchive.ps1 new file mode 100644 index 0000000000..fa17d042ab --- /dev/null +++ b/tests/helpers/common/Archives/Expand-ZipArchive.ps1 @@ -0,0 +1,23 @@ +function Expand-ZipArchive { + <# + .Synopsis + Helper function to extract the contents of an archive without a .zip extension. +#> + [CmdletBinding()] + param( + # The intunewin file to extract + [Parameter(Position = 1, Mandatory = $true)] + $Source, + # The location to put the files when done. + [Parameter(Position = 2, Mandatory = $true)] + $Destination + ) + $zipFile = "$Source.zip" + Rename-Item -Path $Source -NewName $zipFile + try { + Expand-Archive -Path $zipFile -DestinationPath $Destination + } + finally { + Rename-Item -Path $zipFile -NewName $Source + } +} diff --git a/tests/helpers/common/Chocolatey/ConvertFrom-ChocolateyOutput.ps1 b/tests/helpers/common/Chocolatey/ConvertFrom-ChocolateyOutput.ps1 new file mode 100644 index 0000000000..5c424f78d4 --- /dev/null +++ b/tests/helpers/common/Chocolatey/ConvertFrom-ChocolateyOutput.ps1 @@ -0,0 +1,47 @@ +function ConvertFrom-ChocolateyOutput { + <# + .Synopsis + Converts from Chocolatey's --LimitOutput (-r) to PowerShell object + + .Example + (Invoke-Choco list -lo -r).Lines | ConvertFrom-ChocolateyOutput -Command List + + .Example + (Invoke-Choco pin list -r).Lines | ConvertFrom-ChocolateyOutput -Command PinList + + .Example + (Invoke-Choco source list -r).Lines | ConvertFrom-ChocolateyOutput -Command SourceList + + .Example + (Invoke-Choco feature list -r).Lines | ConvertFrom-ChocolateyOutput -Command Feature + #> + [CmdletBinding()] + param( + [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] + [Alias("Lines")] + $InputObject, + + [Parameter(Mandatory)] + [ValidateSet("List", "PinList", "SourceList", "SelfService", "Feature")] + [string]$Command + ) + begin { + # This is of limited use as we can't check pipelined commands broken up over several lines. + if ($MyInvocation.Line -match "choco\s" -and $MyInvocation.Line -notmatch "(--LimitOutput|--Limit-Output|-r)") { + Write-Warning "Chocolatey may not have been called with --LimitOutput." + } + + if (-not $script:ChocoCommandHeaders.ContainsKey($Command)) { + throw "No Headers found for '$($Command)'" + } + + # TODO: If Issue 2591 is merged, the header portion of these calls will not be needed. + $ConversionParams = @{ + Delimiter = "|" + Header = $script:ChocoCommandHeaders[$Command] + } + } + process { + $InputObject | Where-Object { $_ -like '*|*' } | ConvertFrom-Csv @ConversionParams + } +} diff --git a/tests/helpers/common/Chocolatey/ConvertTo-ChocoAuditObject.ps1 b/tests/helpers/common/Chocolatey/ConvertTo-ChocoAuditObject.ps1 new file mode 100644 index 0000000000..bdaf7868f9 --- /dev/null +++ b/tests/helpers/common/Chocolatey/ConvertTo-ChocoAuditObject.ps1 @@ -0,0 +1,26 @@ +function ConvertTo-ChocoAuditObject { + [CmdletBinding()] + param ( + [Parameter(ValueFromPipeline)] + [string] + $InputObject + ) + + process { + # format of the 'choco list' output is: + # (ie. adobereader 2015.6.7) + if (-not [string]::IsNullOrEmpty($InputObject)) { + $props = $_.split('|') + + [pscustomobject]@{ + + name = $props[0] + version = $props[1] + InstalledBy = $props[2] -replace ('User:', '') + Domain = $props[3] -replace ('Domain:', '') + RequestedBy = $props[4] -replace ('Original User:', '') + InstallDateUtc = $props[5] -replace ('InstallDateUtc:', '') + } + } + } +} diff --git a/tests/helpers/common/Chocolatey/Disable-ChocolateyFeature.ps1 b/tests/helpers/common/Chocolatey/Disable-ChocolateyFeature.ps1 new file mode 100644 index 0000000000..8399cfe760 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Disable-ChocolateyFeature.ps1 @@ -0,0 +1,10 @@ +function Disable-ChocolateyFeature { + [Alias('Disable-ChocoFeature')] + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string[]] + $Name + ) + Set-ChocolateyFeature -Name $Name -Disable +} diff --git a/tests/helpers/common/Chocolatey/Disable-ChocolateySource.ps1 b/tests/helpers/common/Chocolatey/Disable-ChocolateySource.ps1 new file mode 100644 index 0000000000..523839f5c9 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Disable-ChocolateySource.ps1 @@ -0,0 +1,18 @@ +# TODO: Refactor the *-ChocolateySource functions to have a Get-ChocolateySource that can be piped to the Enable and Disable +function Disable-ChocolateySource { + [CmdletBinding()] + param( + [Parameter()] + [string]$Name = "*", + + [Parameter()] + [switch]$All + ) + # Significantly weird behaviour with piping this source list by property name. + $CurrentSources = (Invoke-Choco source list -r).Lines | ConvertFrom-ChocolateyOutput -Command SourceList | Where-Object { + $_.Name -like $Name + } + foreach ($Source in $CurrentSources) { + $null = Invoke-Choco source disable --name $Source.Name + } +} diff --git a/tests/helpers/common/Chocolatey/Enable-ChocolateyFeature.ps1 b/tests/helpers/common/Chocolatey/Enable-ChocolateyFeature.ps1 new file mode 100644 index 0000000000..df86d19172 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Enable-ChocolateyFeature.ps1 @@ -0,0 +1,11 @@ +function Enable-ChocolateyFeature { + [Alias('Enable-ChocoFeature')] + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string[]] + $Name + ) + + Set-ChocolateyFeature -Name $Name -Enable +} diff --git a/tests/helpers/common/Chocolatey/Enable-ChocolateySource.ps1 b/tests/helpers/common/Chocolatey/Enable-ChocolateySource.ps1 new file mode 100644 index 0000000000..6a44cd184e --- /dev/null +++ b/tests/helpers/common/Chocolatey/Enable-ChocolateySource.ps1 @@ -0,0 +1,18 @@ +# TODO: Refactor the *-ChocolateySource functions to have a Get-ChocolateySource that can be piped to the Enable and Disable +function Enable-ChocolateySource { + [CmdletBinding()] + param( + [Parameter()] + [string]$Name = "*", + + [Parameter()] + [switch]$All + ) + # Significantly weird behaviour with piping this source list by property name. + $CurrentSources = (Invoke-Choco source list -r).Lines | ConvertFrom-ChocolateyOutput -Command SourceList | Where-Object { + $_.Name -like $Name + } + foreach ($Source in $CurrentSources) { + $null = Invoke-Choco source enable --name $Source.Name + } +} diff --git a/tests/helpers/common/Chocolatey/Get-ChocoPath.ps1 b/tests/helpers/common/Chocolatey/Get-ChocoPath.ps1 new file mode 100644 index 0000000000..bfc770a3a5 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-ChocoPath.ps1 @@ -0,0 +1,12 @@ +function Get-ChocoPath { + <# + .Synopsis + Helper function to resolve the path to the chocolatey executable, or use an environment variable with the path. + #> + if (Test-Path Env:\CHOCO_EXECUTABLE) { + return $env:CHOCO_EXECUTABLE + } + else { + "$env:ChocolateyInstall\bin\choco.exe" + } +} diff --git a/tests/helpers/common/Chocolatey/Get-ChocolateyFeature.ps1 b/tests/helpers/common/Chocolatey/Get-ChocolateyFeature.ps1 new file mode 100644 index 0000000000..ad91f234bf --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-ChocolateyFeature.ps1 @@ -0,0 +1,56 @@ +function Get-ChocolateyFeature { + # Helper function to determine what features we have + # available or not. Once all features have been found, + # this is better served as a specific package we can install + # during provision instead. + [CmdletBinding()] + [OutputType([pscustomobject])] + [Alias('Get-ChocolateyFeatures')] + param() + + if ($null -ne $script:features) { + return $script:features + } + + $license = Get-ChocolateyLicense + # Just so we don't return the actual license for tests + # we only specify as true if there is a license. + $isLicensed = if ($license) { $true } else { $false } + $is30Licensed = $isLicensed -and (Test-PackageIsEqualOrHigher 'chocolatey.extension' '3.0.0-alpha') + $is22Licensed = $isLicensed -and ($is30Licensed -or (Test-PackageIsEqualOrHigher 'chocolatey.extension' '2.2.0-beta')) + + # These features are collected from + $script:features = [pscustomobject]@{ + License = $license + + Audit = $license -in @('business', 'trial') + AutoSync = $isLicensed -and $license -ne 'architect' + Builder = $isLicensed -and $license -ne 'professional' + BuilderUI = $isLicensed + CCM = $isLicensed -and $license -notin @('professional', 'architect') + CDNCache = $isLicensed -and $license -ne 'architect' + CommercialCmdlet = $is30Licensed -and $license -in @('business', 'msp', 'trial') + CommercialCmdletInstall = $is30Licensed + DirectoryInstall = $isLicensed -and $license -notin @('professional', 'architect') + DirectoryOverride = $isLicensed -and $license -ne 'architect' + Downloader = $isLicensed + Enhanced = $isLicensed -and $license -ne 'architect' + FromPrograms = $isLicensed -and $license -notin @('professional', 'architect') + Internalizer = $isLicensed -and $license -ne 'professional' + Intune = $is30Licensed -and $license -in @('business', 'trial') + Is30Licensed = $is30Licensed + QDE = $isLicensed -and $license -notin @('professional', 'architect') + Reducer = $isLicensed -and $license -ne 'architect' + SelfService = $isLicensed -and $license -notin @('professional', 'architect') + Sync = $isLicensed -and $license -notin @('architect', 'msp', 'professional') + Throttle = $isLicensed -and $license -ne 'architect' + VirusScan = $isLicensed -and $license -ne 'architect' + VirusTotal = $isLicensed -and $license -notin @('architect', 'msp') + + # The following are different tests that was discovered during writing tests. + # These could be either fixes of bugs, or undocumented features. + PackageProxy = !$isLicensed -or $is22Licensed + } + + $script:features +} diff --git a/tests/helpers/common/Chocolatey/Get-ChocolateyLicense.ps1 b/tests/helpers/common/Chocolatey/Get-ChocolateyLicense.ps1 new file mode 100644 index 0000000000..3fb964e27a --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-ChocolateyLicense.ps1 @@ -0,0 +1,19 @@ +function Get-ChocolateyLicense { + if ($script:LicenseType -and $script:LicenseType -ne '') { + return $script:LicenseType + } + + $package = (Invoke-Choco list --local-only --limitoutput).Lines | + ConvertFrom-ChocolateyOutput -Command List | + Where-Object Name -Match "^chocolatey-license-" | + Select-Object -First 1 # We only expect one package, so we only take the first result + + if ($package) { + $script:LicenseType = $package.Name -replace "^chocolatey-license-" + } + else { + $script:LicenseType = '' + } + + $script:LicenseType +} diff --git a/tests/helpers/common/Chocolatey/Get-ChocolateyTestLocation.ps1 b/tests/helpers/common/Chocolatey/Get-ChocolateyTestLocation.ps1 new file mode 100644 index 0000000000..976cf90ba3 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-ChocolateyTestLocation.ps1 @@ -0,0 +1,13 @@ +function Get-ChocolateyTestLocation { + <# + .SYNOPSIS + Gets the last set chocolatey test location. + This is usually set when initializing the original + location before creating snapshots, + otherwise the value is typically null. + #> + [CmdletBinding()] + param() + + $script:chocolateyTestLocation +} diff --git a/tests/helpers/common/Chocolatey/Get-ChocolateyVersion.ps1 b/tests/helpers/common/Chocolatey/Get-ChocolateyVersion.ps1 new file mode 100644 index 0000000000..e046b595dd --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-ChocolateyVersion.ps1 @@ -0,0 +1,15 @@ +function Get-ChocolateyVersion { + <# + .Synopsis + Returns the current Chocolatey version as SemVer + #> + [Alias('Get-ChocoVersion')] + [OutputType('NuGet.Versioning.SemanticVersion')] + [CmdletBinding()] + param() + if (-not $script:runningVersion) { + [NuGet.Versioning.SemanticVersion]$script:runningVersion = ((Invoke-Choco --version).Lines | Where-Object { $_ -NotMatch "please upgrade" }) -join '`r`n' + } + + $script:runningVersion +} diff --git a/tests/helpers/common/Chocolatey/Get-ExpectedChocolateyHeader.ps1 b/tests/helpers/common/Chocolatey/Get-ExpectedChocolateyHeader.ps1 new file mode 100644 index 0000000000..1b34ddcc2b --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-ExpectedChocolateyHeader.ps1 @@ -0,0 +1,25 @@ +function Get-ExpectedChocolateyHeader { + $packages = (Invoke-Choco list --local-only --limitoutput).Lines | + Where-Object { $_ -NotMatch 'please upgrade' } | + ConvertFrom-ChocolateyOutput -Command List + + $licenseType = Get-ChocolateyLicense + + if ($licenseType -eq "msp") { + $licenseType = "ManagedServiceProvider" + } + elseif ($licenseType -eq 'education') { + $licenseType = "Educational" + } + elseif ($licenseType -eq 'trial') { + $licenseType = "BusinessTrial" + } + + if ($packages.Name -contains "chocolatey.extension") { + # hard coded license type for now + return "Chocolatey v$(Get-ChocolateyVersion) $licenseType" + } + else { + return "Chocolatey v$(Get-ChocolateyVersion)" + } +} diff --git a/tests/helpers/common/Chocolatey/Get-OriginalChocolateyPath.ps1 b/tests/helpers/common/Chocolatey/Get-OriginalChocolateyPath.ps1 new file mode 100644 index 0000000000..d3d81a252f --- /dev/null +++ b/tests/helpers/common/Chocolatey/Get-OriginalChocolateyPath.ps1 @@ -0,0 +1,6 @@ +function Get-OriginalChocolateyPath { + [CmdletBinding()] + param() + + return $script:originalChocolateyInstall +} diff --git a/tests/helpers/common/Chocolatey/Initialize-ChocolateyTestInstall.ps1 b/tests/helpers/common/Chocolatey/Initialize-ChocolateyTestInstall.ps1 new file mode 100644 index 0000000000..f23b5901b9 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Initialize-ChocolateyTestInstall.ps1 @@ -0,0 +1,53 @@ +function Initialize-ChocolateyTestInstall { + <# + .Synopsis + Sets up a temporary Chocolatey install for testing + #> + [CmdletBinding()] + param( + # The location to create the temporary installation + [string]$Directory = "$(Get-TempDirectory)ChocolateyTests\original", + + # A source to add, disabling all others + [string]$Source, + + # Whether the source called 'hermes' should be disabled or not + [switch]$DisableHermesSource, + + # Whether the source called 'chocolatey' should be enabled or not + [switch]$EnableChocolateySource + ) + end { + if (-not (Test-Path $Directory -PathType Container)) { + $null = New-Item $Directory -Force -ItemType Directory + } + + # TODO: If this will be used cross-platform, it should not use robocopy + $null = robocopy $env:ChocolateyInstall $Directory /MIR + + $env:ChocolateyInstall = $Directory + Set-ChocolateyTestLocation -Directory $Directory + + Invoke-Choco feature disable -n shownonelevatedwarnings + + # This should only affect the newly copied choco, so no need to clean it up + if ($PSBoundParameters.ContainsKey("Source")) { + Disable-ChocolateySource -All + $null = Invoke-Choco source add -n TestSource -s $Source + } + + if ($DisableHermesSource.IsPresent) { + Disable-ChocolateySource -Name 'hermes' + } + else { + Enable-ChocolateySource -Name 'hermes' + } + + if ($EnableChocolateySource.IsPresent) { + Enable-ChocolateySource -Name 'chocolatey' + } + else { + Disable-ChocolateySource -Name 'chocolatey' + } + } +} diff --git a/tests/helpers/common/Chocolatey/Invoke-Choco.ps1 b/tests/helpers/common/Chocolatey/Invoke-Choco.ps1 new file mode 100644 index 0000000000..8390fd08af --- /dev/null +++ b/tests/helpers/common/Chocolatey/Invoke-Choco.ps1 @@ -0,0 +1,26 @@ +function Invoke-Choco { + <# + .Synopsis + Helper function to call chocolatey with any number of specified arguments, + and return a hashtable with the output as well as the exit code. + #> + [CmdletBinding()] + param( + # The arguments to use when calling the Choco executable + [Parameter(Position = 1, ValueFromRemainingArguments)] + [string[]]$Arguments + ) + + $chocoPath = Get-ChocoPath + $firstArgument, [string[]]$remainingArguments = $Arguments + $arguments = @($firstArgument; '--allow-unofficial'; $remainingArguments) + $output = & $chocoPath @arguments + [PSCustomObject]@{ + # We trim all the lines, so we do not take into account + # trimming the lines when asserting, and that extra whitespace + # is not considered in our assertions. + Lines = if ($output) { $output.Trim() } else { @() } + String = $output -join "`r`n" + ExitCode = $LastExitCode + } +} diff --git a/tests/helpers/common/Chocolatey/New-ChocolateyInstallSnapshot.ps1 b/tests/helpers/common/Chocolatey/New-ChocolateyInstallSnapshot.ps1 new file mode 100644 index 0000000000..437bfe6687 --- /dev/null +++ b/tests/helpers/common/Chocolatey/New-ChocolateyInstallSnapshot.ps1 @@ -0,0 +1,66 @@ +function New-ChocolateyInstallSnapshot { + <# + .Synopsis + Creates a new temporary snapshot + #> + [CmdletBinding()] + param( + # The location to create the temporary installation + [string]$SnapshotPath = "$(Get-TempDirectory)ChocolateyTests\snapshots\$(New-Guid)", + # Whether the current work directory should be moved to the package + # path + [Alias('SetWorkDir')] + [switch]$SetWorkingDirectory, + # Whether we should do a quick creation, basically only create a new + # package snapshot directory but without copying over any files from + # the base test installation. + # This can be used when we do not need to change any state, like purely + # calling the help command without changing any configurations. + [Alias('Quick')] + [switch]$NoSnapshotCopy + ) + + if (-not (Test-Path $SnapshotPath)) { + Write-Verbose "Creating sub directories in $SnapshotPath" + if (!($NoSnapshotCopy)) { + $null = New-Item -Path "$SnapshotPath\install" -Force -ItemType Directory + } + $null = New-Item -Path "$SnapshotPath\packages" -Force -ItemType Directory + } + + Write-Verbose 'Adding information to queue' + $null = $script:snapshots.Enqueue(@{ + Path = $SnapshotPath + PreviousPath = $env:ChocolateyInstall + PathVariable = $env:PATH + SetWorkingDirectory = $SetWorkingDirectory + NoSnapshotCopy = $NoSnapshotCopy + }) + + if (!($NoSnapshotCopy)) { + $chocolateyTestLocation = Get-ChocolateyTestLocation + Write-Verbose "Copying files from '$chocolateyTestLocation' to '$SnapshotPath\install" + $null = robocopy $chocolateyTestLocation "$SnapshotPath\install" /MIR + $null = Remove-Item -Path "$SnapshotPath\install\logs" -Recurse -Force -ErrorAction SilentlyContinue + + $env:ChocolateyInstall = "$SnapshotPath\install" + $env:PATH = "$SnapshotPath\install\bin;$env:PATH" + } + else { + $chocolateyTestLocation = Get-ChocolateyTestLocation + Write-Verbose "Resetting chocolatey install path to '$chocolateyTestlocation" + $env:ChocolateyInstall = "$chocolateyTestLocation" + $env:PATH = "$chocolateyTestLocation\bin;$env:PATH" + } + + $env:CHOCOLATEY_TEST_PACKAGES_PATH = "$SnapshotPath\packages" + + if ($SetWorkingDirectory) { + $null = Push-Location $env:CHOCOLATEY_TEST_PACKAGES_PATH -StackName 'snapshots' + } + + [PSCustomObject]@{ + InstallPath = $env:ChocolateyInstall + PackagesPath = $env:CHOCOLATEY_TEST_PACKAGES_PATH + } +} diff --git a/tests/helpers/common/Chocolatey/New-ChocolateyTestPackage.ps1 b/tests/helpers/common/Chocolatey/New-ChocolateyTestPackage.ps1 new file mode 100644 index 0000000000..02f1b2f279 --- /dev/null +++ b/tests/helpers/common/Chocolatey/New-ChocolateyTestPackage.ps1 @@ -0,0 +1,43 @@ +function New-ChocolateyTestPackage { + <# + .Synopsis + Builds given packages and (optionally) ensures they are available in a given directory + #> + [CmdletBinding()] + param( + # The path to the base location of packages + [Parameter(Mandatory)] + [ValidateScript( { Test-Path $_ -PathType Container })] + [string]$TestPath, + + # Name of the package to build + [Parameter(Mandatory)] + [string]$Name, + + # Version of the package to build + [Parameter(Mandatory)] + [string]$Version, + + # Location to store the built package(s) + [ValidateNotNullOrEmpty()] + [string]$Destination = $env:CHOCOLATEY_TEST_PACKAGES_PATH + ) + process { + $NuspecFile = Get-Item "$TestPath\$Name\$Version\$Name.nuspec" + + Write-Verbose "Building '$($NuspecFile.Count)' packages" + + foreach ($Package in $NuspecFile) { + Write-Verbose "Building '$($Package.Name)' with '$($Package.FullName)'" + $ExpectedPackage = Join-Path $Destination "$Name.$Version.nupkg" + + if (-not (Test-Path $ExpectedPackage)) { + $BuildOutput = Invoke-Choco pack $Package.FullName --outputdirectory $Destination + + if ($BuildOutput.ExitCode -ne 0) { + throw $BuildOutput.String + } + } + } + } +} diff --git a/tests/helpers/common/Chocolatey/Remove-ChocolateyInstallSnapshot.ps1 b/tests/helpers/common/Chocolatey/Remove-ChocolateyInstallSnapshot.ps1 new file mode 100644 index 0000000000..7d3a61f5b3 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Remove-ChocolateyInstallSnapshot.ps1 @@ -0,0 +1,57 @@ +function Remove-ChocolateyInstallSnapshot { + <# + .Synopsis + Removes an existing snapshot + #> + [CmdletBinding()] + param( + # Whether to remove all stored snapshots + [switch] $RemoveAll + ) + + if ($script:snapshots.Count -eq 0) { + return + } + + $snapshotPath = $script:snapshots.Dequeue() + + if ($snapshotPath) { + + if ($snapshotPath.SetWorkingDirectory) { + # We ignore any errors that may occur when popping the location, + # this is done so we do not have failures during teardown as + # there are cases where the previous directory won't exist. + $null = Pop-Location -StackName 'snapshots' -ErrorAction SilentlyContinue + } + + if (Test-Path $snapshotPath.Path) { + $null = robocopy "$($snapshotPath.Path)/install/logs" "$env:ChocolateyInstall\snapshot\$(Get-Date -Format 'yyyMMdd-HHmmss')" /MIR + # We ignore any errors that may occur on this. + # There are some rare cases where removal fails, and we do not + # want anything to hang or be outputted to the console when the + # removal fails (removal of very long paths seem to fail). + $null = Remove-Item $snapshotPath.Path -Force -Recurse -ErrorAction SilentlyContinue + } + + $env:CHOCOLATEY_TEST_PACKAGES_PATH = "$($snapshotPath.PreviousPath)\packages" + $env:PATH = $snapshotPath.PathVariable + + # We can rely on this simple test, as we do not create the install + # directory during quick snapshot creation + if (Test-Path "$($snapshotPath.PreviousPath)\install") { + $env:ChocolateyInstall = "$($snapshotPath.PreviousPath)\install" + } + else { + $env:ChocolateyInstall = Get-ChocolateyTestLocation + } + + $escapedPath = [regex]::Escape("$env:ChocolateyInstall\bin") + if ($env:PATH -notmatch $escapedPath) { + $env:PATH = "$env:ChocolateyInstall\bin;$env:PATH" + } + } + + if ($RemoveAll.IsPresent -and ($script:snapshots.Count -gt 0)) { + Remove-ChocolateyInstallSnapshot -RemoveAll + } +} diff --git a/tests/helpers/common/Chocolatey/Remove-ChocolateyTestInstall.ps1 b/tests/helpers/common/Chocolatey/Remove-ChocolateyTestInstall.ps1 new file mode 100644 index 0000000000..9a89a4660f --- /dev/null +++ b/tests/helpers/common/Chocolatey/Remove-ChocolateyTestInstall.ps1 @@ -0,0 +1,17 @@ +function Remove-ChocolateyTestInstall { + [CmdletBinding()] + param() + + Remove-ChocolateyInstallSnapshot -RemoveAll + $chocolateyTestDirectory = Get-ChocolateyTestLocation + + if (Test-Path $chocolateyTestDirectory) { + $null = Remove-Item $chocolateyTestDirectory -Force -Recurse + } + elseif (!$chocolateyTestDirectory) { + Write-Warning "No test directory was found!" + } + + $env:ChocolateyInstall = Get-OriginalChocolateyPath + Set-ChocolateyTestLocation -Directory $null +} diff --git a/tests/helpers/common/Chocolatey/Restore-ChocolateyInstallSnapshot.ps1 b/tests/helpers/common/Chocolatey/Restore-ChocolateyInstallSnapshot.ps1 new file mode 100644 index 0000000000..1d738662e2 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Restore-ChocolateyInstallSnapshot.ps1 @@ -0,0 +1,26 @@ +function Restore-ChocolateyInstallSnapshot { + <# + .Synopsis + Removes an existing snapshot, and creates a completely new one. + #> + [CmdletBinding()] + param( + # The location to create the temporary installation + [string]$SnapshotPath = "$(Get-TempDirectory)ChocolateyTests\snapshots\$(New-Guid)", + # Whether the current work directory should be moved to the package + # path + [Alias('SetWorkDir')] + [switch]$SetWorkingDirectory, + + # Whether we should do a quick creation, basically only create a new + # package snapshot directory but without copying over any files from + # the base test installation. + # This can be used when we do not need to change any state, like purely + # calling the help command without changing any configurations. + [Alias('Quick')] + [switch]$NoSnapshotCopy + ) + + Remove-ChocolateyInstallSnapshot + return New-ChocolateyInstallSnapshot -SnapshotPath $SnapshotPath -SetWorkingDirectory:$SetWorkingDirectory -NoSnapshotCopy:$NoSnapshotCopy +} diff --git a/tests/helpers/common/Chocolatey/Set-ChocolateyFeature.ps1 b/tests/helpers/common/Chocolatey/Set-ChocolateyFeature.ps1 new file mode 100644 index 0000000000..ffbf57e193 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Set-ChocolateyFeature.ps1 @@ -0,0 +1,33 @@ +function Set-ChocolateyFeature { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string[]] + $Name, + [Parameter(Mandatory = $true, ParameterSetName='Enable')] + [switch] + $Enable, + [Parameter(Mandatory = $true, ParameterSetName='Disable')] + [switch] + $Disable + ) + $action = $PSCmdlet.ParameterSetName + $failures = $Name | ForEach-Object { + $output = Invoke-Choco feature $action "--name=$_" + if ($output.ExitCode -ne 0) { + Write-Host "An error occurred setting ($action) feature: $_" + Write-Host ("Chocolatey output: {0}{1}{2}" -f $output.ExitCode, ([Environment]::NewLine), $output.String) + $_ + } + } + + if ($failures) { + $errorCountMessage = 'An error has' + if ($failures.Count -gt 1) { + $errorCountMessage = 'Errors have' + $featurePlurality = 's' + } + + throw "{0} occured setting ($action) feature{1}: {2}" -f $errorCountMessage, $featurePlurality, ($failures -join ', ') + } +} diff --git a/tests/helpers/common/Chocolatey/Set-ChocolateyTestLocation.ps1 b/tests/helpers/common/Chocolatey/Set-ChocolateyTestLocation.ps1 new file mode 100644 index 0000000000..728f43c14c --- /dev/null +++ b/tests/helpers/common/Chocolatey/Set-ChocolateyTestLocation.ps1 @@ -0,0 +1,16 @@ +function Set-ChocolateyTestLocation { + <# + .SYNOPSIS + Sets the specified directory as the test + location directory, to be used later in processing. + #> + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "Low")] + param( + [string]$Directory + ) + + # Recommendation from PSScriptAnalyzer to use SupportsShouldProcess + if ($PSCmdlet.ShouldProcess($Directory)) { + $script:chocolateyTestLocation = $Directory + } +} diff --git a/tests/helpers/common/Chocolatey/Test-ChocolateyVersionEqualOrHigherThan.ps1 b/tests/helpers/common/Chocolatey/Test-ChocolateyVersionEqualOrHigherThan.ps1 new file mode 100644 index 0000000000..c66e4497d6 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Test-ChocolateyVersionEqualOrHigherThan.ps1 @@ -0,0 +1,16 @@ +function Test-ChocolateyVersionEqualOrHigherThan { + <# + .Synopsis + Helper function that can be used to assert whether the current + Chocolatey version is equal to or higher than a certain threshold. + #> + [Alias('Test-ChocoVersionEqualOrHigherThan')] + [CmdletBinding()] + [OutputType([boolean])] + param( + [NuGet.Versioning.SemanticVersion]$Version + ) + $installedVersion = ((Invoke-Choco list -lo -r).Lines | ConvertFrom-ChocolateyOutput -Command List | Where-Object Name -eq 'chocolatey').Version + + return Test-VersionEqualOrHigher -InstalledVersion $installedVersion -CompareVersion $Version +} diff --git a/tests/helpers/common/Chocolatey/Test-PackageIsEqualOrHigher.ps1 b/tests/helpers/common/Chocolatey/Test-PackageIsEqualOrHigher.ps1 new file mode 100644 index 0000000000..61bda7ca97 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Test-PackageIsEqualOrHigher.ps1 @@ -0,0 +1,24 @@ +# TODO: Should we cache the result +function Test-PackageIsEqualOrHigher { + [CmdletBinding()] + [OutputType([boolean])] + param( + [Parameter(Mandatory)] + [string]$PackageName, + [Parameter(Mandatory)] + [NuGet.Versioning.SemanticVersion]$Version, + [switch]$AllowMissingPackage + ) + + $package = (Invoke-Choco list --local-only --limitoutput).Lines | + Where-Object { $_ -notmatch 'please upgrade' } | + ConvertFrom-ChocolateyOutput -Command List | + Where-Object Name -EQ $PackageName + if (!$package) { + return $AllowMissingPackage.IsPresent + } + + [NuGet.Versioning.SemanticVersion]$installedVersion = $package.Version + + return Test-VersionEqualOrHigher -InstalledVersion $installedVersion -CompareVersion $Version +} diff --git a/tests/helpers/common/Chocolatey/Test-VersionEqualOrHigher.ps1 b/tests/helpers/common/Chocolatey/Test-VersionEqualOrHigher.ps1 new file mode 100644 index 0000000000..19c6b4ecd0 --- /dev/null +++ b/tests/helpers/common/Chocolatey/Test-VersionEqualOrHigher.ps1 @@ -0,0 +1,47 @@ +function Test-VersionEqualOrHigher { + <# + .SYNOPSIS + Helper function to compare whether the specified InstallVersion + is higher or equal to the version specified in CompareVersion. + #> + [CmdletBinding()] + [OutputType([boolean])] + param( + [Parameter(Mandatory)] + [NuGet.Versioning.SemanticVersion]$InstalledVersion, + [Parameter(Mandatory)] + [NuGet.Versioning.SemanticVersion]$CompareVersion + ) + + if ($installedVersion -gt $CompareVersion) { + return $true + } + + # We are using `ge` here instead of `eq` as it will + # take the correct intention into consideration, and the + # previous `gt` call somehow do not match against all situations + # it is supposed to. + $result = $installedVersion -ge $CompareVersion + + # If the previous assertion is $true, and both the installed + # and the acquired package version are pre-releases, we'll need + # to compare the release part do see which string is higher than the + # other. + # That means alpha < beta, ceta > beta and beta-2016 > beta. + if ($result -and $installedVersion.IsPrerelease -and $CompareVersion.IsPrerelease) { + return $installedVersion.Release -ge $CompareVersion.Release + } + # If the previous assertion was false, we only need to see + # if the acquired package version is a pre-release (assuming both versions were) + # considered somewhat equal. + elseif ($result -and $CompareVersion.IsPrerelease) { + return $true # In this case, the installed version is not a pre-release + } + + # Lastly, if we get here, then either the installed version + # was lower than the acquired package, or the installed version + # is a pre-release while the acquired package version was not. + # To be certain of this, we do an extra check to ensure we + # are returning the correct result to the user. + return $result -and !$installedVersion.IsPrerelease +} diff --git a/tests/helpers/common/Get-TempDirectory.ps1 b/tests/helpers/common/Get-TempDirectory.ps1 new file mode 100644 index 0000000000..e157851aeb --- /dev/null +++ b/tests/helpers/common/Get-TempDirectory.ps1 @@ -0,0 +1,7 @@ +function Get-TempDirectory { + <# + .SYNOPSIS + Returns the temporary directory. + #> + [System.IO.Path]::GetTempPath() +} diff --git a/tests/helpers/common/Logging/Clear-ChocoLogData.ps1 b/tests/helpers/common/Logging/Clear-ChocoLogData.ps1 new file mode 100644 index 0000000000..5c7bff4abc --- /dev/null +++ b/tests/helpers/common/Logging/Clear-ChocoLogData.ps1 @@ -0,0 +1,3 @@ +function Clear-ChocoLogData { + Remove-Item (Get-ChocoLogPath) +} \ No newline at end of file diff --git a/tests/helpers/common/Logging/Get-ChocoLogData.ps1 b/tests/helpers/common/Logging/Get-ChocoLogData.ps1 new file mode 100644 index 0000000000..8a26830ffc --- /dev/null +++ b/tests/helpers/common/Logging/Get-ChocoLogData.ps1 @@ -0,0 +1,8 @@ +function Get-ChocoLogData { + # Strip out the date and other incidental data from the beginning of log lines + $chocoLogData = (Get-Content (Get-ChocoLogPath)) -replace '^\d.* \[', '[' + [PSCustomObject]@{ + Lines = $chocoLogData + String = $chocoLogData -join "`r`n" + } +} \ No newline at end of file diff --git a/tests/helpers/common/Logging/Get-ChocoLogPath.ps1 b/tests/helpers/common/Logging/Get-ChocoLogPath.ps1 new file mode 100644 index 0000000000..fa241d21cb --- /dev/null +++ b/tests/helpers/common/Logging/Get-ChocoLogPath.ps1 @@ -0,0 +1,12 @@ +function Get-ChocoLogPath { + <# + .Synopsis + Helper function to resolve the path to the chocolatey log, or use an environment variable with the path of the Chocolatey executable. + #> + if (Test-Path Env:\CHOCO_EXECUTABLE) { + "$(Split-Path -Parent $env:CHOCO_EXECUTABLE)\logs\chocolatey.log" + } + else { + "$env:ChocolateyInstall\logs\chocolatey.log" + } +} \ No newline at end of file diff --git a/tests/helpers/common/NuGet.Versioning.dll b/tests/helpers/common/NuGet.Versioning.dll new file mode 100644 index 0000000000..21e9536db2 Binary files /dev/null and b/tests/helpers/common/NuGet.Versioning.dll differ diff --git a/tests/helpers/common/Test-ByteOrderMark.ps1 b/tests/helpers/common/Test-ByteOrderMark.ps1 new file mode 100644 index 0000000000..fce10d1d9a --- /dev/null +++ b/tests/helpers/common/Test-ByteOrderMark.ps1 @@ -0,0 +1,40 @@ +# This function is based on the function found here: https://vertigion.com/2015/02/04/powershell-get-fileencoding/ + +function Test-ByteOrderMark { + <# + .SYNOPSIS + Checks a single file if it contains a bye order mark (BOM) or + not. If BOM is found, returns the encoding that were found. + Otherwise, $false is returned. + #> + [CmdletBinding()] + param( + [ValidateScript( { Test-Path $_ })] + [Parameter(Mandatory)] + [string]$Path + ) + [byte[]]$bom = Get-Content -Encoding Byte -ReadCount 4 -TotalCount 4 -Path $Path + + $encoding_found = $false + + foreach ($encoding in [System.Text.Encoding]::GetEncodings().GetEncoding()) { + $preamble = $encoding.GetPreamble() + if ($preamble) { + for ($i = 0; ($i -lt $bom.Length -and $i -lt $preamble.Length); $i++) { + if ($bom[$i] -ne $preamble[$i]) { + break + } + } + + if ($i -eq $preamble.Length) { + $encoding_found = $encoding + } + } + + if ($encoding_found) { + break + } + } + + $encoding_found +} diff --git a/tests/helpers/common/Web/Invoke-DownloadOrCacheFile.ps1 b/tests/helpers/common/Web/Invoke-DownloadOrCacheFile.ps1 new file mode 100644 index 0000000000..06f9236b9e --- /dev/null +++ b/tests/helpers/common/Web/Invoke-DownloadOrCacheFile.ps1 @@ -0,0 +1,63 @@ +function Invoke-DownloadOrCacheFile { + [CmdletBinding()] + [OutputType([string])] + param( + # The url to the resource if it do not already exist in a cache directory. + [parameter(Mandatory)] + [string]$Url, + # The checksum of the resource, if not found or the found file do not match + # the checksum the file will be redownloaded. + # The checksum must be in 'sha1' + [string]$Checksum, + + # The name of the file + [string]$FileName, + + # The output path that any files will be copied to. + [string]$OutFile + ) + + $cacheDirectory = "$(Get-TempDirectory)ChocolateyDownloadCache" + # we do a naive implementation of acquiring the file name. + if (!$fileName) { + $fileName = Split-Path $url -Leaf + } + + $fullPath = "$cacheDirectory\$fileName" + + if (Test-Path $fullPath) { + # We use SHA1 as the checksum, as this is the highest checksum + # visible on hermes. + $actualChecksum = Get-FileHash -Path $fullPath -Algorithm SHA1 | Select-Object -ExpandProperty Hash + if ($actualChecksum -eq $checksum) { + if ($OutFile) { + $null = Copy-Item $fullPath $OutFile + return $OutFile + } + + return $fullPath + } + + $null = Remove-Item $fullPath + } + elseif (!(Test-Path $cacheDirectory)) { + $null = New-Item $cacheDirectory -ItemType Directory + } + + $client = New-Object -TypeName System.Net.WebClient + $null = $client.DownloadFile($Url, $fullPath) + + $actualChecksum = Get-FileHash -Path $fullPath -Algorithm SHA1 | Select-Object -ExpandProperty Hash + + if ($actualChecksum -ne $checksum) { + throw 'Checksum of downloaded file do not match the expected checksum!' + } + + if ($OutFile) { + $null = Copy-Item $fullPath $OutFile + $OutFile + } + else { + $fullPath + } +} diff --git a/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-db/mvcmusicstore-db.nuspec b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-db/mvcmusicstore-db.nuspec new file mode 100644 index 0000000000..fc5edbed08 --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-db/mvcmusicstore-db.nuspec @@ -0,0 +1,25 @@ + + + + + mvcmusicstore-db + 1.0.0 + + + Mvc Music Store Database + Nobody + mvcmusicstore db + Mvc Music Store Database + This is the code that releases the database + v1.0.0 - Initial Release + + + + + + + + + + + diff --git a/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-db/tools/chocolateyinstall.ps1 b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-db/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..c473461c7f --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-db/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Host "Software has been installed" diff --git a/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-web/mvcmusicstore-web.nuspec b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-web/mvcmusicstore-web.nuspec new file mode 100644 index 0000000000..069d773c90 --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-web/mvcmusicstore-web.nuspec @@ -0,0 +1,21 @@ + + + + + mvcmusicstore-web + 1.0.0 + + + Mvc Music Store Web + Nobody + mvcmusicstore-web SPACE_SEPARATED + Mvc Music Store Website + This is the code that releases the website + v1.0.0 - Initial release + + + + + + + diff --git a/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-web/tools/chocolateyinstall.ps1 b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-web/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..c473461c7f --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.0.0/mvcmusicstore-web/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Host "Software has been installed" diff --git a/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-db/mvcmusicstore-db.nuspec b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-db/mvcmusicstore-db.nuspec new file mode 100644 index 0000000000..dd82e806f8 --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-db/mvcmusicstore-db.nuspec @@ -0,0 +1,25 @@ + + + + + mvcmusicstore-db + 1.2.0 + + + Mvc Music Store Database + Nobody + mvcmusicstore db + Mvc Music Store Database + This is the code that releases the database + v1.2.0 - Updated Migration + + + + + + + + + + + diff --git a/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-db/tools/chocolateyinstall.ps1 b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-db/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..c473461c7f --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-db/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Host "Software has been installed" diff --git a/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-web/mvcmusicstore-web.nuspec b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-web/mvcmusicstore-web.nuspec new file mode 100644 index 0000000000..5b847b78fb --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-web/mvcmusicstore-web.nuspec @@ -0,0 +1,21 @@ + + + + + mvcmusicstore-web + 1.2.0 + + + Mvc Music Store Web + Nobody + mvcmusicstore-web SPACE_SEPARATED + Mvc Music Store Website + This is the code that releases the website + v1.2.0 - Minor upgrade + + + + + + + diff --git a/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-web/tools/chocolateyinstall.ps1 b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-web/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..c473461c7f --- /dev/null +++ b/tests/packages/MvcMusicStore/v1.2.0/mvcmusicstore-web/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Host "Software has been installed" diff --git a/tests/packages/business-only-license/business-only-license.nuspec b/tests/packages/business-only-license/business-only-license.nuspec new file mode 100755 index 0000000000..313225f89c --- /dev/null +++ b/tests/packages/business-only-license/business-only-license.nuspec @@ -0,0 +1,18 @@ + + + + + business-only-license + 19.0.0.0 + Igor Pavlov + 7-Zip (Install) + Igor Pavlov + Copyright (c) 1999-2018 Igor Pavlov + 7-zip admin + This package can be used to validate only business licenses can install this package. + + + + + + diff --git a/tests/packages/business-only-license/icons/icon.ico b/tests/packages/business-only-license/icons/icon.ico new file mode 100755 index 0000000000..16ba6baf7e Binary files /dev/null and b/tests/packages/business-only-license/icons/icon.ico differ diff --git a/tests/packages/business-only-license/tools/7z1900-x64.exe b/tests/packages/business-only-license/tools/7z1900-x64.exe new file mode 100755 index 0000000000..406b131964 Binary files /dev/null and b/tests/packages/business-only-license/tools/7z1900-x64.exe differ diff --git a/tests/packages/business-only-license/tools/7z1900-x64.exe.ignore b/tests/packages/business-only-license/tools/7z1900-x64.exe.ignore new file mode 100755 index 0000000000..5f282702bb --- /dev/null +++ b/tests/packages/business-only-license/tools/7z1900-x64.exe.ignore @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/packages/business-only-license/tools/chocolateyinstall.ps1 b/tests/packages/business-only-license/tools/chocolateyinstall.ps1 new file mode 100755 index 0000000000..fca2255f0e --- /dev/null +++ b/tests/packages/business-only-license/tools/chocolateyinstall.ps1 @@ -0,0 +1,31 @@ +$ErrorActionPreference = 'Stop' + +$LicensedCommandsRegistered = Get-Command "Invoke-ValidateChocolateyLicense" -EA SilentlyContinue +if (!$LicensedCommandsRegistered) { + Write-Warning "Package Requires Commercial License - Installation cannot continue as Package Builder use require endpoints to be licensed with Chocolatey Licensed Extension v3.0.0+ (chocolatey.extension). Please see error below for details and correction instructions." + throw "This package requires a commercial edition of Chocolatey as it was built/internalized with commercial features. Please install the license and install/upgrade to Chocolatey Licensed Extension v3.0.0+ as per https://docs.chocolatey.org/en-us/licensed-extension/setup." +} + +Invoke-ValidateChocolateyLicense -RequiredLicenseTypes @('Business') + +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$fileLocation = Join-Path $toolsDir '7z1900-x64.exe' + +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + softwareName = '7-Zip*' + file = $fileLocation + fileType = 'exe' + silentArgs = "/S" + + validExitCodes= @(0) + url = "" + checksum = '0F5D4DBBE5E55B7AA31B91E5925ED901FDF46A367491D81381846F05AD54C45E' + checksumType = 'sha256' + url64bit = "" + checksum64 = '' + checksumType64= 'sha256' + destination = $toolsDir +} + +Install-ChocolateyInstallPackage @packageArgs diff --git a/tests/packages/business-only-license/tools/chocolateyuninstall.ps1 b/tests/packages/business-only-license/tools/chocolateyuninstall.ps1 new file mode 100755 index 0000000000..0260fea52b --- /dev/null +++ b/tests/packages/business-only-license/tools/chocolateyuninstall.ps1 @@ -0,0 +1,26 @@ +$ErrorActionPreference = 'Stop' + +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + softwareName = '7-Zip*' + fileType = 'exe' + silentArgs = "/S" + validExitCodes= @(0) +} + +[array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName'] + +if ($key.Count -eq 1) { + $key | % { + $packageArgs['file'] = "$($_.UninstallString)" + + Uninstall-ChocolateyPackage @packageArgs + } +} elseif ($key.Count -eq 0) { + Write-Warning "$env:ChocolateyPackageName has already been uninstalled by other means." +} elseif ($key.Count -gt 1) { + Write-Warning "$($key.Count) matches found!" + Write-Warning "To prevent accidental data loss, no programs will be uninstalled." + Write-Warning "Please alert package maintainer the following keys were matched:" + $key | % {Write-Warning "- $($_.DisplayName)"} +} diff --git a/tests/packages/circulardependency1/README.md b/tests/packages/circulardependency1/README.md new file mode 100644 index 0000000000..d6ffe24a9b --- /dev/null +++ b/tests/packages/circulardependency1/README.md @@ -0,0 +1,11 @@ +# circulardependency1 + +## Purpose + +The purpose of this package is for testing of circular dependencies. Currently Chocolatey prevents them on a `choco install`, but choco-licensed `convert` and `push` commands currently don't prevent it. + +Current (as of October 1 2021) behaviour: + +* `choco install circulardependency1` results in an error indicating that a circular dependency has been detected. +* `choco convert circulardependency1.0.0.1.nupkg --to intune` results in `intunewin` files being created +* `choco push circulardependency1.0.0.1.intunewin` results in a circular loop indicating `circulardepency[12] is not in Intune` until the Intune authentication token expires at which point you'll be told it's expired. diff --git a/tests/packages/circulardependency1/circulardependency1.nuspec b/tests/packages/circulardependency1/circulardependency1.nuspec new file mode 100644 index 0000000000..fad4f54162 --- /dev/null +++ b/tests/packages/circulardependency1/circulardependency1.nuspec @@ -0,0 +1,16 @@ + + + + circulardependency1 + 0.0.1 + circulardependency1 (Install) + Chocolatey Software + circulardependency1 SPACE_SEPARATED + Test of circular dependencies + Circular dependencies are not supported by Chocolatey. `choco install` should fail when it encounters them. + + + + + + diff --git a/tests/packages/circulardependency2/README.md b/tests/packages/circulardependency2/README.md new file mode 100644 index 0000000000..d6ffe24a9b --- /dev/null +++ b/tests/packages/circulardependency2/README.md @@ -0,0 +1,11 @@ +# circulardependency1 + +## Purpose + +The purpose of this package is for testing of circular dependencies. Currently Chocolatey prevents them on a `choco install`, but choco-licensed `convert` and `push` commands currently don't prevent it. + +Current (as of October 1 2021) behaviour: + +* `choco install circulardependency1` results in an error indicating that a circular dependency has been detected. +* `choco convert circulardependency1.0.0.1.nupkg --to intune` results in `intunewin` files being created +* `choco push circulardependency1.0.0.1.intunewin` results in a circular loop indicating `circulardepency[12] is not in Intune` until the Intune authentication token expires at which point you'll be told it's expired. diff --git a/tests/packages/circulardependency2/circulardependency2.nuspec b/tests/packages/circulardependency2/circulardependency2.nuspec new file mode 100644 index 0000000000..294b167284 --- /dev/null +++ b/tests/packages/circulardependency2/circulardependency2.nuspec @@ -0,0 +1,16 @@ + + + + circulardependency2 + 0.0.1 + circulardependency2 (Install) + Chocolatey Software + circulardependency1 SPACE_SEPARATED + Test of circular dependencies + Circular dependencies are not supported by Chocolatey. `choco install` should fail when it encounters them. + + + + + + diff --git a/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/get-chocolateyunzip-test.nuspec b/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/get-chocolateyunzip-test.nuspec new file mode 100644 index 0000000000..6cd1b07357 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/get-chocolateyunzip-test.nuspec @@ -0,0 +1,17 @@ + + + + get-chocolateyunzip-custom-paths + 0.0.1 + get-chocolateyunzip-custom-paths (Install) + Test + Test + false + Package to test Get-ChocolateyUnzip. Specifically designed for testing custom paths like those identified in https://github.com/chocolatey/chocolatey-licensed-issues/issues/284 + Package to test Get-ChocolateyUnzip + get-chocolateyunzip issue test + + + + + \ No newline at end of file diff --git a/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/tools/chocolateyinstall.ps1 b/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..57adf85c28 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/tools/chocolateyinstall.ps1 @@ -0,0 +1,10 @@ +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$zipFileLocation = Join-Path $toolsDir "test.zip" +$pp = Get-PackageParameters +if ($pp['Destination']) { + $destinationPath = $pp['Destination'] +} else { + $destinationPath = $env:TEMP +} + +Get-ChocolateyUnzip -FileFullPath $zipFileLocation -Destination $destinationPath diff --git a/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/tools/test.zip b/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/tools/test.zip new file mode 100644 index 0000000000..7081cef761 Binary files /dev/null and b/tests/packages/get-chocolateyunzip-custom-paths/0.0.1/tools/test.zip differ diff --git a/tests/packages/get-chocolateyunzip-licensed/README.md b/tests/packages/get-chocolateyunzip-licensed/README.md new file mode 100755 index 0000000000..7d68a9ab1a --- /dev/null +++ b/tests/packages/get-chocolateyunzip-licensed/README.md @@ -0,0 +1,5 @@ +This package contains a commercial edition of the cmdlet `Get-ChocolateyUnzip`, and can be used to verify that installation with that cmdlet works as intended. + +Additionally it can be tested that the package will fail if being installed on FOSS Edition of Chocolatey. + +The package defines the license types `business`, `Education` and `professional` as being valid licenses. \ No newline at end of file diff --git a/tests/packages/get-chocolateyunzip-licensed/TODO.txt b/tests/packages/get-chocolateyunzip-licensed/TODO.txt new file mode 100755 index 0000000000..12deff335e --- /dev/null +++ b/tests/packages/get-chocolateyunzip-licensed/TODO.txt @@ -0,0 +1,11 @@ +=================================== +TODO for get-chocolateyunzip-licensed +=================================== + +This TODO has been generated after running Package Builder against Programs and Features. +There are some things that are required to finish out the creation of this package. +This doesn't serve as a complete list. + + +This package needs the following items to be complete: + * tools\ChocolateyInstall.ps1 - Set silent arguments diff --git a/tests/packages/get-chocolateyunzip-licensed/get-chocolateyunzip-licensed.nuspec b/tests/packages/get-chocolateyunzip-licensed/get-chocolateyunzip-licensed.nuspec new file mode 100755 index 0000000000..a1daaef7c5 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-licensed/get-chocolateyunzip-licensed.nuspec @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + get-chocolateyunzip-licensed + + + + 3.21.2 + + __REPLACE__ + + + + + __REPLACE__ (Portable) + __REPLACE__ + + __REPLACE__ + get-chocolateyunzip-licensed + __REPLACE__MarkDown_Okay + + + + + + + + + + + + + + diff --git a/tests/packages/get-chocolateyunzip-licensed/tools/chocolateyinstall.ps1 b/tests/packages/get-chocolateyunzip-licensed/tools/chocolateyinstall.ps1 new file mode 100755 index 0000000000..e10b6bb76e --- /dev/null +++ b/tests/packages/get-chocolateyunzip-licensed/tools/chocolateyinstall.ps1 @@ -0,0 +1,47 @@ +$ErrorActionPreference = 'Stop' + +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$fileLocation = Join-Path $toolsDir 'cmake-3.21.2-windows-i386.zip' +$fileLocation64 = Join-Path $toolsDir 'cmake-3.21.2-windows-x86_64.zip' +if (Get-ProcessorBits 64) { +$forceX86 = $env:chocolateyForceX86 + if ($forceX86 -eq 'true') { + Write-Debug "User specified '-x86' so forcing 32-bit" + } else { + $fileLocation = $fileLocation64 + } +} + +#Based on Custom +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + softwareName = 'get-chocolateyunzip-licensed*' + file = $fileLocation + fileType = 'zip' + silentArgs = "" + #OTHERS + # Uncomment matching EXE type (sorted by most to least common) + #$silentArgs = '/S' # NSIS + #silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' # Inno Setup + #silentArgs = '/s' # InstallShield + #silentArgs = '/s /v"/qn"' # InstallShield with MSI + #silentArgs = '/s' # Wise InstallMaster + #silentArgs = '-s' # Squirrel + #silentArgs = '-q' # Install4j + #silentArgs = '-s' # Ghost + # Note that some installers, in addition to the silentArgs above, may also need assistance of AHK to achieve silence. + #silentArgs = '' # none; make silent with input macro script like AutoHotKey (AHK) + # https://chocolatey.org/packages/autohotkey.portable + + validExitCodes= @(0) + url = "" + checksum = '9374249E8CA5CFE899F6A8DC95252E79242290E452B3CE12A88449560143B6E9' + checksumType = 'sha256' + url64bit = "" + checksum64 = '213A4E6485B711CB0A48CBD97B10DFE161A46BFE37B8F3205F47E99FFEC434D2' + checksumType64= 'sha256' + destination = $toolsDir +} + +Get-ChocolateyUnzipCmdlet @packageArgs + diff --git a/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-i386.zip b/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-i386.zip new file mode 100644 index 0000000000..0dd614f04d Binary files /dev/null and b/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-i386.zip differ diff --git a/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-i386/noop b/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-i386/noop new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-x86_64.zip b/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-x86_64.zip new file mode 100644 index 0000000000..4c3ebffa3d Binary files /dev/null and b/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-x86_64.zip differ diff --git a/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-x86_64/noop b/tests/packages/get-chocolateyunzip-licensed/tools/cmake-3.21.2-windows-x86_64/noop new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/packages/get-chocolateyunzip-test/0.0.1/get-chocolateyunzip-test.nuspec b/tests/packages/get-chocolateyunzip-test/0.0.1/get-chocolateyunzip-test.nuspec new file mode 100644 index 0000000000..47b46f2135 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-test/0.0.1/get-chocolateyunzip-test.nuspec @@ -0,0 +1,14 @@ + + + + get-chocolateyunzip-test + 0.0.1 + get-chocolateyunzip-test (Install) + Test + Test + false + Package to test Get-ChocolateyUnzip + Package to test Get-ChocolateyUnzip + get-chocolateyunzip issue test + + \ No newline at end of file diff --git a/tests/packages/get-chocolateyunzip-test/0.0.1/tools/chocolateyinstall.ps1 b/tests/packages/get-chocolateyunzip-test/0.0.1/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..8b09d934c8 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-test/0.0.1/tools/chocolateyinstall.ps1 @@ -0,0 +1,17 @@ +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$zipFileLocation = Join-Path $toolsDir "test.zip" + +if ((Get-Location) -eq $null) +{ + Write-Warning "Working Directory not set. Setting to '$env:ChocolateyInstall'" + Set-Location $env:ChocolateyInstall #See https://github.com/chocolatey/choco/issues/1781 +} +if ([string]::IsNullOrEmpty((Get-Location))) +{ + Write-Warning "Working Directory is an empty string. Setting to '$env:ChocolateyInstall'" + Set-Location $env:ChocolateyInstall #See https://github.com/chocolatey/choco/issues/1781 +} + +Write-Debug "Working Directory is now '$(Get-Location)'" + +Get-ChocolateyUnzip -FileFullPath $zipFileLocation -Destination $toolsDir diff --git a/tests/packages/get-chocolateyunzip-test/0.0.1/tools/test.zip b/tests/packages/get-chocolateyunzip-test/0.0.1/tools/test.zip new file mode 100644 index 0000000000..15cb0ecb3e Binary files /dev/null and b/tests/packages/get-chocolateyunzip-test/0.0.1/tools/test.zip differ diff --git a/tests/packages/get-chocolateyunzip-test/0.0.2/get-chocolateyunzip-test.nuspec b/tests/packages/get-chocolateyunzip-test/0.0.2/get-chocolateyunzip-test.nuspec new file mode 100644 index 0000000000..986ad73d77 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-test/0.0.2/get-chocolateyunzip-test.nuspec @@ -0,0 +1,18 @@ + + + + get-chocolateyunzip-test + 0.0.2 + get-chocolateyunzip-test (Install) + Test + Test + false + Package to test Get-ChocolateyUnzip + Package to test Get-ChocolateyUnzip + get-chocolateyunzip issue test + + + + + + \ No newline at end of file diff --git a/tests/packages/get-chocolateyunzip-test/0.0.2/tools/chocolateyinstall.ps1 b/tests/packages/get-chocolateyunzip-test/0.0.2/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..60b8b650b0 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-test/0.0.2/tools/chocolateyinstall.ps1 @@ -0,0 +1,15 @@ +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$zipFileLocation = Join-Path $toolsDir "test.zip" + +if ((Get-Location) -eq $null) { + Write-Warning "Working Directory not set. Setting to '$env:ChocolateyInstall'" + Set-Location $env:ChocolateyInstall #See https://github.com/chocolatey/choco/issues/1781 +} +if ([string]::IsNullOrEmpty((Get-Location))) { + Write-Warning "Working Directory is an empty string. Setting to '$env:ChocolateyInstall'" + Set-Location $env:ChocolateyInstall #See https://github.com/chocolatey/choco/issues/1781 +} + +Write-Debug "Working Directory is now '$(Get-Location)'" + +Get-ChocolateyUnzip -FileFullPath $zipFileLocation -UnzipLocation $toolsDir diff --git a/tests/packages/get-chocolateyunzip-test/0.0.2/tools/purpose.txt b/tests/packages/get-chocolateyunzip-test/0.0.2/tools/purpose.txt new file mode 100644 index 0000000000..0d6b5baaa4 --- /dev/null +++ b/tests/packages/get-chocolateyunzip-test/0.0.2/tools/purpose.txt @@ -0,0 +1 @@ +This package is intended to test wether enhancement request https://github.com/chocolatey/choco/issues/2203 is implemented. \ No newline at end of file diff --git a/tests/packages/hasbeforeinstallblock/1.0.0/Readme.md b/tests/packages/hasbeforeinstallblock/1.0.0/Readme.md new file mode 100644 index 0000000000..7660f70fa3 --- /dev/null +++ b/tests/packages/hasbeforeinstallblock/1.0.0/Readme.md @@ -0,0 +1,7 @@ +This package can be used for testing both downloading remote MSI installers from a known location (GitHub), +as well as testing whether the new functionality in 0.10.16 that adds the ability to run a before install block +works as expected. + +Additionally, this package can be used to test against different type of checksums as well. +The parameter '/Algorithm' can be used to test the actual algorithm, and the parameter '/Checksum' can be used +to test with a different checksum value. \ No newline at end of file diff --git a/tests/packages/hasbeforeinstallblock/1.0.0/hasbeforeinstallblock.nuspec b/tests/packages/hasbeforeinstallblock/1.0.0/hasbeforeinstallblock.nuspec new file mode 100644 index 0000000000..fe282f57a1 --- /dev/null +++ b/tests/packages/hasbeforeinstallblock/1.0.0/hasbeforeinstallblock.nuspec @@ -0,0 +1,25 @@ + + + + + hasbeforeinstallblock + 1.0.0 + hasbeforeinstallblock (Using ChocolateyGUI) + Who Wants It + https://test.com + hasbeforeinstallblock remote before-install + Remote MSI installation package with a before install block + +This package can be used for testing both downloading remote MSI installers from a known location (GitHub), +as well as testing whether the new functionality in 0.10.16 that adds the ability to run a before install block +works as expected. + +Additionally, this package can be used to test against different type of checksums as well. +The parameter '/Algorithm' can be used to test the actual algorithm, and the parameter '/Checksum' can be used +to test with a different checksum value. + + + + + + diff --git a/tests/packages/hasbeforeinstallblock/1.0.0/tools/chocolateyinstall.ps1 b/tests/packages/hasbeforeinstallblock/1.0.0/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..a7cda6409c --- /dev/null +++ b/tests/packages/hasbeforeinstallblock/1.0.0/tools/chocolateyinstall.ps1 @@ -0,0 +1,60 @@ +$ErrorActionPreference = 'Stop' # stop on all errors + +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + fileType = 'msi' + url = 'https://github.com/chocolatey/ChocolateyGUI/releases/download/0.18.1/ChocolateyGUI.msi' + + softwareName = 'Chocolatey GUI*' + + checksum = '' + checksumType = 'sha256' + + # MSI + silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`"" # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0 + validExitCodes= @(0, 3010, 1641) + + beforeInstall = { + # This is just to notify that the before install script + # block have been ran + Write-Host "Running necessary Pre-Install step" + } +} + +$pp = Get-PackageParameters + +$algorithms = @{ + "MD5" = "27272275D1851F8E68C02BCE79538E2A" + "SHA1" = "2D8214F84162069FB809776287DBB5BCAA5AE725" + "SHA256" = "490DCAC8A2BF52CB55A84686EEB2D23A4B303578AE09A0290D3208AEFBE5B59D" + "SHA512" = "D8FB6BE60863D145CEE1CF12AEA66C6E5042CE0C04DB6FABF4C2659EEE87C63E6830514945C56B059B76311C02CC6AFD64BC73FF3AF0B4EE993CCA4545BF0FD3" +} + +if ($pp.Algorithm) { + if ($pp.Algorithm -eq $true) { + # This allows us to test when the checksum type is specified + # but is set to empty + $packageArgs["checksumType"] = "" + $packageArgs["checksum"] = $algorithms["MD5"] # Default is MD5 when type is not specified, or is empty + } + else { + $packageArgs["checksumType"] = $pp.Algorithm + $packageArgs["checksum"] = $algorithms[$pp.Algorithm] + } +} else { + $packageArgs["checksum"] = $algorithms["SHA256"] +} + +if ($pp.Checksum) { + if ($pp.Checksum -eq $true) { + # This allows us to test when there is an empty checksum + $packageArgs["checksum"] = "" + } else { + $packageArgs["checksum"] = $pp.Checksum + } +} + +Write-Host "Using Algorithm: $($packageArgs["checksumType"])" +Write-Host "Expects checksum: $($packageArgs["checksum"])" + +Install-ChocolateyPackage @packageArgs diff --git a/tests/packages/hasoutofrangedependency/1.0.0/hasnesteddependency.nuspec b/tests/packages/hasoutofrangedependency/1.0.0/hasnesteddependency.nuspec new file mode 100644 index 0000000000..612431a177 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/1.0.0/hasnesteddependency.nuspec @@ -0,0 +1,22 @@ + + + + hasoutofrangedependency + 1.0.0 + Has out of range Dependency + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + Package to test for out of range dependencies. This 1st version have a valid exact range. + + + hasoutofrangedependency admin + + + + + + + + diff --git a/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateybeforemodify.ps1 b/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..7d0b91fece --- /dev/null +++ b/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateybeforemodify.ps1 @@ -0,0 +1 @@ +Write-Output "Upgrading or Uninstalling $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateyinstall.ps1 b/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..d64eb8f47b --- /dev/null +++ b/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Installed" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateyuninstall.ps1 b/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/1.0.0/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.0/hasnesteddependency.nuspec b/tests/packages/hasoutofrangedependency/2.0.0/hasnesteddependency.nuspec new file mode 100644 index 0000000000..de600986ad --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.0/hasnesteddependency.nuspec @@ -0,0 +1,22 @@ + + + + hasoutofrangedependency + 2.0.0 + Has out of range Dependency (Below available) + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + Package to test for out of range dependencies. This version uses a dependency that require a lower version. + + + hasoutofrangedependency admin + + + + + + + + diff --git a/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateybeforemodify.ps1 b/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..7d0b91fece --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateybeforemodify.ps1 @@ -0,0 +1 @@ +Write-Output "Upgrading or Uninstalling $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateyinstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..d64eb8f47b --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Installed" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateyuninstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.0/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.1/hasnesteddependency.nuspec b/tests/packages/hasoutofrangedependency/2.0.1/hasnesteddependency.nuspec new file mode 100644 index 0000000000..3a014300da --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.1/hasnesteddependency.nuspec @@ -0,0 +1,22 @@ + + + + hasoutofrangedependency + 2.0.1 + Has out of range Dependency (Between available) + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + Package to test for out of range dependencies. This version uses a dependency that require a version between available + + + hasoutofrangedependency admin + + + + + + + + diff --git a/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateybeforemodify.ps1 b/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..7d0b91fece --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateybeforemodify.ps1 @@ -0,0 +1 @@ +Write-Output "Upgrading or Uninstalling $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateyinstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..d64eb8f47b --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Installed" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateyuninstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.1/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.2/hasnesteddependency.nuspec b/tests/packages/hasoutofrangedependency/2.0.2/hasnesteddependency.nuspec new file mode 100644 index 0000000000..66b9f7668b --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.2/hasnesteddependency.nuspec @@ -0,0 +1,22 @@ + + + + hasoutofrangedependency + 2.0.2 + Has out of range Dependency (Exact unavailable) + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + Package to test for out of range dependencies. This version uses a dependency that require an exact version that do not exist. + + + hasoutofrangedependency admin + + + + + + + + diff --git a/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateybeforemodify.ps1 b/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..7d0b91fece --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateybeforemodify.ps1 @@ -0,0 +1 @@ +Write-Output "Upgrading or Uninstalling $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateyinstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..d64eb8f47b --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Installed" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateyuninstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.2/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.3/hasnesteddependency.nuspec b/tests/packages/hasoutofrangedependency/2.0.3/hasnesteddependency.nuspec new file mode 100644 index 0000000000..909621e2a5 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.3/hasnesteddependency.nuspec @@ -0,0 +1,22 @@ + + + + hasoutofrangedependency + 2.0.3 + Has out of range Dependency (Above available) + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + __REPLACE__ + Package to test for out of range dependencies. This version uses a dependency that require a higher version. + + + hasoutofrangedependency admin + + + + + + + + diff --git a/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateybeforemodify.ps1 b/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..7d0b91fece --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateybeforemodify.ps1 @@ -0,0 +1 @@ +Write-Output "Upgrading or Uninstalling $env:PackageName $env:PackageVersion" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateyinstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..d64eb8f47b --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Installed" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateyuninstall.ps1 b/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..9ead91ffa3 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/2.0.3/tools/chocolateyuninstall.ps1 @@ -0,0 +1 @@ +Write-Output "$env:PackageName $env:PackageVersion Uninstalled" \ No newline at end of file diff --git a/tests/packages/hasoutofrangedependency/Readme.md b/tests/packages/hasoutofrangedependency/Readme.md new file mode 100644 index 0000000000..385e2446b4 --- /dev/null +++ b/tests/packages/hasoutofrangedependency/Readme.md @@ -0,0 +1,7 @@ +This package can be used to test the installation or upgrading of packages that have out-of-range dependencies. + +- Version 1.0.0 Contains a valid range that can be used in an upgrade scenario and has an exact version dependency on `hasdependency 1.0.0` +- Version 2.0.0 Contains an invalid maximum dependency on `hasdependency` with a version lower than `1.0.0` +- Version 2.0.1 Contains an invalid dependency on `hasdependency` with versions between `1.1.1` and `1.4.0` +- Version 2.0.2 Contains an invalid dependency on `hasdependency` with an exact version of `1.3.0` +- Version 2.0.3 Contains an invalid minimum dependency on `hasdependency` with a version higher than `2.2.0` diff --git a/tests/packages/msi.template/msi.template.nuspec b/tests/packages/msi.template/msi.template.nuspec new file mode 100644 index 0000000000..e3a7f33688 --- /dev/null +++ b/tests/packages/msi.template/msi.template.nuspec @@ -0,0 +1,40 @@ + + + + msi.template + 1.0.2 + https://github.com/ferventcoder/chocolatey-packages + Rob Reynolds, Chocolatey + Chocolatey MSI Template + Rob Reynolds, The Chocolatey Team + https://github.com/chocolatey/choco + https://github.com/chocolatey/choco/raw/master/docs/logo/chocolateyicon.gif + RealDimensions Software, LLC - 2016-Present + https://raw.githubusercontent.com/chocolatey/choco/master/LICENSE + false + + msi package template + https://github.com/chocolatey/choco + MSI Chocolatey template + ### Chocolatey MSI Template +This adds a template for MSI packages. + + + +### 1.0.2 + +Removed aliases from Install script for clarity. + +### 1.0.1 + +Ensure `fileType` is MSI + +### 1.0.0 + +Initial + + + + + + diff --git a/tests/packages/msi.template/templates/ReadMe.md b/tests/packages/msi.template/templates/ReadMe.md new file mode 100644 index 0000000000..49f29587e1 --- /dev/null +++ b/tests/packages/msi.template/templates/ReadMe.md @@ -0,0 +1,91 @@ +## Summary +How do I create packages? See https://chocolatey.org/docs/create-packages + +If you are submitting packages to the community feed (https://chocolatey.org) +always try to ensure you have read, understood and adhere to the create +packages wiki link above. + +## Automatic Packaging Updates? +Consider making this package an automatic package, for the best +maintainability over time. Read up at https://chocolatey.org/docs/automatic-packages + +## Shim Generation +Any executables you include in the package or download (but don't call +install against using the built-in functions) will be automatically shimmed. + +This means those executables will automatically be included on the path. +Shim generation runs whether the package is self-contained or uses automation +scripts. + +By default, these are considered console applications. + +If the application is a GUI, you should create an empty file next to the exe +named 'name.exe.gui' e.g. 'bob.exe' would need a file named 'bob.exe.gui'. +See https://chocolatey.org/docs/create-packages#how-do-i-set-up-shims-for-applications-that-have-a-gui + +If you want to ignore the executable, create an empty file next to the exe +named 'name.exe.ignore' e.g. 'bob.exe' would need a file named +'bob.exe.ignore'. +See https://chocolatey.org/docs/create-packages#how-do-i-exclude-executables-from-getting-shims + +## Self-Contained? +If you have a self-contained package, you can remove the automation scripts +entirely and just include the executables, they will automatically get shimmed, +which puts them on the path. Ensure you have the legal right to distribute +the application though. See https://chocolatey.org/docs/legal. + +You should read up on the Shim Generation section to familiarize yourself +on what to do with GUI applications and/or ignoring shims. + +## Automation Scripts +You have a powerful use of Chocolatey, as you are using PowerShell. So you +can do just about anything you need. Choco has some very handy built-in +functions that you can use, these are sometimes called the helpers. + +### Built-In Functions +https://chocolatey.org/docs/helpers-reference + +A note about a couple: +* Get-BinRoot - this is a horribly named function that doesn't do what new folks think it does. It gets you the 'tools' root, which by default is set to 'c:\tools', not the chocolateyInstall bin folder - see https://chocolatey.org/docs/helpers-get-tools-location +* Install-BinFile - used for non-exe files - executables are automatically shimmed... - see https://chocolatey.org/docs/helpers-install-bin-file +* Uninstall-BinFile - used for non-exe files - executables are automatically shimmed - see https://chocolatey.org/docs/helpers-uninstall-bin-file + +### Getting package specific information +Use the package parameters pattern - see https://chocolatey.org/docs/how-to-parse-package-parameters-argument + +### Need to mount an ISO? +https://chocolatey.org/docs/how-to-mount-an-iso-in-chocolatey-package + + +### Environment Variables +Chocolatey makes a number of environment variables available (You can access any of these with $env:TheVariableNameBelow): + + * TEMP = Overridden to the CacheLocation, but may be the same as the original TEMP folder + * ChocolateyInstall = Top level folder where Chocolatey is installed + * chocolateyPackageName = The name of the package, equivalent to the id in the nuspec (0.9.9+) + * chocolateyPackageVersion = The version of the package, equivalent to the version in the nuspec (0.9.9+) + * chocolateyPackageFolder = The top level location of the package folder + +#### Advanced Environment Variables +The following are more advanced settings: + + * chocolateyPackageParameters = (0.9.8.22+) + * CHOCOLATEY_VERSION = The version of Choco you normally see. Use if you are 'lighting' things up based on choco version. (0.9.9+) + - Otherwise take a dependency on the specific version you need. + * chocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. (0.9.9+) + - Automatically handled in built in Choco functions. + * OS_PLATFORM = Like Windows, macOS, Linux. (0.9.9+) + * OS_VERSION = The version of OS, like 6.1 something something for Windows. (0.9.9+) + * OS_NAME = The reported name of the OS. (0.9.9+) + * IS_PROCESSELEVATED = Is the process elevated? (0.9.9+) + +#### Experimental Environment Variables +The following are experimental or use not recommended: + + * OS_IS64BIT = This may not return correctly - it may depend on the process the app is running under (0.9.9+) + * CHOCOLATEY_VERSION_PRODUCT = the version of Choco that may match CHOCOLATEY_VERSION but may be different (0.9.9+) + - it's based on git describe + * IS_ADMIN = Is the user an administrator? But doesn't tell you if the process is elevated. (0.9.9+) + * chocolateyInstallOverride = Not for use in package automation scripts. (0.9.9+) + * chocolateyInstallArguments = the installer arguments meant for the native installer. You should use chocolateyPackageParameters intead. (0.9.9+) + diff --git a/tests/packages/msi.template/templates/msi.nuspec.template b/tests/packages/msi.template/templates/msi.nuspec.template new file mode 100644 index 0000000000..4f718820fa --- /dev/null +++ b/tests/packages/msi.template/templates/msi.nuspec.template @@ -0,0 +1,63 @@ + + + + + + + + + + + [[PackageNameLower]] + + + + [[PackageVersion]] + + http://github.com/[[MaintainerRepo]]/[[PackageNameLower]] + + [[MaintainerName]] + + + + + [[PackageName]] (Install) + __REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__ + + https://_Software_Location_REMOVE_OR_FILL_OUT_ + + + + + + + + + [[PackageNameLower]] admin SPACE_SEPARATED + __REPLACE__ + __REPLACE__MarkDown_Okay [[AutomaticPackageNotesNuspec]] + + + + + + + + + + + + + + + + + diff --git a/tests/packages/msi.template/templates/tools/LICENSE.txt b/tests/packages/msi.template/templates/tools/LICENSE.txt new file mode 100644 index 0000000000..e04744b63f --- /dev/null +++ b/tests/packages/msi.template/templates/tools/LICENSE.txt @@ -0,0 +1,11 @@ + +Note: Include this file if including binaries you have the right to distribute. +Otherwise delete. this file. + +===DELETE ABOVE THIS LINE AND THIS LINE=== + +From: + +LICENSE + + diff --git a/tests/packages/msi.template/templates/tools/VERIFICATION.txt b/tests/packages/msi.template/templates/tools/VERIFICATION.txt new file mode 100644 index 0000000000..1a34ca0cf9 --- /dev/null +++ b/tests/packages/msi.template/templates/tools/VERIFICATION.txt @@ -0,0 +1,11 @@ + +Note: Include this file if including binaries you have the right to distribute. +Otherwise delete. this file. + +===DELETE ABOVE THIS LINE AND THIS LINE=== + +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's contents are trustworthy. + + \ No newline at end of file diff --git a/tests/packages/msi.template/templates/tools/chocolateybeforemodify.ps1 b/tests/packages/msi.template/templates/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..9588ffe803 --- /dev/null +++ b/tests/packages/msi.template/templates/tools/chocolateybeforemodify.ps1 @@ -0,0 +1,9 @@ +# This runs in 0.9.10+ before upgrade and uninstall. +# Use this file to do things like stop services prior to upgrade or uninstall. +# NOTE: It is an anti-pattern to call chocolateyUninstall.ps1 from here. If you +# need to uninstall an MSI prior to upgrade, put the functionality in this +# file without calling the uninstall script. Make it idempotent in the +# uninstall script so that it doesn't fail when it is already uninstalled. +# NOTE: For upgrades - like the uninstall script, this script always runs from +# the currently installed version, not from the new upgraded package version. + diff --git a/tests/packages/msi.template/templates/tools/chocolateyinstall.ps1 b/tests/packages/msi.template/templates/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..1a7f6a7372 --- /dev/null +++ b/tests/packages/msi.template/templates/tools/chocolateyinstall.ps1 @@ -0,0 +1,32 @@ +$ErrorActionPreference = 'Stop' + +[[AutomaticPackageNotesInstaller]] +$packageName= '[[PackageName]]' +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +#$fileLocation = Join-Path $toolsDir 'NAME_OF_EMBEDDED_INSTALLER_FILE' + +$packageArgs = @{ + packageName = $packageName + unzipLocation = $toolsDir + fileType = 'MSI' + url = '[[Url]]' # download url, HTTPS preferred + url64bit = '[[Url64]]' # 64bit URL here (HTTPS preferred) or remove - if installer contains both (very rare), use $url + #file = $fileLocation + + softwareName = '[[PackageName]]*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique + + checksum = '[[Checksum]]' + checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512 + checksum64 = '[[Checksum64]]' + checksumType64= 'sha256' + + silentArgs = "[[SilentArgs]]" # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0 + validExitCodes= @(0, 3010, 1641) +} + +#https://chocolatey.org/docs/helpers-install-chocolatey-package +Install-ChocolateyPackage @packageArgs +## If you are making your own internal packages (organizations), you can embed the installer or +## put on internal file share and use the following instead (you'll need to add $file to the above) +# https://chocolatey.org/docs/helpers-install-chocolatey-install-package +#Install-ChocolateyInstallPackage @packageArgs diff --git a/tests/packages/msi.template/templates/tools/chocolateyuninstall.ps1 b/tests/packages/msi.template/templates/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..63b9c4781f --- /dev/null +++ b/tests/packages/msi.template/templates/tools/chocolateyuninstall.ps1 @@ -0,0 +1,47 @@ +$ErrorActionPreference = 'Stop' # stop on all errors + +$packageName = '[[PackageName]]' +$softwareName = '[[PackageName]]*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique +$installerType = 'MSI' +$silentArgs = '/qn /norestart' +# https://msdn.microsoft.com/en-us/library/aa376931(v=vs.85).aspx +$validExitCodes = @(0, 3010, 1605, 1614, 1641) + +$uninstalled = $false +# Get-UninstallRegistryKey is new to 0.9.10, if supporting 0.9.9.x and below, +# take a dependency on "chocolatey-uninstall.extension" in your nuspec file. +# This is only a fuzzy search if $softwareName includes '*'. Otherwise it is +# exact. In the case of versions in key names, we recommend removing the version +# and using '*'. +[array]$key = Get-UninstallRegistryKey -SoftwareName $softwareName + +if ($key.Count -eq 1) { + $key | ForEach-Object { + $file = "$($_.UninstallString)" + + if ($installerType -eq 'MSI') { + # The Product Code GUID is all that should be passed for MSI, and very + # FIRST, because it comes directly after /x, which is already set in the + # Uninstall-ChocolateyPackage msiargs (facepalm). + $silentArgs = "$($_.PSChildName) $silentArgs" + + # Don't pass anything for file, it is ignored for msi (facepalm number 2) + # Alternatively if you need to pass a path to an msi, determine that and + # use it instead of the above in silentArgs, still very first + $file = '' + } + + Uninstall-ChocolateyPackage -PackageName $packageName ` + -FileType $installerType ` + -SilentArgs "$silentArgs" ` + -ValidExitCodes $validExitCodes ` + -File "$file" + } +} elseif ($key.Count -eq 0) { + Write-Warning "$packageName has already been uninstalled by other means." +} elseif ($key.Count -gt 1) { + Write-Warning "$key.Count matches found!" + Write-Warning "To prevent accidental data loss, no programs will be uninstalled." + Write-Warning "Please alert package maintainer the following keys were matched:" + $key | ForEach-Object {Write-Warning "- $_.DisplayName"} +} \ No newline at end of file diff --git a/tests/packages/package.extension/extensions/Test-ExtensionAvailable.ps1 b/tests/packages/package.extension/extensions/Test-ExtensionAvailable.ps1 new file mode 100644 index 0000000000..5fc30cc0b4 --- /dev/null +++ b/tests/packages/package.extension/extensions/Test-ExtensionAvailable.ps1 @@ -0,0 +1,3 @@ +function Test-ExtensionAvailable() { + Write-Host "Extension is available. Success!!" +} \ No newline at end of file diff --git a/tests/packages/package.extension/extensions/package.psm1 b/tests/packages/package.extension/extensions/package.psm1 new file mode 100644 index 0000000000..859845d29a --- /dev/null +++ b/tests/packages/package.extension/extensions/package.psm1 @@ -0,0 +1,4 @@ +$scriptRoot = Split-Path $MyInvocation.MyCommand.Definition + +. "$scriptRoot\Test-ExtensionAvailable.ps1" +Export-ModuleMember -Function "Test-ExtensionAvailable" \ No newline at end of file diff --git a/tests/packages/package.extension/package.extension.nuspec b/tests/packages/package.extension/package.extension.nuspec new file mode 100644 index 0000000000..abdd16e7b7 --- /dev/null +++ b/tests/packages/package.extension/package.extension.nuspec @@ -0,0 +1,17 @@ + + + + + package.extension + 1.0.0 + package.extension (Install) + __REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__ + https://_Software_Location_REMOVE_OR_FILL_OUT_ + package.extension SPACE_SEPARATED + __REPLACE__ + __REPLACE__MarkDown_Okay + + + + + diff --git a/tests/packages/package.template/package.template.nuspec b/tests/packages/package.template/package.template.nuspec new file mode 100644 index 0000000000..1b6241dc07 --- /dev/null +++ b/tests/packages/package.template/package.template.nuspec @@ -0,0 +1,17 @@ + + + + + package.template + 1.0.0 + package.template (Install) + __REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__ + https://_Software_Location_REMOVE_OR_FILL_OUT_ + package.template SPACE_SEPARATED + __REPLACE__ + __REPLACE__MarkDown_Okay + + + + + diff --git a/tests/packages/package.template/templates/chocolateyinstall.ps1 b/tests/packages/package.template/templates/chocolateyinstall.ps1 new file mode 100644 index 0000000000..59d0820595 --- /dev/null +++ b/tests/packages/package.template/templates/chocolateyinstall.ps1 @@ -0,0 +1 @@ +Write-Host "Created by package template" \ No newline at end of file diff --git a/tests/packages/package.template/templates/notice.txt b/tests/packages/package.template/templates/notice.txt new file mode 100644 index 0000000000..4842270eb7 --- /dev/null +++ b/tests/packages/package.template/templates/notice.txt @@ -0,0 +1 @@ +This file was generated by a package template \ No newline at end of file diff --git a/tests/packages/pureportable/1.0.0/pureportable.nuspec b/tests/packages/pureportable/1.0.0/pureportable.nuspec new file mode 100644 index 0000000000..bbf5c1541c --- /dev/null +++ b/tests/packages/pureportable/1.0.0/pureportable.nuspec @@ -0,0 +1,17 @@ + + + + pureportable + 1.0.0 + pureportable + __REPLACE_AUTHORS_OF_SOFTWARE__ + __REPLACE_YOUR_NAME__ + false + This package is intentionally minimal. It is designed to test purely portable packages which do not contain any installation or uninstallation scripts. + This package is intentionally minimal. It is designed to test purely portable packages which do not contain any installation or uninstallation scripts. + pureportable admin + + + + + diff --git a/tests/packages/pureportable/1.0.0/purpose.txt b/tests/packages/pureportable/1.0.0/purpose.txt new file mode 100644 index 0000000000..15132953cb --- /dev/null +++ b/tests/packages/pureportable/1.0.0/purpose.txt @@ -0,0 +1 @@ +This is used to test that https://github.com/chocolatey/choco/issues/2241 is implemented diff --git a/tests/packages/pureportable/1.0.0/tools/console.exe b/tests/packages/pureportable/1.0.0/tools/console.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/packages/pureportable/1.0.0/tools/graphical.exe b/tests/packages/pureportable/1.0.0/tools/graphical.exe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/packages/test-chocolateypath/test-chocolateypath.nuspec b/tests/packages/test-chocolateypath/test-chocolateypath.nuspec new file mode 100644 index 0000000000..9756ecb9c7 --- /dev/null +++ b/tests/packages/test-chocolateypath/test-chocolateypath.nuspec @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + test-chocolateypath + + + + 0.1.0 + + + + + + + + test-packagepath (Install) + __REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__ + + https://_Software_Location_REMOVE_OR_FILL_OUT_ + + + + + + + + + + + test-packagepath SPACE_SEPARATED + __REPLACE__ + __REPLACE__MarkDown_Okay + + + + + + + + + + + + + + + + diff --git a/tests/packages/test-chocolateypath/tools/chocolateybeforemodify.ps1 b/tests/packages/test-chocolateypath/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..aed0c325fb --- /dev/null +++ b/tests/packages/test-chocolateypath/tools/chocolateybeforemodify.ps1 @@ -0,0 +1,7 @@ +$ErrorActionPreference = 'Stop' + +$packagePath = Get-ChocolateyPath -PathType 'PackagePath' +$installPath = Get-ChocolateyPath -PathType 'InstallPath' + +Write-Host "Package Path in Before Modify Script: $packagePath" +Write-Host "Install Path in Before Modify Script: $installPath" \ No newline at end of file diff --git a/tests/packages/test-chocolateypath/tools/chocolateyinstall.ps1 b/tests/packages/test-chocolateypath/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..7d3dd5c585 --- /dev/null +++ b/tests/packages/test-chocolateypath/tools/chocolateyinstall.ps1 @@ -0,0 +1,7 @@ +$ErrorActionPreference = 'Stop' + +$packagePath = Get-ChocolateyPath -PathType 'PackagePath' +$installPath = Get-ChocolateyPath -PathType 'InstallPath' + +Write-Host "Package Path in Install Script: $packagePath" +Write-Host "Install Path in Install Script: $installPath" \ No newline at end of file diff --git a/tests/packages/test-chocolateypath/tools/chocolateyuninstall.ps1 b/tests/packages/test-chocolateypath/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000000..afc17122df --- /dev/null +++ b/tests/packages/test-chocolateypath/tools/chocolateyuninstall.ps1 @@ -0,0 +1,7 @@ +$ErrorActionPreference = 'Stop' + +$packagePath = Get-ChocolateyPath -PathType 'PackagePath' +$installPath = Get-ChocolateyPath -PathType 'InstallPath' + +Write-Host "Package Path in Uninstall Script: $packagePath" +Write-Host "Install Path in Uninstall Script: $installPath" \ No newline at end of file diff --git a/tests/packages/zip.template/templates/ReadMe.md b/tests/packages/zip.template/templates/ReadMe.md new file mode 100644 index 0000000000..49f29587e1 --- /dev/null +++ b/tests/packages/zip.template/templates/ReadMe.md @@ -0,0 +1,91 @@ +## Summary +How do I create packages? See https://chocolatey.org/docs/create-packages + +If you are submitting packages to the community feed (https://chocolatey.org) +always try to ensure you have read, understood and adhere to the create +packages wiki link above. + +## Automatic Packaging Updates? +Consider making this package an automatic package, for the best +maintainability over time. Read up at https://chocolatey.org/docs/automatic-packages + +## Shim Generation +Any executables you include in the package or download (but don't call +install against using the built-in functions) will be automatically shimmed. + +This means those executables will automatically be included on the path. +Shim generation runs whether the package is self-contained or uses automation +scripts. + +By default, these are considered console applications. + +If the application is a GUI, you should create an empty file next to the exe +named 'name.exe.gui' e.g. 'bob.exe' would need a file named 'bob.exe.gui'. +See https://chocolatey.org/docs/create-packages#how-do-i-set-up-shims-for-applications-that-have-a-gui + +If you want to ignore the executable, create an empty file next to the exe +named 'name.exe.ignore' e.g. 'bob.exe' would need a file named +'bob.exe.ignore'. +See https://chocolatey.org/docs/create-packages#how-do-i-exclude-executables-from-getting-shims + +## Self-Contained? +If you have a self-contained package, you can remove the automation scripts +entirely and just include the executables, they will automatically get shimmed, +which puts them on the path. Ensure you have the legal right to distribute +the application though. See https://chocolatey.org/docs/legal. + +You should read up on the Shim Generation section to familiarize yourself +on what to do with GUI applications and/or ignoring shims. + +## Automation Scripts +You have a powerful use of Chocolatey, as you are using PowerShell. So you +can do just about anything you need. Choco has some very handy built-in +functions that you can use, these are sometimes called the helpers. + +### Built-In Functions +https://chocolatey.org/docs/helpers-reference + +A note about a couple: +* Get-BinRoot - this is a horribly named function that doesn't do what new folks think it does. It gets you the 'tools' root, which by default is set to 'c:\tools', not the chocolateyInstall bin folder - see https://chocolatey.org/docs/helpers-get-tools-location +* Install-BinFile - used for non-exe files - executables are automatically shimmed... - see https://chocolatey.org/docs/helpers-install-bin-file +* Uninstall-BinFile - used for non-exe files - executables are automatically shimmed - see https://chocolatey.org/docs/helpers-uninstall-bin-file + +### Getting package specific information +Use the package parameters pattern - see https://chocolatey.org/docs/how-to-parse-package-parameters-argument + +### Need to mount an ISO? +https://chocolatey.org/docs/how-to-mount-an-iso-in-chocolatey-package + + +### Environment Variables +Chocolatey makes a number of environment variables available (You can access any of these with $env:TheVariableNameBelow): + + * TEMP = Overridden to the CacheLocation, but may be the same as the original TEMP folder + * ChocolateyInstall = Top level folder where Chocolatey is installed + * chocolateyPackageName = The name of the package, equivalent to the id in the nuspec (0.9.9+) + * chocolateyPackageVersion = The version of the package, equivalent to the version in the nuspec (0.9.9+) + * chocolateyPackageFolder = The top level location of the package folder + +#### Advanced Environment Variables +The following are more advanced settings: + + * chocolateyPackageParameters = (0.9.8.22+) + * CHOCOLATEY_VERSION = The version of Choco you normally see. Use if you are 'lighting' things up based on choco version. (0.9.9+) + - Otherwise take a dependency on the specific version you need. + * chocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. (0.9.9+) + - Automatically handled in built in Choco functions. + * OS_PLATFORM = Like Windows, macOS, Linux. (0.9.9+) + * OS_VERSION = The version of OS, like 6.1 something something for Windows. (0.9.9+) + * OS_NAME = The reported name of the OS. (0.9.9+) + * IS_PROCESSELEVATED = Is the process elevated? (0.9.9+) + +#### Experimental Environment Variables +The following are experimental or use not recommended: + + * OS_IS64BIT = This may not return correctly - it may depend on the process the app is running under (0.9.9+) + * CHOCOLATEY_VERSION_PRODUCT = the version of Choco that may match CHOCOLATEY_VERSION but may be different (0.9.9+) + - it's based on git describe + * IS_ADMIN = Is the user an administrator? But doesn't tell you if the process is elevated. (0.9.9+) + * chocolateyInstallOverride = Not for use in package automation scripts. (0.9.9+) + * chocolateyInstallArguments = the installer arguments meant for the native installer. You should use chocolateyPackageParameters intead. (0.9.9+) + diff --git a/tests/packages/zip.template/templates/tools/LICENSE.txt b/tests/packages/zip.template/templates/tools/LICENSE.txt new file mode 100644 index 0000000000..e04744b63f --- /dev/null +++ b/tests/packages/zip.template/templates/tools/LICENSE.txt @@ -0,0 +1,11 @@ + +Note: Include this file if including binaries you have the right to distribute. +Otherwise delete. this file. + +===DELETE ABOVE THIS LINE AND THIS LINE=== + +From: + +LICENSE + + diff --git a/tests/packages/zip.template/templates/tools/VERIFICATION.txt b/tests/packages/zip.template/templates/tools/VERIFICATION.txt new file mode 100644 index 0000000000..1a34ca0cf9 --- /dev/null +++ b/tests/packages/zip.template/templates/tools/VERIFICATION.txt @@ -0,0 +1,11 @@ + +Note: Include this file if including binaries you have the right to distribute. +Otherwise delete. this file. + +===DELETE ABOVE THIS LINE AND THIS LINE=== + +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's contents are trustworthy. + + \ No newline at end of file diff --git a/tests/packages/zip.template/templates/tools/chocolateybeforemodify.ps1 b/tests/packages/zip.template/templates/tools/chocolateybeforemodify.ps1 new file mode 100644 index 0000000000..9588ffe803 --- /dev/null +++ b/tests/packages/zip.template/templates/tools/chocolateybeforemodify.ps1 @@ -0,0 +1,9 @@ +# This runs in 0.9.10+ before upgrade and uninstall. +# Use this file to do things like stop services prior to upgrade or uninstall. +# NOTE: It is an anti-pattern to call chocolateyUninstall.ps1 from here. If you +# need to uninstall an MSI prior to upgrade, put the functionality in this +# file without calling the uninstall script. Make it idempotent in the +# uninstall script so that it doesn't fail when it is already uninstalled. +# NOTE: For upgrades - like the uninstall script, this script always runs from +# the currently installed version, not from the new upgraded package version. + diff --git a/tests/packages/zip.template/templates/tools/chocolateyinstall.ps1 b/tests/packages/zip.template/templates/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000000..fc18b68e4a --- /dev/null +++ b/tests/packages/zip.template/templates/tools/chocolateyinstall.ps1 @@ -0,0 +1,28 @@ +$ErrorActionPreference = 'Stop' + +[[AutomaticPackageNotesInstaller]] +$packageName= '[[PackageName]]' +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +#$fileLocation = Join-Path $toolsDir 'NAME_OF_EMBEDDED_ZIP_FILE' + +$packageArgs = @{ + packageName = $packageName + unzipLocation = $toolsDir + url = '[[Url]]' # download url, HTTPS preferred + url64bit = '[[Url64]]' # 64bit URL here (HTTPS preferred) or remove - if installer contains both (very rare), use $url + #file = $fileLocation + #fileFullPath = $fileLocation + destination = $toolsDir + + checksum = '[[Checksum]]' + checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512 + checksum64 = '[[Checksum64]]' + checksumType64= 'sha256' +} + +# https://chocolatey.org/docs/helpers-install-chocolatey-zip-package +Install-ChocolateyZipPackage @packageArgs + +## Unzips a file to the specified location - auto overwrites existing content +## - https://chocolatey.org/docs/helpers-get-chocolatey-unzip +#Get-ChocolateyUnzip @packageArgs \ No newline at end of file diff --git a/tests/packages/zip.template/templates/zip.nuspec.template b/tests/packages/zip.template/templates/zip.nuspec.template new file mode 100644 index 0000000000..b1e44ecabf --- /dev/null +++ b/tests/packages/zip.template/templates/zip.nuspec.template @@ -0,0 +1,63 @@ + + + + + + + + + + + [[PackageNameLower]] + + + + [[PackageVersion]] + + http://github.com/[[MaintainerRepo]]/[[PackageNameLower]] + + [[MaintainerName]] + + + + + [[PackageName]] (Install) + __REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__ + + https://_Software_Location_REMOVE_OR_FILL_OUT_ + + + + + + + + + [[PackageNameLower]] portable SPACE_SEPARATED + __REPLACE__ + __REPLACE__MarkDown_Okay [[AutomaticPackageNotesNuspec]] + + + + + + + + + + + + + + + + + diff --git a/tests/packages/zip.template/zip.template.nuspec b/tests/packages/zip.template/zip.template.nuspec new file mode 100644 index 0000000000..fc3577b2ab --- /dev/null +++ b/tests/packages/zip.template/zip.template.nuspec @@ -0,0 +1,27 @@ + + + + zip.template + 1.0.0 + https://github.com/ferventcoder/chocolatey-packages + Rob Reynolds, Chocolatey + Chocolatey Zip Template + Rob Reynolds, The Chocolatey Team + https://github.com/chocolatey/choco + https://github.com/chocolatey/choco/raw/master/docs/logo/chocolateyicon.gif + RealDimensions Software, LLC - 2016-Present + https://raw.githubusercontent.com/chocolatey/choco/master/LICENSE + false + + zip package template + https://github.com/chocolatey/choco + Zip Chocolatey template + ### Chocolatey Zip Template +This adds a template for archive (zipped) packages. + + + + + + + diff --git a/tools/packages.config b/tools/packages.config new file mode 100644 index 0000000000..ef49ed48cb --- /dev/null +++ b/tools/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/zip.bat b/zip.bat deleted file mode 100644 index a54cad4d88..0000000000 --- a/zip.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -::Project UppercuT - http://uppercut.googlecode.com -::No edits to this file are required - http://uppercut.pbwiki.com - -SET DIR=%cd% -SET BUILD_DIR=%~d0%~p0% - -SET NANT="%BUILD_DIR%lib\Nant\nant.exe" -SET build.config.settings="%DIR%\.uppercut" - -%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\zip.build" -D:build.config.settings=%build.config.settings% %* - -if %ERRORLEVEL% NEQ 0 goto errors - -goto finish - -:errors -EXIT /B %ERRORLEVEL% - -:finish diff --git a/zip.sh b/zip.sh deleted file mode 100755 index 564161cf6b..0000000000 --- a/zip.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# stty -echo - -# ::Project UppercuT - http://uppercut.googlecode.com -# ::No edits to this file are required - http://uppercut.pbwiki.com -function usage -{ - echo "" - echo "Usage: zip.sh" - exit -} - -function displayUsage -{ - case $1 in - "/?"|"-?"|"?"|"/help") usage ;; - esac -} - -displayUsage $1 - -# http://www.michaelruck.de/2010/03/solving-pkg-config-and-mono-35-profile.html -# http://cloudgen.wordpress.com/2013/03/06/configure-nant-to-run-under-mono-3-06-beta-for-mac-osx/ -export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig:$PKG_CONFIG_PATH - -#mono ./lib/NAnt/NAnt.exe /logger:"NAnt.Core.DefaultLogger" /nologo /quiet /f:"$(cd $(dirname "$0"); pwd)/.build/zip.build" /D:build.config.settings="$(cd $(dirname "$0"); pwd)/.uppercut" /D:microsoft.framework="mono-3.5" $* -mono --runtime=v4.0.30319 ./lib/NAnt/NAnt.exe /logger:"NAnt.Core.DefaultLogger" /nologo /quiet /f:"$(cd $(dirname "$0"); pwd)/.build/zip.build" /D:build.config.settings="$(cd $(dirname "$0"); pwd)/.uppercut" /D:microsoft.framework="mono-4.5" $*