@@ -12,7 +12,8 @@ nuget Fake.DotNet.Fsi
12
12
nuget Fake.DotNet.NuGet
13
13
nuget Fake.DotNet.Testing.Expecto
14
14
nuget Fake.Tools.Git
15
- nuget Fake.Api.GitHub //"
15
+ nuget Fake.Api.GitHub
16
+ nuget System.Runtime.InteropServices.RuntimeInformation //"
16
17
17
18
#if ! FAKE
18
19
#load " ./.fake/build.fsx/intellisense.fsx"
@@ -28,6 +29,18 @@ open Fake.IO
28
29
open Fake.IO .FileSystemOperators
29
30
open Fake.IO .Globbing .Operators
30
31
open Fake.Tools
32
+ open System.Runtime .InteropServices
33
+
34
+ let openOsSpecificFile path =
35
+ if RuntimeInformation.IsOSPlatform( OSPlatform.Windows) then
36
+ let psi = new System.Diagnostics.ProcessStartInfo( FileName = path, UseShellExecute = true )
37
+ System.Diagnostics.Process.Start( psi) |> ignore
38
+ elif RuntimeInformation.IsOSPlatform( OSPlatform.Linux) then
39
+ System.Diagnostics.Process.Start( " xdg-open" , path) |> ignore
40
+ elif RuntimeInformation.IsOSPlatform( OSPlatform.OSX) then
41
+ System.Diagnostics.Process.Start( " open" , path) |> ignore
42
+ else
43
+ invalidOp " Not supported OS platform"
31
44
32
45
let project = " FSharp.Plotly"
33
46
@@ -229,7 +242,14 @@ Target.create "GenerateDocs" (fun _ ->
229
242
" fsi"
230
243
" --define:RELEASE --define:REFERENCE --define:HELP --exec generate.fsx"
231
244
232
- if not result.OK then failwith " error generating docs"
245
+ if not result.OK then
246
+ failwith " error generating docs"
247
+ else
248
+ Shell.copyRecursive
249
+ (__ SOURCE_ DIRECTORY__ @@ " packages/formatting/FSharp.Formatting/styles" )
250
+ " docs/output/content"
251
+ true
252
+ |> printfn " %A "
233
253
)
234
254
235
255
// --------------------------------------------------------------------------------------
@@ -242,7 +262,7 @@ Target.create "ReleaseDocs" (fun _ ->
242
262
let tempDocsDir = " temp/gh-pages"
243
263
Shell.cleanDir tempDocsDir |> ignore
244
264
Git.Repository.cloneSingleBranch " " ( gitHome + " /" + gitName + " .git" ) " gh-pages" tempDocsDir
245
- Shell.copyRecursive " docs" tempDocsDir true |> printfn " %A "
265
+ Shell.copyRecursive " docs/output " tempDocsDir true |> printfn " %A "
246
266
Git.Staging.stageAll tempDocsDir
247
267
Git.Commit.exec tempDocsDir ( sprintf " Update generated documentation for version %s " release.NugetVersion)
248
268
Git.Branches.push tempDocsDir
@@ -251,12 +271,23 @@ Target.create "ReleaseDocs" (fun _ ->
251
271
Target.create " ReleaseDocsLocal" ( fun _ ->
252
272
let tempDocsDir = " temp/gh-pages"
253
273
Shell.cleanDir tempDocsDir |> ignore
254
- Shell.copyRecursive " docs" tempDocsDir true |> printfn " %A "
274
+ Shell.copyRecursive " docs/output" tempDocsDir true |> printfn " %A "
275
+ let filesToReplaceIn =
276
+ !! ( tempDocsDir @@ " *.html" )
277
+ printfn " %A " filesToReplaceIn
255
278
Shell.replaceInFiles
256
- ( seq {
257
- yield " href=\" /" + project + " /" , " href=\" "
258
- yield " src=\" /" + project + " /" , " src=\" " })
259
- ( Directory.EnumerateFiles tempDocsDir |> Seq.filter ( fun x -> x.EndsWith( " .html" )))
279
+ [
280
+ """ href="https://muehlhaus.github.io/FSharp.Plotly/""" , """ href=./"""
281
+ """ src="https://muehlhaus.github.io/FSharp.Plotly/""" , """ src=./"""
282
+ " .html\" " , " .html"
283
+ " .css\" " , " .css"
284
+ " .jpg\" " , " .jpg"
285
+ " .png\" " , " .png"
286
+ " .svg\" " , " .svg"
287
+ " tips.js\" " , " tips.js"
288
+ ]
289
+ filesToReplaceIn
290
+ openOsSpecificFile ( tempDocsDir @@ " index.html" )
260
291
)
261
292
Target.create " Release" ( fun _ ->
262
293
Git.Staging.stageAll " "
0 commit comments