-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathutilities.cake
35 lines (29 loc) · 1.3 KB
/
utilities.cake
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
// ***********************************************************************
// Copyright (c) Charlie Poole and contributors.
// Licensed under the MIT License. See LICENSE.txt in root directory.
// ***********************************************************************
//////////////////////////////////////////////////////////////////////
// GLOBALLY ACCESSIBLE UTILITY METHODS
//////////////////////////////////////////////////////////////////////
public void DeleteObjectDirectories(BuildParameters parameters)
{
string pattern = parameters.SourceDirectory + "**/obj/";
foreach (var dir in GetDirectories(pattern))
DeleteDirectory(dir, new DeleteDirectorySettings() { Recursive = true });
}
private void PushNuGetPackage(FilePath package, string apiKey, string url)
{
CheckPackageExists(package);
NuGetPush(package, new NuGetPushSettings() { ApiKey = apiKey, Source = url });
}
private void PushChocolateyPackage(FilePath package, string apiKey, string url)
{
CheckPackageExists(package);
ChocolateyPush(package, new ChocolateyPushSettings() { ApiKey = apiKey, Source = url });
}
private void CheckPackageExists(FilePath package)
{
if (!FileExists(package))
throw new InvalidOperationException(
$"Package not found: {package.GetFilename()}.\nCode may have changed since package was last built.");
}