Add basic lantern build script to help with setting up for development
...opening 3 terminal tabs is hassle :P
This commit is contained in:
parent
42aa571ae5
commit
fd16ca4078
3 changed files with 93 additions and 0 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "lantern-build-engine"]
|
||||||
|
path = lantern-build-engine
|
||||||
|
url = https://gitlab.com/sbrl/lantern-build-engine.git
|
89
build.sh
Executable file
89
build.sh
Executable file
|
@ -0,0 +1,89 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Make sure the current directory is the location of this script to simplify matters
|
||||||
|
cd "$(dirname "$(readlink -f "$0")")" || { echo "Error: Failed to cd to script directory" >&2; exit 1; };
|
||||||
|
################
|
||||||
|
### Settings ###
|
||||||
|
################
|
||||||
|
|
||||||
|
# The name of this project
|
||||||
|
project_name="systemquery";
|
||||||
|
|
||||||
|
# The path to the lantern build engine git submodule
|
||||||
|
lantern_path="./lantern-build-engine";
|
||||||
|
|
||||||
|
###
|
||||||
|
# Custom Settings
|
||||||
|
###
|
||||||
|
|
||||||
|
# Put any custom settings here.
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# Check out the lantern git submodule if needed
|
||||||
|
if [ ! -f "${lantern_path}/lantern.sh" ]; then git submodule update --init "${lantern_path}"; fi
|
||||||
|
|
||||||
|
#shellcheck disable=SC1090
|
||||||
|
source "${lantern_path}/lantern.sh";
|
||||||
|
|
||||||
|
if [[ "$#" -lt 1 ]]; then
|
||||||
|
echo -e "${FBLE}${project_name}${RS} build script";
|
||||||
|
echo -e " by Starbeamrainbowlabs";
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
echo -e "${LC}Powered by the lantern build engine, v${version}${RS}";
|
||||||
|
echo -e "";
|
||||||
|
echo -e "${CSECTION}Usage${RS}";
|
||||||
|
echo -e " ./build ${CTOKEN}{action}${RS} ${CTOKEN}{action}${RS} ${CTOKEN}{action}${RS} ...";
|
||||||
|
echo -e "";
|
||||||
|
echo -e "${CSECTION}Available actions${RS}";
|
||||||
|
echo -e " ${CACTION}setup${RS} - Perform initial setup";
|
||||||
|
echo -e " ${CACTION}launch${RS} - Launch a 3-node development swarm";
|
||||||
|
echo -e "";
|
||||||
|
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
## Starts a new terminal tab.
|
||||||
|
# $1 The title of the new tab.
|
||||||
|
# $2..$n The command to arguments
|
||||||
|
terminal_tab() {
|
||||||
|
title="${1}";
|
||||||
|
shift
|
||||||
|
gnome-terminal --title "${title}" --tab -- "$@";
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
task_setup() {
|
||||||
|
stage_begin "Setting up";
|
||||||
|
|
||||||
|
check_command git true;
|
||||||
|
check_command node true;
|
||||||
|
check_command npm true;
|
||||||
|
|
||||||
|
subtask_begin "Initialising submodules";
|
||||||
|
git submodule update --init;
|
||||||
|
subtask_end $?;
|
||||||
|
|
||||||
|
stage_end 0;
|
||||||
|
|
||||||
|
task_begin "Installing dependencies";
|
||||||
|
npm install;
|
||||||
|
task_end $?;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
task_launch() {
|
||||||
|
task_begin "Launching swarm";
|
||||||
|
|
||||||
|
terminal_tab "systemquery:agent-a" src/index.mjs agent --config config/test_a.toml;
|
||||||
|
terminal_tab "systemquery:agent-b" src/index.mjs agent --config config/test_b.toml;
|
||||||
|
terminal_tab "systemquery:agent-c" src/index.mjs agent --config config/test_c.toml;
|
||||||
|
|
||||||
|
task_end 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
tasks_run "$@";
|
1
lantern-build-engine
Submodule
1
lantern-build-engine
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 094e175740cc6ebc10dd788a60af60e19407d641
|
Loading…
Reference in a new issue