Skip to content

Update cmdlet #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 77 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e53bc8f
Set up CI with Azure Pipelines
alerickson Jan 26, 2021
1b4e76d
Set up CI with Azure Pipelines
alerickson Jan 26, 2021
0880d95
Set up CI with Azure Pipelines
alerickson Jan 26, 2021
976ea4d
create new src directory
alerickson Feb 9, 2021
0976f05
create new test directory
alerickson Feb 9, 2021
b20cf7b
Merge branch 'development' of https://github.com/powershell/PowerShel…
alerickson Mar 12, 2021
f37e3f1
Merge branch 'development' of https://github.com/powershell/PowerShel…
alerickson Apr 15, 2021
18c1e75
Merge branch 'development' of https://github.com/PowerShell/PowerShel…
alerickson Jun 9, 2021
4a1a72f
Begin refactoring Install
alerickson Jun 22, 2021
c893be2
Merge branch 'development' of https://github.com/PowerShell/PowerShel…
alerickson Jun 22, 2021
792c6fa
Fix bug in GetHelper class related to debug statement
alerickson Jun 23, 2021
219e71b
Major refactors to Install helper
alerickson Jun 23, 2021
cae3d5e
Update utils class
alerickson Jun 23, 2021
8d2f910
incorporate bug fixes
alerickson Jun 29, 2021
f270329
Merge branch 'master' of https://github.com/PowerShell/PowerShellGet …
alerickson Jun 29, 2021
67b2c5f
Add install bug fixes and tests
alerickson Jul 1, 2021
6302b2d
Update project to C# 7.2
alerickson Jul 1, 2021
e44b9b5
Add scope tests
alerickson Jul 1, 2021
06403ed
Merge branch 'master' of https://github.com/alerickson/PowerShellGet …
alerickson Jul 1, 2021
0a1edf4
create new src directory
alerickson Jul 2, 2021
0a1bbc2
made changes to paths created in InstallHelper and use Scope as string
anamnavi Jul 7, 2021
2e6081f
Incorporate bug fixes for accept license, scripts, and installation p…
alerickson Jul 7, 2021
c2d95d3
Add more install tests
alerickson Jul 7, 2021
95c7935
resolve merge conflicts from pulling in Install changes
anamnavi Jul 7, 2021
db19cb8
remove comments used for debugging earlier
anamnavi Jul 7, 2021
fc7cc7f
Clean up code and tests
alerickson Jul 8, 2021
8b22604
remove some files accidentally added
anamnavi Jul 8, 2021
a8b8962
Change scope to be a an Enum type
alerickson Jul 8, 2021
e64691f
Delete azure-pipelines-1.yml
alerickson Jul 8, 2021
ff95a3c
Delete azure-pipelines-2.yml
alerickson Jul 8, 2021
44b8dfe
Delete azure-pipelines.yml
alerickson Jul 8, 2021
c0907ba
Address bugs introduced from changing Scope type to enum
alerickson Jul 8, 2021
cfcf351
Incorporate review feedback, clean up code a bit
alerickson Jul 9, 2021
386f0a9
Remove input object parameter
alerickson Jul 10, 2021
4aff535
Remove string comparison in install helper
alerickson Jul 10, 2021
42c4a39
Update src/code/PSResourceInfo.cs
alerickson Jul 10, 2021
f80c3f8
Address some code review suggestions
alerickson Jul 10, 2021
002cd94
Merge branch 'installRefactor' of https://github.com/alerickson/Power…
alerickson Jul 10, 2021
fb9de86
Add comments and incorporate other code review changes
alerickson Jul 12, 2021
c2a5c52
add tests for Update
anamnavi Jul 12, 2021
2b52465
Add save functionality
alerickson Jul 13, 2021
869d596
Update InstallHelper with Save changes
alerickson Jul 13, 2021
ca89e9a
remove NoClobber as Update parameter
anamnavi Jul 13, 2021
ec6dc7a
pull in changes for Install
anamnavi Jul 13, 2021
a6cf093
Merge branch 'master' of https://github.com/anamnavi/PowerShellGet in…
anamnavi Jul 13, 2021
57023cf
Update src/code/InstallPSResource.cs
alerickson Jul 13, 2021
7477528
Incorporate further code review changes
alerickson Jul 13, 2021
61d2d5b
Merge branch 'installRefactor' of https://github.com/alerickson/Power…
alerickson Jul 13, 2021
c4cc08f
add IsPRerelease to AdditionalMetadata
anamnavi Jul 13, 2021
6acf8e2
resolve merge conflicts
anamnavi Jul 13, 2021
6ea5a64
resolve prerelease label issue
anamnavi Jul 14, 2021
27aa0e4
fix merge conflicts
anamnavi Jul 20, 2021
cd9e625
fix merge conflicts in tests
anamnavi Jul 20, 2021
c607a11
pull in Install test from master
anamnavi Jul 20, 2021
05fbb0e
pull in PSGetTestUtils form master
anamnavi Jul 20, 2021
ca35b8c
add helper for filtering wildcards that handles *
anamnavi Jul 20, 2021
2547dd2
fix failing tests
anamnavi Jul 20, 2021
8b78922
resolve feedback from PR
anamnavi Jul 20, 2021
7098b2d
add code to skip if not windows tests
anamnavi Jul 20, 2021
2c8e7e9
rename Utils helper method and remove unecessary comments
anamnavi Jul 20, 2021
123e962
add SupportShouldProcess
anamnavi Jul 20, 2021
86e50ce
fix tests for updating with Scope, and use Get-InstalledPSResource in…
anamnavi Jul 21, 2021
f104e7e
revert change to TryParseVersionOrVersionRange
anamnavi Jul 27, 2021
729f729
Merge branch 'master' of https://github.com/anamnavi/PowerShellGet in…
anamnavi Jul 28, 2021
f115d94
remove cancellationToken
anamnavi Jul 28, 2021
39e3bd9
remove PSGalleryName variable not needed
anamnavi Jul 28, 2021
87bbcf1
update design and help docs for UpdatePSResource
anamnavi Jul 28, 2021
b6d7c8d
remove comments from Update tests
anamnavi Jul 28, 2021
b4aea7d
remove call to Register-LocalRepo helper as is not needed
anamnavi Jul 28, 2021
623fa9b
Merge branch 'master' of https://github.com/anamnavi/PowerShellGet in…
anamnavi Jul 29, 2021
63df3a6
add test for AcceptLicense paramter
anamnavi Jul 29, 2021
9fd206b
update test with AcceptLicense
anamnavi Jul 29, 2021
7d088a8
update Install test for AcceptLicense
anamnavi Jul 29, 2021
a5fceb5
add whatIf test to update
anamnavi Jul 29, 2021
b9605f3
resolve PR feedback and add skip to Unix AllUsers scope tests
anamnavi Jul 29, 2021
5ffe0dc
remove references to NameParameterSet
anamnavi Jul 29, 2021
2994ace
add fix for failing MacOS tests
anamnavi Jul 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 5 additions & 31 deletions Docs/UpdatePSResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ Other parameters allow the returned results to be further filtered.

