From 2a247c49ddce19961c3dfb8cea495d64deedceaf 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 1a5f2c41d057e05393ddba2974d573472c244451 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 b9eaf07278cb62248b07eaaa20a2394c7d247a6f 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