Skip to content

Commit

Permalink
feat: add support for memento docker plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Mondelli committed Aug 5, 2022
1 parent 08c5858 commit beba236
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 38 deletions.
9 changes: 0 additions & 9 deletions .bmeme/build/commands/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ if [[ "$1" == "run" ]]; then
docker-compose build --build-arg FIX_UID=$(id -u) --build-arg FIX_GID=$(id -g) 2>&1 >> ${LOGFILE}
echo "${LOGPREFIX} CMD docker-compose up -d" >> ${LOGFILE}
docker-compose up -d 2>&1 >> ${LOGFILE}

echo ""
if [[ ":$PATH:" == *":$LOCAL_PATH:"* ]]; then
echo -e "Your ${CG}\$PATH${CN} is correctly set"
else
echo -e "Your ${CG}\$PATH${CN} is not configured."
echo ""
echo -e "Run: ${CY}eval \$(${0} env)${CN}"
echo ""
fi

fi
41 changes: 13 additions & 28 deletions configure → .bmeme/build/configure
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env bash

set -e
source .bmeme/build/common/lib.sh
THIS_SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
source "${THIS_SCRIPT_DIR}/common/lib.sh"

mkdir -p "${BASE_PRJ_DIR}/.bmeme/log"

if ! test -f ".env"; then
if ! test -f "${BASE_PRJ_DIR}/.env"; then
echo "Please specify the vendor for your new project."
echo "Typically this is your organization name, or the organization the projects belongs to."
echo -n -e "${CY}Vendor:${CN} "
Expand All @@ -18,24 +19,18 @@ if ! test -f ".env"; then

echo ""
echo -e "Configuring ${CG}env${CN} file..."
sed "s/@@@PROJECT@@@/${PROJECT}/g;s/@@@VENDOR@@@/${VENDOR}/g" .env.dist >.env
sed "s/@@@PROJECT@@@/${PROJECT}/g;s/@@@VENDOR@@@/${VENDOR}/g" "${BASE_PRJ_DIR}/.env.dist" > "${BASE_PRJ_DIR}/.env"

echo -e "Removing ${CG}.env.dist${CN} file..."
rm -f .env.dist
rm -f "${BASE_PRJ_DIR}/.env.dist"

source .env
source "${BASE_PRJ_DIR}/.env"
fi

if ! test -f ".env"; then
if ! test -f "${BASE_PRJ_DIR}/.env"; then
exit 1
fi

command_env() {
if [[ ":$PATH:" != *":$LOCAL_PATH:"* ]]; then
echo -n "export PATH=\"${LOCAL_PATH}:\${PATH}\""
fi
}

command_help() {

echo ""
Expand All @@ -44,23 +39,15 @@ command_help() {
echo "=============================================================================================="
echo ""
echo -en "${CY}"
printf "%-25s" "${0} help"
printf "%-25s" " help"
echo -e "${CN} -- Show help on how to use this script"
for i in $(ls .bmeme/build/commands); do
CMD_DESCR=$(.bmeme/build/commands/$i descr)
for i in $(ls "${BASE_PRJ_DIR}/.bmeme/build/commands"); do
CMD_DESCR=$("${BASE_PRJ_DIR}/.bmeme/build/commands/$i" descr)
echo -en "${CY}"
printf "%-25s" "${0} ${i%.*}"
printf "%-25s" " ${i%.*}"
echo -e "${CN} -- ${CMD_DESCR}"
done
echo -en "${CY}"
printf "%-25s" "eval \$(${0} env)"
echo -e "${CN} -- Set your \$PATH in order to use c script wrapper"
echo ""

if [[ ":$PATH:" == *":$LOCAL_PATH:"* ]]; then
echo ""
echo -e "Your ${CG}\$PATH${CN} is correctly set"
fi

echo ""
echo -e "DNS alias: ${CB}app.${PROJECT_NAME}.${PROJECT_VENDOR}.docker${CN}"
Expand All @@ -78,10 +65,8 @@ for cmdLineArg in "$@"; do

if [[ "$cmdLineArg" == "help" ]]; then
command_help
elif [[ "$cmdLineArg" == "env" ]]; then
command_env
elif [[ -f ".bmeme/build/commands/${cmdLineArg}.sh" ]]; then
bash -c ".bmeme/build/commands/${cmdLineArg}.sh run"
elif [[ -f "${BASE_PRJ_DIR}/.bmeme/build/commands/${cmdLineArg}.sh" ]]; then
bash -c "${BASE_PRJ_DIR}/.bmeme/build/commands/${cmdLineArg}.sh run"
else
echo -e "Unrecognized command: ${CR}${cmdLineArg}${CN}"
echo
Expand Down
2 changes: 1 addition & 1 deletion .bmeme/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ services:
environment:
- TERM=xterm-256color
- DNSDOCK_ALIAS=app.${PROJECT_NAME}.${PROJECT_VENDOR}.docker
- VIRTUAL_PORT=8090
- VIRTUAL_PORT=8080
- VIRTUAL_HOST=app.${PROJECT_NAME}.${PROJECT_VENDOR}.docker

0 comments on commit beba236

Please sign in to comment.