mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-21 09:41:47 +01:00
add recursive verify for includes in Bastillefile
This commit is contained in:
@@ -51,6 +51,22 @@ verify_release() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_template_include() {
|
||||||
|
case ${TEMPLATE_INCLUDE} in
|
||||||
|
http?://*/*/*)
|
||||||
|
bastille bootstrap "${TEMPLATE_INCLUDE}"
|
||||||
|
;;
|
||||||
|
*/*)
|
||||||
|
BASTILLE_TEMPLATE_USER=$(echo "${TEMPLATE_INCLUDE}" | awk -F / '{ print $1 }')
|
||||||
|
BASTILLE_TEMPLATE_REPO=$(echo "${TEMPLATE_INCLUDE}" | awk -F / '{ print $2 }')
|
||||||
|
bastille verify "${BASTILLE_TEMPLATE_USER}/${BASTILLE_TEMPLATE_REPO}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error_exit "Template INCLUDE content not recognized."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
verify_template() {
|
verify_template() {
|
||||||
_template_path=${bastille_templatesdir}/${BASTILLE_TEMPLATE}
|
_template_path=${bastille_templatesdir}/${BASTILLE_TEMPLATE}
|
||||||
_hook_validate=0
|
_hook_validate=0
|
||||||
@@ -75,20 +91,8 @@ verify_template() {
|
|||||||
echo
|
echo
|
||||||
while read _include; do
|
while read _include; do
|
||||||
info "[${_hook}]:[${_include}]:"
|
info "[${_hook}]:[${_include}]:"
|
||||||
|
TEMPLATE_INCLUDE="${_include}"
|
||||||
case ${_include} in
|
handle_template_include
|
||||||
http?://*/*/*)
|
|
||||||
bastille bootstrap "${_include}"
|
|
||||||
;;
|
|
||||||
*/*)
|
|
||||||
BASTILLE_TEMPLATE_USER=$(echo "${_include}" | awk -F / '{ print $1 }')
|
|
||||||
BASTILLE_TEMPLATE_REPO=$(echo "${_include}" | awk -F / '{ print $2 }')
|
|
||||||
bastille verify "${BASTILLE_TEMPLATE_USER}/${BASTILLE_TEMPLATE_REPO}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
error_exit "Template INCLUDE content not recognized."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done < "${_path}"
|
done < "${_path}"
|
||||||
|
|
||||||
## if tree; tree -a bastille_template/_dir
|
## if tree; tree -a bastille_template/_dir
|
||||||
@@ -105,6 +109,18 @@ verify_template() {
|
|||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
done < "${_path}"
|
done < "${_path}"
|
||||||
|
elif [ "${_hook}" = 'Bastillefile' ]; then
|
||||||
|
info "[${_hook}]:"
|
||||||
|
cat "${_path}"
|
||||||
|
while read _line; do
|
||||||
|
_cmd=$(echo "${_line}" | awk '{print tolower($1);}')
|
||||||
|
## if include; recursive verify
|
||||||
|
if [ "${_cmd}" = 'include' ]; then
|
||||||
|
TEMPLATE_INCLUDE=$(echo "${_line}" | awk '{print $2;}')
|
||||||
|
handle_template_include
|
||||||
|
fi
|
||||||
|
done < "${_path}"
|
||||||
|
echo
|
||||||
else
|
else
|
||||||
info "[${_hook}]:"
|
info "[${_hook}]:"
|
||||||
cat "${_path}"
|
cat "${_path}"
|
||||||
|
|||||||
Reference in New Issue
Block a user