diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-20 18:09:50 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-20 20:23:30 +0200 |
commit | 11cf17750885324a58a68d237b0ac29bc3a6269b (patch) | |
tree | 474da312f12a82629b495b5901c10ea49b08e98c /lib | |
parent | d2e3a3795f345fd78ead2cf06b1134b46f9d4bc4 (diff) | |
download | app.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.tar.gz app.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.tar.bz2 app.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.tar.xz app.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.zip |
o Making all app-conf options except import use <-l location>.
o Setting $HOME to the temporary area when testing.
o Adding test docs for app-conf.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/common | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -159,6 +159,53 @@ find_versions() { ) } +validate_location() { + local name=$1; shift + + case "${!name}" in + s|system) + eval ${name}=1 + ;; + u|user) + eval ${name}=2 + ;; + a|app) + eval ${name}=3 + ;; + *) + fatal "Invalid location: ${!name}, must be one of 's', 'system', 'u', 'user', 'a' or 'app'." + ;; + esac +} + +location_to_file() { + case "${!1}" in + s|system|1) + _get_config_file_system $1 + ;; + u|user|2) + _get_config_file_user $1 + ;; + a|app|3) + _get_config_file_app $1 + ;; + *) + fatal "Invalid location: ${!1}, must be one of 's', 'system', 'u', 'user', 'a' or 'app'." + esac +} + +_get_config_file_system() { + eval $1="${APPSH_DEFAULT_CONFIG-$APPSH_HOME/lib/default-config}" +} + +_get_config_file_user() { + eval $1="$HOME/.appconfig" +} + +_get_config_file_app() { + eval $1=".app/config" +} + grep_path() { local regex="$1"; shift local path="$1"; shift |