diff --git a/blueprint.sh b/blueprint.sh index 2f64cc6..536480c 100644 --- a/blueprint.sh +++ b/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 diff --git a/blueprint/lib/throwError.sh b/blueprint/lib/throwError.sh index cb87709..cb9ef53 100644 --- a/blueprint/lib/throwError.sh +++ b/blueprint/lib/throwError.sh @@ -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