Skip to content

Commit 7e16f08

Browse files
Build script is added and updated README.md file
1 parent 63e6e06 commit 7e16f08

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

Build.ps1

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<#
2+
.SYNOPSIS
3+
You can add this to you build script to ensure that psbuild is available before calling
4+
Invoke-MSBuild. If psbuild is not available locally it will be downloaded automatically.
5+
#>
6+
function EnsurePsbuildInstalled{
7+
[cmdletbinding()]
8+
param(
9+
[string]$psbuildInstallUri = 'https://raw.githubusercontent.com/ligershark/psbuild/master/src/GetPSBuild.ps1'
10+
)
11+
process{
12+
if(-not (Get-Command "Invoke-MsBuild" -errorAction SilentlyContinue)){
13+
'Installing psbuild from [{0}]' -f $psbuildInstallUri | Write-Verbose
14+
(new-object Net.WebClient).DownloadString($psbuildInstallUri) | iex
15+
}
16+
else{
17+
'psbuild already loaded, skipping download' | Write-Verbose
18+
}
19+
20+
# make sure it's loaded and throw if not
21+
if(-not (Get-Command "Invoke-MsBuild" -errorAction SilentlyContinue)){
22+
throw ('Unable to install/load psbuild from [{0}]' -f $psbuildInstallUri)
23+
}
24+
}
25+
}
26+
27+
# Taken from psake https://github.com/psake/psake
28+
29+
<#
30+
.SYNOPSIS
31+
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
32+
to see if an error occcured. If an error is detected then an exception is thrown.
33+
This function allows you to run command-line programs without having to
34+
explicitly check the $lastexitcode variable.
35+
.EXAMPLE
36+
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
37+
#>
38+
function Exec
39+
{
40+
[CmdletBinding()]
41+
param(
42+
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
43+
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
44+
)
45+
& $cmd
46+
if ($lastexitcode -ne 0) {
47+
throw ("Exec: " + $errorMessage)
48+
}
49+
}
50+
51+
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
52+
53+
EnsurePsbuildInstalled
54+
55+
exec { & dotnet restore }
56+
57+
Invoke-MSBuild
58+
59+
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
60+
$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)
61+
62+
exec { & dotnet pack .\src\GravatarTagHelpers -c Release -o .\artifacts --version-suffix=$revision }
63+
64+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# GravatarTagHelpers
2-
Simple tag helper to display the Gravatar image using email address.
2+
A simple tag helper to display the Gravatar image using email address.
33

44
## Setup
55
To use this tag helper, add the following line in ```_ViewImports.cshtml```.

src/GravatarTagHelpers/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"title": "GravatarTagHelpers",
55

6-
"description": "A Simple tag helper to display the Gravatar image using email address.",
6+
"description": "A simple tag helper to display the Gravatar image using email address.",
77

88
"authors": [ "Manoj Kulkarni" ],
99

0 commit comments

Comments
 (0)