@@ -7,40 +7,63 @@ SHELL := /bin/bash
77usage :
88 @fgrep -h " ##" $(MAKEFILE_LIST ) | fgrep -v fgrep | sed -e ' s/\\$$//' | sed -e ' s/##//'
99
10+ # # Check if all required prerequisites are installed
11+ check :
12+ @command -v docker > /dev/null 2>&1 || { echo " Docker is not installed. Please install Docker and try again." ; exit 1; }
13+ @command -v node > /dev/null 2>&1 || { echo " Node.js is not installed. Please install Node.js and try again." ; exit 1; }
14+ @command -v aws > /dev/null 2>&1 || { echo " AWS CLI is not installed. Please install AWS CLI and try again." ; exit 1; }
15+ @command -v localstack > /dev/null 2>&1 || { echo " LocalStack is not installed. Please install LocalStack and try again." ; exit 1; }
16+ @command -v cdk > /dev/null 2>&1 || { echo " CDK is not installed. Please install CDK and try again." ; exit 1; }
17+ @command -v cdklocal > /dev/null 2>&1 || { echo " cdklocal is not installed. Please install cdklocal and try again." ; exit 1; }
18+ @command -v aws > /dev/null 2>&1 || { echo " AWS CLI is not installed. Please install AWS CLI and try again." ; exit 1; }
19+ @command -v awslocal > /dev/null 2>&1 || { echo " awslocal is not installed. Please install awslocal and try again." ; exit 1; }
20+ @echo " All required prerequisites are available."
21+
1022# # Install dependencies
1123install :
12- @which localstack || pip install localstack
13- @which awslocal || pip install awscli-local
14- @which cdklocal || npm install -g aws-cdk-local aws-cdk
24+ @if [ ! -d " node_modules" ]; then \
25+ echo " node_modules not found. Running npm install..." ; \
26+ npm install; \
27+ fi
28+ @if [ ! -d " demos/rds-query-fn-code/node_modules" ]; then \
29+ echo " demos/rds-query-fn-code/node_modules not found. Running npm install..." ; \
30+ npm install --prefix demos/rds-query-fn-code; \
31+ fi
32+ @echo " All required dependencies are available."
1533
1634# # Deploy the infrastructure
17- build :
18- npm install && cd demos/rds-query-fn-code && npm install
19-
20- # # Bootstap the CDK sample
21- bootstrap :
22- cdklocal bootstrap
23-
24- # # Deploy the CDK sample
2535deploy :
36+ @echo " Bootstrapping CDK..."
37+ cdklocal bootstrap
38+ @echo " Deploying CDK..."
2639 cdklocal deploy --require-approval never
40+ @echo " CDK deployed successfully."
41+
42+ # # Run the tests
43+ test :
44+ @echo " Running tests..."
45+ npm test
46+ @echo " Tests completed successfully."
2747
2848# # Start LocalStack in detached mode
2949start :
30- RDS_MYSQL_DOCKER=1 localstack start -d
50+ @echo " Starting LocalStack..."
51+ @LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN ) localstack start -d
52+ @echo " LocalStack started successfully."
3153
3254# # Stop the Running LocalStack container
3355stop :
34- @echo
35- localstack stop
56+ @echo " Stopping LocalStack..."
57+ @localstack stop
58+ @echo " LocalStack stopped successfully."
3659
3760# # Make sure the LocalStack container is up
3861ready :
3962 @echo Waiting on the LocalStack container...
4063 @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1)
4164
42- # # Save the logs in a separate file, since the LS container will only contain the logs of the last sample run.
65+ # # Save the logs in a separate file
4366logs :
4467 @localstack logs > logs.txt
4568
46- .PHONY : usage install bootstrap build deploy deploy start stop ready logs
69+ .PHONY : usage check start ready install deploy test logs stop
0 commit comments