summaryrefslogtreecommitdiff
path: root/yarns/implementations.yarn
diff options
context:
space:
mode:
Diffstat (limited to 'yarns/implementations.yarn')
-rw-r--r--yarns/implementations.yarn120
1 files changed, 54 insertions, 66 deletions
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 1350662d..6491b38e 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -20,11 +20,10 @@ We run `morph init` in two different ways: either the simple way,
letting yarn catch errors, or in a way that catches the error so
we can test it later in a THEN step.
- IMPLEMENTS WHEN morph initialises a workspace
- run_morph init "$DATADIR/workspace"
-
- IMPLEMENTS WHEN morph attempts to initialise a workspace
- attempt_morph init "$DATADIR/workspace"
+ IMPLEMENTS WHEN the user (attempts to initialise|initialises) a workspace
+ set init "$DATADIR/workspace"
+ if [ $MATCH_1 == "initialises" ]; then run_morph "$@"
+ else attempt_morph "$@"; fi
IMPLEMENTS THEN morph failed
case $(cat "$DATADIR/morph-exit") in
@@ -158,19 +157,15 @@ Implementation sections for system branch operations
Checkout out an existing system branch. We parameterise this so the
same phrase can be used to check out any system branch.
- IMPLEMENTS WHEN checking out the (\S+) system (branch|tag)
- cd "$DATADIR/workspace"
- run_morph checkout test:morphs "$MATCH_1"
-
-Attempt to check out a system branch, and remember if it failed.
-
- IMPLEMENTS WHEN morph attempts to check out system branch (\S+)
+ IMPLEMENTS WHEN the user (attempts to check|checks) out the system (branch|tag) called (\S+)
cd "$DATADIR/workspace"
- attempt_morph checkout test:morphs "$MATCH_1"
+ set checkout test:morphs "$MATCH_3"
+ if [ $MATCH_1 == "checks" ]; then run_morph "$@"
+ else attempt_morph "$@"; fi
Attempt to check out a system branch from a root that has no systems.
- IMPLEMENTS WHEN morph attempts to check out a repository with no systems
+ IMPLEMENTS WHEN the user attempts to check out from a repository with no systems
cd "$DATADIR/workspace"
attempt_morph checkout test:test-chunk master
@@ -183,109 +178,97 @@ We also need to verify that a system branch has been checked out.
We can create a new branch, off master.
- IMPLEMENTS WHEN user creates system branch (\S+)
+ IMPLEMENTS WHEN the user (attempts to create|creates) a system branch called (\S+)
cd "$DATADIR/workspace"
- run_morph branch test:morphs "$MATCH_1"
-
- IMPLEMENTS WHEN user attempts to create system branch (\S+)
- cd "$DATADIR/workspace"
- attempt_morph branch test:morphs "$MATCH_1"
+ set branch test:morphs "$MATCH_2"
+ if [ $MATCH_1 == "creates"]; then run morph "$@"
+ else attempt_morph "$@"; fi
We can create a new branch, off another system branch.
- IMPLEMENTS WHEN creating system branch (\S+), based on (\S+)
+ IMPLEMENTS WHEN the user creates a system branch called (\S+), based on (\S+)
cd "$DATADIR/workspace"
run_morph branch test:morphs "$MATCH_1" "$MATCH_2"
Attempt to branch a system branch from a root that had no systems.
- IMPLEMENTS WHEN morph attempts to branch a repository with no systems
+ IMPLEMENTS WHEN the user attempts to branch a repository with no systems
cd "$DATADIR/workspace"
attempt_morph branch test:test-chunk foo
Pushing all changes in a system branch checkout to the git server.
- IMPLEMENTS WHEN pushing system branch (\S+) to git server
+ IMPLEMENTS WHEN the user pushes the system branch called (\S+) to the git server
# FIXME: For now, this is just the morphs checkout.
run_in "$DATADIR/workspace/$MATCH_1/test:morphs" git push origin HEAD
Report workspace path.
- IMPLEMENTS WHEN morph reports workspace in (\S+)
+ IMPLEMENTS WHEN the user reports the workspace from the directory (\S+)
cd "$DATADIR/workspace/$MATCH_1"
run_morph workspace > "$DATADIR/workspace-reported"
- IMPLEMENTS THEN workspace is reported correctly
+ IMPLEMENTS THEN the workspace is reported correctly
assert_equal $(cat "$DATADIR/workspace-reported") "$DATADIR/workspace"
- IMPLEMENTS WHEN morph attempts to report workspace
+ IMPLEMENTS WHEN the user attempts to report the workspace from a non-workspace directory
cd "$DATADIR"
attempt_morph workspace
Report system branch name:
- IMPLEMENTS WHEN reporting system branch in (\S+)
- cd "$DATADIR/workspace/$MATCH_1"
- run_morph show-system-branch > "$DATADIR/system-branch.reported"
+ IMPLEMENTS WHEN the user (attempts to report|reports) the system branch from the directory (\S+)
+ cd "$DATADIR/workspace/$MATCH_2"
+ set $DATADIR/system-branch.reported
+ if [ $MATCH_1 == reports ]; then run_morph show-system-branch > "$@"
+ else attempt_morph show-system-branch > "$@"; fi
- IMPLEMENTS THEN system branch is reported as (.*)
+ IMPLEMENTS THEN the system branch is reported as (.*)
echo "$MATCH_1" > "$DATADIR/system-branch.actual"
diff -u "$DATADIR/system-branch.actual" "$DATADIR/system-branch.reported"
- IMPLEMENTS WHEN attempting to report system branch in (.*)
- cd "$DATADIR/workspace/$MATCH_1"
- attempt_morph show-system-branch
-
Report system branch root repository.
- IMPLEMENTS WHEN reporting system branch root repository in (.*)
- cd "$DATADIR/workspace/$MATCH_1"
- run_morph show-branch-root > "$DATADIR/branch-root.reported"
+ IMPLEMENTS WHEN the user (attempts to report|reports) the system branch root repository from the directory (.*)
+ cd "$DATADIR/workspace/$MATCH_2"
+ set $DATADIR/branch-root.reported
+ if [ $MATCH_1 == "reports" ]; then run_morph show-branch-root > "$@"
+ else attempt_morph show-branch-root > "$@"; fi
- IMPLEMENTS THEN root repository is reported as (.*)
+ IMPLEMENTS THEN the system branch root repository is reported as (.*)
echo "$MATCH_1" > "$DATADIR/branch-root.actual"
diff -u "$DATADIR/branch-root.actual" "$DATADIR/branch-root.reported"
- IMPLEMENTS WHEN attempting to report system branch root repository in (.*)
- cd "$DATADIR/workspace/$MATCH_1"
- attempt_morph show-branch-root
-
Editing morphologies with `morph edit`.
- IMPLEMENTS THEN in branch (\S+), system (\S+) refs (\S+) in (\S+)
- "$SRCDIR/scripts/yaml-extract" \
- "$DATADIR/workspace/$MATCH_1/test:morphs/$MATCH_2.morph" \
- strata name="$MATCH_3" ref > "$DATADIR/ref.actual"
- echo "$MATCH_4" > "$DATADIR/ref.wanted"
- diff -u "$DATADIR/ref.wanted" "$DATADIR/ref.actual"
-
- IMPLEMENTS THEN in branch (\S+), stratum (\S+) refs (\S+) in (\S+)
+ IMPLEMENTS THEN in branch (\S+), (system|stratum) (\S+) refs (\S+) in (\S+)
+ if [ $MATCH_2 == system ]; then set strata; else set chunks; fi
"$SRCDIR/scripts/yaml-extract" \
- "$DATADIR/workspace/$MATCH_1/test:morphs/$MATCH_2.morph" \
- chunks name="$MATCH_3" ref > "$DATADIR/ref.actual"
- echo "$MATCH_4" > "$DATADIR/ref.wanted"
+ "$DATADIR/workspace/$MATCH_1/test:morphs/$MATCH_3.morph" \
+ $@ name="$MATCH_4" ref > "$DATADIR/ref.actual"
+ echo "$MATCH_5" > "$DATADIR/ref.wanted"
diff -u "$DATADIR/ref.wanted" "$DATADIR/ref.actual"
- IMPLEMENTS WHEN editing stratum (\S+) in system (\S+) in branch (\S+)
+ IMPLEMENTS WHEN the user edits the stratum (\S+) in the system (\S+) in branch (\S+)
cd "$DATADIR/workspace/$MATCH_3/test:morphs"
run_morph edit "$MATCH_2" "$MATCH_1"
- IMPLEMENTS WHEN editing chunk (\S+) in (\S+) in (\S+) in branch (\S+)
+ IMPLEMENTS WHEN the user edits the chunk (\S+) in the stratum (\S+) in the system (\S+) in branch (\S+)
cd "$DATADIR/workspace/$MATCH_4/test:morphs"
run_morph edit "$MATCH_3" "$MATCH_2" "$MATCH_1"
- IMPLEMENTS THEN edited chunk (\S+) has git branch (\S+)
+ IMPLEMENTS THEN the edited chunk (\S+) has git branch (\S+)
ls -l "$DATADIR/workspace/$MATCH_2"
cd "$DATADIR/workspace/$MATCH_2/$MATCH_1"
git branch | awk '$1 == "*" { print $2 }' > "$DATADIR/git-branch.actual"
echo "$MATCH_2" > "$DATADIR/git-branch.wanted"
diff -u "$DATADIR/git-branch.wanted" "$DATADIR/git-branch.actual"
- IMPLEMENTS WHEN editing chunk (\S+) in stratum (\S+) with no system specified in branch (\S+)
+ IMPLEMENTS WHEN the user edits the chunk (\S+) in the stratum (\S+) with no system specified in branch (\S+)
cd "$DATADIR/workspace/$MATCH_3"
attempt_morph edit "$MATCH_2" "$MATCH_1"
- IMPLEMENTS WHEN creating an uncommitted system morphology called (\S+) for architecture (\S+) in system branch (\S+)
+ IMPLEMENTS WHEN the user creates an uncommitted system morphology called (\S+) for architecture (\S+) in system branch (\S+)
cat << EOF > "$DATADIR/workspace/$MATCH_3/test:morphs/$MATCH_1.morph"
arch: $MATCH_2
configuration-extensions: []
@@ -401,11 +384,12 @@ Petrification and unpetrification:
Tagging.
- IMPLEMENTS WHEN tagging system branch (\S+) as (\S+)
+ IMPLEMENTS WHEN the user tags the system branch called (\S+) as (\S+)
cd "$DATADIR/workspace/$MATCH_1/test:morphs"
+ set tag "$MATCH_2" -- -m "testing morph tagging"
run_morph tag "$MATCH_2" -- -m "testing morph tagging"
- IMPLEMENTS WHEN attempting to tag system branch (\S+) as (\S+)
+ IMPLEMENTS WHEN the user attempts to tag the system branch called (\S+) as (\S+)
cd "$DATADIR/workspace/$MATCH_1/test:morphs"
attempt_morph tag "$MATCH_2" -- -m "testing morph tagging"
@@ -467,16 +451,20 @@ Generating a manifest.
Implementation sections for building
====================================
- IMPLEMENTS WHEN attempting to build the system (\S+) in branch (\S+)
- cd "$DATADIR/workspace/$MATCH_2"
- attempt_morph build "$MATCH_1"
+ IMPLEMENTS WHEN the user (attempts to build|builds) the system (\S+) in branch (\S+)
+ cd "$DATADIR/workspace/$MATCH_3"
+ set build "$MATCH_2"
+ if [ $MATCH_1 == "builds" ]; then run_morph "$@"
+ else attempt_morph "$@"; fi
Implementation sections for deployment
======================================
- IMPLEMENTS WHEN attempting to deploy the (system|cluster) (\S+) in branch (\S+)
- cd "$DATADIR/workspace/$MATCH_3"
- attempt_morph deploy "$MATCH_2"
+ IMPLEMENTS WHEN the user (attempts to deploy|deploys) the (system|cluster) (\S+) in branch (\S+)
+ cd "$DATADIR/workspace/$MATCH_4"
+ set build "$MATCH_3"
+ if [ $MATCH_1 == "deploys" ]; then run_morph "$@"
+ else attempt_morph deploy "$MATCH_3"; fi
Implementations sections for reading error messages
===================================================