Skip to content
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

(nuget.commandline) AU updater #682

Merged
merged 2 commits into from
Apr 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions automatic/nuget.commandline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# [nuget.commandline](https://chocolatey.org/packages/nuget.commandline)

NuGet is the package manager for the Microsoft development platforms including .NET. NuGet gives you access to thousands of packages from other developers on [nuget.org](http://nuget.org), and the NuGet tools let you create, share, and host packages of your own.
27 changes: 27 additions & 0 deletions automatic/nuget.commandline/nuget.commandline.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>nuget.commandline</id>
<title>Nuget.CommandLine</title>
<version>0</version>
<authors>Microsoft</authors>
<owners>chocolatey, nuget-mirror</owners>
<summary>NuGet is the package manager for the Microsoft development platforms</summary>
<description>NuGet is the package manager for the Microsoft development platforms including .NET. NuGet gives you access to thousands of packages from other developers on [nuget.org](http://nuget.org), and the NuGet tools let you create, share, and host packages of your own.
</description>
<projectUrl>https://github.com/NuGet/NuGet.Client</projectUrl>
<tags>nuget dot.net microsoft foss cross-platform</tags>
<copyright>© .NET Foundation. All rights reserved.</copyright>
<licenseUrl>https://raw.githubusercontent.com/NuGet/NuGet.Client/dev/LICENSE.txt</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<iconUrl>https://cdn.rawgit.com/majkinetor/chocolatey/master/nuget.commandline/icon.png</iconUrl>
<docsUrl>https://docs.microsoft.com/en-us/nuget</docsUrl>
<projectSourceUrl>https://github.com/NuGet/NuGet.Client</projectSourceUrl>
<packageSourceUrl>https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/automatic/nuget.commandline</packageSourceUrl>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
42 changes: 42 additions & 0 deletions automatic/nuget.commandline/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import-module au
. $PSScriptRoot\..\..\scripts\Set-DescriptionFromReadme.ps1

$packageName = 'NuGet.CommandLine'

function global:au_SearchReplace {
@{
# Those might be useful for some other nuget packages

# ".\tools\chocolateyInstall.ps1" = @{
# "(?i)(^\s*[$]packageName\s*=\s*)('.*')"= "`$1'$packageName'"
# }
# ".\tools\chocolateyUninstall.ps1" = @{
# "(?i)(^\s*[$]packageName\s*=\s*)('.*')"= "`$1'$packageName'"
# }
}
}

function global:au_BeforeUpdate {
Get-RemoteFiles -Purge -NoSuffix

set-alias 7z $Env:chocolateyInstall\tools\7z.exe
rm tools\*.exe
7z e tools\*.nupkg NuGet.exe -r -otools
rm tools\*.nupkg
}

function global:au_AfterUpdate { Set-DescriptionFromReadme -SkipFirst 2 }

function global:au_GetLatest {
$releases = "https://www.nuget.org/packages/$packageName"
$download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing

$url = $download_page.links | ? title -like '*this version*' | % href
$version = $url -split '/' | select -last 1
@{
Version = $version
Url32 = "https://api.nuget.org/packages/$($packageName.ToLower()).${version}.nupkg"
}
}

update -ChecksumFor none