dam/build.sh

61 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
EXEC=dam
test_function() {
local functionList=(${@})
2018-05-18 19:42:46 +00:00
source src/env
for function in ${functionList[@]}; do
local dependencyList=($(grep "# DEPENDENCIES" ${function} | sed 's|# DEPENDENCIES||'))
for dependency in ${dependencyList[@]}; do
eval source ${dependency}
done
2018-05-18 19:42:46 +00:00
bash ${function}
done
}
gen_help() {
for file in $(find help/ -type f -printf "%P\n"); do
echo -e "
# ${file} help
help_${file}() {
echo -e \""
cat help/${file}
echo -e "\"
}"
done
}
gen_env() {
echo -e "#!/bin/bash\n"
[[ $(git describe --tags) ]] && VERSION=$(git describe --tags) || VERSION=$(cat VERSION)
echo "VERSION=${VERSION}"
2018-07-02 15:08:04 +00:00
echo "REPO_VERSION=1"
awk '!/^ *#/ && NF' src/env
}
gen_function() {
local functionList=(${@})
for function in ${functionList[@]}; do
awk '!/^ *#/ && NF' ${function}
done
}
gen_parser() {
awk '!/^ *#/ && NF' src/parser
}
2018-05-18 19:42:46 +00:00
test_function $(find src/ -type f -not -name env -not -name parser)
# test_function src/import_track
gen_env > ${EXEC}
gen_help >> ${EXEC}
gen_function $(find src/ -type f -not -name env -not -name parser) >> ${EXEC}
gen_function $(find bunc/src/ -type f) >> ${EXEC}
gen_parser >> ${EXEC}
echo ${@} >> ${EXEC}
2018-04-07 23:58:45 +00:00
chmod +x ${EXEC}