-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tefca viewer design review tooling (#2239)
* Add design-review script and associated README * README updates * Fix README typo * Update to use curl instead of wget to install script from GitHub
- Loading branch information
1 parent
0a13b14
commit 741ab2c
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Design Review Script | ||
|
||
A bash script intended to allow designers and members of the team to easily spin up an instance of the TEFCA Viewer on their local machines for UI/UX review. Currently only MacOS is supported. | ||
|
||
## Initial Setup | ||
|
||
In order to use this script a copy must be downloaded onto your computer from GitHub . To do this follow these instructions. | ||
1. Open the Terminal application. | ||
2. Copy and paste `curl https://raw.githubusercontent.com/CDCgov/phdi/main/containers/tefca-viewer/design-review/design-review.sh -O` into the Terminal prompt and press enter. This command uses the wget program to download a copy the `design-review.sh` file from this directory to the root level of your user directory e.g. `Users/johndoe`. | ||
3. Copy and paste `chmod +x design-review.sh` into Terminal and press enter. This command assigns executable permissions to `design-review.sh` allowing it to be run. | ||
|
||
|
||
## Usage | ||
|
||
Follow these steps to run script and spin up a local instance of the TEFCA Viewer. | ||
|
||
1. Ensure you have completed the initial setup instructions. | ||
2. Open the Terminal application. | ||
3. Copy and paste `./design-reivew.sh <MY-BRANCH>` into the Terminal prompt. | ||
4. Replace `<MY-BRANCH>` with the name of the GitHub branch you would like to conduct a review on. For example, `./design-reivew.sh main` will spin up an instance of the TEFCA Viewer based on the current state of the `main` branch of repository. | ||
5. Press enter. The script will now ensure that all required dependencies are installed on your machine, build and run the TEFCA Viewer, and finally navigate to the landing page in your system's default browser. Please note that because certain dependencies may need to be installed the script make take a few minutes the first time it is run. | ||
6. When you are done with your review to shut the TEFCA Viewer down return to Terminal and press enter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash | ||
|
||
# Check if branch name is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <branch-name>" | ||
exit 1 | ||
fi | ||
|
||
BRANCH_NAME=$1 | ||
|
||
# Function to check if a command exists | ||
command_exists() { | ||
command -v "$1" &> /dev/null | ||
} | ||
|
||
# Install Homebrew if it's not already installed | ||
if ! command_exists brew; then | ||
echo "Homebrew not found, installing it now..." | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
fi | ||
|
||
# Update Homebrew | ||
brew update | ||
|
||
# Install Git if it's not already installed | ||
if ! command_exists git; then | ||
brew install git | ||
fi | ||
|
||
# Install Docker if it's not already installed | ||
if ! command_exists docker; then | ||
brew install --cask docker | ||
fi | ||
|
||
# Start Docker | ||
open /Applications/Docker.app | ||
echo "Waiting for Docker to launch..." | ||
while ! docker system info > /dev/null 2>&1; do | ||
sleep 1 | ||
done | ||
|
||
# Install Docker Compose if it's not already installed | ||
if ! command_exists docker-compose; then | ||
brew install docker-compose | ||
fi | ||
|
||
# Clone the repository if it doesn't exist, otherwise pull the latest changes | ||
REPO_URL="https://github.com/CDCgov/phdi.git" | ||
REPO_DIR="phdi" | ||
|
||
if [ ! -d "$REPO_DIR" ]; then | ||
git clone $REPO_URL | ||
cd $REPO_DIR | ||
else | ||
cd $REPO_DIR | ||
git pull | ||
fi | ||
|
||
cd ./containers/tefca-viewer | ||
|
||
# Checkout the specified branch | ||
git checkout $BRANCH_NAME | ||
|
||
# Build and run docker-compose | ||
docker-compose build --no-cache && docker-compose up -d | ||
|
||
# Wait for TEFCA Viewer to be available | ||
URL="http://localhost:3000/tefca-viewer" | ||
while ! curl -s -o /dev/null -w "%{http_code}" "$URL" | grep -q "200"; do | ||
echo "Waiting for $URL to be available..." | ||
sleep 5 | ||
done | ||
|
||
|
||
# Open in default browser | ||
open http://localhost:3000/tefca-viewer | ||
|
||
# Prompt to end review session | ||
read -p "Press enter to end review" | ||
docker compose down |