Sha256: b312f510ed3bbf5df729a4429a59c769f4ac31eeb36a8b016d29948ed565a639
Contents?: true
Size: 1.91 KB
Versions: 21
Compression:
Stored size: 1.91 KB
Contents
#!/usr/bin/env bash # # Pre-commit hook for checking cookbook standards and bumping versions # # set -x # If a Rakefile is found, we assume you know what you're doing... [ -f Rakefile ] && exit 0 set -e function normalize { arg="$1" [ -z "$arg" ] && arg="yes" echo "$arg" | tr '[:upper:]' '[:lower:]' } ROOT="$(git rev-parse --show-toplevel)" NAME="$(basename $ROOT)" cd $ROOT echo "Checking cookbook..." echo find . -name .DS_Store -exec rm {} \; # INF-4970 bundle exec knife cookbook test $NAME -o ".." bundle exec foodcritic . exec < /dev/tty # Enable reading from STDIN in commit hook if [ -f .kitchen.yml ] ; then read -p "Now, you ran test kitchen, right? (yes|no) " plea plea="$(normalize $plea)" while [ "yes" != "$plea" -a "no" != "$plea" ] ; do echo "Hey man, 'yes' or 'no' please." read -p "But really, you ran test kitchen? (yes|no) " plea plea="$(normalize $plea)" done if [ "no" == "$plea" ] ; then echo "Thanks for your honesty. Bailing!" exit 1 fi echo "All right then..." fi if [ -f VERSION ] ; then echo read -p "Should I bump the cookbook version? (yes|no|major|minor) " plea plea="$(normalize $plea)" while [ -n "$plea" -a "yes" != "$plea" -a "no" != "$plea" -a "major" != "$plea" -a "minor" != "$plea" ] ; do echo "I only understand 'yes', 'no', major', and 'minor'" read -p "So should I bump it? (yes|no|major|minor) " plea plea="$(normalize $plea)" done if [ "$plea" == "no" ] ; then echo "No version bump for you, then!" echo "Current version $(cat VERSION)." fi if [ "$plea" == "major" ] ; then echo "Bumping the major version..." bundle exec tony bump major fi if [ "$plea" == "minor" ] ; then echo "Bumping the minor version..." bundle exec tony bump minor fi if [ "$plea" == "yes" ] ; then echo "Bumping the patch version..." bundle exec tony bump fi git add VERSION fi echo echo "Finished."
Version data entries
21 entries across 21 versions & 1 rubygems