This repository has been archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae50521
commit a236105
Showing
7 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
## [0.0.1] - 05/04/2019 | ||
### Added | ||
* `Get-NuGet` command with the mandatory version argument | ||
* `publish.ps1` script for publishing GetNuGet package to the gallery | ||
### Breaking Changes | ||
### Fixed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 ClrCoder community. | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# GetNuGet | ||
## Introduction | ||
```PowerShell | ||
# Downloads (with the local cache) the nuget.exe and returns path | ||
$NuGet = Get-NuGet -Version 4.9.3 | ||
# Restores packages | ||
&$NuGet restore | ||
# Should print under windows: | ||
# c:\users\<user>\.nuget\cli\4.9.3\nuget.exe | ||
Write-Host $NuGet | ||
``` | ||
#### Supported Operating Systems | ||
* Windows | ||
* *Linux (Planned)* | ||
|
||
### See Also | ||
* [CHANGELOG](CHANGELOG.md) | ||
* [LICENSE](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
param( | ||
[parameter(Position=0, Mandatory = $true)] | ||
$ApiKey | ||
) | ||
|
||
|
||
Publish-Module -Path $PSScriptRoot/src/GetNuGet -NuGetApiKey $ApiKey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@{ | ||
|
||
# Script module or binary module file associated with this manifest. | ||
RootModule = 'GetNuGet.psm1' | ||
|
||
# Version number of this module. | ||
ModuleVersion = '0.0.1' | ||
|
||
# ID used to uniquely identify this module | ||
GUID = '247BD3D2-C7A8-4465-A256-E87355CB2A51' | ||
|
||
# Author of this module | ||
Author = 'ClrCoder community' | ||
|
||
# Copyright statement for this module | ||
Copyright = '(c) 2019 ClrCoder community' | ||
|
||
# Description of the functionality provided by this module | ||
Description = 'Helps to obtain NuGet command line tools' | ||
|
||
# Minimum version of the Windows PowerShell engine required by this module | ||
PowerShellVersion = '5.1' | ||
|
||
# Functions to export from this module | ||
FunctionsToExport = @('Get-NuGet') | ||
|
||
# Cmdlets to export from this module | ||
CmdletsToExport = @() | ||
|
||
# Variables to export from this module | ||
VariablesToExport = @() | ||
|
||
# Aliases to export from this module | ||
AliasesToExport = @() | ||
|
||
RequiredModules = @( | ||
) | ||
# Private data to pass to the module specified in RootModule/ModuleToProcess. | ||
# This may also contain a PSData hashtable with additional module metadata used by PowerShell. | ||
PrivateData = @{ | ||
PSData = @{ | ||
# Tags applied to this module. These help with module discovery in online galleries. | ||
Tags = @('NuGet', "CommandLine", "nuget.exe") | ||
|
||
# A URL to the license for this module. | ||
LicenseUri = 'https://github.com/ClrCoder/GetNuGet/blob/master/LICENSE' | ||
|
||
# A URL to the main website for this project. | ||
ProjectUri = 'https://github.com/ClrCoder/GetNuGet' | ||
|
||
# ReleaseNotes of this module | ||
ReleaseNotes = 'https://github.com/ClrCoder/GetNuGet/blob/master/CHANGELOG.md' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
function Get-NuGet { | ||
param( | ||
[Parameter(Position = 0)] | ||
[ValidatePattern("^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$")] | ||
[string] | ||
$Version) | ||
|
||
if ($null -ne $IsWindows -and !$IsWindows) { | ||
throw "Currently this command is implemented only for windows" | ||
} | ||
|
||
$NuGetFolder = "$($env:USERPROFILE)/.nuget/cli/$Version" | ||
$NuGetPath = "$NuGetFolder/nuget.exe" | ||
if (!(Test-Path $NuGetPath -PathType Leaf)) { | ||
if (!(Test-Path $NuGetPath -PathType Container)) { | ||
New-Item -type Directory -Path $NuGetFolder | Out-Null | ||
} | ||
|
||
# Downloading nuget.exe | ||
Invoke-WebRequest -Uri "https://dist.nuget.org/win-x86-commandline/v$Version/nuget.exe" -OutFile $NuGetPath | ||
$helpOutput = &$NuGetPath help | ||
|
||
$actualVersion = $helpOutput[0].Split(":")[1].SubString(1, 5); | ||
if ($actualVersion -ne $Version) { | ||
throw "Actual version ($actualVersion) of the downloaded nuget.exe does not match to the required version ($Version)." | ||
} | ||
} | ||
|
||
$NuGetPath | ||
} | ||
|
||
$exportModuleMemberParams = @{ | ||
Function = @( | ||
'Get-NuGet' | ||
) | ||
|
||
Variable = @( | ||
) | ||
} | ||
|
||
Export-ModuleMember @exportModuleMemberParams |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Reloading Module | ||
Remove-Module GetNuGet -ErrorAction SilentlyContinue | ||
Import-Module "$PSScriptRoot/../src/GetNuGet/GetNuGet.psm1" | ||
|
||
|
||
Get-NuGet 4.8.2 |