Skip to content

Commit

Permalink
Merge pull request #479 from JrGoodle/optional-defaults
Browse files Browse the repository at this point in the history
Make ref and remote defaults optional
  • Loading branch information
JrGoodle committed May 13, 2020
2 parents 63be79f + 02292c1 commit fd9716d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/clowder/clowder.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@
"description": "Default values inherited by projects and sources",
"type": "object",
"required": [
"ref",
"remote",
"source",
"protocol"
],
Expand Down
4 changes: 2 additions & 2 deletions src/clowder/model/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def __init__(self, defaults: dict):
:param dict defaults: Parsed YAML python object for defaults
"""

self.ref = defaults["ref"]
self.protocol = defaults["protocol"]
self.remote = defaults["remote"]
self.source = defaults["source"]
self.ref = defaults.get("ref", "refs/heads/master")
self.remote = defaults.get("remote", "origin")
self.depth = defaults.get("depth", 0)
self.recursive = defaults.get("recursive", False)
self.timestamp_author = defaults.get("timestamp_author", None)
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/cats/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test_help() {
popd || exit 1

echo "TEST: Print help with invalid clowder.yaml"
$COMMAND link -v 'test-missing-default-ref' || exit 1
$COMMAND link -v 'test-empty-project' || exit 1
_test_help

print_double_separator
Expand Down
30 changes: 29 additions & 1 deletion test/scripts/cats/herd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test_herd_missing_clowder

test_herd_implicit_project_paths() {
print_single_separator
echo "TEST: Check projects are on correct branches"
echo "TEST: Check projects are on correct branches with implicit project paths"
$COMMAND link -v implicit-paths || exit 1
$COMMAND herd $PARALLEL || exit 1
pushd jrgoodle/mu || exit 1
Expand All @@ -77,6 +77,34 @@ test_herd_implicit_project_paths
./clean.sh
./init.sh || exit 1

test_herd_implicit_defaults() {
print_single_separator
echo "TEST: Check projects are on correct branches with implicit defaults"
$COMMAND link -v implicit-defaults || exit 1
$COMMAND herd $PARALLEL || exit 1
echo "TEST: cats projects on default branches with implicit defaults"
for project in "${black_cats_projects[@]}"; do
pushd $project || exit 1
test_branch master
name=${project#"black-cats/"}
test_remote_url 'origin' "https://github.com/jrgoodle/$name.git"
popd || exit 1
done
pushd mu || exit 1
test_branch knead
test_remote_url 'origin' "https://github.com/jrgoodle/mu.git"
popd || exit 1
pushd duke || exit 1
test_branch purr
test_remote_url 'origin' "https://github.com/jrgoodle/duke.git"
popd || exit 1

}
test_herd_implicit_defaults

./clean.sh
./init.sh || exit 1

test_herd() {
print_single_separator
echo "TEST: Check projects are on correct branches"
Expand Down

0 comments on commit fd9716d

Please sign in to comment.