diff --git a/_builder/getdir.bash b/_builder/getdir.bash index 54e4009..645b129 100644 --- a/_builder/getdir.bash +++ b/_builder/getdir.bash @@ -1,22 +1,19 @@ #!/bin/bash -# Function to get a directory using fzf -get_directory() { - # List all directories in the current directory that don't start with an underscore - local directories - directories=$(find . -maxdepth 1 -type d -not -name '_*' -exec basename {} \; | grep -v '[_\.]' | sort -r) +# List all directories in the current directory that don't start with an underscore +directories +directories=$(find . -maxdepth 1 -type d -not -name '_*' -exec basename {} \; | grep -v '[_\.]' | sort -r) - # Use fzf to allow the user to select a directory - local selected_dir - selected_dir=$(echo "$directories" | fzf --prompt="Select a directory: ") +# Use fzf to allow the user to select a directory +selected_dir +selected_dir=$(echo "$directories" | fzf --prompt="Select a directory: ") - # Check if a directory was selected - if [[ -z "$selected_dir" ]]; then - echo "No directory selected." - return 1 - fi +# Check if a directory was selected +if [[ -z "$selected_dir" ]]; then + echo "No directory selected." + return 1 +fi - # Set the BLDR_DIR variable to the selected directory - BLDR_DIR="${BLDR_PARENT_PATH}/${selected_dir}" - BLDR_APP=${selected_dir} -} +# Set the BLDR_DIR variable to the selected directory +BLDR_DIR="${BLDR_PARENT_PATH}/${selected_dir}" +BLDR_APP=${selected_dir} diff --git a/_builder/readme-new.sh b/_builder/readme-new.sh index 270a3ae..9bd9916 100644 --- a/_builder/readme-new.sh +++ b/_builder/readme-new.sh @@ -13,6 +13,13 @@ generate_readme() { readme_content+="# $BLDR_APP\n\n" readme_content+="Last Updated: $UPDATED\n\n" + # Overview + readme_content+="## Overview\n" + readme_content+="Docker Hub: \n" + readme_content+="Project: \n" + readme_content+="Composer Example: \n" + readme_content+="Proxy Port: \n" + # Description readme_content+="## Description\n" readme_content+="$DESCRIPTION\n\n" diff --git a/_builder/se-new.sh b/_builder/se-new.sh index 0115759..3787940 100644 --- a/_builder/se-new.sh +++ b/_builder/se-new.sh @@ -1,7 +1,7 @@ #!/bin/bash BLDR_ENV_FILE+="# $BLDR_APP\n" -BLDR_ENV_FILE+="COOKBOOK=$BLDR_PARENT_PATH #HELP: cookbooks\n" +BLDR_ENV_FILE+="COOKBOOK=/git/docker-compose-cookbooks #HELP: cookbooks\n" while IFS= read -r line; do # Use a regex to match and extract variable names and defaults diff --git a/builder.bash b/builder.bash index 4fd8aff..0365429 100644 --- a/builder.bash +++ b/builder.bash @@ -1,16 +1,17 @@ #!/bin/bash -BLDR_DIR="" + BLDR_APP="" -BLDR_PARENT_PATH=$(dirname "$(realpath "${BASH_SOURCE[0]}")") -BLDR_OLD_DCF="" # Content of Old Docker Compose File -BLDR_NEW_DCF="" # Content of New Docker Compose File -BLDR_NEW_SE="" # sample-extends -BLDR_NEW_README="" -BLDR_DC_VOLS="" -BLDR_DC_IMAGE="" BLDR_DC_ENV="" +BLDR_DC_IMAGE="" +BLDR_DC_VOLS="" +BLDR_DIR="" BLDR_ENV_FILE="" +BLDR_NEW_DCF="" # Content of New Docker Compose File +BLDR_NEW_README="" +BLDR_NEW_SE="" # sample-extends +BLDR_OLD_DCF="" # Content of Old Docker Compose File +BLDR_PARENT_PATH=$(dirname "$(realpath "${BASH_SOURCE[0]}")") source ./_builder/debug.sh #debug_print_helper_variables @@ -26,7 +27,6 @@ check_command "yq" # Get Directory we are working with ################################################ source ./_builder/getdir.bash -get_directory ################################################ # Save file to work with @@ -78,11 +78,8 @@ source ./_builder/extends-new.sh ################################################ # Create Readme.md ################################################ -source ./_builder/readme-new.sh -BLDR_NEW_README=$(generate_readme) -echo "$BLDR_NEW_README" > ${BLDR_DIR}/README.md - -# TODO: for readme file do mkdir -p data/vols for vols -# Do a git diff on the directory -# fuzzy find latest image using skopeo -# skopeo list-tags docker://docker.io/solidnerd/book \ No newline at end of file +if [[ ! -f "${BLDR_DIR}/README.md" ]]; then + source ./_builder/readme-new.sh + BLDR_NEW_README=$(generate_readme) + echo "$BLDR_NEW_README" > ${BLDR_DIR}/README.md +fi diff --git a/stashapp/sample.env b/stashapp/sample.env index 9070975..8e6ba12 100644 --- a/stashapp/sample.env +++ b/stashapp/sample.env @@ -1,5 +1,5 @@ -COOKBOOK=/home/nick/github/docker-compose-cookbooks #HELP: cookbooks +COOKBOOK=/git/docker-compose-cookbooks #HELP: cookbooks # stashapp STASHAPP_IMAGE=stashapp/stash:latest STASHAPP_STASH_CACHE=/cache/