-
Notifications
You must be signed in to change notification settings - Fork 491
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
martinwoodward
merged 2 commits into
OpenLiveWriter:master
from
gep13:ChocolateyPackage
Dec 17, 2015
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,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> | ||
<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> |
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,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`"" |
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,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)." | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. 💖
There was a problem hiding this comment.
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.