-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathphanbook
executable file
·78 lines (69 loc) · 2.05 KB
/
phanbook
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
#!/usr/bin/env bash
#
# Executes setup.rb using the Ruby bundled with Vagrant.
#
# These paths assume Vagrant was installed from the vendor-supplied packages
# if [ "$(uname)" == "Darwin" ]; then
# ruby=/Applications/Vagrant/embedded/bin/ruby
# else
# ruby=/opt/vagrant/embedded/bin/ruby
# fi
getThemeBlog() {
cd content/themes
if [ ! -d "blog" ]; then
git clone --depth=1 https://github.com/phanbook/blog.git
fi
}
#Setup some dependency
#rm -rf opsfiles
if [ ! -d "opsfiles" ]; then
git clone --depth=1 git@github.com:phanbook/opsfiles.git
fi
if [ "up" == "$1" ]; then
if ! which vagrant > /dev/null; then
echo "Vagrant doesn't seem to be installed. Please download and install it"
echo "from http://www.vagrantup.com/downloads.html and re-run setup.sh."
exit 1
fi
(cd opsfiles && vagrant up)
fi
if [ "provision" == "$1" ]; then
cd opsfiles && vagrant provision
fi
if [ "ssh" == "$1" ]; then
cd opsfiles && vagrant ssh
fi
if [ "halt" == "$1" ]; then
cd opsfiles && vagrant halt
fi
if [ "destroy" == "$1" ]; then
cd opsfiles && vagrant destroy
fi
if [ "blog" == "$2" ]; then
getThemeBlog
fi
#Docker setup
if [ "docker" == "$1" ]; then
if ! which docker > /dev/null; then
echo "Docker doesn't seem to be installed. Please download and install it"
echo "from https://docs.docker.com/engine/installation/ and re-run phanbook."
exit 3
fi
if [[ "destroy" == "$2" ]]; then
# Stop and remove any existing containers
docker rm -f $(docker ps -a -q)
# Delete all images
docker rmi -f $(docker images -q)
fi
if ! which docker-compose > /dev/null; then
curl -L https://github.com/docker/compose/releases/download/1.3.3/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sudo service docker start
fi
cp opsfiles/docker/docker-compose.yml .
docker-compose up -d
fi
#Fix PSR2
if [ 'psr2' == "$1" ]; then
php phpcbf.phar --standard=PSR2 $2
fi