From 73aa6e838658a6f38c9de2f01990295576b69ad5 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 20 Jun 2011 00:37:12 +0200 Subject: cobra: initial README --- cobra/README | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cobra/README (limited to 'cobra') diff --git a/cobra/README b/cobra/README new file mode 100644 index 00000000..145ecd14 --- /dev/null +++ b/cobra/README @@ -0,0 +1,33 @@ + +# usage +cobra [target...] + +# description +cobra tries to satisfies all specified targets and all of it dependencies. + +# targets +targets can be a lot of different things, e.g. directories + +## dirctory targets +try to do the right thing when the cobra search path contains a directory +that contains an index.{js,sh,py,etc.} file. + +## cobra search path +like your sh's PATH + +## example: cobra as some kind of make +$ echo $COBRA_PATH +. +$ ls . +foo/ bar/ baz/ +$ cat foo/cobra.json +{ "deps": "bar", "baz" } +$ cat bar/cobra.json +No such file or directory +$ cat baz/cobra.json +No such file or directory +$ cobra foo +[cobra bar] +[cobra baz] +[cobra foo] +$ exit -- cgit v1.2.3 From fe0739a39d3f5f34efcde6d4611d399dba6b94b5 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 20 Jun 2011 00:49:35 +0200 Subject: cobra: initial index.sh --- cobra/hello/index.sh | 1 + cobra/index.sh | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cobra/hello/index.sh create mode 100755 cobra/index.sh (limited to 'cobra') diff --git a/cobra/hello/index.sh b/cobra/hello/index.sh new file mode 100644 index 00000000..df2dea7c --- /dev/null +++ b/cobra/hello/index.sh @@ -0,0 +1 @@ +echo 'Hello, world!' diff --git a/cobra/index.sh b/cobra/index.sh new file mode 100755 index 00000000..e3c5a1ea --- /dev/null +++ b/cobra/index.sh @@ -0,0 +1,20 @@ +#! /bin/sh +set -euf +trap "echo 'You are made of stupid!' >&2; exit 23" EXIT +disarm() { + trap - EXIT +} + +COBRA_PATH="${COBRA_PATH-$PWD}" + +## main +for target; do + for path in $COBRA_PATH; do + if test -d "$path/$target"; then + if index="$path/$target/index.sh" && test -f "$index"; then + exec /bin/sh "$index" + disarm + fi + fi + done +done -- cgit v1.2.3 From 8ea20189b14abf6a2ba8fab572fb6f411270dd0c Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 20 Jun 2011 00:52:46 +0200 Subject: cobra needs no disarm --- cobra/index.sh | 4 ---- 1 file changed, 4 deletions(-) (limited to 'cobra') diff --git a/cobra/index.sh b/cobra/index.sh index e3c5a1ea..1118a823 100755 --- a/cobra/index.sh +++ b/cobra/index.sh @@ -1,9 +1,6 @@ #! /bin/sh set -euf trap "echo 'You are made of stupid!' >&2; exit 23" EXIT -disarm() { - trap - EXIT -} COBRA_PATH="${COBRA_PATH-$PWD}" @@ -13,7 +10,6 @@ for target; do if test -d "$path/$target"; then if index="$path/$target/index.sh" && test -f "$index"; then exec /bin/sh "$index" - disarm fi fi done -- cgit v1.2.3