### NameParameterSet (Default)
``` PowerShell
[[-Name] <string[]>] [-Version <string>] [-Prerelease] [-Scope <string>]
[[-Name] <string[]>] [-Version <string>] [-Prerelease] [-Scope <Microsoft.PowerShell.PowerShellGet.UtilClasses.ScopeType>]
[-Repository <string[]>] [-TrustRepository] [-Credential <pscredential>] [-Quiet]
[-AcceptLicense] [-NoClobber] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### InputObjectParameterSet
``` PowerShell
[[-InputObject] <object[]> [-WhatIf] [-Confirm] [<CommonParameters>]
```

## Parameters

### -Name
Expand Down Expand Up @@ -74,8 +69,8 @@ Parameter Sets: NameParameterSet
Specifies the scope of the resource to update.

```yml
Type: string
Parameter Sets: NameParameterSet, RequiredResourceFileParameterSet
Type: Microsoft.PowerShell.PowerShellGet.UtilClasses.ScopeType
Parameter Sets: NameParameterSet
AllowedValues: 'CurrentUser','AllUsers'
```

Expand All @@ -85,7 +80,7 @@ Suppresses being prompted for untrusted sources.

```yml
Type: SwitchParameter
Parameter Sets: NameParameterSet, RequiredResourceFileParameterSet
Parameter Sets: NameParameterSet
```

### -Credential
Expand Down Expand Up @@ -115,30 +110,19 @@ Type: SwitchParameter
Parameter Sets: (All)
```

### -NoClobber

Prevents updating modules that have the same cmdlets as a differently named module already

```yml
Type: SwitchParameter
Parameter Sets: NameParameterSet
```


### Outputs

No output.

## Notes
Input object still needs to be implemented.

Should a -PassThru parameter be added?

## Tests

Most update tests can be performed on a local repository.

Some tests should be performed on remote repository (PSGallery) to verify remote operation, but can be limited.
Some tests should be performed on remote repository (PoshTestGallery) to verify remote operation, but can be limited.

### -Name param

Expand All @@ -149,11 +133,6 @@ Some tests should be performed on remote repository (PSGallery) to verify remote
- Errors: Not found (single name, wildcard, multiple name)
- Errors: Repository: Invalid name, connection error, etc

### -Type InputObject

- Validate pipeline input
- Errors: The object passed in is not the correct type

### -Version param

- Validate the resource is updated to the correct version
Expand Down Expand Up @@ -193,11 +172,6 @@ Some tests should be performed on remote repository (PSGallery) to verify remote

- Validate that modules which require license agreements are approved without a prompt

### -NoClobber

- Validate that resources are not overwritten when flag is passed


## Work Items

### Create cmdlet and parameter sets
Expand Down
77 changes: 32 additions & 45 deletions help/Update-PSResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,45 @@ schema: 2.0.0
# Update-PSResource

## SYNOPSIS
{{ Fill in the Synopsis }}
Updates a package already installed on the user's machine.

## SYNTAX

### NameParameterSet (Default)
```
Update-PSResource [-Name] <String[]> [-Version <String>] [-Prerelease] [-Repository <String[]>]
[-Scope <String>] [-TrustRepository] [-Credential <PSCredential>] [-Quiet] [-AcceptLicense] [-NoClobber]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### RequiredResourceFileParameterSet
```
Update-PSResource [-Scope <String>] [-TrustRepository] [-Quiet] [-AcceptLicense] [-WhatIf] [-Confirm]
[<CommonParameters>]
[-Scope <Microsoft.PowerShell.PowerShellGet.UtilClasses.ScopeType>] [-TrustRepository] [-Credential <PSCredential>] [-Quiet] [-AcceptLicense] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}
The Update-PSResource cmdlet replaces the Update-Module and Update-Script cmdlets from V2.
It updates an already installed package based on the -Name parameter argument.
It does not return an object. Other parameters allow the package to be updated to be further filtered.

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Get-InstalledPSResource -Name "TestModule"
Name Version Prerelease Description
---- ------- ---------- -----------
TestModule 1.2.0 test

