forked from cpriego/valet-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
develop
executable file
·110 lines (88 loc) · 3.31 KB
/
develop
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
VAGRANT_FOLDER="./tests/Acceptance/Vagrant"
if [ $# -gt 0 ]; then
# Spin up given development environment
if [ "$1" == "up" ]; then
cd "$VAGRANT_FOLDER/$2" && \
shift 2 && \
VALET_ENVIRONMENT=development vagrant up "$@"
# SSH into the given development environment
elif [ "$1" == "ssh" ]; then
cd "$VAGRANT_FOLDER/$2" && \
shift 2 && \
vagrant ssh "$@"
# Switch off given development environment
elif [ "$1" == "down" ]; then
cd "$VAGRANT_FOLDER/$2" && \
shift 2 && \
vagrant halt "$@"
# Destroy given development environment
elif [[ "$1" == "destroy" ]]; then
cd "$VAGRANT_FOLDER/$2" && \
shift 2 && \
vagrant destroy "$@"
# Destroy all development environments
elif [[ "$1" == "destroy-all" ]]; then
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
./develop destroy ${DIRECTORY##*/} -f
fi
done
# Run Acceptance tests against given environment
elif [ "$1" == "test" ]; then
./develop up $2 && \
./develop ssh $2 --command "bash ~/cpriego-valet-linux/tests/Acceptance/vagrant.sh"
# Run Acceptance tests against ALL environments
elif [ "$1" == "test-all" ]; then
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
echo -e "\033[44m ${DIRECTORY##*/} \033[0m"
./develop test ${DIRECTORY##*/} && \
./develop down ${DIRECTORY##*/}
fi
done
# Run Acceptance tests against ALL environments in parallel
elif [ "$1" == "test-all-parallel" ]; then
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
gnome-terminal --tab \
--command="bash -c \"./develop test ${DIRECTORY##*/} && ./develop down ${DIRECTORY##*/}; read\""
fi
done
fi
else
# Display usage
echo -e "Usage: ./develop [action] [arguments]\n"
echo -e "Available actions:"
# ./develop up {OS_NAME}
echo -e "\tup {OS_NAME}"
echo -e "\t\tSpin up a development environment using vagrant and SSH into it."
echo -e -n "\t\tAvailable OSes: "
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
echo -e -n "${DIRECTORY##*/} "
fi
done
echo
# ./develop ssh {OS_NAME}
echo -e "\tssh {OS_NAME}"
echo -e "\t\tSSH into the given development environment."
# ./develop down {OS_NAME}
echo -e "\tdown {OS_NAME}"
echo -e "\t\tSwitch off given development environment. This does NOT destroy the box."
# ./develop destroy {OS_NAME}
echo -e "\tdestroy {OS_NAME}"
echo -e "\t\tDestroy given development environment."
# ./develop destroy-all
echo -e "\tdestroy-all"
echo -e "\t\tDestroy all development environments."
# ./develop test {OS_NAME}
echo -e "\ttest {OS_NAME}"
echo -e "\t\tRun Acceptance tests against a given OS."
# ./develop test-all
echo -e "\ttest-all"
echo -e "\t\tRun Acceptance tests against ALL OSes."
# ./develop test-all-parallel
echo -e "\ttest-all-parallel"
echo -e "\t\tRun Acceptance tests against ALL OSes in parellel. Requires gnome-terminal."
fi