feat libraries
: Make new "misc" library that is a collection of all tiny functions of other libraries.
This commit is contained in:
parent
5542b24e74
commit
084ebeca80
4 changed files with 23 additions and 55 deletions
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# This script has been created as part of the Blueprint source code
|
|
||||||
# and uses the same license as the rest of the codebase.
|
|
||||||
|
|
||||||
FLDR=".blueprint/extensions/blueprint/private/db/database"
|
|
||||||
|
|
||||||
# dbAdd "database.record"
|
|
||||||
dbAdd() { echo "* ${1};" >> $FLDR; }
|
|
||||||
|
|
||||||
# dbValidate "database.record"
|
|
||||||
dbValidate() { grep -Fxq "* ${1};" $FLDR > /dev/null; }
|
|
||||||
|
|
||||||
# dbRemove "database.record"
|
|
||||||
dbRemove() { sed -i "s/* ${1};//g" $FLDR > /dev/null; }
|
|
|
@ -3,6 +3,28 @@
|
||||||
# This script has been created as part of the Blueprint source code
|
# This script has been created as part of the Blueprint source code
|
||||||
# and uses the same license as the rest of the codebase.
|
# and uses the same license as the rest of the codebase.
|
||||||
|
|
||||||
|
|
||||||
|
# === DATABASE ===
|
||||||
|
FLDR=".blueprint/extensions/blueprint/private/db/database"
|
||||||
|
# dbAdd "database.record"
|
||||||
|
dbAdd() { echo "* ${1};" >> $FLDR; }
|
||||||
|
# dbValidate "database.record"
|
||||||
|
dbValidate() { grep -Fxq "* ${1};" $FLDR > /dev/null; }
|
||||||
|
# dbRemove "database.record"
|
||||||
|
dbRemove() { sed -i "s/* ${1};//g" $FLDR > /dev/null; }
|
||||||
|
|
||||||
|
|
||||||
|
# === TELEMETRY ===
|
||||||
|
sendTelemetry() {
|
||||||
|
cd "${BLUEPRINT__FOLDER}" || exit
|
||||||
|
key=$(cat .blueprint/extensions/blueprint/private/db/telemetry_id)
|
||||||
|
if [[ $key == "KEY_NOT_UPDATED" ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
curl --location --silent "http://api.blueprint.zip:50000/send/$key/$1" > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# === CACHEREMINDER ===
|
||||||
updateCacheReminder() {
|
updateCacheReminder() {
|
||||||
cd "${BLUEPRINT__FOLDER}" || exit
|
cd "${BLUEPRINT__FOLDER}" || exit
|
||||||
# Overwrite previous adminCacheReminderHider with the default one.
|
# Overwrite previous adminCacheReminderHider with the default one.
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# This script has been created as part of the Blueprint source code
|
|
||||||
# and uses the same license as the rest of the codebase.
|
|
||||||
|
|
||||||
sendTelemetry() {
|
|
||||||
cd "${BLUEPRINT__FOLDER}" || exit
|
|
||||||
key=$(cat .blueprint/extensions/blueprint/private/db/telemetry_id)
|
|
||||||
if [[ $key == "KEY_NOT_UPDATED" ]]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
curl --location --silent "http://api.blueprint.zip:50000/send/$key/$1" > /dev/null
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# This script has been created as part of the Blueprint source code
|
|
||||||
# and uses the same license as the rest of the codebase.
|
|
||||||
|
|
||||||
source "${BLUEPRINT__FOLDER}/.blueprint/lib/bash_colors.sh"
|
|
||||||
source "${BLUEPRINT__FOLDER}/.blueprint/lib/logFormat.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="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 == "scriptsNoDataDir" ]]; then err="Could not run extension's install/remove/export script as the extension does not have a data directory.";fi
|
|
||||||
|
|
||||||
if [[ $err == "" ]]; then err="$1"; fi
|
|
||||||
PRINT FATAL "$err"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function throwByte {
|
|
||||||
# [ ^^] ello
|
|
||||||
if [[ $err == "" ]]; then err="$1"; fi
|
|
||||||
log_blue "[ " log_white "^^" log_blue "] $err"
|
|
||||||
return 1
|
|
||||||
}
|
|
Loading…
Reference in a new issue