From dc7205638ba2e50c06e706202922d44c4e96efd1 Mon Sep 17 00:00:00 2001 From: Leo Wilkin Date: Sun, 5 Jan 2025 21:56:30 +0000 Subject: [PATCH] codespace tools for auto setup! (#17) --- devcontainer.json | 4 ++++ install-tools.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 devcontainer.json create mode 100755 install-tools.sh diff --git a/devcontainer.json b/devcontainer.json new file mode 100644 index 0000000..c600a09 --- /dev/null +++ b/devcontainer.json @@ -0,0 +1,4 @@ +{ + "name": "Shipment Viewer Codespace", + "postCreateCommand": "./install-tools.sh" +} \ No newline at end of file diff --git a/install-tools.sh b/install-tools.sh new file mode 100755 index 0000000..4672fa5 --- /dev/null +++ b/install-tools.sh @@ -0,0 +1,29 @@ +#!/bin/bash +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +RED='\033[0;31m' +NC='\033[0m' + +ERROR_LOG="error.log" + +run_command() { + "$@" > /dev/null 2>>"$ERROR_LOG" # Suppress output, log errors to error.log + if [ $? -ne 0 ]; then + echo -e "${RED}❌ Command failed: $1. Please check the error log: $ERROR_LOG.${NC}" + exit 1 # Stop the script if the command fails + fi +} + +echo -e "${YELLOW}🛠️ Orph is setting up your workspace!${NC}" + +echo -e "${GREEN}⚙️ Installing dependencies...${NC}" +run_command bundle install + +echo -e "${GREEN}🔑 Installing dotenvx...${NC}" +run_command curl -fsS https://dotenvx.sh | sudo sh + +echo -e "${GREEN}🎉 You're all good to go!${NC}" + +echo -e "${GREEN}🚀 Starting your server...${NC}" +dotenvx run -f .env.test -- bundle exec rackup # Show server logs in the console +