Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
et1975 committed Apr 17, 2021
1 parent 0ba96fd commit 750923e
Show file tree
Hide file tree
Showing 16 changed files with 316 additions and 622 deletions.
8 changes: 7 additions & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
"isRoot": true,
"tools": {
"fake-cli": {
"version": "5.18.3",
"version": "5.20.3",
"commands": [
"fake"
]
},
"fsharp.formatting.commandtool": {
"version": "9.0.4",
"commands": [
"fsdocs"
]
}
}
}
1 change: 1 addition & 0 deletions .fsdocs/cache

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ obj/
packages/

.fake
docs/output/
temp/
output/
tmp/
*.user
Directory.Build.props
3 changes: 3 additions & 0 deletions AAD.fs/Domain.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ type UserName = UserName of string
type Password = Password of string

type Demand =
/// Components of the claim, left to right
| Pattern of string list
/// Any demand on the list will suffice
| Any of Demand list
/// All demands on the list must be met
| All of Demand list

[<Struct>]
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ steps:
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags') }}:
arguments: 'build -t release'
${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/tags')) }}:
arguments: build
arguments: build -t ci

71 changes: 25 additions & 46 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#r "paket:
storage: packages
nuget FSharp.Core ~> 4.7
nuget Fake.DotNet.Cli
nuget Fake.IO.FileSystem
nuget Fake.Core.ReleaseNotes
nuget Fake.Core.Target
nuget Fake.Tools.Git
nuget FSharp.Formatting
nuget FSharp.Formatting.CommandTool
nuget Fake.DotNet.FSFormatting //"
nuget Fake.Tools.Git //"
#load "./.fake/build.fsx/intellisense.fsx"
#if !FAKE
#r "Facades/netstandard"
Expand All @@ -26,6 +23,7 @@ let gitName = "AAD.fs"
let gitOwner = "Azure"
let gitHome = sprintf "https://github.com/%s" gitOwner
let gitRepo = sprintf "[email protected]:%s/%s.git" gitOwner gitName
let gitContent = sprintf "https://raw.githubusercontent.com/%s/%s" gitOwner gitName

let release = ReleaseNotes.load "RELEASE_NOTES.md"
let ver =
Expand Down Expand Up @@ -206,68 +204,46 @@ Target.create "meta" (fun _ ->
"<PropertyGroup>"
sprintf "<PackageProjectUrl>%s/%s</PackageProjectUrl>" gitHome gitName
"<PackageLicense>MIT</PackageLicense>"
sprintf "<RepositoryUrl>%s/%s</RepositoryUrl>" gitHome gitName
sprintf "<PackageReleaseNotes>%s</PackageReleaseNotes>" (List.head release.Notes)
"<PackageIconUrl>https://raw.githubusercontent.com/Azure/AAD.fs/master/docs/files/img/logo.png</PackageIconUrl>"
"<PackageTags>suave;giraffe;fsharp</PackageTags>"
sprintf "<Version>%s</Version>" (string ver)
"<Copyright>(c) Microsoft Corporation. All rights reserved.</Copyright>"
sprintf "<FsDocsLogoLink>%s/master/docs/content/logo.png</FsDocsLogoLink>" gitContent
sprintf "<FsDocsLicenseLink>%s/blob/master/LICENSE.md</FsDocsLicenseLink>" gitRepo
sprintf "<FsDocsReleaseNotesLink>%s/blob/master/RELEASE_NOTES.md</FsDocsReleaseNotesLink>" gitRepo
"<FsDocsNavbarPosition>fixed-right</FsDocsNavbarPosition>"
"<FsDocsWarnOnMissingDocs>true</FsDocsWarnOnMissingDocs>"
"<FsDocsTheme>default</FsDocsTheme>"
"</PropertyGroup>"
"</Project>"]
|> File.write false "Directory.Build.props"
)


// --------------------------------------------------------------------------------------
// Generate the documentation
let docs_out = "docs/output"
let docsHome = "https://azure.github.io/AAD.fs"

let generateDocs _ =
let info =
[ "project-name", "AAD.fs"
"project-author", "Azure Dedicated"
"project-summary", "Azure AD authorization for F# web APIs"
"project-github", sprintf "%s/%s" gitHome gitName
"project-nuget", "http://nuget.org/packages/AAD.fs" ]

FSFormatting.createDocs (fun args ->
{ args with
Source = "docs/content"
OutputDirectory = docs_out
LayoutRoots = [ "docs/tools/templates"
".fake/build.fsx/packages/FSharp.Formatting/templates" ]
ProjectParameters = ("root", docsHome)::info
Template = "docpage.cshtml" } )
!!"**/*"
|> GlobbingPattern.setBaseDir "docs/files"
|> Shell.copyFilesWithSubFolder "docs/output"
!!"**/*"
|> GlobbingPattern.setBaseDir ".fake/build.fsx/packages/FSharp.Formatting/styles"
|> Shell.copyFilesWithSubFolder "docs/output"

Target.create "generateDocs" generateDocs
Target.create "generateDocs" (fun _ ->
Shell.cleanDir ".fsdocs"
DotNet.exec id "fsdocs" "build --clean" |> ignore
)

Target.create "watchDocs" (fun _ ->
use watcher =
(!! "docs/content/**/*.*")
|> ChangeWatcher.run generateDocs

Trace.traceImportant "Waiting for help edits. Press any key to stop."
System.Console.ReadKey() |> ignore
watcher.Dispose()
Shell.cleanDir ".fsdocs"
DotNet.exec id "fsdocs" "watch" |> ignore
)

Target.create "releaseDocs" (fun _ ->
let tempDocsDir = "temp/gh-pages"
let tempDocsDir = "tmp/gh-pages"
Shell.cleanDir tempDocsDir
Git.Repository.cloneSingleBranch "" gitRepo "gh-pages" tempDocsDir

Shell.copyRecursive docs_out tempDocsDir true |> Trace.tracefn "%A"
Shell.copyRecursive "output" tempDocsDir true |> Trace.tracefn "%A"
Git.Staging.stageAll tempDocsDir
Git.Commit.exec tempDocsDir (sprintf "Update generated documentation for version %s" release.NugetVersion)
Git.Branches.push tempDocsDir
)

Target.create "release" ignore
Target.create "ci" ignore

"clean"
==> "restore"
Expand All @@ -281,9 +257,12 @@ Target.create "release" ignore
<== ["test"; "generateDocs" ]

"integration"
<== [ "test" ]
<== [ "test" ]

"release"
<== [ "meta"; "publish" ]
<== [ "meta"; "publish" ]

"ci"
<== [ "package" ]

Target.runOrDefault "test"
Loading

0 comments on commit 750923e

Please sign in to comment.