Skip to content

Commit 60d995a

Browse files
committed
CSHARP-1851: Add RefDocs task to build.caks.
1 parent 0e447eb commit 60d995a

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Tools/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Addins/
22
Cake*/
33
GitVersion.CommandLine/
4+
Hugo/
45
packages/
56
nuget.exe
67
packages.config.md5sum

build.cake

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ var target = Argument("target", "Default");
88
var configuration = Argument("configuration", "Release");
99

1010
var solutionDirectory = Directory("./");
11+
var artifactsDirectory = solutionDirectory + Directory("artifacts");
12+
var toolsDirectory = solutionDirectory + Directory("Tools");
13+
1114
var solutionFile = solutionDirectory + File("CSharpDriver.sln");
1215
var gitVersion = GitVersion();
1316

@@ -112,6 +115,50 @@ Task("TestLinux")
112115
Task("Test")
113116
.IsDependentOn("TestWindows");
114117

118+
Task("RefDocs")
119+
.Does(() =>
120+
{
121+
var hugoDirectory = toolsDirectory + Directory("Hugo");
122+
EnsureDirectoryExists(hugoDirectory);
123+
CleanDirectory(hugoDirectory);
124+
125+
var url = "https://github.com/spf13/hugo/releases/download/v0.13/hugo_0.13_windows_amd64.zip";
126+
var zipFile = hugoDirectory + File("hugo_0.13_windows_amd64.zip");
127+
DownloadFile(url, zipFile);
128+
Unzip(zipFile, hugoDirectory);
129+
var hugoExe = hugoDirectory + File("hugo_0.13_windows_amd64.exe");
130+
131+
var landingDirectory = solutionDirectory + Directory("docs") + Directory("landing");
132+
var processSettings = new ProcessSettings
133+
{
134+
WorkingDirectory = landingDirectory
135+
};
136+
StartProcess(hugoExe, processSettings);
137+
138+
var referenceDirectory = solutionDirectory + Directory("docs") + Directory("reference");
139+
processSettings = new ProcessSettings
140+
{
141+
WorkingDirectory = referenceDirectory
142+
};
143+
StartProcess(hugoExe, processSettings);
144+
145+
var tempDirectory = artifactsDirectory + Directory("tmp");
146+
EnsureDirectoryExists(tempDirectory);
147+
CleanDirectory(tempDirectory);
148+
149+
var landingPublicDirectory = landingDirectory + Directory("public");
150+
CopyDirectory(landingPublicDirectory, tempDirectory);
151+
152+
var referencePublicDirectory = referenceDirectory + Directory("public");
153+
var referencePublicDestinationDirectory = tempDirectory + Directory(gitVersion.Major + "." + gitVersion.Minor);
154+
CopyDirectory(referencePublicDirectory, referencePublicDestinationDirectory);
155+
156+
var referenceDocsZipFile = artifactsDirectory + File("RefDocs-" + gitVersion.SemVer + "-html.zip");
157+
Zip(tempDirectory, referenceDocsZipFile);
158+
159+
DeleteDirectory(tempDirectory, recursive: true);
160+
});
161+
115162
Task("Default")
116163
.IsDependentOn("Build");
117164

0 commit comments

Comments
 (0)