2018-03-28 13:52:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
EXEC=dam
|
2018-05-18 19:30:24 +00:00
|
|
|
|
|
|
|
test_function() {
|
2018-05-18 20:12:49 +00:00
|
|
|
local functionList=(${@})
|
2018-05-18 19:42:46 +00:00
|
|
|
source src/env
|
2018-05-18 19:30:24 +00:00
|
|
|
for function in ${functionList[@]}; do
|
2018-05-18 20:12:49 +00:00
|
|
|
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}
|
2018-05-18 19:30:24 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-04-08 01:02:31 +00:00
|
|
|
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
|
2018-03-28 13:52:57 +00:00
|
|
|
|
2018-04-08 01:02:31 +00:00
|
|
|
}
|
2018-03-28 13:52:57 +00:00
|
|
|
|
2018-04-08 01:02:31 +00:00
|
|
|
gen_env() {
|
|
|
|
echo -e "#!/bin/bash\n"
|
2018-06-26 14:57:40 +00:00
|
|
|
[[ $(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"
|
2018-04-08 01:02:31 +00:00
|
|
|
awk '!/^ *#/ && NF' src/env
|
|
|
|
}
|
|
|
|
|
|
|
|
gen_function() {
|
2018-05-18 20:12:49 +00:00
|
|
|
local functionList=(${@})
|
2018-04-08 01:02:31 +00:00
|
|
|
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)
|
2018-05-18 20:12:49 +00:00
|
|
|
# test_function src/import_track
|
2018-05-18 19:30:24 +00:00
|
|
|
|
2018-04-08 01:02:31 +00:00
|
|
|
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}
|
2018-03-28 23:26:38 +00:00
|
|
|
|
2018-05-18 23:37:38 +00:00
|
|
|
echo ${@} >> ${EXEC}
|
|
|
|
|
2018-04-07 23:58:45 +00:00
|
|
|
chmod +x ${EXEC}
|