-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdefault.ps1
72 lines (58 loc) · 2.16 KB
/
default.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Framework('4.0x86')
properties {
$version = '1.0.0.0'
$sfpassword = $null
$updateurl = $null
}
task default -depends Build
task Test {
exec { msbuild .\LogWatch.Tests\LogWatch.Tests.csproj /p:DownloadNuGetExe=True }
exec { .\Tools\xunit\xunit.console.clr4.x86.exe .\LogWatch.Tests\bin\Debug\LogWatch.Tests.dll /teamcity }
}
task Clean {
Remove-Item .\Build -ErrorAction SilentlyContinue -Recurse -Force
New-Item .\Build -ItemType Directory -ErrorAction SilentlyContinue
}
task Publish -depends Clean, Test {
exec { msbuild .\LogWatch\LogWatch.csproj `
/t:publish `
/p:Configuration=Release `
/p:DownloadNuGetExe=True `
/p:ApplicationVersion=$version `
/p:UpdateUrl=$updateurl }
Copy-Item .\LogWatch\bin\Release\app.publish\* .\Build -Recurse -Force
}
task Build -depends Clean, Test {
exec { msbuild .\LogWatch\LogWatch.csproj `
/t:Build `
/p:OutputPath=..\Build\ `
/p:Configuration=Release `
/p:DownloadNuGetExe=True `
/p:ApplicationVersion=$version }
}
task Download-PSFTP {
if (Test-Path .\Tools\psftp.exe) {
return;
}
New-Item .\Tools -ItemType Directory -ErrorAction SilentlyContinue
$wc = New-Object System.Net.WebClient
$wc.DownloadFile('http://the.earth.li/~sgtatham/putty/latest/x86/psftp.exe', '.\Tools\psftp.exe')
}
task Deploy -depends Publish, Download-PSFTP -precondition { $sfpassword -ne $null } {
Remove-Item .\Tools\deploy.psftp -ErrorAction SilentlyContinue
$versionDirName = (Get-Item '.\Build\Application Files\LogWatch*').Name
@('cd /home/pfs/project/logwatch-dotnet',
'del LogWatch.application',
'del setup.exe',
'put .\Build\LogWatch.application',
'put .\Build\setup.exe',
'cd "Application Files"',
"mkdir `"$versionDirName`"",
"cd $versionDirName",
"mput `"Build\Application Files\$versionDirName\*.*`"",
'mkdir en',
'cd en',
"mput `"Build\Application Files\$versionDirName\en\*.*`"") `
| Add-Content .\Tools\deploy.psftp
exec { .\Tools\psftp.exe -l sergey-shumov frs.sourceforge.net -be -b .\Tools\deploy.psftp -pw $sfpassword }
}