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

Adding basic creation of Chocolatey Package #75

Merged
merged 2 commits into from
Dec 17, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions OpenLiveWriter.Install.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>openlivewriter</id>
<version>0.5.0.0</version>
<title>OpenLiveWriter (Install)</title>
<authors>See list of authors at http://openlivewriter.org/</authors>
<owners>Darwin Sanoy, OpenLiveWriter</owners>
<licenseUrl>https://github.com/OpenLiveWriter/OpenLiveWriter/blob/master/license.txt</licenseUrl>
<projectUrl>http://openlivewriter.org/</projectUrl>
<iconUrl>https://cdn.rawgit.com/csi-windowschocolatey/openlivewriter/master/app.png</iconUrl>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the requirements for the iconURL? Shall we stick a copy in the Open Live Writer CDN to save taking a dependency?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You get bandwidth from rawgit for free.

Rawgit is not likely to be a dependency that would fail - but if it does so
will more than half the icons on Chocolatey.org

This is used to serve up your icon time someone sees your package in
chocolatey.org hit lists or when they view the individual listing.

Not sure when else (perhaps ChocolateyGUI and other graphic package
managers?).

D.

On Tue, Dec 15, 2015 at 2:56 PM, Martin Woodward notifications@github.com
wrote:

In OpenLiveWriter.Install.nuspec
#75 (comment)
:

@@ -0,0 +1,26 @@
+
+

What are the requirements for the iconURL? Shall we stick a copy in the
Open Live Writer CDN to save taking a dependency?


Reply to this email directly or view it on GitHub
https://github.com/OpenLiveWriter/OpenLiveWriter/pull/75/files#r47688733
.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinwoodward using Rawgit is actually one of the icon guidelines. you can find them all here: https://github.com/chocolatey/choco/wiki/CreatePackages#package-icon-guidelines

Yes, ChocolateyGUI uses the listed URL in the nuspec to serve the image as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for educating me chaps. While I love the magic of Choco - it's finer points are new to me. 💖

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinwoodward not a problem at all. Happy to help out where we can 😄 You can grab us in our Gitter Chat room as well https://gitter.im/chocolatey/choco if you have any questions.

<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Open Live Writer is an open source application enabling users to author, edit, and publish blog posts.
It is based on a fork of the well-loved but not actively developed Windows Live Writer code.</description>
<summary>Open Live Writer makes it easy to write, preview, and post to your blog.</summary>
<copyright>.NET Foundation</copyright>
<tags>Blog WindowsLiveWriter OpenLiveWriter</tags>
<releaseNotes>https://github.com/OpenLiveWriter/OpenLiveWriter/releases</releaseNotes>
<!--<projectSourceUrl>https://github.com/OpenLiveWriter</projectSourceUrl>-->
</metadata>
<files>
<file src="OpenLiveWriterSetup.exe" target="tools" />
<file src="..\choco\chocolateyInstall.ps1" target="tools"/>
<file src="..\choco\chocolateyUninstall.ps1" target="tools"/>
</files>
</package>
9 changes: 9 additions & 0 deletions choco/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$packageName= 'openlivewriter'
$fileType = 'EXE'
$silentArgs = '--silent'
$scriptPath = $(Split-Path $MyInvocation.MyCommand.Path)
$fileFullPath = Join-Path $scriptPath 'OpenLiveWriterSetup.exe'

Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $fileFullPath

Write-Output "The install log is at `"$env:localappdata\SquirrelTemp\SquirrelSetup.log`""
56 changes: 56 additions & 0 deletions choco/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$ErrorActionPreference = 'Stop';

$packageName = 'openlivewriter'
$softwareName = 'open live writer*'
$installerType = 'EXE'
$file = "$env:localappdata\OpenLiveWriter\Update.exe"

$silentArgs = '--uninstall -s'

if ($installerType -ne 'MSI') {
$validExitCodes = @(0)
}

$uninstalled = $false
$local_key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'

$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) `
-ErrorAction SilentlyContinue `
| ? { $_.DisplayName -like "$softwareName" }

if (!(Test-Path "$env:localappdata\openlivewriter\openlivewriter.exe"))
{
If (!(Test-Path $file))
{
throw "Could not find $file - because this software is always installed to a user profile folder, it must be uninstalled in the context of the user who installed it."
}
else
{
Try {
Uninstall-ChocolateyPackage -PackageName $packageName `
-FileType $installerType `
-SilentArgs "$silentArgs" `
-ValidExitCodes $validExitCodes `
-File "$file"

#Remove leftovers so new install will succeed
If (test-path "$env:localappdata\openlivewriter\.dead")
{
remove-item "$env:localappdata\openlivewriter" -Recurse -Force -ErrorAction 'SilentlyContinue'
}
If (test-path "C:\ProgramData\SquirrelMachineInstalls\OpenLiveWriter.exe")
{
remove-item "C:\ProgramData\SquirrelMachineInstalls\OpenLiveWriter.exe" -Force -ErrorAction 'SilentlyContinue'
}
Write-Output "The install log is at `"$env:localappdata\SquirrelTemp\SquirrelSetup.log`""
}
Catch
{
throw $_.Exception
}
}
} else {
Write-Warning "$packageName has already been uninstalled by other means or it is installed to a user's profile who is not the current user ($env:username)."
}
4 changes: 4 additions & 0 deletions src/managed/PostBuild.CreateInstaller/createinstaller.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ ECHO Created Writer NuGet package.
.\src\managed\packages\squirrel.windows.1.2.1\tools\Squirrel.exe -i .\src\managed\OpenLiveWriter.PostEditor\Images\Writer.ico %OLW_SIGN% --no-msi --releasify .\OpenLiveWriter.%dottedVersion%.nupkg
ECHO Created Open Live Writer setup file.

%LocalAppData%\Nuget\Nuget.exe pack .\OpenLiveWriter.Install.nuspec -version %dottedVersion% -basepath Releases
ECHO Created Writer Chocolatey Package

:end

POPD