forked from flosell/iamspec
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgo
executable file
·53 lines (42 loc) · 998 Bytes
/
go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
SCRIPT_DIR=$(cd $(dirname $0) ; pwd -P)
tf() {
pushd "${SCRIPT_DIR}/example_infra" > /dev/null
terraform $1
popd > /dev/null
}
goal_test() {
pushd "${SCRIPT_DIR}" > /dev/null
bundle exec rake spec
popd > /dev/null
}
goal_test-unit() {
pushd "${SCRIPT_DIR}" > /dev/null
bundle exec rspec --exclude-pattern spec/integration_spec.rb
popd > /dev/null
}
goal_example-infra-plan() {
tf "plan"
}
goal_example-infra-apply() {
tf "apply"
}
goal_setup() {
pushd "${SCRIPT_DIR}" > /dev/null
bundle install
popd > /dev/null
}
if type -t "goal_$1" &>/dev/null; then
goal_$1 ${@:2}
else
echo "usage: $0 <goal>
goal:
setup -- install all dependencies, make repo ready for development
test -- run all tests
test-unit -- run only unit tests
example-infra-plan -- terraform plan on example infra
example-infra-apply -- terraform apply on example infra
"
exit 1
fi