-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new field to the copier questions: description. This is not picked up by copier, it is only used in the new docs page, 30-questions. Adds a new documentation page 30-questions. This lists the questions and the new description. Changes the strategy question to include a link to the questions. Closes #274
- Loading branch information
1 parent
c46df89
commit 44c68f6
Showing
9 changed files
with
211 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
AnswerStrategy: | ||
type: str | ||
default: recommended | ||
help: Optional questions (You can use our defaults, or the bare minimum, or decide everything) | ||
help: "Strategy for optional questions (You can see the full list of questions in https://abelsiqueira.com/BestieTemplate.jl/dev/30-questions/)" | ||
choices: | ||
Recommended (Our defaults): "recommended" | ||
Minimum (Answer no to any addition): "minimum" | ||
Ask me (Ask all questions): "ask" | ||
description: | | ||
This defines how to deal with the rest of the questions. | ||
The `minimum` strategy answers "no" to every question. This is not the same as a bare-bones package. The resulting package will have the minimum amount of best practices that we recommend. | ||
The `recommended` strategy uses all our recommended best practices, which might be overwhelming for anyone. See the answers below this step to see all the options. This is not the same as saying "yes" to everything. | ||
The `ask` strategy does not select anything from the list below. All questions will be asked. | ||
Notice that some options are only available through the `ask` strategy, or by explicitly passing them to the Bestie command. | ||
Defaults to the "recommended" strategy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
[deps] | ||
BestieTemplate = "E5D671A7-4186-4F1A-BF88-C19B630DA94F" | ||
BestieTemplate = "e5d671a7-4186-4f1a-bf88-c19b630da94f" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589" | ||
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" | ||
|
||
[compat] | ||
Documenter = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Questions | ||
|
||
In this page we list all the questions of the template, in the order that they are asked. | ||
Some of these questions are skipped because they are guessed. | ||
|
||
To answer any of these question via the Julia interface, you can pass a dictionary to the `generate` or `apply` functions. | ||
For instance: | ||
|
||
```@example | ||
using BestieTemplate | ||
cd(mktempdir()) do # hide | ||
data = Dict( | ||
"PackageName" => "NotMyPkg", | ||
"PackageOwner" => "bestie", | ||
"Authors" => "Bestie", | ||
) | ||
BestieTemplate.generate( | ||
pkgdir(BestieTemplate), # hide | ||
"MyPkg", | ||
data, | ||
defaults=true, # Choose default for other questions - will fail if there is none | ||
quiet=true, | ||
vcs_ref="HEAD", # hide | ||
) | ||
print(read("MyPkg/Project.toml", String)) | ||
end # hide | ||
``` | ||
|
||
!!! note "Help wanted" | ||
We have not managed to create a table of contents because we can't create the anchors in the headers. If you have an idea of what to do, help is appreciated. | ||
|
||
```@eval | ||
using Markdown, YAML | ||
sections = String[] | ||
questions = Dict{String,Any}() | ||
dir = joinpath(@__DIR__, "..", "..") | ||
out = "" | ||
for line in readlines(joinpath(dir, "copier.yml")) | ||
if startswith("!include")(line) | ||
file = split(line)[2] | ||
section_name = basename(file) |> x -> splitext(x)[1] | ||
if section_name == "constants" | ||
continue | ||
end | ||
push!(sections, section_name) | ||
yaml = YAML.load_file(joinpath(dir, file)) | ||
questions[section_name] = yaml | ||
end | ||
end | ||
title_override = Dict( | ||
"ci" => "Continuous Integration", | ||
) | ||
titles = Dict( | ||
section => get(title_override, section, section) |> x -> replace(x, "-" => " ") |> titlecase | ||
for section in sections | ||
) | ||
for section in sections | ||
global out | ||
title = titles[section] | ||
out *= "## Section: $title\n\n" | ||
for question in questions[section] | ||
name, answers = question | ||
out *= "### $name\n\n" | ||
help = answers["help"] | ||
out *= "**Question (in the CLI)**: $help\n\n" | ||
description = get(answers, "description", "") | ||
if description != "" | ||
out *= "**Description:**\n" | ||
out *= join("> " .* split(description, "\n"), "\n>\n") | ||
end | ||
out *= "\n\n" | ||
end | ||
end | ||
Markdown.parse(out) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters