diff --git a/.github/workflows/test-starter-pack.yml b/.github/workflows/test-starter-pack.yml index 6109d8da..754a1f7c 100644 --- a/.github/workflows/test-starter-pack.yml +++ b/.github/workflows/test-starter-pack.yml @@ -17,6 +17,8 @@ jobs: - name: Check out repo uses: actions/checkout@v4 - name: Run init and build + env: + default_filetype_choice: md # don't prompt for user choice run: sp-tests/run-init-and-build.sh - name: Add some files, build, and test run: sp-tests/add-files-and-build.sh @@ -46,6 +48,8 @@ jobs: - name: Check out repo uses: actions/checkout@v4 - name: Run init and build + env: + default_filetype_choice: md # don't prompt for user choice run: sp-tests/run-init-and-build.sh docs - name: Add some files, build, and test run: sp-tests/add-files-and-build.sh docs diff --git a/init.sh b/init.sh index dd7926b2..48863209 100755 --- a/init.sh +++ b/init.sh @@ -15,6 +15,32 @@ if [ -z "$install_directory" ]; then read -rp "Enter the installation directory (e.g., '.' or 'docs'): " install_directory fi +# Check if md or rst is preferred for the documentation being built +promptForFileChoice() +{ +while true; do + read -p "Will you be using the 'rst' or 'md' file format for the documentation (default: 'rst'): " filetype_choice + + filetype_choice=${filetype_choice:-rst} + + if [ "$filetype_choice" = "md" ] || [ "$filetype_choice" = "rst" ]; then + file_type="$filetype_choice" + echo "Setting filetype to: $file_type" + break + else + echo "Invalid input. Please enter either 'md' or 'rst':" + fi +done +} + +# If default variable for filetype choice is defined in CI then don't prompt user for choice +if [ -z "${default_filetype_choice:-}" ]; then + promptForFileChoice +else + file_type="$default_filetype_choice" + echo "Using predefined filetype choice: $file_type" +fi + # Normalise the install_directory path install_directory=$(realpath -m --relative-to="$(pwd)" "$install_directory") echo "Installing at $install_directory..." @@ -84,6 +110,23 @@ fi echo "Copying contents to the installation directory..." cp -R "$temp_directory"/sp-files/* "$temp_directory"/sp-files/.??* "$install_directory" +# Delete files with unpreferred filetype in the installation directory +# No wildcard delete to avoid data loss if user Git-inits in dir with pre-existing files +if [ -z "${default_filetype_choice:-}" ]; then + echo "Default filetype not defined, so proceed with deleting unpreferred filetype." + if [ "$file_type" = 'md' ]; then + echo "Deleting .rst files..." + rm "$install_directory"/doc-cheat-sheet.rst + rm "$install_directory"/index.rst + else + echo "Deleting .md files..." + rm "$install_directory"/doc-cheat-sheet-myst.md + rm "$install_directory"/index.md + fi +else + echo "Default filetype is defined, so skip filetype deletion." +fi + # Ensure GitHub workflows and woke config are placed in the repo root # if installing in a non-root directory if [ "$install_directory" != "." ]; then diff --git a/sp-files/index.md b/sp-files/index.md new file mode 100644 index 00000000..30f1c89d --- /dev/null +++ b/sp-files/index.md @@ -0,0 +1,73 @@ +# Starter pack + +**A single sentence that says what the product is, succinctly and memorably.** +Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et +dolore magna aliqua. + +**A paragraph of one to three short sentences, that describe what the product +does.** Urna cursus eget nunc scelerisque viverra mauris in. Nibh mauris +cursus mattis molestie a iaculis at vestibulum rhoncus est pellentesque +elit. Diam phasellus vestibulum lorem sed. + +**A third paragraph of similar length, this time explaining what need the +product meets.** Dui ut ornare lectus sit amet est. Nunc sed augue lacus +viverra vitae congue eu consequat ac libero id faucibus nisl tincidunt eget +nullam. + +**Finally, a paragraph that describes whom the product is useful for.** Nunc +non blandit massa enim nec dui nunc mattis enim. Ornare arcu odio ut sem +nulla pharetra diam porttitor leo a diam sollicitudin tempor id eu. Ipsum +dolor sit amet consectetur adipiscing elit pellentesque habitant. + +--------- + +## In this documentation + +````{grid} 1 1 2 2 + +```{grid-item-card} [Tutorials](index) + +**Start here**: a hands-on introduction to Example Product for new users +``` + +```{grid-item-card} [How-to guides](index) + +**Step-by-step guides** covering key operations and common tasks +``` + +```` + +````{grid} 1 1 2 2 +:reverse: + +```{grid-item-card} [Reference](index) + +**Technical information** - specifications, APIs, architecture +``` + +```{grid-item-card} [Explanations](index) + +**Discussion and clarification** of key topics +``` + +```` + +--------- + +## Project and community + +Example Project is a member of the Ubuntu family. It’s an open source project that warmly welcomes community projects, contributions, suggestions, fixes and constructive feedback. + +* Code of conduct +* Get support +* Join our online chat +* Contribute +* Roadmap +* Thinking about using Example Product for your next project? Get in touch! + +```{toctree} +:hidden: +:maxdepth: 2 + +self +```