Skip to content

Commit d749875

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

12 files changed

+230
-0
lines changed

LogStitcher.sln

+5
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

LogStitcher/Chocolatey/PrePackage.ps1

+76
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

+12
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+
]
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"
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

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cinst TidyJson.portable -yf -s %CD%

LogStitcher/Chocolatey/pack.bat

+10
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

LogStitcher/Chocolatey/package.nuspec

+29
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>

LogStitcher/Chocolatey/uninstall.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cuninst -y TidyJson.portable

LogStitcher/LogStitcher.csproj

+11
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.

LogStitcher/packages.config

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="ChocolateyCoolWhip" version="0.0.11.0" targetFramework="net40" developmentDependency="true" />
4+
</packages>

appveyor.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Great reference: http://www.appveyor.com/docs/appveyor-yml
2+
3+
version: 1.0.{build}
4+
skip_tags: false
5+
configuration: Release
6+
init:
7+
- ps: >-
8+
$parsedReleaseBuildVersion = $env:APPVEYOR_REPO_TAG_NAME -Match "(\d+.\d+.\d+(.\d+)?)"
9+
10+
If($env:appveyor_repo_tag -AND $parsedReleaseBuildVersion) {
11+
$env:BuildVersion = $matches[0]
12+
$env:IsGithubRelease = $TRUE
13+
}
14+
else {
15+
$env:BuildVersion = $env:appveyor_build_version
16+
$env:IsGithubRelease = ""
17+
}
18+
19+
Write-Host "Build Version: " $env:BuildVersion
20+
21+
Write-Host "appveyor_build_version Variable: " $env:appveyor_build_version
22+
assembly_info:
23+
patch: true
24+
file: '**\AssemblyInfo.*'
25+
assembly_version: $(BuildVersion)
26+
assembly_file_version: $(BuildVersion)
27+
assembly_informational_version: $(BuildVersion)
28+
nuget:
29+
account_feed: true
30+
project_feed: true
31+
before_build:
32+
- nuget restore LogStitcher.sln
33+
34+
build:
35+
project: LogStitcher.sln
36+
publish_nuget: true
37+
publish_nuget_symbols: true
38+
verbosity: minimal
39+
40+
before_package:
41+
- ps: Invoke-Expression LogStitcher\Chocolatey\PrePackage.ps1
42+
- cpack LogStitcher\Chocolatey\package.nuspec --version %BuildVersion%
43+
44+
artifacts:
45+
- path: LogStitcher\bin\$(configuration)
46+
name: bin
47+
- path: '*.nupkg'
48+
name: ChocolateyPackage
49+
50+
deploy:
51+
- provider: GitHub
52+
auth_token:
53+
secure: 6Kc++hw4gNF7gTXwA6MpETVE8+gaMWqaLplEo3i5nLBrpjRKH/QX+yzVf6y1XEjn
54+
artifact:
55+
prerelease: false
56+
on:
57+
branch: master
58+
IsGithubRelease: true
59+
- provider: NuGet
60+
server: https://chocolatey.org/
61+
api_key:
62+
secure: 2Uqi8iUyKSHUakCSDeJb+qeXjn8i87F2U9RRmQIsqz4HOSycTjhat5AxHNs0yJ4g
63+
artifact: ChocolateyPackage
64+
on:
65+
branch: master
66+
IsGithubRelease: true

0 commit comments

Comments
 (0)