Skip to content

Commit

Permalink
Add fresh_after_build callback
Browse files Browse the repository at this point in the history
Closes #80.
  • Loading branch information
twe4ked committed Sep 16, 2013
1 parent 6ad89ca commit 815e990
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/fresh
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,20 @@ To disable this error, add \`FRESH_NO_BIN_CHECK=true\` in your freshrc file."
# remove the old build dir
rm -rf "$FRESH_PATH/build.old"

fresh_after_build

# success!
if [ ! "$1" == "--quiet" ];
then
echo $'Your dot files are now \033[1;32mfresh\033[0m.'
fi
}

# placeholder method that can be overridden in your freshrc
fresh_after_build() {
true
}

_dsl_install_fresh() {
_set_dsl_caller
_parse_fresh_dsl_args "$@"
Expand Down
11 changes: 11 additions & 0 deletions test/fresh_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,17 @@ it_allows_bin_fresh_error_to_be_disabled() {
runFresh
}

it_runs_fresh_after_build() {
echo "fresh_after_build() { echo test after_build; }" >> $FRESH_RCFILE

runFresh

assertFileMatches $SANDBOX_PATH/out.log <<EOF
test after_build
$(echo $'Your dot files are now \033[1;32mfresh\033[0m.')
EOF
}

assert_parse_fresh_dsl_args() {
(
set -e
Expand Down

0 comments on commit 815e990

Please sign in to comment.