diff --git a/Directory.Packages.props b/Directory.Packages.props index c4b67d266..fdabf4ece 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -16,6 +16,7 @@ + diff --git a/build.fsx b/build.fsx index 6706d59d7..a9866d70a 100644 --- a/build.fsx +++ b/build.fsx @@ -50,9 +50,13 @@ let testStage = $"dotnet test {solutionFile} --configuration {configuration} --no-build --blame --logger trx --results-directory TestResults -tl" } -pipeline "CI" { - lintStage +let buildStage = + stage "Build" { + run $"dotnet restore {solutionFile} -tl" + run $"dotnet build {solutionFile} --configuration {configuration} -tl" + } +let cleanStage = stage "Clean" { run (fun _ -> !!artifactsDir ++ "temp" |> Shell.cleanDirs @@ -60,13 +64,14 @@ pipeline "CI" { [ "bin"; "temp"; "tests/bin" ] |> Seq.iter Directory.ensure) } - stage "Build" { - run $"dotnet restore {solutionFile} -tl" - run $"dotnet build {solutionFile} --configuration {configuration} -tl" - } - +let nugetStage = stage "NuGet" { run $"dotnet pack {solutionFile} --output \"{artifactsDir}\" --configuration {configuration} -tl" } +pipeline "CI" { + lintStage + cleanStage + buildStage + nugetStage testStage stage "GenerateDocs" { @@ -93,4 +98,11 @@ pipeline "Verify" { runIfOnlySpecified true } +pipeline "BuildAndPack" { + cleanStage + buildStage + nugetStage + runIfOnlySpecified true +} + tryPrintPipelineCommandHelp () diff --git a/src/fsdocs-tool/BuildCommand.fs b/src/fsdocs-tool/BuildCommand.fs index 33f9a94b8..e94790aa6 100644 --- a/src/fsdocs-tool/BuildCommand.fs +++ b/src/fsdocs-tool/BuildCommand.fs @@ -2,6 +2,7 @@ namespace fsdocs open System.Collections.Concurrent open CommandLine +open Spectre.Console open System open System.Diagnostics @@ -1580,16 +1581,16 @@ type CoreBuildOptions(watch) = let dir = Path.GetDirectoryName(typeof.Assembly.Location) // get template locations for in-package and in-repo and decide which to use later - let inPackageLocations = Common.InPackageLocations(Path.Combine(dir, "..", "..", "..")) - let inRepoLocations = Common.InRepoLocations(Path.Combine(dir, "..", "..", "..", "..", "..")) + let inNugetPackageLocations = Common.InNugetPackageLocations(Path.Combine(dir, "..", "..", "..")) + let inThisRepoLocations = Common.InDocsFolderLocations(Path.Combine(dir, "..", "..", "..", "..", "..", "docs")) let defaultTemplate = if this.nodefaultcontent then None - else if inPackageLocations.Exist() then - Some inPackageLocations.template_html - elif inRepoLocations.Exist() then - Some inRepoLocations.template_html + else if inNugetPackageLocations.AllLocationsExist() then + Some inNugetPackageLocations.``templates/template.html``.Path + elif inThisRepoLocations.AllLocationsExist() then + Some inThisRepoLocations.``template.html``.Path else None @@ -1598,22 +1599,22 @@ type CoreBuildOptions(watch) = // The "extras" content goes in "." // From .nuget\packages\fsdocs-tool\7.1.7\tools\net6.0\any // to .nuget\packages\fsdocs-tool\7.1.7\extras - if inPackageLocations.Exist() then - printfn "using extra content from %s" inPackageLocations.extras - (inPackageLocations.extras, ".") + if inNugetPackageLocations.AllLocationsExist() then + printfn "using extra content from %s" inNugetPackageLocations.extras.Path + (inNugetPackageLocations.extras.Path, ".") else if // This is for in-repo use only, assuming we are executing directly from // src\fsdocs-tool\bin\Debug\net6.0\fsdocs.exe // src\fsdocs-tool\bin\Release\net6.0\fsdocs.exe - inRepoLocations.Exist() + inThisRepoLocations.AllLocationsExist() then - printfn "using extra content from %s" inRepoLocations.docs_content - (inRepoLocations.docs_content, "content") + printfn "using extra content from %s" inThisRepoLocations.content.Path + (inThisRepoLocations.content.Path, "content") else printfn "no extra content found at %s or %s" - inPackageLocations.extras - inRepoLocations.docs_content ] + inNugetPackageLocations.extras.Path + inThisRepoLocations.content.Path ] // The incremental state (as well as the files written to disk) let mutable latestApiDocModel = None @@ -1671,12 +1672,12 @@ type CoreBuildOptions(watch) = templateFiles d - OutputKind.Html, Some d - | None -> - printfn - "note, no template file '%s' found, and no default template at '%s'" - templateFiles - inRepoLocations.template_html + OutputKind.Html, Some d + | None -> + printfn + "note, no template file '%s' found, and no default template at '%s'" + templateFiles + inThisRepoLocations.``template.html``.Path OutputKind.Html, None diff --git a/src/fsdocs-tool/InitCommand.fs b/src/fsdocs-tool/InitCommand.fs index 6cfe312c9..8a926a727 100644 --- a/src/fsdocs-tool/InitCommand.fs +++ b/src/fsdocs-tool/InitCommand.fs @@ -3,14 +3,16 @@ namespace fsdocs open System.IO open CommandLine +open Spectre.Console + [] type InitCommand() = let dir = Path.GetDirectoryName(typeof.Assembly.Location) // get template locations for in-package and in-repo files and decide which to use later - let inPackageLocations = Common.InPackageLocations(Path.Combine(dir, "..", "..", "..")) - let inRepoLocations = Common.InRepoLocations(Path.Combine(dir, "..", "..", "..", "..", "..")) + let inNugetPackageLocations = Common.InNugetPackageLocations(Path.Combine(dir, "..", "..", "..")) + let inThisRepoLocations = Common.InDocsFolderLocations(Path.Combine(dir, "..", "..", "..", "..", "..", "docs")) [] member val output: string = "docs" with get, set + [] + member val force: bool = false with get, set + member this.Execute() = - let outputPath = Path.GetFullPath(this.output) - let repoRoot = Path.GetFullPath(Path.Combine(outputPath, "..")) - let initLocations = Common.InRepoLocations(repoRoot) + let docsOutputPath = Path.GetFullPath(this.output) + let initLocations = Common.InDocsFolderLocations(docsOutputPath) let ensureOutputDirs () = - [ outputPath; initLocations.docs; initLocations.docs_img ] + [ docsOutputPath; initLocations.DocsFolder.Path; initLocations.img.Path ] |> List.iter ensureDirectory - if inPackageLocations.Exist() then + if inNugetPackageLocations.AllLocationsExist() then // if the in-package locations exist, this means fsdocs is run from the nuget package. - ensureOutputDirs () - try - [ (inPackageLocations.template_html, initLocations.template_html) - (inPackageLocations.template_ipynb, initLocations.template_ipynb) - (inPackageLocations.template_tex, initLocations.template_tex) - (inPackageLocations.dockerfile, initLocations.dockerfile) - (inPackageLocations.nuget_config, initLocations.nuget_config) - // these files must be renamed, because files prefixed with a dot are otherwise ignored by fsdocs. We want this in the source repo, but not in the output of this command. - (inPackageLocations.logo_template, Path.GetFullPath(Path.Combine(initLocations.docs_img, "logo.png"))) - (inPackageLocations.index_md_template, Path.GetFullPath(Path.Combine(initLocations.docs, "index.md"))) - (inPackageLocations.literate_sample_template, - Path.GetFullPath(Path.Combine(initLocations.docs, "literate_sample.fsx"))) ] - |> List.iter (fun (src, dst) -> File.Copy(src, dst, true)) + ensureOutputDirs () + + let fileMap = + [ inNugetPackageLocations.``templates/template.html``, initLocations.``template.html``.Path + inNugetPackageLocations.``templates/template.ipynb``, initLocations.``template.ipynb``.Path + inNugetPackageLocations.``templates/template.tex``, initLocations.``template.tex``.Path + inNugetPackageLocations.Dockerfile, initLocations.Dockerfile.Path + inNugetPackageLocations.``Nuget.config``, initLocations.``Nuget.config``.Path + inNugetPackageLocations.``extras/content/img/badge-binder.svg``, initLocations.``img/badge-binder.svg``.Path + inNugetPackageLocations.``extras/content/img/badge-notebook.svg``, initLocations.``img/badge-notebook.svg``.Path + inNugetPackageLocations.``extras/content/img/badge-script.svg``, initLocations.``img/badge-script.svg``.Path + // these files must be renamed, because files prefixed with a dot are otherwise ignored by fsdocs. We want this in the source repo, but not in the output of this command. + inNugetPackageLocations.``templates/init/.logo.png``, + Path.GetFullPath(Path.Combine(initLocations.img.Path, "logo.png")) + inNugetPackageLocations.``templates/init/.index_md_template.md``, + Path.GetFullPath(Path.Combine(initLocations.DocsFolder.Path, "index.md")) + inNugetPackageLocations.``templates/init/.literate_sample_template.fsx``, + Path.GetFullPath(Path.Combine(initLocations.DocsFolder.Path, "literate_sample.fsx")) ] + + fileMap |> List.iter (fun (src, dst) -> File.Copy(src.Path, dst, this.force)) printfn "" printfn "a basic fsdocs scaffold has been created in %s." this.output @@ -55,22 +69,32 @@ type InitCommand() = printfn "Error: %s" exn.Message 1 - elif inRepoLocations.Exist() then + elif inThisRepoLocations.AllLocationsExist() then // if the in-repo locations exist, this means fsdocs is run from inside the FSharp.Formatting repo itself. - ensureOutputDirs () try - [ (inRepoLocations.template_html, initLocations.template_html) - (inRepoLocations.template_ipynb, initLocations.template_ipynb) - (inRepoLocations.template_tex, initLocations.template_tex) - (inRepoLocations.dockerfile, initLocations.dockerfile) - (inRepoLocations.nuget_config, initLocations.nuget_config) - // these files must be renamed, because files prefixed with a dot are otherwise ignored by fsdocs. We want this in the source repo, but not in the output of this command. - (inRepoLocations.logo_template, Path.GetFullPath(Path.Combine(initLocations.docs_img, "logo.png"))) - (inRepoLocations.index_md_template, Path.GetFullPath(Path.Combine(initLocations.docs, "index.md"))) - (inRepoLocations.literate_sample_template, - Path.GetFullPath(Path.Combine(initLocations.docs, "literate_sample.fsx"))) ] - |> List.iter (fun (src, dst) -> File.Copy(src, dst, true)) + ensureOutputDirs () + + let fileMap = + [ (inThisRepoLocations.``template.html``, initLocations.``template.html``.Path) + (inThisRepoLocations.``template.ipynb``, initLocations.``template.ipynb``.Path) + (inThisRepoLocations.``template.tex``, initLocations.``template.tex``.Path) + (inThisRepoLocations.Dockerfile, initLocations.Dockerfile.Path) + (inThisRepoLocations.``Nuget.config``, initLocations.``Nuget.config``.Path) + (inThisRepoLocations.``img/badge-binder.svg``, initLocations.``img/badge-binder.svg``.Path) + (inThisRepoLocations.``img/badge-notebook.svg``, initLocations.``img/badge-notebook.svg``.Path) + (inThisRepoLocations.``img/badge-script.svg``, initLocations.``img/badge-script.svg``.Path) + // these files must be renamed, because files prefixed with a dot are otherwise ignored by fsdocs. We want this in the source repo, but not in the output of this command. + (inThisRepoLocations.``templates/init/.logo.png``, + Path.GetFullPath(Path.Combine(initLocations.img.Path, "logo.png"))) + (inThisRepoLocations.``templates/init/.index_md_template.md``, + Path.GetFullPath(Path.Combine(initLocations.DocsFolder.Path, "index.md"))) + (inThisRepoLocations.``templates/init/.literate_sample_template.fsx``, + Path.GetFullPath(Path.Combine(initLocations.DocsFolder.Path, "literate_sample.fsx"))) ] + + fileMap + // |> List.map (fun (src, dst) -> ) + |> List.iter (fun (src, dst) -> File.Copy(src.Path, dst, this.force)) printfn "" printfn "a basic fsdocs scaffold has been created in %s." this.output @@ -84,7 +108,7 @@ type InitCommand() = else printfn "no sources for default files found from either %s or %s" - inPackageLocations.RelAssemblyPath - inRepoLocations.RelAssemblyPath + inNugetPackageLocations.NugetPackageRootPath.Path + inThisRepoLocations.DocsFolder.Path 1 diff --git a/src/fsdocs-tool/Options.fs b/src/fsdocs-tool/Options.fs index 57afd1303..15ff7fc62 100644 --- a/src/fsdocs-tool/Options.fs +++ b/src/fsdocs-tool/Options.fs @@ -37,128 +37,253 @@ module Common = open System.IO + [] + module DefaultLocationDescriptions = + + //folders + [] + let ``docs folder`` = "the path to the folder that contains the inputs (documentation) for fsdocs." + + let ``nuget package root path`` = "the root path of the nuget package, e.g. when the tool is installed via `dotnet tool install`." + + [] + let ``templates`` = "contains additional default files (e.g., default files for the `init` command)" + + [] + let ``extras`` = "contains additional default files (e.g., default files for the `init` command)" + + [] + let ``templates/init`` = "contains the default files for the init command." + + [] + let ``img`` = "base folder to contain all images for your documentation" + + [] + let ``content`` = "contains additional content (e.g., custom css themes)" + + // files in the docs folder + [] + let ``_template.html`` = "description here" + + [] + let ``_template.ipynb`` = "description here" + + [] + let ``_template.tex`` = "description here" + + [] + let ``Dockerfile`` = "description here" + + [] + let ``Nuget.config`` = "description here" + + [] + let ``img/badge-binder.svg`` = "description here" + + [] + let ``img/badge-notebook.svg`` = "description here" + + [] + let ``img/badge-script.svg`` = "description here" + + [] + let ``img/logo.png`` = "description here" + + // specific files for the init command + [] + let ``templates/init/.logo.png`` = "description here" + + [] + let ``templates/init/.index_md_template.md`` = "description here" + + [] + let ``templates/init/.literate_sample_template.fsx`` = "description here" + + type AnnotatedPath = + { Path: string + Description: string } + + static member Combine(ap: AnnotatedPath, path, ?description) = + { Path = Path.Combine(ap.Path, path) |> Path.GetFullPath + Description = defaultArg description "" } + /// - /// a set of default locations in this repo. - /// these files are to be used in 2 scenarios assuming we are executing directly from + /// A set of default locations in a folder containing documentation inputs for fsdocs. /// - /// src\fsdocs-tool\bin\Debug\net6.0\fsdocs.exe + /// When the fsdocs tool binary is called directly via /// - /// src\fsdocs-tool\bin\Release\net6.0\fsdocs.exe: + /// `src\fsdocs-tool\bin\Debug\net6.0\fsdocs.exe` or `src\fsdocs-tool\bin\Release\net6.0\fsdocs.exe`, /// - /// - as default styles when running watch or build when there are no user equivalents present and `nodefaultcontent` is not set to true + /// these locations can also be used /// - /// - as content of the output of the `init` command to initialize a default docs folder structure. + /// - as default content for the `watch` and `build` commands when no user equivalents present and `nodefaultcontent` is not set to true. This can be achieved by using the relative assembly path (plus "/docs") of the command classes as `docsFolderPath`. /// - /// Note that the path of these files will always be combined with the given `assemblyPath` because the cli tool will query it's own path on runtime via reflection. + /// - as output paths of the `init` command to initialize a default docs folder structure. + /// + /// because the paths will exist relative to the FSharp.Formatting repo root path. /// - type InRepoLocations(relAssemblyPath) = + type InDocsFolderLocations(docsFolderPath) = - // relAssemblyPath : relative path from assemly to repo root path - member _.RelAssemblyPath = relAssemblyPath + // DocsFolderPath : the path to the docs folder which is used as the base path to construct the other paths. + // note that this folder is not necessarily named "docs", it can be any location that is used as the base folder containing inputs for fsdocs. + member _.DocsFolder = + { Path = docsFolderPath + Description = DefaultLocationDescriptions.``docs folder`` } - // default folder locations relative to the assembly path - member this.docs = Path.Combine(this.RelAssemblyPath, "docs") |> Path.GetFullPath - member this.docs_templates = Path.Combine(this.docs, "templates") |> Path.GetFullPath - member this.docs_templates_init = Path.Combine(this.docs_templates, "init") |> Path.GetFullPath - member this.docs_img = Path.Combine(this.docs, "img") |> Path.GetFullPath - member this.docs_content = Path.Combine(this.docs, "content") |> Path.GetFullPath - member this.docs_content_img = Path.Combine(this.docs_content, "img") |> Path.GetFullPath + // default folder locations based on the docs folder path + member this.templates = + AnnotatedPath.Combine(this.DocsFolder, "templates", DefaultLocationDescriptions.``templates``) - // specific files in this folder structure that might need special treatment instead of just copy pasting - member this.template_html = Path.Combine(this.docs, "_template.html") |> Path.GetFullPath - member this.template_ipynb = Path.Combine(this.docs, "_template.ipynb") |> Path.GetFullPath - member this.template_tex = Path.Combine(this.docs, "_template.tex") |> Path.GetFullPath - member this.dockerfile = Path.Combine(this.docs, "Dockerfile") |> Path.GetFullPath - member this.nuget_config = Path.Combine(this.docs, "Nuget.config") |> Path.GetFullPath + member this.``templates/init`` = + AnnotatedPath.Combine(this.templates, "init", DefaultLocationDescriptions.``templates/init``) - // specific files for the init command - member this.logo_template = Path.Combine(this.docs_templates_init, ".logo.png") |> Path.GetFullPath + member this.content = AnnotatedPath.Combine(this.DocsFolder, "content", DefaultLocationDescriptions.content) + member this.img = AnnotatedPath.Combine(this.DocsFolder, "img", DefaultLocationDescriptions.``img``) + + // specific files in the docs folder. + member this.``template.html`` = + AnnotatedPath.Combine(this.DocsFolder, "_template.html", DefaultLocationDescriptions.``_template.html``) + + member this.``template.ipynb`` = + AnnotatedPath.Combine(this.DocsFolder, "_template.ipynb", DefaultLocationDescriptions.``_template.ipynb``) + + member this.``template.tex`` = + AnnotatedPath.Combine(this.DocsFolder, "_template.tex", DefaultLocationDescriptions.``_template.tex``) - member this.index_md_template = - Path.Combine(this.docs_templates_init, ".index_md_template.md") - |> Path.GetFullPath + member this.Dockerfile = + AnnotatedPath.Combine(this.DocsFolder, "Dockerfile", DefaultLocationDescriptions.Dockerfile) - member this.literate_sample_template = - Path.Combine(this.docs_templates_init, ".literate_sample_template.fsx") - |> Path.GetFullPath + member this.``Nuget.config`` = + AnnotatedPath.Combine(this.DocsFolder, "Nuget.config", DefaultLocationDescriptions.``Nuget.config``) + + member this.``img/badge-binder.svg`` = + AnnotatedPath.Combine(this.img, "badge-binder.svg", DefaultLocationDescriptions.``img/badge-binder.svg``) + + member this.``img/badge-notebook.svg`` = + AnnotatedPath.Combine( + this.img, + "badge-notebook.svg", + DefaultLocationDescriptions.``img/badge-notebook.svg`` + ) + + member this.``img/badge-script.svg`` = + AnnotatedPath.Combine(this.img, "badge-script.svg", DefaultLocationDescriptions.``img/badge-script.svg``) + + // specific files for the init command. Note that these typically only exist in the FSharp.Formatting repo because they are to be copied and renamed on running `fsdocs init``` + member this.``templates/init/.logo.png`` = + AnnotatedPath.Combine( + this.``templates/init``, + ".logo.png", + DefaultLocationDescriptions.``templates/init/.logo.png`` + ) + + member this.``templates/init/.index_md_template.md`` = + AnnotatedPath.Combine( + this.``templates/init``, + ".index_md_template.md", + DefaultLocationDescriptions.``templates/init/.index_md_template.md`` + ) + + member this.``templates/init/.literate_sample_template.fsx`` = + AnnotatedPath.Combine( + this.``templates/init``, + ".literate_sample_template.fsx", + DefaultLocationDescriptions.``templates/init/.literate_sample_template.fsx`` + ) /// - /// returns true if all special files and folders of this location exist. + /// returns true if all files and folders of this location exist. /// - member this.Exist() = + member this.AllLocationsExist() = try - Directory.Exists(this.docs) - && Directory.Exists(this.docs_templates) - && Directory.Exists(this.docs_templates_init) - && Directory.Exists(this.docs_img) - && Directory.Exists(this.docs_content) - && Directory.Exists(this.docs_content_img) - && File.Exists(this.template_html) - && File.Exists(this.template_ipynb) - && File.Exists(this.template_tex) - && File.Exists(this.dockerfile) - && File.Exists(this.nuget_config) - && File.Exists(this.logo_template) - && File.Exists(this.index_md_template) - && File.Exists(this.literate_sample_template) + Directory.Exists(this.DocsFolder.Path) + && Directory.Exists(this.templates.Path) + && Directory.Exists(this.``templates/init``.Path) + && Directory.Exists(this.content.Path) + && Directory.Exists(this.img.Path) + && File.Exists(this.``template.html``.Path) + && File.Exists(this.``template.ipynb``.Path) + && File.Exists(this.``template.tex``.Path) + && File.Exists(this.Dockerfile.Path) + && File.Exists(this.``img/badge-binder.svg``.Path) + && File.Exists(this.``img/badge-notebook.svg``.Path) + && File.Exists(this.``img/badge-script.svg``.Path) + && File.Exists(this.``templates/init/.logo.png``.Path) + && File.Exists(this.``templates/init/.index_md_template.md``.Path) + && File.Exists(this.``templates/init/.literate_sample_template.fsx``.Path) with _ -> false /// /// a set of default locations in the nuget package created for fsdocs-tool. - /// these files are to be used in 2 scenarios assuming the tool is invoked via cli: + /// these files are to be used when fsdocs is run as dotnet tool installed via `dotnet tool install` in the following scenarios: /// - /// - as default styles when running watch or build when there are no user equivalents present and `nodefaultcontent` is not set to true + /// - as default files when running watch or build when there are no user equivalents present and `nodefaultcontent` is not set to true /// /// - as content of the output of the `init` command to initialize a default docs folder structure. /// /// Note that the path of these files will always be combined with the given `assemblyPath` because the cli tool will query it's own path on runtime via reflection. /// - type InPackageLocations(relAssemblyPath) = - - // relAssemblyPath : relative path from assemly to package root path - member _.RelAssemblyPath = relAssemblyPath + type InNugetPackageLocations(nugetPackageRootPath) = - // From .nuget\packages\fsdocs-tool\7.1.7\tools\net6.0\any - // to .nuget\packages\fsdocs-tool\7.1.7\* + // PackageRootPath : the root path of the nuget package, e.g. when the tool is installed via `dotnet tool install`. + // for example, default on windows would be: ~\.nuget\packages\fsdocs-tool\20.0.0-alpha-010 + member _.NugetPackageRootPath = + { + Path = nugetPackageRootPath + Description = "the root path of the nuget package, e.g. when the tool is installed via `dotnet tool install`." + } - // default folder locations relative to the assembly path - member this.templates = Path.Combine(this.RelAssemblyPath, "templates") |> Path.GetFullPath - member this.extras = Path.Combine(this.RelAssemblyPath, "extras") |> Path.GetFullPath - member this.extras_content = Path.Combine(this.extras, "content") |> Path.GetFullPath - member this.extras_content_img = Path.Combine(this.extras_content, "img") |> Path.GetFullPath + // default folder locations relative to the package root path + member this.templates = AnnotatedPath.Combine(this.NugetPackageRootPath, "templates", DefaultLocationDescriptions.templates) + member this.``templates/init`` = AnnotatedPath.Combine(this.templates, "init", DefaultLocationDescriptions.templates) + member this.extras = AnnotatedPath.Combine(this.NugetPackageRootPath, "extras") + member this.``extras/content`` = AnnotatedPath.Combine(this.extras, "content") + member this.``extras/content/img`` = AnnotatedPath.Combine(this.``extras/content``, "img") // specific files in this folder structure that might need special treatment instead of just copy pasting - member this.template_html = Path.Combine(this.templates, "_template.html") |> Path.GetFullPath - member this.template_ipynb = Path.Combine(this.templates, "_template.ipynb") |> Path.GetFullPath - member this.template_tex = Path.Combine(this.templates, "_template.tex") |> Path.GetFullPath - member this.dockerfile = Path.Combine(this.extras, "Dockerfile") |> Path.GetFullPath - member this.nuget_config = Path.Combine(this.extras, "Nuget.config") |> Path.GetFullPath + member this.``templates/template.html`` = AnnotatedPath.Combine(this.templates, "_template.html") + member this.``templates/template.ipynb`` = AnnotatedPath.Combine(this.templates, "_template.ipynb") + member this.``templates/template.tex`` = AnnotatedPath.Combine(this.templates, "_template.tex") + member this.Dockerfile = AnnotatedPath.Combine(this.extras, "Dockerfile") + member this.``Nuget.config`` = AnnotatedPath.Combine(this.extras, "Nuget.config") + + member this.``extras/content/img/badge-binder.svg`` = + AnnotatedPath.Combine(this.``extras/content/img``, "badge-binder.svg", DefaultLocationDescriptions.``img/badge-binder.svg``) + + member this.``extras/content/img/badge-notebook.svg`` = + AnnotatedPath.Combine( + this.``extras/content/img``, + "badge-notebook.svg", + DefaultLocationDescriptions.``img/badge-notebook.svg`` + ) + member this.``extras/content/img/badge-script.svg`` = + AnnotatedPath.Combine(this.``extras/content/img``, "badge-script.svg", DefaultLocationDescriptions.``img/badge-script.svg``) // specific files for the init command - member this.logo_template = Path.Combine(this.templates, ".logo.png") |> Path.GetFullPath - member this.index_md_template = Path.Combine(this.templates, ".index_md_template.md") |> Path.GetFullPath + member this.``templates/init/.logo.png`` = AnnotatedPath.Combine(this.``templates/init``, ".logo.png") + member this.``templates/init/.index_md_template.md`` = AnnotatedPath.Combine(this.``templates/init``, ".index_md_template.md") - member this.literate_sample_template = - Path.Combine(this.templates, ".literate_sample_template.fsx") - |> Path.GetFullPath + member this.``templates/init/.literate_sample_template.fsx`` = AnnotatedPath.Combine(this.``templates/init``, ".literate_sample_template.fsx") /// /// returns true if all special files and folders of this location exist. /// - member this.Exist() = + member this.AllLocationsExist() = try - Directory.Exists(this.templates) - && Directory.Exists(this.extras) - && Directory.Exists(this.extras_content) - && Directory.Exists(this.extras_content_img) - && File.Exists(this.template_html) - && File.Exists(this.template_ipynb) - && File.Exists(this.template_tex) - && File.Exists(this.dockerfile) - && File.Exists(this.nuget_config) - && File.Exists(this.logo_template) - && File.Exists(this.index_md_template) - && File.Exists(this.literate_sample_template) + Directory.Exists(this.templates.Path) + && Directory.Exists(this.extras.Path) + && Directory.Exists(this.``extras/content``.Path) + && Directory.Exists(this.``extras/content/img``.Path) + && File.Exists(this.``templates/template.html``.Path) + && File.Exists(this.``templates/template.ipynb``.Path) + && File.Exists(this.``templates/template.tex``.Path) + && File.Exists(this.Dockerfile.Path) + && File.Exists(this.``extras/content/img/badge-binder.svg``.Path) + && File.Exists(this.``extras/content/img/badge-notebook.svg``.Path) + && File.Exists(this.``extras/content/img/badge-script.svg``.Path) + && File.Exists(this.``templates/init/.logo.png``.Path) + && File.Exists(this.``templates/init/.index_md_template.md``.Path) + && File.Exists(this.``templates/init/.literate_sample_template.fsx``.Path) with _ -> false diff --git a/src/fsdocs-tool/fsdocs-tool.fsproj b/src/fsdocs-tool/fsdocs-tool.fsproj index c0a48a519..6e2e044af 100644 --- a/src/fsdocs-tool/fsdocs-tool.fsproj +++ b/src/fsdocs-tool/fsdocs-tool.fsproj @@ -28,13 +28,14 @@ - - - + + + + @@ -50,6 +51,7 @@ + \ No newline at end of file