Skip to content

Commit 881b322

Browse files
committed
Fix Code review comments
1 parent c4a88b1 commit 881b322

5 files changed

+78
-39
lines changed

DockerMsftProvider.psd1

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'DockerMsftProvider.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.1.0.2'
15+
ModuleVersion = '0.1.0.3'
1616

1717
# ID used to uniquely identify this module
1818
GUID = '5beed3da-526b-47eb-9197-29c6a7214e4e'
@@ -42,7 +42,11 @@ PrivateData = @{
4242
PSData = @{
4343
# Tags applied to this module. These help with module discovery in online galleries.
4444
Tags = @('PackageManagement', 'Provider')
45-
45+
ProjectUri = 'https://github.com/OneGet/MicrosoftDockerProvider'
46+
LicenseUri = ''
47+
ReleaseNotes = @'
48+
- Docker Provider to find, save and install docker on windows.
49+
'@
4650
} # End of PSData hashtable
4751

4852
} # End of PrivateData hashtable

DockerMsftProvider.psm1

+22-23
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ function Find-FromUrl
871871
}
872872
}
873873

874-
$savedVersion = $script:SemVerTypeName::new('0.0.0')
874+
$savedVersion = New-Object $script:SemVerTypeName -ArgumentList '0.0.0'
875875

876876
# version requirement
877877
# compare different versions
@@ -914,39 +914,45 @@ function Find-FromUrl
914914
}
915915
}
916916

917-
$thisVersion = $script:SemVerTypeName::new($versionValue)
917+
$thisVersion = New-Object $script:SemVerTypeName -ArgumentList $versionValue
918918

919919
if($MinimumVersion)
920920
{
921-
if($thisVersion -ge $MinimumVersion)
921+
$convertedMinimumVersion = New-Object $script:SemVerTypeName -ArgumentList $MinimumVersion
922+
if($thisVersion -ge $convertedMinimumVersion)
922923
{
923-
if($thisVersion -ge $savedVersion) {$savedVersion = $thisVersion}
924924
$toggle = $true
925925
}
926926
else
927927
{
928928
$toggle = $false
929+
continue
929930
}
930931
}
931932

932933
if($MaximumVersion)
933934
{
934-
if($thisVersion -le $MaximumVersion)
935+
$convertedMaximumVersion = New-Object $script:SemVerTypeName -ArgumentList $MaximumVersion
936+
if($thisVersion -le $convertedMaximumVersion)
935937
{
936-
if($thisVersion -ge $savedVersion) {$savedVersion = $thisVersion}
937938
$toggle = $true
938939
}
939-
else
940+
else
940941
{
941942
$toggle = $false
942-
}
943+
continue
944+
}
945+
}
946+
947+
if($toggle)
948+
{
949+
if($thisVersion -ge $savedVersion) {$savedVersion = $thisVersion}
943950
}
944951