Update-PSResource -Name "TestModule"
Get-InstalledPSResource -Name "TestModule"
Name Version Prerelease Description
---- ------- ---------- -----------
TestModule 1.3.0 test
TestModule 1.2.0 test

```

{{ Add example description here }}
In this example, the user already has the TestModule package installed and they update the package. Update-PSResource will install the latest version of the package without deleting the older version installed.

## PARAMETERS

### -AcceptLicense
{{ Fill AcceptLicense Description }}
For resources that require a license, AcceptLicense automatically accepts the license agreement during the update.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -55,7 +61,7 @@ Accept wildcard characters: False
```

### -Credential
{{ Fill Credential Description }}
Specifies optional credentials to be used when accessing a private repository.

```yaml
Type: System.Management.Automation.PSCredential
Expand All @@ -65,12 +71,12 @@ Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept pipeline input: False
Accept wildcard characters: False
```

### -Name
{{ Fill Name Description }}
Specifies name of a resource or resources to update.

```yaml
Type: System.String[]
Expand All @@ -79,28 +85,13 @@ Aliases:

Required: True
Position: 0
Default value: None
Default value: "*"
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```

### -NoClobber
{{ Fill NoClobber Description }}

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NameParameterSet
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Accept wildcard characters: True
```

### -Prerelease
{{ Fill Prerelease Description }}
When specified, allows updating to a prerelease version.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -115,7 +106,7 @@ Accept wildcard characters: False
```

### -Quiet
{{ Fill Quiet Description }}
Supresses progress information.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -130,7 +121,8 @@ Accept wildcard characters: False
```

### -Repository
{{ Fill Repository Description }}
Specifies one or more repository names to update packages from.
If not specified, search for packages to update will include all currently registered repositories in order of highest priority.

```yaml
Type: System.String[]
Expand All @@ -145,10 +137,10 @@ Accept wildcard characters: False
```

### -Scope
{{ Fill Scope Description }}
Specifies the scope of the resource to update.

```yaml
Type: System.String
Type: Microsoft.PowerShell.PowerShellGet.UtilClasses.ScopeType
Parameter Sets: (All)
Aliases:
Accepted values: CurrentUser, AllUsers
Expand All @@ -161,7 +153,7 @@ Accept wildcard characters: False
```

### -TrustRepository
{{ Fill TrustRepository Description }}
Specifies optional credentials to be used when accessing a private repository.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -176,7 +168,7 @@ Accept wildcard characters: False
```

### -Version
{{ Fill Version Description }}
Specifies the version the resource is to be updated to.

```yaml
Type: System.String
Expand Down Expand Up @@ -228,15 +220,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

### System.String[]

### System.Management.Automation.PSCredential

## OUTPUTS

### System.Object

## NOTES

## RELATED LINKS

[<add>](<add>)

4 changes: 2 additions & 2 deletions src/PowerShellGet.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
'Set-PSResourceRepository',
'Publish-PSResource',
'Uninstall-PSResource',
'Unregister-PSResourceRepository')
# 'Update-PSResource')
'Unregister-PSResourceRepository',
'Update-PSResource')

VariablesToExport = 'PSGetPath'
AliasesToExport = @('inmo', 'fimo', 'upmo', 'pumo')
Expand Down
Loading