diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 155eef78a7..0000000000
--- a/.editorconfig
+++ /dev/null
@@ -1,184 +0,0 @@
-; This file is for unifying the coding style for different editors and IDEs.
-; More information at http://EditorConfig.org
-
-root = true
-
-[*]
-end_of_line = crlf
-
-[*.ps1]
-indent_style = space
-indent_size = 4
-
-[*.cs]
-dotnet_diagnostic.RS0030.severity=error
-dotnet_diagnostic.RS0031.severity=error
-dotnet_diagnostic.RS0035.severity=error
-csharp_using_directive_placement = outside_namespace:warning
-csharp_prefer_simple_using_statement = true:suggestion
-csharp_prefer_braces = true:error
-csharp_style_namespace_declarations = block_scoped:error
-csharp_style_prefer_method_group_conversion = true:silent
-csharp_style_prefer_top_level_statements = false:error
-csharp_style_expression_bodied_methods = false:warning
-csharp_style_expression_bodied_constructors = false:warning
-csharp_style_expression_bodied_operators = false:warning
-csharp_style_expression_bodied_properties = false:warning
-csharp_style_expression_bodied_indexers = false:warning
-csharp_style_expression_bodied_accessors = false:warning
-csharp_style_expression_bodied_lambdas = true:silent
-csharp_style_expression_bodied_local_functions = false:error
-csharp_indent_labels = no_change
-csharp_space_around_binary_operators = before_and_after
-csharp_style_throw_expression = true:silent
-csharp_style_prefer_null_check_over_type_check = true:error
-csharp_prefer_simple_default_expression = true:suggestion
-csharp_style_prefer_local_over_anonymous_function = true:suggestion
-csharp_style_prefer_index_operator = true:suggestion
-csharp_style_implicit_object_creation_when_type_is_apparent = false:warning
-csharp_style_prefer_range_operator = true:suggestion
-csharp_style_prefer_tuple_swap = true:suggestion
-csharp_style_prefer_utf8_string_literals = true:suggestion
-csharp_style_deconstructed_variable_declaration = true:suggestion
-csharp_style_inlined_variable_declaration = true:suggestion
-csharp_style_unused_value_expression_statement_preference = discard_variable:silent
-csharp_style_unused_value_assignment_preference = discard_variable:suggestion
-csharp_prefer_static_local_function = true:suggestion
-csharp_style_prefer_readonly_struct = true:suggestion
-csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
-csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
-csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
-csharp_style_conditional_delegate_call = true:suggestion
-csharp_style_prefer_switch_expression = true:suggestion
-csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
-csharp_style_prefer_pattern_matching = true:suggestion
-csharp_style_prefer_not_pattern = true:suggestion
-csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
-csharp_style_prefer_extended_property_pattern = true:suggestion
-csharp_style_var_for_built_in_types = true:warning
-csharp_style_var_when_type_is_apparent = true:warning
-csharp_style_var_elsewhere = false:silent
-csharp_style_prefer_primary_constructors = false:error
-csharp_style_prefer_readonly_struct_member = true:suggestion
-csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
-csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
-
-[*.{cs,vb}]
-#### Naming styles ####
-
-# Naming rules
-
-dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
-dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
-dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
-
-dotnet_naming_rule.types_should_be_pascal_case.severity = error
-dotnet_naming_rule.types_should_be_pascal_case.symbols = types
-dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
-
-dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
-dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
-dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
-
-dotnet_naming_rule.private_fields_should_be_camel_case_underscore_prefix.severity = error
-dotnet_naming_rule.private_fields_should_be_camel_case_underscore_prefix.symbols = private_fields
-dotnet_naming_rule.private_fields_should_be_camel_case_underscore_prefix.style = camel_case_underscore_prefix
-
-dotnet_naming_rule.non_private_fields_should_be_pascal_case.severity = error
-dotnet_naming_rule.non_private_fields_should_be_pascal_case.symbols = non_private_fields
-dotnet_naming_rule.non_private_fields_should_be_pascal_case.style = pascal_case
-
-dotnet_naming_rule.local_variables_should_be_camel_case.severity = error
-dotnet_naming_rule.local_variables_should_be_camel_case.symbols = local_variables
-dotnet_naming_rule.local_variables_should_be_camel_case.style = camel_case
-
-dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error
-dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
-dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case
-
-# Symbol specifications
-
-dotnet_naming_symbols.interface.applicable_kinds = interface
-dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
-dotnet_naming_symbols.interface.required_modifiers =
-
-dotnet_naming_symbols.non_private_fields.applicable_kinds = field
-dotnet_naming_symbols.non_private_fields.applicable_accessibilities = public, internal, protected, protected_internal
-dotnet_naming_symbols.non_private_fields.required_modifiers =
-
-dotnet_naming_symbols.private_fields.applicable_kinds = field
-dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected
-dotnet_naming_symbols.private_fields.required_modifiers =
-
-dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
-dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
-dotnet_naming_symbols.types.required_modifiers =
-
-dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
-dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
-dotnet_naming_symbols.non_field_members.required_modifiers =
-
-dotnet_naming_symbols.local_variables.applicable_kinds = parameter, local
-dotnet_naming_symbols.local_variables.applicable_accessibilities = local
-dotnet_naming_symbols.local_variables.required_modifiers =
-
-dotnet_naming_symbols.constant_fields.applicable_kinds = field
-dotnet_naming_symbols.constant_fields.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
-dotnet_naming_symbols.constant_fields.required_modifiers = const
-
-# Naming styles
-
-dotnet_naming_style.pascal_case.required_prefix =
-dotnet_naming_style.pascal_case.required_suffix =
-dotnet_naming_style.pascal_case.word_separator =
-dotnet_naming_style.pascal_case.capitalization = pascal_case
-
-dotnet_naming_style.camel_case.required_prefix =
-dotnet_naming_style.camel_case.required_suffix =
-dotnet_naming_style.camel_case.word_separator =
-dotnet_naming_style.camel_case.capitalization = camel_case
-
-dotnet_naming_style.begins_with_i.required_prefix = I
-dotnet_naming_style.begins_with_i.required_suffix =
-dotnet_naming_style.begins_with_i.word_separator =
-dotnet_naming_style.begins_with_i.capitalization = pascal_case
-
-dotnet_naming_style.camel_case_underscore_prefix.required_prefix = _
-dotnet_naming_style.camel_case_underscore_prefix.required_suffix =
-dotnet_naming_style.camel_case_underscore_prefix.word_separator =
-dotnet_naming_style.camel_case_underscore_prefix.capitalization = camel_case
-
-dotnet_style_operator_placement_when_wrapping = beginning_of_line
-tab_width = 4
-indent_size = 4
-dotnet_style_coalesce_expression = true:suggestion
-dotnet_style_null_propagation = true:suggestion
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
-dotnet_style_prefer_auto_properties = true:warning
-dotnet_style_object_initializer = true:warning
-dotnet_style_collection_initializer = true:warning
-dotnet_style_prefer_simplified_boolean_expressions = true:warning
-dotnet_style_prefer_conditional_expression_over_assignment = true:silent
-dotnet_style_prefer_conditional_expression_over_return = true:silent
-dotnet_style_explicit_tuple_names = true:suggestion
-dotnet_style_prefer_inferred_tuple_names = true:suggestion
-dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
-dotnet_style_prefer_compound_assignment = true:suggestion
-dotnet_style_prefer_simplified_interpolation = true:suggestion
-dotnet_style_namespace_match_folder = true:error
-dotnet_style_readonly_field = true:suggestion
-dotnet_style_predefined_type_for_locals_parameters_members = true:warning
-dotnet_style_predefined_type_for_member_access = true:warning
-dotnet_style_require_accessibility_modifiers = for_non_interface_members:error
-dotnet_style_allow_multiple_blank_lines_experimental = true:silent
-dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
-dotnet_code_quality_unused_parameters = all:error
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
-dotnet_style_qualification_for_property = false:error
-dotnet_style_qualification_for_field = false:error
-dotnet_style_qualification_for_method = false:error
-dotnet_style_qualification_for_event = false:error
-dotnet_style_prefer_collection_expression = true:suggestion
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 6e9bc471ff..901384dd65 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -12,7 +12,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- - uses: actions/stale@v4.1.0
+ - uses: actions/stale@v9
id: stale
with:
days-before-stale: 30
@@ -24,9 +24,10 @@ jobs:
only-labels: '0 - Waiting on User'
close-issue-label: "No Response / Stale"
close-pr-label: "No Response / Stale"
- exempt-issue-labels: 'Security / CVE'
- exempt-pr-labels: 'Security / CVE'
- labels-to-remove-when-unstale: '0 - Wating on User,Pending closure'
+ exempt-issue-labels: 'Security / CVE,2 - Working,3 - Review'
+ exempt-pr-labels: 'Security / CVE,2 - Working,3 - Review'
+ labels-to-remove-when-unstale: '0 - Waiting on User,Pending closure'
+ remove-stale-when-updated: true
stale-issue-message: |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue will be closed in 14 days if it continues to be inactive.
diff --git a/.gitignore b/.gitignore
index 4112787edb..58b7903074 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ code_drop
obj
src/packages
/.vscode/**
+!.vscode/extensions.json
!/.vscode/settings.json
.vs
@@ -53,4 +54,7 @@ tools/**
!tools/Modules/packages.config
BuildArtifacts/
code_drop/
-src/chocolatey.install/assets/Install.ps1
\ No newline at end of file
+src/chocolatey.install/assets/Install.ps1
+
+# This project uses an editorconfig file maintained via a nuget package, so do not commit any of these to the repo
+.editorconfig
\ No newline at end of file
diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts
index 4f79114751..8f52dbb633 100644
--- a/.teamcity/settings.kts
+++ b/.teamcity/settings.kts
@@ -22,6 +22,8 @@ object Chocolatey : BuildType({
id = AbsoluteId("Chocolatey")
name = "Chocolatey CLI (Built with Unit Tests)"
+ templates(AbsoluteId("SlackNotificationTemplate"))
+
artifactRules = """
""".trimIndent()
@@ -86,6 +88,7 @@ object Chocolatey : BuildType({
requirements {
doesNotExist("docker.server.version")
+ doesNotContain("teamcity.agent.name", "Docker")
}
})
@@ -93,6 +96,8 @@ object ChocolateySchd : BuildType({
id = AbsoluteId("ChocolateySchd")
name = "Chocolatey CLI (Scheduled Integration Testing)"
+ templates(AbsoluteId("SlackNotificationTemplate"))
+
artifactRules = """
""".trimIndent()
@@ -150,6 +155,7 @@ object ChocolateySchd : BuildType({
requirements {
doesNotExist("docker.server.version")
+ doesNotContain("teamcity.agent.name", "Docker")
}
})
@@ -157,6 +163,8 @@ object ChocolateyQA : BuildType({
id = AbsoluteId("ChocolateyQA")
name = "Chocolatey CLI (SonarQube)"
+ templates(AbsoluteId("SlackNotificationTemplate"))
+
artifactRules = """
""".trimIndent()
@@ -216,6 +224,7 @@ object ChocolateyQA : BuildType({
requirements {
doesNotExist("docker.server.version")
+ doesNotContain("teamcity.agent.name", "Docker")
}
})
@@ -223,6 +232,8 @@ object ChocolateySign : BuildType({
id = AbsoluteId("ChocolateySign")
name = "Chocolatey CLI (Script Signing)"
+ templates(AbsoluteId("SlackNotificationTemplate"))
+
artifactRules = """
""".trimIndent()
@@ -286,6 +297,7 @@ object ChocolateySign : BuildType({
requirements {
doesNotExist("docker.server.version")
+ doesNotContain("teamcity.agent.name", "Docker")
}
})
@@ -293,6 +305,8 @@ object ChocolateyDockerWin : BuildType({
id = AbsoluteId("ChocolateyDockerWin")
name = "Docker (Windows)"
+ templates(AbsoluteId("SlackNotificationTemplate"))
+
params {
// TeamCity has suggested "${Chocolatey.depParamRefs.buildNumber}"
param("env.CHOCOLATEY_VERSION", "%dep.Chocolatey.build.number%")
@@ -340,6 +354,7 @@ object ChocolateyDockerWin : BuildType({
requirements {
contains("docker.server.osType", "windows")
exists("docker.server.version")
+ contains("teamcity.agent.name", "Docker")
}
})
@@ -347,6 +362,8 @@ object ChocolateyPosix : BuildType({
id = AbsoluteId("ChocolateyPosix")
name = "Docker (Linux)"
+ templates(AbsoluteId("SlackNotificationTemplate"))
+
params {
param("env.CAKE_NUGET_SOURCE", "") // The Cake version we use has issues with authing to our private source on Linux
param("env.PRIMARY_NUGET_SOURCE", "") // As above there are issues with authing to our private source on Linux
@@ -452,5 +469,6 @@ object ChocolateyPosix : BuildType({
requirements {
contains("docker.server.osType", "linux")
exists("docker.server.version")
+ contains("teamcity.agent.name", "Docker")
}
})
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000000..5c2b21c45f
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,5 @@
+{
+ "recommendations": [
+ "yzhang.markdown-all-in-one"
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 4dc317cc50..1d0b65848d 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,6 @@
{
"[powershell]": {
"files.encoding": "utf8bom",
- }
+ },
+ "markdown.extension.toc.levels": "2..6"
}
\ No newline at end of file
diff --git a/GenerateDocs.ps1 b/GenerateDocs.ps1
index 8bde26b1cc..7a2636699d 100644
--- a/GenerateDocs.ps1
+++ b/GenerateDocs.ps1
@@ -34,22 +34,20 @@ $sourceCommands = $sourceLocation + 'src/chocolatey/infrastructure.app/commands'
$sourceFunctions = $sourceLocation + 'src/chocolatey.resources/helpers/functions'
$global:powerShellReferenceTOC = @'
---
-Order: 40
+order: 40
xref: powershell-reference
-Title: PowerShell Reference
-Description: PowerShell Functions aka Helpers Reference
-RedirectFrom:
- - docs/helpers-reference
- - docs/HelpersReference
+title: PowerShell Reference
+description: PowerShell Functions aka Helpers Reference
---
+import Xref from '@components/Xref.astro';
# PowerShell Functions aka Helpers Reference
-
+{/* This documentation file is automatically generated from the files at $sourceFunctions using $($sourceLocation)GenerateDocs.ps1. Contributions are welcome at the original location(s). */}
## Summary
-In your Chocolatey packaging, you have the ability to use these functions (and others with Chocolatey's [PowerShell Extensions](xref:extensions)) to work with all aspects of software management. Keep in mind Chocolatey's automation scripts are just PowerShell, so you can do manage anything you want.
+In your Chocolatey packaging, you have the ability to use these functions (and others with Chocolatey's ) to work with all aspects of software management. Keep in mind Chocolatey's automation scripts are just PowerShell, so you can do manage anything you want.
> :choco-info: **NOTE**
>
@@ -57,12 +55,12 @@ In your Chocolatey packaging, you have the ability to use these functions (and o
## Main Functions
-These functions call other functions and many times may be the only thing you need in your [chocolateyInstall.ps1 file](xref:chocolatey-install-ps1).
+These functions call other functions and many times may be the only thing you need in your .
-* [Install-ChocolateyPackage](xref:install-chocolateypackage)
-* [Install-ChocolateyZipPackage](xref:install-chocolateyzippackage)
-* [Install-ChocolateyPowershellCommand](xref:install-chocolateypowershellcommand)
-* [Install-ChocolateyVsixPackage](xref:install-chocolateyvsixpackage)
+*
+*
+*
+*
## More Functions
@@ -70,13 +68,13 @@ These functions call other functions and many times may be the only thing you ne
When creating packages that need to run one of the following commands below, one should add the tag `admin` to the nuspec.
-* [Install-ChocolateyPackage](xref:install-chocolateypackage)
-* [Start-ChocolateyProcessAsAdmin](xref:start-chocolateyprocessasadmin)
-* [Install-ChocolateyInstallPackage](xref:install-chocolateyinstallpackage)
-* [Install-ChocolateyPath](xref:install-chocolateypath) - when specifying machine path
-* [Install-ChocolateyEnvironmentVariable](xref:install-chocolateyenvironmentvariable) - when specifying machine path
-* [Install-ChocolateyExplorerMenuItem](xref:install-chocolateyexplorermenuitem)
-* [Install-ChocolateyFileAssociation](xref:install-chocolateyfileassociation)
+*
+*
+*
+* - when specifying machine path
+* - when specifying machine path
+*
+*
### Non-Administrator Safe Functions
@@ -84,17 +82,17 @@ When you have a need to run Chocolatey without Administrative access required (n
These are the functions from above as one list.
-* [Install-ChocolateyZipPackage](xref:install-chocolateyzippackage)
-* [Install-ChocolateyPowershellCommand](xref:install-chocolateypowershellcommand)
-* [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-ChocolateyPinnedTaskBarItem](xref:install-chocolateypinnedtaskbaritem)
-* [Install-ChocolateyShortcut](xref:install-chocolateyshortcut)
-* [Update-SessionEnvironment](xref:update-sessionenvironment)
-* [Get-PackageParameters](xref:get-packageparameters)
+*
+*
+*
+*
+*
+* - when specifying user path
+* - when specifying user path
+*
+*
+*
+*
## Complete List (alphabetical order)
@@ -145,9 +143,9 @@ function Replace-CommonItems($text) {
$text = $text -replace '(Pro[fessional]\s?/\s?Business)', '[$1](https://chocolatey.org/compare)'
$text = $text -replace '([Ll]icensed editions)', '[$1](https://chocolatey.org/compare)'
$text = $text -replace '([Ll]icensed versions)', '[$1](https://chocolatey.org/compare)'
- $text = $text -replace '\(https://docs.chocolatey.org/en-us/create/automatic-packages\)', '(xref:automatic-packaging)'
- $text = $text -replace 'Learn more about using this at https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument', '[Learn more](xref:parse-package-parameters)'
- $text = $text -replace 'at https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument#step-3---use-core-community-extension', 'in [the docs](xref:parse-package-parameters#step-3-use-core-community-extension)'
+ $text = $text -replace '\[automatic packaging\]\(https://docs.chocolatey.org/en-us/create/automatic-packages\)', ''
+ $text = $text -replace 'Learn more about using this at https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument', ''
+ $text = $text -replace 'at https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument#step-3---use-core-community-extension', 'in '
$text = $text -replace 'https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument', 'https://docs.chocolatey.org/en-us/guides/create/parse-packageparameters-argument'
$text = $text -replace '\[community feed\)\]\(https://community.chocolatey.org/packages\)', '[community feed](https://community.chocolatey.org/packages))'
@@ -207,7 +205,7 @@ function Convert-Parameter($objItem, $commandName) {
$aliases = [string]((Get-Command -Name $commandName).parameters."$($objItem.Name)".Aliases -join ', ')
$required = [string]($objItem.required)
$position = [string]($objItem.position)
- $defValue = [string]($objItem.defaultValue)
+ $defValue = [string]($objItem.defaultValue -replace '@{Headers = @{}', '`@{Headers = @{}`' )
$acceptPipeline = [string]($objItem.pipelineInput)
$padding = ($aliases.Length, $required.Length, $position.Length, $defValue.Length, $acceptPipeline.Length | Measure-Object -Maximum).Maximum
@@ -245,11 +243,11 @@ function Convert-CommandText {
$commandText = $commandText -replace '^(Windows Features|Ruby|Cygwin|Python)\s*$', '### $1'
$commandText = $commandText -replace '(? :choco-info: **NOTE**'
$commandText = $commandText -replace '(? :choco-warning: **WARNING**'
- $commandText = $commandText -replace '\*> :choco-(info|warning): \*\*(INFO|WARNING)\*\*\*', '> :choco-$1: **$2**'
- $commandText = $commandText -replace 'the command reference', '[how to pass arguments](xref:choco-commands#how-to-pass-options-switches)'
+ $commandText = $commandText -replace '\*> :choco-(info|warning): \*\*(INFO|WARNING|NOTE)\*\*\*', '> :choco-$1: **$2**'
+ $commandText = $commandText -replace 'the command reference', ''
$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 '\`([choco\s]*)(apikey|install|upgrade|uninstall|list|search|info|outdated|pin)\`', ''
$commandText = $commandText -replace '^(.+):\s(.+.gif)$', '![$1]($2)'
$commandText = $commandText -replace '^(\s+)\<\?xml', "~~~xml$lineFeed`$1', "`$1$lineFeed~~~"
@@ -257,21 +255,21 @@ function Convert-CommandText {
$commandText = $commandText -replace '(Pro[fessional]\s?/\s?Business)', '[$1](https://chocolatey.org/compare)'
$commandText = $commandText -replace '([Ll]icensed editions)', '[$1](https://chocolatey.org/compare)'
$commandText = $commandText -replace '([Ll]icensed versions)', '[$1](https://chocolatey.org/compare)'
- $commandText = $commandText -replace 'https://raw.githubusercontent.com/wiki/chocolatey/choco/images', '/assets/images'
+ $commandText = $commandText -replace 'https://raw.githubusercontent.com/wiki/chocolatey/choco/images', '/images'
$commandText = $commandText -replace 'https://chocolatey.org/docs/features-automatically-recompile-packages', 'https://docs.chocolatey.org/en-us/guides/create/recompile-packages'
$commandText = $commandText -replace 'https://chocolatey.org/docs/features-private-cdn', 'https://docs.chocolatey.org/en-us/features/private-cdn'
$commandText = $commandText -replace 'https://chocolatey.org/docs/features-virus-check', 'https://docs.chocolatey.org/en-us/features/virus-check'
$commandText = $commandText -replace 'https://chocolatey.org/docs/features-synchronize', 'https://docs.chocolatey.org/en-us/features/package-synchronization'
$commandText = $commandText -replace 'explicity', 'explicit'
$commandText = $commandText -replace 'https://chocolatey.org/docs/features-create-packages-from-installers', 'https://docs.chocolatey.org/en-us/features/package-builder'
- $commandText = $commandText -replace 'See https://chocolatey.org/docs/features-create-packages-from-installers', 'See more information about [Package Builder features](xref:package-builder)'
- $commandText = $commandText -replace 'See https://docs.chocolatey.org/en-us/features/package-builder', 'See more information about [Package Builder features](xref:package-builder)'
+ $commandText = $commandText -replace 'See https://chocolatey.org/docs/features-create-packages-from-installers', 'See more information about '
+ $commandText = $commandText -replace 'See https://docs.chocolatey.org/en-us/features/package-builder', 'See more information about '
$commandText = $commandText -replace 'https://chocolatey.org/docs/features-install-directory-override', 'https://docs.chocolatey.org/en-us/features/install-directory-override'
$commandText = $commandText -replace 'y.org/docs/features-package-reducer', 'y.org/docs/en-us/features/package-reducer'
$commandText = $commandText -replace 'https://chocolatey.org/docs/features-package-reducer', 'https://docs.chocolatey.org/en-us/features/package-reducer'
$commandText = $commandText -replace 'https://chocolatey.org/docs/en-us/features/package-reducer', 'https://docs.chocolatey.org/en-us/features/package-reducer'
$commandText = $commandText -replace '\[community feed\)\]\(https://community.chocolatey.org/packages\)', '[community feed](https://community.chocolatey.org/packages))'
- $commandText = $commandText -replace '> :choco-(info|warning): \*\*(INFO|WARNING)\*\*\s', '> :choco-$1: **$2**
+ $commandText = $commandText -replace '> :choco-(info|warning): \*\*(INFO|WARNING|NOTE)\*\*\s', '> :choco-$1: **$2**
>
> '
@@ -286,7 +284,7 @@ function Convert-CommandText {
try to install version 1.0.0 of every package passed. So please split
out multiple package calls when wanting to pass specific options.
-Includes [default options/switches](xref:choco-commands#default-options-and-switches) (included below for completeness).
+Includes (included below for completeness).
~~~
'@
@@ -318,32 +316,30 @@ function Convert-CommandReferenceSpecific($commandText) {
param($m)
$commandName = $m.Groups[1].Value
$commandNameUpper = $($commandName.Substring(0, 1).ToUpper() + $commandName.Substring(1))
- " * [$commandName](xref:choco-command-$($commandName)) -"
+ " * -"
}
)
#$commandText = $commandText -replace '\s?\s?\*\s(\w+)\s\-', ' * [[$1|Commands$1]] -'
- $commandText = $commandText.Replace("## Default Options and Switches", "## See Help Menu In Action$lineFeed$lineFeed![choco help in action](/assets/images/gifs/choco_help.gif)$lineFeed$lineFeed## Default Options and Switches")
+ $commandText = $commandText.Replace("## Default Options and Switches", "## See Help Menu In Action$lineFeed$lineFeed![choco help in action](/images/gifs/choco_help.gif)$lineFeed$lineFeed## Default Options and Switches")
Write-Output $commandText
}
function Generate-TopLevelCommandReference {
Write-Host "Generating Top Level Command Reference"
- $fileName = "$docsFolder\choco\commands\index.md"
+ $fileName = "$docsFolder\choco\commands\index.mdx"
$commandOutput = @("---")
- $commandOutput += @("Order: 40")
+ $commandOutput += @("order: 40")
$commandOutput += @("xref: choco-commands")
- $commandOutput += @("Title: Commands")
- $commandOutput += @("Description: Full list of all available Chocolatey commands")
- $commandOutput += @("RedirectFrom:")
- $commandOutput += @(" - docs/commandsreference")
- $commandOutput += @(" - docs/commands-reference")
- $commandOutput += @("---$lineFeed")
+ $commandOutput += @("title: Commands")
+ $commandOutput += @("description: Full list of all available Chocolatey commands")
+ $commandOutput += @("---")
+ $commandOutput += @("import Xref from '@components/Xref.astro';$lineFeed")
$commandOutput += @("# Command Reference$lineFeed")
- $commandOutput += @(" $lineFeed")
+ $commandOutput += @("{/* This file is automatically generated based on output from the files at $sourceCommands using $($sourceLocation)GenerateDocs.ps1. Contributions are welcome at the original location(s). */} $lineFeed")
$commandOutput += $(& $chocoExe -? -r)
$commandOutput += @("$lineFeed~~~$lineFeed")
- $commandOutput += @("$lineFeed$lineFeed*NOTE:* This documentation has been automatically generated from ``choco -h``. $lineFeed")
+ $commandOutput += @("$lineFeed$lineFeed> :choco-info: **NOTE**$lineFeed>$lineFeed> This documentation has been automatically generated from ``choco -h``. $lineFeed")
$commandOutput |
ForEach-Object { Convert-CommandText($_) } |
@@ -356,51 +352,50 @@ function Move-GeneratedFiles {
New-Item -ItemType Directory -Path "$docsFolder\create\commands" -ErrorAction Continue | Out-Null
}
- Move-Item -Path "$docsFolder\choco\commands\apikey.md" -Destination "$docsFolder\create\commands\api-key.md"
- 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"
+ Move-Item -Path "$docsFolder\choco\commands\apikey.mdx" -Destination "$docsFolder\create\commands\api-key.mdx"
+ Move-Item -Path "$docsFolder\choco\commands\new.mdx" -Destination "$docsFolder\create\commands\new.mdx"
+ Move-Item -Path "$docsFolder\choco\commands\pack.mdx" -Destination "$docsFolder\create\commands\pack.mdx"
+ Move-Item -Path "$docsFolder\choco\commands\push.mdx" -Destination "$docsFolder\create\commands\push.mdx"
+ Move-Item -Path "$docsFolder\choco\commands\template.mdx" -Destination "$docsFolder\create\commands\template.mdx"
+ Move-Item -Path "$docsFolder\choco\commands\templates.mdx" -Destination "$docsFolder\create\commands\templates.mdx"
+ Move-Item -Path "$docsFolder\choco\commands\convert.mdx" -Destination "$docsFolder\create\commands\convert.mdx"
}
function Generate-CommandReference($commandName, $order) {
if (-not(Test-Path "$docsFolder\choco\commands")) {
New-Item -ItemType Directory -Path "$docsFolder\choco\commands" -ErrorAction Continue | Out-Null
}
- $fileName = Join-Path "$docsFolder\choco\commands" "$($commandName.ToLower()).md"
+ $fileName = Join-Path "$docsFolder\choco\commands" "$($commandName.ToLower()).mdx"
$commandNameLower = $commandName.ToLower()
Write-Host "Generating $fileName ..."
$commandOutput += @("---")
- $commandOutput += @("Order: $order")
+ $commandOutput += @("order: $order")
$commandOutput += @("xref: choco-command-$commandNameLower")
- $commandOutput += @("Title: $commandName")
- $commandOutput += @("Description: $commandName Command (choco $commandNameLower)")
- $commandOutput += @("RedirectFrom:")
- $commandOutput += @(" - docs/commands$commandNameLower")
- $commandOutput += @(" - docs/commands-$commandNameLower")
+ $commandOutput += @("title: $commandName")
+ $commandOutput += @("description: $commandName Command (choco $commandNameLower)")
if ($commandName -eq 'Features') {
- $commandOutput += @("ShowInNavbar: false")
$commandOutput += @("ShowInSidebar: false")
}
if ($commandName -eq 'Templates') {
- $commandOutput += @("ShowInNavbar: false")
$commandOutput += @("ShowInSidebar: false")
}
- $commandOutput += @("---$lineFeed")
- $commandOutput += @(" $lineFeed")
+ $commandOutput += @("---")
+ $commandOutput += @("import Xref from '@components/Xref.astro';$lineFeed")
+ $commandOutput += @("{/* This file is automatically generated based on output from $($sourceCommands)/Chocolatey$($commandName)Command.cs using $($sourceLocation)GenerateDocs.ps1. Contributions are welcome at the original location(s). If the file is not found, it is not part of the open source edition of Chocolatey or the name of the file is different. */} $lineFeed")
$commandOutput += $(& $chocoExe $commandName.ToLower() -h -r)
- $commandOutput += @("$lineFeed~~~$lineFeed$lineFeed[Command Reference](xref:choco-commands)")
+ $commandOutput += @("$lineFeed~~~$lineFeed$lineFeed")
$commandOutput += @("$lineFeed$lineFeed*NOTE:* This documentation has been automatically generated from ``choco $($commandName.ToLower()) -h``. $lineFeed")
- $commandOutput |
+ $fileContent = $commandOutput |
ForEach-Object { Convert-CommandText $_ $commandName.ToLower() } |
- Out-File $fileName -Encoding UTF8 -Force
+ Out-String
+ # Surround indented blocks with code blocks (intended for Usage and Examples sections), ignoring sections we are putting in code blocks in other ways
+ $fileContent = $fileContent -replace '(\r?\n( {4}[^ <-].+\r?\n?)+)',"`r`n~~~`$0~~~`r`n`r`n"
+ $fileContent | Out-File $fileName -Encoding UTF8 -Force
}
try {
@@ -426,8 +421,8 @@ try {
$helperOrder = 10;
Get-Command -Module $psModuleName -CommandType Function | ForEach-Object -Process { Get-Help $_ -Full } | ForEach-Object -Process { `
$commandName = $_.Name
- $fileName = Join-Path "$docsFolder\create\functions" "$($_.Name.ToLower()).md"
- $global:powerShellReferenceTOC += "$lineFeed * [$commandName](xref:$([System.IO.Path]::GetFileNameWithoutExtension($fileName)))"
+ $fileName = Join-Path "$docsFolder\create\functions" "$($_.Name.ToLower()).mdx"
+ $global:powerShellReferenceTOC += "$lineFeed * "
$hasCmdletBinding = (Get-Command -Name $commandName).CmdLetBinding
Write-Host "Generating $fileName ..."
@@ -446,18 +441,16 @@ try {
@"
---
-Order: $($helperOrder)
+order: $($helperOrder)
xref: $($_.Name.ToLower())
-Title: $($_.Name)
-Description: Information on $($_.Name) function
-RedirectFrom:
- - docs/helpers-$($FormattedName)
- - docs/helpers$($NameNoHyphen.ToLower())
+title: $($_.Name)
+description: Information on $($_.Name) function
---
+import Xref from '@components/Xref.astro';
# $($_.Name)
-
+{/* This documentation is automatically generated from $sourceFunctions/$($_.Name)`.ps1 using $($sourceLocation)GenerateDocs.ps1. Contributions are welcome at the original location(s). */}
$(Replace-CommonItems $_.Synopsis)
@@ -481,9 +474,9 @@ $( if ($_.ReturnValues -ne $null -and $_.ReturnValues.Length -gt 0 -and -not $_.
## Parameters
$( 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 | Where-Object { $_.linkText -ne $null} | ForEach-Object { 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 "* $lineFeed" }})
-[Function Reference](xref:powershell-reference)
+
> :choco-info: **NOTE**
>
@@ -495,17 +488,17 @@ View the source for [$($_.Name)]($sourceFunctions/$($_.Name)`.ps1)
}
Write-Host "Generating Top Level PowerShell Reference"
- $fileName = Join-Path "$docsFolder\create\functions" 'index.md'
+ $fileName = Join-Path "$docsFolder\create\functions" 'index.mdx'
$global:powerShellReferenceTOC += @'
## Chocolatey for Business Functions
- * [Install-ChocolateyWindowsService](xref:install-chocolateywindowsservice)
- * [Start-ChocolateyWindowsService](xref:start-chocolateywindowsservice)
- * [Stop-ChocolateyWindowsService](xref:stop-chocolateywindowsservice)
- * [Uninstall-ChocolateyWindowsService](xref:uninstall-chocolateywindowsservice)
+*
+*
+*
+*
## Variables
@@ -515,24 +508,24 @@ There are also a number of environment variables providing access to some values
Chocolatey makes a number of environment variables available (You can access any of these with $env:TheVariableNameBelow):
- * TEMP/TMP - 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 `` field in the nuspec
- * ChocolateyPackageTitle - The title of the package, equivalent to the `
` field in the nuspec
- * ChocolateyPackageVersion - The version of the package, equivalent to the `` field in the nuspec
+* TEMP/TMP - 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 `` field in the nuspec
+* ChocolateyPackageTitle - The title of the package, equivalent to the `` field in the nuspec
+* ChocolateyPackageVersion - The version of the package, equivalent to the `` field in the nuspec
#### Advanced Environment Variables
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`.
- * CHOCOLATEY_VERSION - The version of Choco you normally see. Use if you are 'lighting' things up based on choco version, otherwise take a dependency on the specific version you need.
- * ChocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. Automatically handled in built in Choco functions.
- * OS_PLATFORM - Like Windows, macOS, Linux.
- * OS_VERSION - The version of OS, like 6.1 something something for Windows.
- * OS_NAME - The reported name of the OS.
- * IS_PROCESSELEVATED = Is the process elevated?
- * ChocolateyPackageInstallLocation - Install location of the software that the package installs. Displayed at the end of the package install.
+* ChocolateyPackageParameters - Parameters to use with packaging, not the same as install arguments (which are passed directly to the native installer). Based on `--package-parameters`.
+* CHOCOLATEY_VERSION - The version of Choco you normally see. Use if you are 'lighting' things up based on choco version, otherwise take a dependency on the specific version you need.
+* ChocolateyForceX86 = If available and set to 'true', then user has requested 32bit version. Automatically handled in built in Choco functions.
+* OS_PLATFORM - Like Windows, macOS, Linux.
+* OS_VERSION - The version of OS, like 6.1 something something for Windows.
+* OS_NAME - The reported name of the OS.
+* IS_PROCESSELEVATED = Is the process elevated?
+* ChocolateyPackageInstallLocation - Install location of the software that the package installs. Displayed at the end of the package install.
#### Set By Options and Configuration
diff --git a/Invoke-Tests.ps1 b/Invoke-Tests.ps1
index d6ce96f030..6ff80f79bc 100644
--- a/Invoke-Tests.ps1
+++ b/Invoke-Tests.ps1
@@ -54,12 +54,53 @@ else {
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 -Include *.nuspec | Where-Object FullName -notmatch 'bin'
+ $nuspecs = Get-ChildItem -Path $PSScriptRoot/src/chocolatey.tests.integration, $PSScriptRoot/tests/packages -Recurse -Include *.nuspec | Where-Object FullName -NotMatch 'bin'
Get-ChildItem -Path $PSScriptRoot/tests/packages -Recurse -Include *.nupkg | Copy-Item -Destination "$TestPath/packages"
- foreach ($file in $nuspecs) {
- Write-Host "Packaging $file"
- $null = choco pack $file.FullName --out "$TestPath/packages"
+ $packFailures = foreach ($file in $nuspecs) {
+ # Include allow-unofficial in case an unofficial Chocolatey has been installed globally for testing
+ $packOutput = choco pack $file.FullName --out "$TestPath/packages" --allow-unofficial
+ if ($LASTEXITCODE -ne 0) {
+ [pscustomobject]@{
+ Package = $file.FullName
+ ExitCode = $LASTEXITCODE
+ Output = $packOutput
+ }
+ Write-Warning "Failed to pack $file"
+ }
+ else {
+ Write-Host "Packaged $file"
+ }
+ }
+
+ if ($null -ne $packFailures) {
+ foreach ($failure in $packFailures) {
+ Write-Warning "$($failure.Package) failed to pack with exit code: $($failure.ExitCode)"
+ $failure.Output | Write-Warning
+ }
+ # If you want to stop things, change this to a throw.
+ # This is not currently throwing as there are two packages that are supposed to fail.
+ Write-Error "$($packFailures.Count) packages failed to pack."
+ }
+}
+
+if (-not (Test-Path "$TestPath/all-packages") -or -not $SkipPackaging) {
+ $null = New-Item -Path "$TestPath/all-packages" -ItemType Directory -Force
+
+ # These are the package ids that are loaded into the all packages test repository.
+ $AllPackagesRepository = @(
+ 'isdependency'
+ 'hasdependency'
+ 'hasnesteddependency'
+ 'downgradesdependency'
+ 'dependencyfailure'
+ 'hasfailingnesteddependency'
+ 'failingdependency'
+ 'isexactversiondependency'
+ )
+
+ foreach ($package in $AllPackagesRepository) {
+ $null = Copy-Item "$TestPath/packages/$package.*.nupkg" "$TestPath/all-packages/"
}
}
@@ -97,6 +138,7 @@ try {
Import-Module $PSScriptRoot\tests\helpers\common-helpers.psm1 -Force
$null = Invoke-Choco source add --name hermes --source "$TestPath/packages"
+ $null = Invoke-Choco source add --name hermes-all --source "$TestPath/all-packages"
Enable-ChocolateyFeature -Name allowGlobalConfirmation
$PesterConfiguration = [PesterConfiguration]@{
Run = @{
diff --git a/README.md b/README.md
index c0e3865bd7..f001a8aede 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,10 @@ You can just call me choco.
- [Windows](#windows)
- [Other Platforms](#other-platforms)
- [Prerequisites:](#prerequisites)
+ - [Before building:](#before-building)
- [Build Process:](#build-process)
+ - [Testing](#testing)
+ - [Installing on Other Platforms:](#installing-on-other-platforms)
- [Credits](#credits)
@@ -39,6 +42,7 @@ You can just call me choco.
| [![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) |
## Chat Room
+
Come join in the conversation about Chocolatey in our Community Chat Room.
[![Discord](https://img.shields.io/discord/778552361454141460?logo=Discord)](https://ch0.co/community)
@@ -46,9 +50,11 @@ Come join in the conversation about Chocolatey in our Community Chat Room.
Please make sure you've read over and agree with the [etiquette regarding communication](#etiquette-regarding-communication).
## Support Chocolatey!
+
* Purchase [Chocolatey Pro / Chocolatey for Business](https://chocolatey.org/pricing#compare)
## See Chocolatey In Action
+
Chocolatey FOSS install showing tab completion and `refreshenv` (a way to update environment variables without restarting your shell):
![install](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_install.gif "Wat? Tab completion and updating environment variables!")
@@ -58,11 +64,13 @@ Chocolatey FOSS install showing tab completion and `refreshenv` (a way to update
![install w/pro](https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/chocopro_install_stopped.gif "Chocolatey Pro availability now! A great option for individuals looking for that community PLUS option.")
## Etiquette Regarding Communication
+
If you are an open source user requesting support, please remember that most folks in the Chocolatey community are volunteers that have lives outside of open source and are not paid to ensure things work for you, so please be considerate of others' time when you are asking for things. Many of us have families that also need time as well and only have so much time to give on a daily basis. A little consideration and patience can go a long way. After all, you are using a pretty good tool without cost. It may not be perfect (yet), and we know that.
If you are using a [commercial edition of Chocolatey](https://chocolatey.org/compare#compare), you have different terms! Please see [support](https://chocolatey.org/support).
## Information
+
* [Chocolatey Website and Community Package Repository](https://community.chocolatey.org)
* [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)
@@ -70,6 +78,7 @@ If you are using a [commercial edition of Chocolatey](https://chocolatey.org/com
* [Documentation](https://docs.chocolatey.org/en-us/) / [Support](https://chocolatey.org/support)
### Documentation
+
Please see the [docs](https://docs.chocolatey.org/en-us/)
Give `choco.exe -?` a shot (or `choco.exe -h`). For specific commands, add the command and then the help switch e.g. `choco.exe install -h`.
@@ -82,9 +91,11 @@ Give `choco.exe -?` a shot (or `choco.exe -h`). For specific commands, add the c
- See our documentation on the [support lifecycle and supported operating systems](https://docs.chocolatey.org/en-us/information/support-lifecycle) for additional information
### License / Credits
+
Apache 2.0 - see [LICENSE](https://github.com/chocolatey/choco/blob/master/LICENSE) and [NOTICE](https://github.com/chocolatey/choco/blob/master/NOTICE) files.
## Submitting Issues
+
![submitting issues](https://cloud.githubusercontent.com/assets/63502/12534554/6ea7cc04-c224-11e5-82ad-3805d0b5c724.png)
* If you are having issue with a package, please see [Request Package Fixes or Updates / Become a maintainer of an existing package](https://docs.chocolatey.org/en-us/community-repository/users/package-triage-process).
@@ -118,31 +129,45 @@ 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/develop/CONTRIBUTING.md).
This project uses an [.editorconfig](https://editorconfig.org) file in order to help maintain consistency of code.
Errors and warnings produced by not following these defined conventions will in future be enforced at build time, so ensure your contributions adhere to the rules defined in it and produce no warnings or errors in Visual Studio.
## Committers
+
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.
#### Windows
+
Prerequisites:
- * .NET Framework 4.8+
- * Visual Studio 2019+
- * ReSharper is immensely helpful (and there is a `.sln.DotSettings` file to help with code conventions).
+The following are a minimum set of requirements to successfully complete the build process:
+
+ * .NET Framework 4.8
+ * .NET Framework 4.8 Dev Pack
+ * Visual Studio 2019 or Visual Studio 2019 Build Tools
+ * .NET SDK (i.e. ability to install .NET Global tools using `dotnet tool install`)
+
+There is a `setup.ps1` file at the root of this repository, which can be used to install all of the above.
Build Process:
* Run `build.bat`.
+> [!IMPORTANT]
+> It is assumed that Chocolatey CLI is installed on the machine where you are running the build, as this is required to generate the final Chocolatey package.
+> If required, you can skip the creation of the Chocolatey packages using the `--shouldRunChocolatey` option, i.e. `.\build.bat --shouldRunChocolatey=false`
+
Running the build on Windows should produce an artifact that is tested and ready to be used.
#### Other Platforms
+
##### Prerequisites:
* Install and configure Mono. Mono 6.6 or newer should work, see `docker/Dockerfile.linux` for the currently recommended version of Mono.
@@ -178,6 +203,15 @@ chmod +x *.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.
+### Testing
+
+The Chocolatey CLI codebase contains a number of different tests, including unit, integration, and end-to-end tests.
+These are all documented in the [TESTING.md](https://github.com/chocolatey/choco/blob/develop/TESTING.md) file.
+
+The unit and integration tests are NUnit tests, which can be executed directly within Visual Studio, or as part of the [build process](https://github.com/chocolatey/choco/blob/develop/TESTING.md#running-tests).
+
+The end-to-end tests use Pester as the test framework. Since these tests have the potential to actually make changes to your system, we recommend using the [provided Vagrant file to run these tests in a dedicated virtual machine](https://github.com/chocolatey/choco/blob/develop/TESTING.md#pester-tests).
+
### Installing on Other Platforms:
1. Get a copy of the source code and build.
@@ -186,4 +220,5 @@ Running the build on Mono produces an artifact similar to Windows but may have m
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/docs/legal/CREDITS.md b/docs/legal/CREDITS.md
index 317b2ae0fa..7905b22ba6 100644
--- a/docs/legal/CREDITS.md
+++ b/docs/legal/CREDITS.md
@@ -6,22 +6,22 @@
- [Contributors](#contributors)
- [Third Party Licenses - Development](#third-party-licenses---development)
- [Third Party Licenses - Runtime](#third-party-licenses---runtime)
- - [7-Zip @ 23.01](#7-zip--2301)
+ - [7-Zip @ 24.08](#7-zip--2408)
- [AlphaFS @ 2.1.3](#alphafs--213)
- - [Checksum @ 0.2.0](#checksum--020)
+ - [Checksum @ 0.3.1](#checksum--031)
- [log4net @ 2.0.12](#log4net--2012)
- [Microsoft.Bcl.HashCode @ 1.1.1](#microsoftbclhashcode--111)
- - [Microsoft.Web.Xdt @ 2.1.1](#microsoftwebxdt--211)
- - [Chocolatey.NuGet.Client @ 3.4.0](#chocolateynugetclient--340)
+ - [Microsoft.Web.Xdt @ 3.1.0](#microsoftwebxdt--310)
+ - [Newtonsoft.Json @ 13.0.1](#newtonsoftjson--1301)
+ - [Chocolatey.NuGet.Client @ 3.4.2](#chocolateynugetclient--342)
- [Rhino.Licensing @ 1.4.1 (modified)](#rhinolicensing--141-modified)
- - [Shim Generator (shimgen) @ 1.0.0](#shim-generator-shimgen--100)
+ - [Shim Generator (shimgen) @ 2.0.0](#shim-generator-shimgen--200)
- [SimpleInjector @ 2.8.3](#simpleinjector--283)
- [System.Reactive @ 5.0.0](#systemreactive--500)
- [System.Runtime.CompilerServices.Unsafe @ 4.5.3](#systemruntimecompilerservicesunsafe--453)
- [System.Threading.Tasks.Extensions @ 4.5.4](#systemthreadingtasksextensions--454)
-
## Committers & Contributors
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.
@@ -73,7 +73,7 @@ We would like to credit other super sweet tools/frameworks that aid in the devel
Chocolatey CLI (choco) uses a number of 3rd-party components.
Their details are below.
-### 7-Zip @ 23.01
+### 7-Zip @ 24.08
Chocolatey uses [7-Zip](http://www.7-zip.org/) for uncompressing archives.
[License terms](http://www.7-zip.org/license.txt):
@@ -198,7 +198,7 @@ Chocolatey uses [AlphaFS](https://github.com/alphaleonis/AlphaFS) for long file
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
-### Checksum @ 0.2.0
+### Checksum @ 0.3.1
Chocolatey uses [Checksum](https://github.com/chocolatey/checksum) to determine checksums.
[License terms](https://github.com/chocolatey/checksum/blob/e6f5645610c7bc15084b48f69d4cdb056106f956/LICENSE):
@@ -598,113 +598,205 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
-### Microsoft.Web.Xdt @ 2.1.1
+### Microsoft.Web.Xdt @ 3.1.0
Chocolatey uses [Microsoft.Web.Xdt](https://www.nuget.org/packages/Microsoft.Web.xdt) to perform Xml Document Transformation.
-[License terms](https://www.microsoft.com/web/webpi/eula/microsoft_web_xmltransform.htm):
+[License terms](https://github.com/dotnet/xdt/blob/01eb67319c7e9a852799734dfb7c29fa64b48c69/LICENSE.txt):
```txt
- MICROSOFT SOFTWARE LICENSE TERMS
-
- MICROSOFT.WEB.XDT
-
- These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft
-
- · updates,
-
- · supplements,
-
- · Internet-based services, and
-
- · support services
-
- for this software, unless other terms accompany those items. If so, those terms apply.
-
- By using the software, you accept these terms. If you do not accept them, do not use the software.
-
- If you comply with these license terms, you have the perpetual rights below.
-
- 1. INSTALLATION AND USE RIGHTS. You may install and use any number of copies of the software on your devices.
-
- 2. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
-
- a. Distributable Code. The software contains code that you are permitted to distribute in programs you develop if you comply with the terms below.
-
- i. Right to Use and Distribute. You may copy and distribute the object code form of Microsoft.Web.XmlTransform.dll file.
-
- · Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.
-
- ii.Distribution Requirements. For any Distributable Code you distribute, you must
-
- · add significant primary functionality to it in your programs;
-
- · require distributors and external end users to agree to terms that protect it at least as much as this agreement;
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
- · display your valid copyright notice on your programs; and
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
- · indemnify, defend, and hold harmless Microsoft from any claims, including attorneys’ fees, related to the distribution or use of your programs.
+ 1. Definitions.
- iii. Distribution Restrictions. You may not
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
- · alter any copyright, trademark or patent notice in the Distributable Code;
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
- · use Microsoft’s trademarks in your programs’ names or in a way that suggests your programs come from or are endorsed by Microsoft;
+ "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.
- · distribute Distributable Code to run on a platform other than the Windows platform;
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
- · include Distributable Code in malicious, deceptive or unlawful programs; or
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
- · modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that
+ "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.
- · the code be disclosed or distributed in source code form; or
+ "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).
- · others have the right to modify it.
+ "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.
- 3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
+ "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."
- · work around any technical limitations in the software;
+ "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.
- · reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
+ 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.
- · make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;
+ 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.
- · publish the software for others to copy;
+ 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:
- · rent, lease or lend the software; or
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
- · transfer the software or this agreement to any third party.
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
- 4. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall the software.
+ (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
- 5. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
+ (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.
- 6. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting.
+ 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.
- 7. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
+ 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.
- 8. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
+ 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.
- 9. APPLICABLE LAW.
+ 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.
- a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
+ 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.
- b. Outside the United States. If you acquired the software in any other country, the laws of that country apply.
+ 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.
- 10. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
+ END OF TERMS AND CONDITIONS
+```
- 11. DISCLAIMER OF WARRANTY. The software is licensed “as-is.” You bear the risk of using it. Microsoft gives no express warranties, guarantees or conditions. You may have additional consumer rights or statutory guarantees under your local laws which this agreement cannot change. To the extent permitted under your local laws, Microsoft excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
+### Newtonsoft.Json @ 13.0.1
- FOR AUSTRALIA – You have statutory guarantees under the Australian Consumer Law and nothing in these terms is intended to affect those rights.
+Chocolatey uses [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json) to help serialize/deserialze JSON files.
+[License terms](https://github.com/JamesNK/Newtonsoft.Json/blob/415b563806c218e9270331ea98c584fe84e58880/LICENSE.md):
- 12. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. You can recover from Microsoft and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.
+```txt
+The MIT License (MIT)
- This limitation applies to
+Copyright (c) 2007 James Newton-King
- · anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
+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 furnished to do so, subject to the following conditions:
- · claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
+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.
```
### Chocolatey.NuGet.Client @ 3.4.2
@@ -763,7 +855,7 @@ Chocolatey uses [Rhino.Licensing](https://github.com/ayende/rhino-licensing) [(m
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
-### Shim Generator (shimgen) @ 1.0.0
+### Shim Generator (shimgen) @ 2.0.0
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/96a796297641807094f1f56d130a7413e583d0ac/src/chocolatey.resources/tools/shimgen.license.txt):
@@ -892,7 +984,7 @@ SOFTWARE.
### System.Runtime.CompilerServices.Unsafe @ 4.5.3
This is a dependency of System.Threading.Tasks.Extensions.
-[Licensed terms](https://github.com/dotnet/runtime/blob/5bdc36e1d956fc39cd768b6cf59ac4b4bf5f56a5/LICENSE.TXT):
+[License terms](https://github.com/dotnet/runtime/blob/5bdc36e1d956fc39cd768b6cf59ac4b4bf5f56a5/LICENSE.TXT):
```txt
The MIT License (MIT)
@@ -923,7 +1015,7 @@ SOFTWARE.
### System.Threading.Tasks.Extensions @ 4.5.4
This is a dependency of System.Reactive.
-[Licensed terms](https://github.com/dotnet/runtime/blob/5bdc36e1d956fc39cd768b6cf59ac4b4bf5f56a5/LICENSE.TXT):
+[License terms](https://github.com/dotnet/runtime/blob/5bdc36e1d956fc39cd768b6cf59ac4b4bf5f56a5/LICENSE.TXT):
```txt
The MIT License (MIT)
diff --git a/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1
index 0034cbe82f..da4a61d93a 100644
--- a/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1
+++ b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1
@@ -1,8 +1,7 @@
$thisScriptFolder = (Split-Path -Parent $MyInvocation.MyCommand.Definition)
$chocoInstallVariableName = "ChocolateyInstall"
-$sysDrive = $env:SystemDrive
$tempDir = $env:TEMP
-$defaultChocolateyPathOld = "$sysDrive\Chocolatey"
+$insecureRootInstallPath = "$env:SystemDrive\Chocolatey"
$originalForegroundColor = $host.ui.RawUI.ForegroundColor
@@ -135,14 +134,15 @@ function Initialize-Chocolatey {
}
# variable to allow insecure directory:
- $allowInsecureRootInstall = $false
- if ($env:ChocolateyAllowInsecureRootDirectory -eq 'true') {
- $allowInsecureRootInstall = $true
- }
+ $allowInsecureRootInstall = $env:ChocolateyAllowInsecureRootDirectory -eq '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)) {
+
+ $useCustomInstallPath = $alreadyInitializedNugetPath -and
+ $alreadyInitializedNugetPath -ne $chocolateyPath -and
+ ($allowInsecureRootInstall -or $alreadyInitializedNugetPath -ne $insecureRootInstallPath)
+ if ($useCustomInstallPath) {
$chocolateyPath = $alreadyInitializedNugetPath
}
else {
@@ -194,11 +194,6 @@ Creating Chocolatey CLI folders if they do not already exist.
$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
Invoke-Chocolatey-Initial
if ($env:ChocolateyExitCode -eq $null -or $env:ChocolateyExitCode -eq '') {
@@ -220,10 +215,6 @@ You may need to shut down and restart powershell and/or consoles
"@ | Write-Output
}
- if (-not $allowInsecureRootInstall) {
- Remove-OldChocolateyInstall $defaultChocolateyPathOld
- }
-
Remove-UnsupportedShimFiles -Paths $chocolateyExePath
}
@@ -368,87 +359,6 @@ function Ensure-Permissions {
$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", "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
@@ -874,10 +784,10 @@ function Invoke-Chocolatey-Initial {
Export-ModuleMember -Function Initialize-Chocolatey
# SIG # Begin signature block
-# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor
+# MIInJQYJKoZIhvcNAQcCoIInFjCCJxICAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
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w0BCQUxDxcNMjQxMDI5MjE0NDEwWjAvBgkqhkiG9w0B
+# CQQxIgQg0DDuo+Q/agbHq5fwMcgOhZjC/qkLi3O5EEeOtiFVK3cwDQYJKoZIhvcN
+# AQEBBQAEggIAJi3PKc34pOS57XYbtIwfEH3jGIC1hBwImdAjeiny5XCUzDJ+MCb/
+# kasK1TsiIf5+O4B8SPSPQsi+9nFHmpyxnO+KFiPM6qv0pI2Uy3VUofLd+J0EiL7A
+# IwwR2Q4nZcQwt5sUX47QiW/NM9+95zuSv3isZp0gEqkgRlm0D1oswOl9wbsRQFzl
+# gHyemdiDFdNf4MoEZhAKa5w41uJVAKfm5Q41l6sXDLNTOkw+cggwHKnaBiA74+Hi
+# HgDGtE9fdQWBhn577tuoHL7YP2ta1b/eYIVuchukub38wTps1KX8riaVbYGNt5M2
+# v9AfiT4MbpzOPZXFbgW6oyztxCS/pXQLYESytIY4M4SUtA4MxsD2bFMJjwcA9IZL
+# 7XJklq+q+02kcvzZKLIK6dcfxfBsy714VVZpc7CAlAGT5JjsYYL3HrcQ83fFlENv
+# a8ley6s/fMLtw0nZXC46kZfHBBRO2Um7wSQsf6k9TRDt+/vF+aNo1jpRDu0Jlw8o
+# Q0h4udyE/8BTLl88Sv7cttVk7E//2vA2NjUy74n9UcOMx4DbwlSa7xCP2V/j7+uJ
+# sDFbogq46ONf26yMs5V2PkHObaYovCfWp2qSm6ArwJOqQac0RbpndFCEwWAt4iss
+# oSdMIYFkh0U4BPdavX84Tl9AjmZleEZ9Pw+lqd9JAxe4xVKDXHdG1po=
# SIG # End signature block
diff --git a/recipe.cake b/recipe.cake
index 017d2baca6..feca7ac13c 100644
--- a/recipe.cake
+++ b/recipe.cake
@@ -1,4 +1,5 @@
#load nuget:?package=Chocolatey.Cake.Recipe&version=0.28.4
+#tool nuget:?package=WiX&version=3.11.2
///////////////////////////////////////////////////////////////////////////////
// TOOLS
@@ -172,11 +173,21 @@ Task("Prepare-Chocolatey-Packages")
{
// Copy legal documents
CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt");
+ CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco/LICENSE.txt", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/LICENSE.txt");
- // Run Chocolatey Unpackself
- CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe");
+ // Copy choco.exe.manifest
+ CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe.manifest", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe.manifest");
+
+ // Copy external file resources
+ EnsureDirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers");
+ CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/helpers/**/*"), BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers", true);
+ EnsureDirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects");
+ CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/redirects/**/*"), BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects", true);
+ EnsureDirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools");
+ CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/tools/**/*"), BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools", true);
- StartProcess(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build --run-actual" });
+ // Copy merged choco.exe
+ CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco_merged/choco.exe", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe");
// Copy Chocolatey.PowerShell.dll and its help.xml file
CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll");
@@ -264,11 +275,21 @@ Task("Prepare-ChocolateyNo7zip-Package")
// Copy legal documents
CopyFile(BuildParameters.RootDirectoryPath + "/docs/legal/CREDITS.md", nuspecDirectory + "/tools/chocolateyInstall/CREDITS.txt");
+ CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/LICENSE.txt", nuspecDirectory + "/tools/chocolateyInstall/LICENSE.txt");
- // Run Chocolatey Unpackself
- CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", nuspecDirectory + "/tools/chocolateyInstall/choco.exe");
+ // Copy choco.exe.manifest
+ CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe.manifest", nuspecDirectory + "/tools/chocolateyInstall/choco.exe.manifest");
+
+ // Copy external file resources
+ EnsureDirectoryExists(nuspecDirectory + "/tools/chocolateyInstall/helpers");
+ CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/helpers/**/*"), nuspecDirectory + "/tools/chocolateyInstall/helpers", true);
+ EnsureDirectoryExists(nuspecDirectory + "/tools/chocolateyInstall/redirects");
+ CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/redirects/**/*"), nuspecDirectory + "/tools/chocolateyInstall/redirects", true);
+ EnsureDirectoryExists(nuspecDirectory + "/tools/chocolateyInstall/tools");
+ CopyFiles(GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/tools/**/*"), nuspecDirectory + "/tools/chocolateyInstall/tools", true);
- StartProcess(nuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" });
+ // Copy merged choco.exe
+ CopyFile(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip_merged/choco.exe", nuspecDirectory + "/tools/chocolateyInstall/choco.exe");
// Copy Chocolatey.PowerShell.dll and help.xml file
CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll", nuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll");
diff --git a/setup.ps1 b/setup.ps1
index 187b242e30..e0bb159561 100644
--- a/setup.ps1
+++ b/setup.ps1
@@ -3,4 +3,7 @@ if (-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall")) {
Invoke-Expression ((New-Object net.webclient).DownloadString("https://community.chocolatey.org/install.ps1"))
}
-choco install pester -version 2.0.2
+choco install dotnetfx -y
+choco install visualstudio2019buildtools -y
+choco install netfx-4.8-devpack -y
+choco install dotnet-sdk -y
diff --git a/src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml
index b6f74a03dd..a1d054d346 100644
--- a/src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml
+++ b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml
@@ -154,23 +154,23 @@
Online Version:
- https://docs.chocolatey.org/en-us/create/functions/get-environmentvariable
+ https://docs.chocolatey.org/en-us/create/cmdlets/get-environmentvariableGet-EnvironmentVariableNames
- xref:get-environmentvariablenames
+ xref:get-environmentvariablenames,mb-3 d-blockSet-EnvironmentVariable
- xref:set-environmentvariable
+ xref:set-environmentvariable,mb-3 d-blockCmdlet Reference
- xref:powershell-cmdlet-reference
+ xref:powershell-cmdlet-reference,mb-3 d-blockFunction Reference
- xref:powershell-reference
+ xref:powershell-reference,d-block
@@ -274,23 +274,23 @@
Online Version:
- https://docs.chocolatey.org/en-us/create/functions/get-environmentvariablenames
+ https://docs.chocolatey.org/en-us/create/cmdlets/get-environmentvariablenames
- Get-EnvironmentVariable
- xref:get-environmentvariable
+ Get-EnvironmentVariableNames
+ xref:get-environmentvariablenames,mb-3 d-blockSet-EnvironmentVariable
- xref:set-environmentvariable
+ xref:set-environmentvariable,mb-3 d-blockCmdlet Reference
- xref:powershell-cmdlet-reference
+ xref:powershell-cmdlet-reference,mb-3 d-blockFunction Reference
- xref:powershell-reference
+ xref:powershell-reference,d-block
@@ -300,8 +300,7 @@
InstallChocolateyPath
- > :choco-info: NOTE > > Administrative Access Required when `-PathType 'Machine'.`
- This puts a directory to the PATH environment variable.
+ > :choco-info: NOTE > > Administrative Access Required when `-PathType 'Machine'.` This puts a directory to the PATH environment variable.
@@ -351,6 +350,28 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+
+ SwitchParameter
+
+
+ False
+
@@ -390,6 +411,30 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
@@ -401,7 +446,7 @@
- -------------------------- Example 1 --------------------------
+ -------------------------- Example 2 --------------------------PS C:\> Install-ChocolateyPath -PathToInstall "$($env:SystemDrive)\tools\gittfs"Adds the target path to the current user's PATH.
@@ -418,35 +463,35 @@
Online Version:
- https://docs.chocolatey.org/en-us/create/functions/install-chocolateypath
+ https://docs.chocolatey.org/en-us/create/cmdlets/install-chocolateypathUninstall-ChocolateyPath
- xref:uninstall-chocolateypath
+ xref:uninstall-chocolateypath,mb-3 d-blockInstall-ChocolateyEnvironmentVariable
- xref:install-chocolateyenvironmentvariable
+ xref:install-chocolateyenvironmentvariable,mb-3 d-block
- Get-EnvironmentVariable
- xref:get-environmentvariable
+ Get-EnvironmentVariableNames
+ xref:get-environmentvariablenames,mb-3 d-blockSet-EnvironmentVariable
- xref:set-environmentvariable
+ xref:set-environmentvariable,mb-3 d-blockGet-ToolsLocation
- xref:get-toolslocation
+ xref:get-toolslocation,mb-3 d-blockCmdlet Reference
- xref:powershell-cmdlet-reference
+ xref:powershell-cmdlet-reference,mb-3 d-blockFunction Reference
- xref:powershell-reference
+ xref:powershell-reference,d-block
@@ -456,8 +501,7 @@
SetEnvironmentVariable
- > :choco-info: NOTE > > Administrative Access Required when `-Scope 'Machine'.`
- DO NOT USE. Not part of the public API. Use `Install-ChocolateyEnvironmentVariable` instead.
+ > :choco-info: NOTE > > Administrative Access Required when `-Scope 'Machine'.` DO NOT USE. Not part of the public API. Use `Install-ChocolateyEnvironmentVariable` instead.
@@ -519,6 +563,28 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+
+ SwitchParameter
+
+
+ False
+
@@ -570,6 +636,30 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
@@ -590,31 +680,31 @@
Online Version:
- https://docs.chocolatey.org/en-us/create/functions/set-environmentvariable
+ https://docs.chocolatey.org/en-us/create/cmdlets/set-environmentvariableInstall-ChocolateyEnvironmentVariable
- xref:install-chocolateyenvironmentvariable
+ xref:install-chocolateyenvironmentvariable,mb-3 d-blockUninstall-ChocolateyEnvironmentVariable
- xref:uninstall-chocolateyenvironmentvariable
+ xref:uninstall-chocolateyenvironmentvariable,mb-3 d-blockInstall-ChocolateyPath
- xref:install-chocolateypath
+ xref:install-chocolateypath,mb-3 d-block
- Get-EnvironmentVariable
- xref:get-environmentvariable
+ Get-EnvironmentVariableNames
+ xref:get-environmentvariablenames,mb-3 d-blockCmdlet Reference
- xref:powershell-cmdlet-reference
+ xref:powershell-cmdlet-reference,mb-3 d-blockFunction Reference
- xref:powershell-reference
+ xref:powershell-reference,d-block
@@ -690,15 +780,15 @@
Online Version:
- https://docs.chocolatey.org/en-us/create/functions/test-processadminrights
+ https://docs.chocolatey.org/en-us/create/cmdlets/test-processadminrightsCmdlet Reference
- xref:powershell-cmdlet-reference
+ xref:powershell-cmdlet-reference,mb-3 d-blockFunction Reference
- xref:powershell-reference
+ xref:powershell-reference,d-block
@@ -708,8 +798,7 @@
UninstallChocolateyPath
- > :choco_info: NOTE > > Administrative Access Required when `-PathType 'Machine'.`
- This puts a directory to the PATH environment variable.
+ > :choco-info: NOTE > > Administrative Access Required when `-PathType 'Machine'.` This puts a directory to the PATH environment variable.
@@ -759,6 +848,28 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+
+ SwitchParameter
+
+
+ False
+
@@ -798,6 +909,30 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
@@ -825,35 +960,35 @@
Online Version:
- https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateypath
+ https://docs.chocolatey.org/en-us/create/cmdlets/uninstall-chocolateypathInstall-ChocolateyPath
- xref:install-chocolateypath
+ xref:install-chocolateypath,mb-3 d-blockInstall-ChocolateyEnvironmentVariable
- xref:install-chocolateyenvironmentvariable
+ xref:install-chocolateyenvironmentvariable,mb-3 d-block
- Get-EnvironmentVariable
- xref:get-environmentvariable
+ Get-EnvironmentVariableNames
+ xref:get-environmentvariablenames,mb-3 d-blockSet-EnvironmentVariable
- xref:set-environmentvariable
+ xref:set-environmentvariable,mb-3 d-blockGet-ToolsLocation
- xref:get-toolslocation
+ xref:get-toolslocation,mb-3 d-blockCmdlet Reference
- xref:powershell-cmdlet-reference
+ xref:powershell-cmdlet-reference,mb-3 d-blockFunction Reference
- xref:powershell-reference
+ xref:powershell-reference,d-block
@@ -885,6 +1020,28 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+
+ SwitchParameter
+
+
+ False
+
@@ -900,6 +1057,30 @@
None
+
+ Confirm
+
+ Prompts you for confirmation before running the cmdlet.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ WhatIf
+
+ Shows what would happen if the cmdlet runs. The cmdlet is not run.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
@@ -921,15 +1102,15 @@
Online Version:
- https://docs.chocolatey.org/en-us/create/functions/update-sessionenvironment
+ https://docs.chocolatey.org/en-us/create/cmdlets/update-sessionenvironmentCmdlet Reference
- xref:powershell-cmdlet-reference
+ xref:powershell-cmdlet-reference,mb-3 d-blockFunction Reference
- xref:powershell-reference
+ xref:powershell-reference,d-block
diff --git a/src/Chocolatey.PowerShell/Commands/InstallChocolateyPathCommand.cs b/src/Chocolatey.PowerShell/Commands/InstallChocolateyPathCommand.cs
index c9da5edd3b..6ea999f47a 100644
--- a/src/Chocolatey.PowerShell/Commands/InstallChocolateyPathCommand.cs
+++ b/src/Chocolatey.PowerShell/Commands/InstallChocolateyPathCommand.cs
@@ -21,7 +21,7 @@
namespace Chocolatey.PowerShell.Commands
{
- [Cmdlet(VerbsLifecycle.Install, "ChocolateyPath")]
+ [Cmdlet(VerbsLifecycle.Install, "ChocolateyPath", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType(typeof(void))]
public class InstallChocolateyPathCommand : ChocolateyCmdlet
{
diff --git a/src/Chocolatey.PowerShell/Commands/SetEnvironmentVariableCommand.cs b/src/Chocolatey.PowerShell/Commands/SetEnvironmentVariableCommand.cs
index a73c996aa5..1c68a79517 100644
--- a/src/Chocolatey.PowerShell/Commands/SetEnvironmentVariableCommand.cs
+++ b/src/Chocolatey.PowerShell/Commands/SetEnvironmentVariableCommand.cs
@@ -21,7 +21,7 @@
namespace Chocolatey.PowerShell.Commands
{
- [Cmdlet(VerbsCommon.Set, "EnvironmentVariable")]
+ [Cmdlet(VerbsCommon.Set, "EnvironmentVariable", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType(typeof(void))]
public sealed class SetEnvironmentVariableCommand : ChocolateyCmdlet
{
diff --git a/src/Chocolatey.PowerShell/Commands/UninstallChocolateyPathCommand.cs b/src/Chocolatey.PowerShell/Commands/UninstallChocolateyPathCommand.cs
index 92faf6a826..e8b4742a2e 100644
--- a/src/Chocolatey.PowerShell/Commands/UninstallChocolateyPathCommand.cs
+++ b/src/Chocolatey.PowerShell/Commands/UninstallChocolateyPathCommand.cs
@@ -21,7 +21,7 @@
namespace Chocolatey.PowerShell.Commands
{
- [Cmdlet(VerbsLifecycle.Uninstall, "ChocolateyPath")]
+ [Cmdlet(VerbsLifecycle.Uninstall, "ChocolateyPath", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType(typeof(void))]
public class UninstallChocolateyPathCommand : ChocolateyCmdlet
{
diff --git a/src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs b/src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs
index 65c32d514e..a22acf07ac 100644
--- a/src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs
+++ b/src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs
@@ -20,7 +20,7 @@
namespace Chocolatey.PowerShell.Commands
{
- [Cmdlet(VerbsData.Update, "SessionEnvironment")]
+ [Cmdlet(VerbsData.Update, "SessionEnvironment", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Low)]
[OutputType(typeof(void))]
public sealed class UpdateSessionEnvironmentCommand : ChocolateyCmdlet
{
diff --git a/src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs b/src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs
index fedc3d86e2..173fb910c0 100644
--- a/src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs
+++ b/src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs
@@ -139,7 +139,11 @@ public static void SetVariable(PSCmdlet cmdlet, string name, EnvironmentVariable
{
if (scope == EnvironmentVariableTarget.Process)
{
- Environment.SetEnvironmentVariable(name, value);
+ if (cmdlet.ShouldProcess(name, "Set Process environment variable"))
+ {
+ Environment.SetEnvironmentVariable(name, value);
+ }
+
return;
}
@@ -166,32 +170,38 @@ public static void SetVariable(PSCmdlet cmdlet, string name, EnvironmentVariable
cmdlet.WriteDebug($"Registry type for {name} is/will be {registryType}");
- if (string.IsNullOrEmpty(value))
- {
- registryKey.DeleteValue(name, throwOnMissingValue: false);
- }
- else
+ if (cmdlet.ShouldProcess(name, $"Set {scope} environment variable"))
{
- registryKey.SetValue(name, value, registryType);
+ if (string.IsNullOrEmpty(value))
+ {
+ registryKey.DeleteValue(name, throwOnMissingValue: false);
+ }
+ else
+ {
+ registryKey.SetValue(name, value, registryType);
+ }
}
}
try
{
- // Trigger environment refresh in explorer.exe:
- // 1. Notify all windows of environment block change
- NativeMethods.SendMessageTimeout(
- hWnd: (IntPtr)NativeMethods.HWND_BROADCAST,
- Msg: NativeMethods.WM_SETTINGCHANGE,
- wParam: UIntPtr.Zero,
- lParam: "Environment",
- fuFlags: 2,
- uTimeout: 5000,
- out UIntPtr result);
-
- // 2. Set a user environment variable making the system refresh
- var setxPath = string.Format(@"{0}\System32\setx.exe", GetVariable(cmdlet, EnvironmentVariables.SystemRoot, EnvironmentVariableTarget.Process));
- cmdlet.InvokeCommand.InvokeScript($"& \"{setxPath}\" {EnvironmentVariables.ChocolateyLastPathUpdate} \"{DateTime.Now.ToFileTime()}\"");
+ if (cmdlet.ShouldProcess("Environment variables", "Notify system of changes"))
+ {
+ // Trigger environment refresh in explorer.exe:
+ // 1. Notify all windows of environment block change
+ NativeMethods.SendMessageTimeout(
+ hWnd: (IntPtr)NativeMethods.HWND_BROADCAST,
+ Msg: NativeMethods.WM_SETTINGCHANGE,
+ wParam: UIntPtr.Zero,
+ lParam: "Environment",
+ fuFlags: 2,
+ uTimeout: 5000,
+ out UIntPtr result);
+
+ // 2. Set a user environment variable making the system refresh
+ var setxPath = string.Format(@"{0}\System32\setx.exe", GetVariable(cmdlet, EnvironmentVariables.SystemRoot, EnvironmentVariableTarget.Process));
+ cmdlet.InvokeCommand.InvokeScript($"& \"{setxPath}\" {EnvironmentVariables.ChocolateyLastPathUpdate} \"{DateTime.Now.ToFileTime()}\"");
+ }
}
catch (Exception error)
{
@@ -221,37 +231,40 @@ public static void UpdateSession(PSCmdlet cmdlet)
scopeList.Add(EnvironmentVariableTarget.User);
}
- foreach (var scope in scopeList)
+ if (cmdlet.ShouldProcess("Current process", "Refresh all environment variables"))
{
- foreach (var name in GetVariableNames(scope))
+ foreach (var scope in scopeList)
{
- var value = GetVariable(cmdlet, name, scope);
- if (!string.IsNullOrEmpty(value))
+ foreach (var name in GetVariableNames(scope))
{
- SetVariable(cmdlet, name, EnvironmentVariableTarget.Process, value);
+ var value = GetVariable(cmdlet, name, scope);
+ if (!string.IsNullOrEmpty(value))
+ {
+ SetVariable(cmdlet, name, EnvironmentVariableTarget.Process, value);
+ }
}
}
- }
- // Update PATH, combining both scopes' values.
- var paths = new string[2];
- paths[0] = GetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.Machine);
- paths[1] = GetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.User);
+ // Update PATH, combining both scopes' values.
+ var paths = new string[2];
+ paths[0] = GetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.Machine);
+ paths[1] = GetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.User);
- SetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.Process, string.Join(";", paths));
+ SetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.Process, string.Join(";", paths));
- // Preserve PSModulePath as it's almost always updated by process, preserve it
- SetVariable(cmdlet, EnvironmentVariables.PSModulePath, EnvironmentVariableTarget.Process, psModulePath);
+ // Preserve PSModulePath as it's almost always updated by process, preserve it
+ SetVariable(cmdlet, EnvironmentVariables.PSModulePath, EnvironmentVariableTarget.Process, psModulePath);
- // Preserve user and architecture
- if (!string.IsNullOrEmpty(userName))
- {
- SetVariable(cmdlet, EnvironmentVariables.Username, EnvironmentVariableTarget.Process, userName);
- }
+ // Preserve user and architecture
+ if (!string.IsNullOrEmpty(userName))
+ {
+ SetVariable(cmdlet, EnvironmentVariables.Username, EnvironmentVariableTarget.Process, userName);
+ }
- if (!string.IsNullOrEmpty(architecture))
- {
- SetVariable(cmdlet, EnvironmentVariables.ProcessorArchitecture, EnvironmentVariableTarget.Process, architecture);
+ if (!string.IsNullOrEmpty(architecture))
+ {
+ SetVariable(cmdlet, EnvironmentVariables.ProcessorArchitecture, EnvironmentVariableTarget.Process, architecture);
+ }
}
}
}
diff --git a/src/chocolatey.benchmark/App.config b/src/chocolatey.benchmark/App.config
new file mode 100644
index 0000000000..f8e1309c75
--- /dev/null
+++ b/src/chocolatey.benchmark/App.config
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/chocolatey.benchmark/BenchmarkConfig.cs b/src/chocolatey.benchmark/BenchmarkConfig.cs
new file mode 100644
index 0000000000..7e9f243a7c
--- /dev/null
+++ b/src/chocolatey.benchmark/BenchmarkConfig.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BenchmarkDotNet.Analysers;
+using BenchmarkDotNet.Columns;
+using BenchmarkDotNet.Configs;
+using BenchmarkDotNet.Diagnosers;
+using BenchmarkDotNet.Environments;
+using BenchmarkDotNet.Exporters;
+using BenchmarkDotNet.Exporters.Csv;
+using BenchmarkDotNet.Jobs;
+using BenchmarkDotNet.Loggers;
+
+namespace chocolatey.benchmark
+{
+ internal static class BenchmarkConfig
+ {
+ public static IConfig Get()
+ {
+ var config = ManualConfig.CreateEmpty();
+
+ foreach (var platform in new[] { Platform.X64/*, Platform.X86*/ })
+ {
+ config = config.AddJob(Job.Default.WithRuntime(ClrRuntime.Net48).WithPlatform(platform).WithJit(Jit.LegacyJit));
+ }
+
+ return config
+ .AddDiagnoser(MemoryDiagnoser.Default)
+ .AddColumnProvider(DefaultColumnProviders.Instance)
+ .AddLogger(ConsoleLogger.Default)
+ .AddExporter(CsvExporter.Default)
+ .AddExporter(HtmlExporter.Default)
+ .AddExporter(MarkdownExporter.Default)
+ .AddExporter(AsciiDocExporter.Default)
+ .AddAnalyser(GetAnalysers().ToArray());
+ }
+
+ private static IEnumerable GetAnalysers()
+ {
+ yield return EnvironmentAnalyser.Default;
+ yield return OutliersAnalyser.Default;
+ yield return MinIterationTimeAnalyser.Default;
+ yield return MultimodalDistributionAnalyzer.Default;
+ yield return RuntimeErrorAnalyser.Default;
+ yield return ZeroMeasurementAnalyser.Default;
+ yield return BaselineCustomAnalyzer.Default;
+ }
+ }
+}
diff --git a/src/chocolatey.benchmark/ParentProcessBenchmarks.cs b/src/chocolatey.benchmark/ParentProcessBenchmarks.cs
new file mode 100644
index 0000000000..21486b8304
--- /dev/null
+++ b/src/chocolatey.benchmark/ParentProcessBenchmarks.cs
@@ -0,0 +1,69 @@
+using System.Runtime.CompilerServices;
+using BenchmarkDotNet.Attributes;
+using chocolatey.benchmark.helpers;
+using chocolatey.infrastructure.information;
+
+namespace chocolatey.benchmark
+{
+ public class ParentProcessBenchmarks
+ {
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public string GetParentProcessDocumentedPinvoke()
+ {
+ return PinvokeProcessHelper.GetDocumentedParent();
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public string GetParentProcessFilteredDocumentedPinvoke()
+ {
+ return PinvokeProcessHelper.GetDocumentedParentFiltered();
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public string GetParentProcessFilteredManaged()
+ {
+ return ManagedProcessHelper.GetParent();
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public string GetParentProcessFilteredUndocumentedPinvoke()
+ {
+ return PinvokeProcessHelper.GetUndocumentedParentFiltered();
+ }
+
+ [Benchmark(Baseline = true), MethodImpl(MethodImplOptions.NoInlining)]
+ public string GetParentProcessManaged()
+ {
+ return ManagedProcessHelper.GetParent();
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public ProcessTree GetParentProcessTreeDocumentedPinvoke()
+ {
+ return PinvokeProcessHelper.GetDocumentedProcessTree();
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public ProcessTree GetParentProcessTreeManaged()
+ {
+ return ManagedProcessHelper.GetProcessTree();
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public ProcessTree GetParentProcessTreeUndocumentedPinvoke()
+ {
+ return PinvokeProcessHelper.GetUndocumentedProcessTree();
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public string GetParentProcessUndocumentedPinvoke()
+ {
+ return PinvokeProcessHelper.GetUndocumentedParent();
+ }
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ public ProcessTree GetParentProcessTreeImplemented()
+ {
+ return ProcessInformation.GetProcessTree();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/chocolatey.benchmark/ProcessTreeBenchmark.cs b/src/chocolatey.benchmark/ProcessTreeBenchmark.cs
new file mode 100644
index 0000000000..b6264324e7
--- /dev/null
+++ b/src/chocolatey.benchmark/ProcessTreeBenchmark.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using BenchmarkDotNet.Attributes;
+using chocolatey.benchmark.helpers;
+using chocolatey.infrastructure.information;
+
+namespace chocolatey.benchmark
+{
+ public class ProcessTreeBenchmark
+ {
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ [ArgumentsSource(nameof(GetProcessTree))]
+ public string GetFirstFilteredProcessName(ProcessTree tree)
+ {
+ return tree.FirstFilteredProcessName;
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ [ArgumentsSource(nameof(GetProcessTree))]
+ public string GetFirstProcessName(ProcessTree tree)
+ {
+ return tree.FirstProcessName;
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ [ArgumentsSource(nameof(GetProcessTree))]
+ public string GetLastFilteredProcessName(ProcessTree tree)
+ {
+ return tree.LastFilteredProcessName;
+ }
+
+ [Benchmark, MethodImpl(MethodImplOptions.NoInlining)]
+ [ArgumentsSource(nameof(GetProcessTree))]
+ public string GetLastProcessName(ProcessTree tree)
+ {
+ return tree.LastProcessName;
+ }
+
+ [Benchmark(Baseline = true), MethodImpl(MethodImplOptions.NoInlining)]
+ [ArgumentsSource(nameof(GetProcessTree))]
+ public LinkedList GetProcessesList(ProcessTree tree)
+ {
+ return tree.Processes;
+ }
+
+ public IEnumerable