Skip to content

Commit

Permalink
Add a couple of build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ali5ter committed Jun 9, 2020
1 parent 53b0999 commit 1e92f68
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
35 changes: 35 additions & 0 deletions build_taxo_for
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# @file build_taxo_for
# Build a taxo diagram for a particular CLI
# Usage: ./build_taxo_for cli_command
# @author Alister Lewis-Bowen <bowena@vmware.com>

[[ -n $DEBUG ]] && set -x
set -eou pipefail

CLI="${1-null}"

if [[ "$CLI" == 'null' ]]; then
read -p "✋ You forgot to say which CLI? " -r
echo
CLI="$REPLY"
else
CLI="$1"
fi

echo -n "Generating taxonomy tree for $CLI... "
cd exp1 && ./"$CLI"_taxo.sh > results/"$CLI"_taxo.txt && ./"$CLI"_taxo.sh -O > results/"$CLI"_taxo_with_options.txt

echo -en "✅\nExporting tree to csv... "
cd ../exp2 && ./"$CLI"_taxo.sh

echo -en "✅\nCreating diagram... "
cd ../exp3 && ./"$CLI"_taxo.sh && ./generate_results_index.sh

echo -e "✅\n"

cd .. || exit 1

read -p "✋ Do you want to view the diagram now... [y/N] " -n 1 -r
echo
[[ $REPLY =~ ^[Yy]$ ]] && ./show_taxo_for "$CLI"
32 changes: 32 additions & 0 deletions show_taxo_for
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# @file show_taxo_for
# Show a taxo diagram for a particular CLI
# Usage: ./show_taxo_for cli_command
# @author Alister Lewis-Bowen <bowena@vmware.com>

[[ -n $DEBUG ]] && set -x
set -eou pipefail

CLI="${1-null}"

if [[ "$CLI" == 'null' ]]; then
read -p "✋ You forgot to say which CLI? " -r
echo
CLI="$REPLY"
else
CLI="$1"
fi

cd exp3 || exit 1

echo "Running docker container to serve taxonomy diagram for $CLI... "
docker build -t ali5ter/cli-taxo-diagrams:1.0 .
docker ps -a | grep ali5ter/cli-taxo-diagrams > /dev/null 2>&1 && {
docker ps -a | grep ali5ter/cli-taxo-diagrams | \
awk '{print $1}' | \
xargs docker rm -fv > /dev/null 2>&1
}
docker run -d -p8080:80 ali5ter/cli-taxo-diagrams:1.0
open "http://localhost:8080/${CLI}_taxo_radial_tree.html"

cd .. || exit 1

0 comments on commit 1e92f68

Please sign in to comment.