945952
if($AllVersions)
946953
{
947954
if($toggle)
948955
{
949-
950956
$obj = Get-ResultObject -JSON $versions -Version $versionValue
951957
$searchResults += $obj
952958
}
@@ -1241,20 +1247,13 @@ function Resolve-PackageSource
12411247
$wildcardPattern = New-Object System.Management.Automation.WildcardPattern $moduleSourceName,$script:wildcardOptions
12421248
$moduleSourceFound = $false
12431249

1244-
$script:DockerSources.GetEnumerator() |
1245-
Microsoft.PowerShell.Core\Where-Object {$wildcardPattern.IsMatch($_.Key)} |
1246-
Microsoft.PowerShell.Core\ForEach-Object {
1247-
$moduleSource = $script:DockerSources[$_.Key]
1248-
1249-
if($moduleSource.PSObject.properties.name -contains 'SourceLocation')
1250-
{
1251-
$resolvedUrl = Resolve-FwdLink -Uri $moduleSource.SourceLocation
1252-
$moduleSource.SourceLocation = $resolvedUrl
1253-
}
1254-
1255-
$packageSource = New-PackageSourceFromModuleSource -ModuleSource $moduleSource
1256-
Write-Output -InputObject $packageSource
1257-
$moduleSourceFound = $true
1250+
$script:DockerSources.GetEnumerator() |
1251+
Microsoft.PowerShell.Core\Where-Object {$wildcardPattern.IsMatch($_.Key)} |
1252+
Microsoft.PowerShell.Core\ForEach-Object {
1253+
$moduleSource = $script:DockerSources[$_.Key]
1254+
$packageSource = New-PackageSourceFromModuleSource -ModuleSource $moduleSource
1255+
Write-Output -InputObject $packageSource
1256+
$moduleSourceFound = $true
12581257
}
12591258

12601259
if(-not $moduleSourceFound)

LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
DockerMsftProvider
2+
3+
Copyright (c) Microsoft Corporation
4+
5+
All rights reserved.
6+
7+
The MIT License (MIT)
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in all
17+
copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
SOFTWARE.

README.md

+23-14
Original file line numberDiff line numberDiff line change
@@ -14,53 +14,53 @@ Once the provider is installed and imported, you can search, download, or instal
1414

1515
#### Register a source
1616

17-
##### Register an URL to be used with MicrosoftDockerProvider
18-
Register-PackageSource -ProviderName MicrosoftDockerProvider -Name AlternateSource -Location https://contoso.com/metaData.json
17+
##### Register an URL to be used with DockerMsftProvider
18+
Register-PackageSource -ProviderName DockerMsftProvider -Name AlternateSource -Location https://contoso.com/metaData.json
1919

2020
##### Enlist all the registered sources
21-
Get-PackageSource -ProviderName MicrosoftDockerProvider
21+
Get-PackageSource -ProviderName DockerMsftProvider
2222

2323
#### Search a Docker installer
2424

2525
##### Example 1: Find the latest version of all available Docker installers.
26-
Find-Package –providerName MicrosoftDockerProvider
26+
Find-Package –providerName DockerMsftProvider
2727

2828
##### Example 2: Search by version, according to –RequiredVersion, -MinimumVersion, and –MaximumVersion requirements. With –AllVersions parameter, all available versions of Docker installers are returned. Without it, only the latest version is returned.
29-
Find-Package –providerName MicrosoftDockerProvider –AllVersions
29+
Find-Package –providerName DockerMsftProvider –AllVersions
3030

3131
#### Install docker
3232

3333
##### Example 1: Install the latest version of docker to the local machine.
34-
Install-Package -Name docker -ProviderName MicrosoftDockerProvider -Verbose
34+
Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
3535

3636
##### Example 2: Install docker with pipeline result from the search cmdlets.
37-
Find-Package –ProviderName MicrosoftDockerProvider | Install-Package -Verbose
37+
Find-Package –ProviderName DockerMsftProvider | Install-Package -Verbose
3838

3939
#### Download Docker
40-
You can download and save Docker installer without installation, using Save-Package. This cmdlet accepts pipeline result from the search cmdlets.
40+
You can download and save Docker installer without installation, using Save-Package. This cmdlet accepts pipeline result from the search cmdlets. If you have multiple sources, please provide the source for download.
4141

4242
##### Example 1: Download and save Docker installer to a directory that matches the wildcard path. The latest version will be saved if you do not specify the version requirements.
43-
Save-Package –ProviderName MicrosoftDockerProvider -Name Docker -Path .\temp -MinimumVersion 1.2.3
43+
Save-Package –ProviderName DockerMsftProvider -Name Docker -Path .\temp -MinimumVersion 1.2.3
4444

4545
##### Example 2: Download and save Docker installer from the search cmdlets.
46-
Find-package –ProviderName MicrosoftDockerProvider | Save-Package -Path .
46+
Find-package –ProviderName DockerMsftProvider | Save-Package -Path .
4747

4848
#### Get docker
4949

5050
##### Example 1: Inventory docker installation on the local machine.
51-
Get-Package –ProviderName MicrosoftDockerProvider
51+
Get-Package –ProviderName DockerMsftProvider
5252

5353
#### Uninstall docker
54-
Uninstall-Docker uninstalls Docker from the local machine.
54+
Uninstalls Docker from the local machine.
5555

5656
##### Example 1: Uninstall docker from the local machine.
57-
Uninstall-Package -ProviderName MicrosoftDockerProvider -Name dOcKeR -Verbose
57+
Uninstall-Package -ProviderName DockerMsftProvider -Name dOcKeR -Verbose
5858

5959
#### Update docker
6060
Updates current installation of docker with the requested version
6161

6262
##### Example 1: Update docker
63-
Install-Package -Name docker -ProviderName MicrosoftDockerProvider -Verbose -Update
63+
Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose -Update
6464

6565
### Version
6666
0.1.0.0
@@ -70,5 +70,14 @@ Updates current installation of docker with the requested version
7070
#### 0.1.0.0
7171
Initial release
7272

73+
#### 0.1.0.1
74+
Bug fixes
75+
76+
#### 0.1.0.2
77+
Bug fixes
78+
79+
#### 0.1.0.3
80+
Bug fixes
81+
7382
### Dependencies
7483
1. Nuget binaries

SaveHTTPItemUsingBITS.psm1

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
function Save-HTTPItemUsingBitsTransfer
1111
{
12+
[OutputType([System.String])]
13+
1214
[CmdletBinding()]
1315
param(
1416
[Parameter(Mandatory=$true)]

0 commit comments

Comments
 (0)