Skip to content

Commit d749875

Browse files
committed
Add chocolatey coolwhip support.
1 parent 3fd6dbf commit d749875

12 files changed

Lines changed: 230 additions & 0 deletions

LogStitcher.sln

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ VisualStudioVersion = 14.0.24720.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogStitcher", "LogStitcher\LogStitcher.csproj", "{C9AA014C-F95F-41F0-92B1-1985D2AFEF6D}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0D391902-8D8A-4313-8847-8AEBC0B30E44}"
9+
ProjectSection(SolutionItems) = preProject
10+
appveyor.yml = appveyor.yml
11+
EndProjectSection
12+
EndProject
813
Global
914
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1015
Debug|Any CPU = Debug|Any CPU
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
################################################################################
2+
# Prepackage.ps1
3+
#
4+
# This script generates the chocolatey install and uninstall powershell scripts
5+
# found in the Tools directory in the chocolatey package.
6+
#
7+
# It reads template files fond in the ToolsTemplates directory and replaces
8+
# tokens with run time values. Tokens are typically strings with leading and
9+
# trailing underscores, e.g. __PACKAGE_NAME__.
10+
#
11+
# Tokens are defined in the Tokens.Json file in the ToolsTemplates directory.
12+
# __VERSION__ is a special token, it is hardcoded to be replaced with the
13+
# environtment variable APPVEYOR_REPO_TAG_NAME. This allows AppVeyor to
14+
# update version information in the scripts
15+
#
16+
# For more information see:
17+
# https://github.com/MasterDevs/ChocolateyCoolWhip
18+
################################################################################
19+
20+
$versionToken = "__VERSION__";
21+
$version = $env:APPVEYOR_REPO_TAG_NAME
22+
Write-Host "Starting prepackage of version $version";
23+
24+
#######################################
25+
# Find Our Directories
26+
#######################################
27+
Write-Host
28+
$templateDirectory = Get-ChildItem -Recurse -Directory -Include ToolsTemplates LogStitcher\Chocolatey
29+
30+
$toolsDir = "$($templateDirectory.Parent.FullName)\Tools"
31+
write-host "Creating $toolsDir"
32+
$silent = New-Item -ItemType Directory -Force -Path $toolsDir
33+
34+
#######################################
35+
# Read Tokens
36+
#######################################
37+
Write-Host
38+
Write-Host "Reading tokens"
39+
40+
$tokenFile = $templateDirectory.EnumerateFiles().Where({$PSItem.Name -eq "tokens.json";})[0]
41+
$json = Get-Content -Raw $tokenFile.FullName
42+
$tokens = ConvertFrom-Json $json
43+
Write-Host "Replacing tokens"
44+
Write-Host " $versionToken ==> $version"
45+
foreach($token in $tokens)
46+
{
47+
Write-Host " $($token.Name) ==> $($token.Value)"
48+
}
49+
50+
#######################################
51+
# Convert tokenized files
52+
#######################################
53+
Write-Host
54+
foreach($file in $templateDirectory.EnumerateFiles().Where({$PSItem.Name -ne "tokens.json";}))
55+
{
56+
Write-Host "Processing $($file.FullName)"
57+
$newFile = "$($toolsDir)\\$($file.Name)"
58+
59+
$content = Get-Content $file.FullName;
60+
61+
$content = $content -replace $versionToken, $version
62+
ForEach($token in $tokens)
63+
{
64+
$content = $content -replace $token.Name, $token.Value;
65+
}
66+
67+
Write-Host "Writing $newFile";
68+
Set-Content $newFile -Encoding UTF8 $content
69+
70+
Write-Host
71+
}
72+
73+
#######################################
74+
# Done
75+
#######################################
76+
Write-Host "Prepackage complete"

