File tree Expand file tree Collapse file tree 2 files changed +18
-15
lines changed
Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -44,20 +44,24 @@ Organizing code into libraries is recommended, so we're going to start off with
4444
4545
4646``` sh
47- $ test -d test/lib || mkdir test/lib
48- $ cat > test/lib/mylib.sh
47+ # Create a test folder to hold the bake libraries
48+ test -d test/lib || mkdir -p test/lib
49+
50+ # Create library with a bake task
51+ cat > ' test/lib/mylib.sh' << 'EOF '
4952#!/usr/bin/env bash
5053bake_task mylib:foo "The foo command just echo's its arguments"
5154function mylib:foo () {
5255 echo "foo: args='$@'"
5356}
54- ^D
57+ EOF
5558
56- $ cat > Bakefile
59+ # Create Bakefile to include libraries
60+ cat > ' Bakefile' << 'EOF '
5761#!/usr/bin/env bash
5862bake_push_libdir $(bake_bakefile_dir)/test/lib
5963bake_require mylib
60- ^D
64+ EOF
6165```
6266
6367Then run bake:
@@ -70,7 +74,7 @@ bake task [arg ...]
7074 mylib:foo The foo command just echo' s its arguments
7175
7276
73- $ bake foo this that
77+ $ bake mylib: foo this that
7478foo: args=' this that'
7579```
7680
Original file line number Diff line number Diff line change @@ -440,19 +440,19 @@ function bake_inernal_help () {
440440function bake_sorted_task_list () {
441441 (
442442 for task in " ${! BAKE_TASKS[@]} " ; do
443- if ! bake_is_registered_subtask $task ; then
444- echo $task
443+ if ! bake_is_registered_subtask " $task " ; then
444+ echo " $task "
445445 fi
446446 done ;
447447 for task in " ${! BAKE_SUPERTASKS[@]} " ; do
448- echo $task
448+ echo " $task "
449449 done
450450 ) | sort -u
451451}
452452
453453function bake_sorted_subtask_list () {
454454 for task in " ${! BAKE_SUBTASKS[@]} " ; do
455- echo $task
455+ echo " $task "
456456 done | sort -u
457457}
458458
@@ -540,18 +540,17 @@ function bake_update () {
540540
541541function bake_create_bakefile () {
542542 if [ ! -e " Bakefile" ]; then
543- cat > " Bakefile" << END
543+ cat > " Bakefile" << ' END '
544544#!/usr/bin/env bash
545545
546546# bake_require github.com/kyleburton/bake-recipes/docker/docker.sh
547547
548+ # Set default editor if not defined
549+ export EDITOR="${EDITOR:-vi}"
550+
548551bake_task get-started "Get started by editing this Bakefile"
549552function get-started () {
550- if [ -n "$EDITOR " ]; then
551553 "$EDITOR" Bakefile
552- else
553- vim Bakefile
554- fi
555554}
556555END
557556 fi
You can’t perform that action at this time.
0 commit comments