Created
January 22, 2015 16:06
-
-
Save EdHurtig/ff35c06e6800ef7b040b to your computer and use it in GitHub Desktop.
Alters the `kitchen` command to easily provide a kitchen configuration to kitchen.
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
# Usage | |
# kitchen cloud test # Will run 'kitchen test' with 'KITCHEN_YAML=.kitchen.cloud.yml' | |
# kitchen local test # Will run 'kitchen test' with 'KITCHEN_YAML=.kitchen.local.yml' | |
# kitchen test # Will run 'kitchen test' without a KITCHEN_YAML specified | |
kitchen() { | |
if [[ 'cloud,local,dev,prod,stage' == *$1* ]]; then | |
echo "Starting kitchen with configuration file '.kitchen.$1.yml'" | |
if [[ -f ".kitchen.$1.yml" ]]; then | |
command export KITCHEN_YAML=.kitchen.cloud.yml | |
shift 1 | |
command kitchen "$@" | |
else | |
echo "Could not find Configuration file '.kitchen.$1.yml', quitting" | |
fi | |
else | |
echo "Starting kitchen without an override 'KITCHEN_YAML'" | |
command unset KITCHEN_YAML | |
command kitchen "$@" | |
fi | |
} |
Also, line 10 should probably be:
command export KITCHEN_YAML=".kitchen.${1}.yaml"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should be pointed out that if a
.kitchen.local.yml
is present, it will automatically override as the config, unless you’ve specified theKITCHEN_YAML
var. So you might not need it here… food for thought.