LogStitcher/Chocolatey/Tokens.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"Name": "__PACKAGE_NAME__",
4+
"Value": "LogStitcher.portable",
5+
"Comment": "You only need to edit this if you want to use a name other than the default"
6+
},
7+
{
8+
"Name": "__PROJECT_BASE_URL__",
9+
"Value": "https://github.com/MasterDevs/LogStitcher",
10+
"Comment": "You don't need to edit this value"
11+
}
12+
]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$packageName = '__PACKAGE_NAME__' # name for the package, used in messages
2+
$url ="__PROJECT_BASE_URL__/releases/download/__VERSION__/bin.zip"
3+
4+
$installDir = Join-Path $env:AllUsersProfile "$packageName"
5+
Write-Host "Adding `'$installDir`' to the path and the current shell path"
6+
Install-ChocolateyPath "$installDir"
7+
$env:Path = "$($env:Path);$installDir"
8+
9+
Install-ChocolateyZipPackage "$packageName" "$url" "$installDir"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$packageName = '__PACKAGE_NAME__' # name for the package, used in messages
2+
$zipName = "bin.zip"
3+
4+
$installDir = Join-Path $env:AllUsersProfile "$packageName"
5+
Uninstall-ChocolateyZipPackage "$packageName" "$zipName"
6+
Remove-Item -Recurse -Force "$installDir"

LogStitcher/Chocolatey/install.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cinst TidyJson.portable -yf -s %CD%

LogStitcher/Chocolatey/pack.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@echo off
2+
3+
SET BuildVersion=0.0.1
4+
SET APPVEYOR_REPO_TAG_NAME=v%BuildVersion%
5+
6+
ECHO Packaging %APPVEYOR_REPO_TAG_NAME%
7+
8+
powershell .\PrePackage.ps1
9+
10+
cpack --version %BuildVersion% --force
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>LogStitcher.portable</id>
5+
<title>LogStitcher</title>
6+
<!-- Version is overwritten when the package is created -->
7+
<version>0.0.1</version>
8+
<authors>MasterDevs</authors>
9+
<owners>MasterDevs</owners>
10+
<summary>Stitches multiple logs together, interweaving entries to make them chronological</summary>
11+
<description>Stitches multiple logs together, interweaving entries to make them chronological</description>
12+
<tags>CommandLine Log logs utility</tags>
13+
<copyright>Copyright 2016</copyright>
14+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
15+
<projectUrl> https://github.com/MasterDevs/LogStitcher </projectUrl>
16+
<packageSourceUrl> https://github.com/MasterDevs/LogStitcher </packageSourceUrl>
17+
<docsUrl> https://github.com/MasterDevs/LogStitcher </docsUrl>
18+
<projectSourceUrl> https://github.com/MasterDevs/LogStitcher </projectSourceUrl>
19+
<bugTrackerUrl> https://github.com/MasterDevs/LogStitcher/issues </bugTrackerUrl>
20+
<releaseNotes> https://github.com/MasterDevs/LogStitcher/releases </releaseNotes>
21+
<licenseUrl> https://github.com/MasterDevs/LogStitcher/blob/master/LICENSE </licenseUrl>
22+
<!-- Uncomment this line if you have an icon for your project
23+
<iconUrl> https://github.com/MasterDevs/LogStitcher/icon.jpg </iconUrl>
24+
-->
25+
</metadata>
26+
<files>
27+
<file src="tools\**" target="tools" />
28+
</files>
29+
</package>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cuninst -y TidyJson.portable

LogStitcher/LogStitcher.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@
4646
<Compile Include="Program.cs" />
4747
<Compile Include="Properties\AssemblyInfo.cs" />
4848
</ItemGroup>
49+
<ItemGroup>
50+
<None Include="Chocolatey\install.bat" />
51+
<None Include="Chocolatey\pack.bat" />
52+
<None Include="Chocolatey\package.nuspec" />
53+
<None Include="Chocolatey\PrePackage.ps1" />
54+
<None Include="Chocolatey\Tokens.json" />
55+
<None Include="Chocolatey\ToolsTemplates\chocolateyInstall.ps1" />
56+
<None Include="Chocolatey\ToolsTemplates\chocolateyUninstall.ps1" />
57+
<None Include="Chocolatey\uninstall.bat" />
58+
<None Include="packages.config" />
59+
</ItemGroup>
4960
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
5061
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
5162
Other similar extension points exist, see Microsoft.Common.targets.

0 commit comments

Comments
 (0)