From 1e4a96730da70fcfa3b8c153874cbdebad0f9829 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 27 Jan 2013 19:41:28 +0100 Subject: o Starting on a style guide. app-conf: Adding 'import' command. app-cat-conf: Adding support for multiple -f flags. The default files can be switched off. A file named "-" is the same as /dev/stdin. app: Adding a way to enable debugging. app-install-file: Import any configuration delivered with the package. --- test/app-cat-conf.bats | 7 +++++++ test/app-conf.bats | 19 ++++++++++++++++++- test/app-init.bats | 5 ++--- test/data/app-a/app.config | 1 + test/data/app-a/root/etc/app.conf | 1 - 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 test/data/app-a/app.config delete mode 100644 test/data/app-a/root/etc/app.conf (limited to 'test') diff --git a/test/app-cat-conf.bats b/test/app-cat-conf.bats index a95049a..8060cea 100755 --- a/test/app-cat-conf.bats +++ b/test/app-cat-conf.bats @@ -41,6 +41,13 @@ setup_inner() { eq '${#lines[*]}' 1 } +@test "app-cat-conf can use stdin and multiple files" { + x=$(cat $APPSH_HOME/test/data/app-cat-conf/config-3 | \ + $APPSH_HOME/libexec/app-cat-conf -D -f $APPSH_HOME/test/data/app-cat-conf/config-2 -f -) + [[ $x == "foo.bar=wat +foo.wat=bar" ]] +} + @test "uses \$APPSH_DEFAULT_CONFIG" { APPSH_DEFAULT_CONFIG=$APPSH_HOME/test/data/app-cat-conf/config-2 app_libexec app-cat-conf -f /dev/null diff --git a/test/app-conf.bats b/test/app-conf.bats index 08676d2..f85dbab 100755 --- a/test/app-conf.bats +++ b/test/app-conf.bats @@ -4,7 +4,8 @@ load utils setup_inner() { - mkdir .app; touch .app/config + mkdir .app; + echo > .app/config export APPSH_DEFAULT_CONFIG=/dev/null } @@ -116,4 +117,20 @@ setup_inner() { app conf list; echo_lines eq '$status' 0 eq '${lines[0]}' "foo.bar awesome " + eq '${#lines[*]}' 1 +} + +@test "./app conf import" { + echo "foo.bar=1" > .app/config + echo "foo.baz=1" > config-b + echo "foo.bar=2" >> config-b + + app conf import config-b; echo_lines + eq '$status' 0 + eq '${#lines[*]}' 0 + + app_libexec app-cat-conf + eq '${lines[0]}' "foo.bar=2" + eq '${lines[1]}' "foo.baz=1" + eq '${#lines[*]}' 2 } diff --git a/test/app-init.bats b/test/app-init.bats index 4e7c281..10edc63 100755 --- a/test/app-init.bats +++ b/test/app-init.bats @@ -37,9 +37,8 @@ load utils match '${lines[2]}' "Downloading org.example:app-a:1.0-.*" eq '${lines[3]}' "Unpacking..." match '${lines[4]}' "Creating current symlink for version 1.0-.*" - eq '${lines[5]}' "Running hook: post-install" - eq '${lines[6]}' "Post install" - eq '${#lines[*]}' 7 + eq '${lines[5]}' "Post install" + eq '${#lines[*]}' 6 is_directory "my-app/.app" } diff --git a/test/data/app-a/app.config b/test/data/app-a/app.config new file mode 100644 index 0000000..d2c3f48 --- /dev/null +++ b/test/data/app-a/app.config @@ -0,0 +1 @@ +app.bin=bin/app-a diff --git a/test/data/app-a/root/etc/app.conf b/test/data/app-a/root/etc/app.conf deleted file mode 100644 index d2c3f48..0000000 --- a/test/data/app-a/root/etc/app.conf +++ /dev/null @@ -1 +0,0 @@ -app.bin=bin/app-a -- cgit v1.2.3