feat(core): add file path validation to optional options
This commit is contained in:
parent
20bb947c57
commit
54a10c8e52
2 changed files with 21 additions and 3 deletions
22
blueprint.sh
22
blueprint.sh
|
@ -522,10 +522,28 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y"
|
|||
|
||||
if [[ $identifier =~ [a-z] ]]; then log_bright "[INFO] Identifier a-z checks passed."
|
||||
else rm -R ".blueprint/tmp/$n"; quit_red "[FATAL] The extension identifier should be lowercase and only contain characters a-z.";fi
|
||||
if [[ ( ! -f ".blueprint/tmp/$n/$icon" ) && ( $icon != "" ) ]]; then
|
||||
rm -R ".blueprint/tmp/$n"; quit_red "[FATAL] The 'info_icon' path points to a file that does not exist."
|
||||
|
||||
|
||||
|
||||
# Validate paths to files defined in conf.yml.
|
||||
|
||||
# (optional)
|
||||
if [[ ( ! -f ".blueprint/tmp/$n/$icon" ) && ( $icon != "" ) ]] # icon
|
||||
|| [[ ( ! -f ".blueprint/tmp/$n/$admin_controller" ) && ( $admin_controller != "" ) ]] # admin_controller
|
||||
|| [[ ( ! -f ".blueprint/tmp/$n/$admin_css" ) && ( $admin_css != "" ) ]] # admin_css
|
||||
|| [[ ( ! -f ".blueprint/tmp/$n/$admin_wrapper" ) && ( $admin_wrapper != "" ) ]] # admin_wrapper
|
||||
|| [[ ( ! -f ".blueprint/tmp/$n/$dashboard_css" ) && ( $dashboard_css != "" ) ]] # dashboard_css
|
||||
|| [[ ( ! -f ".blueprint/tmp/$n/$dashboard_wrapper" ) && ( $dashboard_wrapper != "" ) ]];then # dashboard_wrapper
|
||||
EMPTYPATHS="y"
|
||||
fi
|
||||
|
||||
# Throw error
|
||||
if [[ $EMPTYPATHS == "y" ]]; then
|
||||
rm -R ".blueprint/tmp/$n";
|
||||
throw 'confymlMissingFiles'
|
||||
fi
|
||||
|
||||
|
||||
if [[ $database_migrations != "" ]]; then
|
||||
log_bright "[INFO] Placing database migrations.."
|
||||
cp -R ".blueprint/tmp/$n/$database_migrations/"* "database/migrations/" 2> /dev/null
|
||||
|
|
|
@ -8,7 +8,7 @@ source $BLUEPRINT__FOLDER/.blueprint/lib/bash_colors.sh
|
|||
function throwError {
|
||||
if [[ $1 == "cdMissingDirectory" ]]; then err="Tried to navigate to a directory that does not exist, halting process.";fi
|
||||
if [[ $1 == "confymlNotFound" ]]; then err="Could not find a conf.yml file.";fi
|
||||
if [[ $1 == "confymlMissingFiles" ]]; then err="Some paths in the extension's conf.yml point to nonexistent files.";fi
|
||||
if [[ $1 == "confymlMissingFiles" ]]; then err="A conf.yml value is pointing to a file that does not exist.";fi
|
||||
if [[ $1 == "scriptsMissingFiles" ]]; then err="Could not find install/remove/export script even though it's enabled.";fi
|
||||
if [[ $1 == "scriptsNoPrivateDir" ]]; then err="Could not run extension's install/remove/export script as the extension does not have a data directory.";fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue