Created
September 15, 2013 21:58
-
-
Save richardnbanks/6574700 to your computer and use it in GitHub Desktop.
A simple wrapper around cf_sketch to make working with a git based workflow easier. See: https://github.com/cfengine/design-center/issues/340
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get working dir | |
WORKING_DIR="${PWD}" | |
while [[ $WORKING_DIR != / && $WORKING_DIR != "" ]] ; do | |
if [ -e "$WORKING_DIR/.cf-sketch" ] ; then | |
DC_ROOT=$WORKING_DIR | |
break | |
else | |
WORKING_DIR="${WORKING_DIR%/*}" | |
fi | |
done | |
# cf_skech home directory | |
DC_HOME={DESIGN_CENTER_PATH} | |
DC_CMD=$DC_HOME/tools/cf-sketch/cf-sketch.pl | |
# cf_sketch file names | |
DC_VARDATA_FILE=vardata.conf | |
DC_RUNFILE=api-runfile.cf | |
DC_STANDALONE_RUNFILE=api-runfile-standalone.cf | |
# cf_sketch arguments | |
DC_ARGS="--installsource=$DC_HOME/sketches/cfsketches.json" | |
# DC_REPO_CONFIG is not empty then add the arguments | |
if [[ -n "$DC_ROOT" ]] ; then | |
# Get relative path to inputs directory | |
DC_REPO_CONFIG=`cat $DC_ROOT/.cf-sketch` | |
DC_REPO_ROOT=$DC_ROOT/$DC_REPO_CONFIG | |
DC_ARGS="$DC_ARGS --vardata=$DC_REPO_ROOT/$DC_VARDATA_FILE \ | |
--runfile=$DC_REPO_ROOT/$DC_RUNFILE \ | |
--standalonerunfile=$DC_REPO_ROOT/$DC_STANDALONE_RUNFILE \ | |
--repolist=$DC_REPO_ROOT/sketches" | |
fi | |
$DC_CMD $DC_ARGS $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment