LearnPAd/learnpad

View on GitHub
lp-collaborative-workspace/build

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash
### Help
# This is a template to help you write the `build' script.

# This script should build then test your component and copy needed material
# into the `out' directory.  It is structured with 3 functions, one for each
# need.

### VARIABLES ###
# Here are some usefull variables

# This is the directory path to your component
declare -r __COMPONENT_PATH__="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# This is the name of your component (must be the last part of ${__COMPONENT_PATH__}
declare -r __COMPONENT_NAME__="$( basename "${__COMPONENT_PATH__}" )"
# This is the path to your `out' directory
declare -r __OUT_PATH__="${__COMPONENT_PATH__}/out"
# These are path for the `start' and `stop' script that must be provided
declare -r __OUT_START_FILE__="${__OUT_PATH__}/start"
declare -r __OUT_STOP_FILE__="${__OUT_PATH__}/stop"
# This is a path to the optional file which list the needed dependencies to run the component
declare -r __OUT_RUNDEPS_FILE__="${__OUT_PATH__}/rundeps.txt"
# This is the path to the directory where you can optionally put some configuration files
declare -r __OUT_CONF_PATH__="${__OUT_PATH__}/etc"

## declare -r __MVN_PROFILE__="--batch-mode -Dhttps.protocols=TLSv1.2"
declare -r __MVN_PROFILE__="--batch-mode -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2"

### BUILD ###
# This is where you compile and build each part of your component
function component_build() {
mvn ${__MVN_PROFILE__} clean install
}

### TEST ###
# This is where you can run tests of your component
function component_test() {
echo "[INFO] Nothing to test"
}

### INSTALL ###
# This is where you need to publish material into the `out' directory
function component_install() {
mkdir -p ${__OUT_PATH__}
cp "scripts/start" "${__OUT_START_FILE__}"
cp "scripts/stop" "${__OUT_STOP_FILE__}"
echo "openjdk-7-jre" > "${__OUT_RUNDEPS_FILE__}"
# These is no configuration file to copy
#cp <path_to>/file.cfg ${__OUT_CONF_PATH__}/
}

component_build && component_test && component_install