forked from ctweney/calcentral
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d
executable file
·44 lines (40 loc) · 1.46 KB
/
d
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
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage : $0 command"
echo "Commands:"
echo "rc - Rails Console"
echo "rdbm - Migrate Database"
echo "restore-db - Restore db from db/current.sql.zip"
echo "restart - Restart rails app after bundling gems"
echo "rebuild - Rebuild the docker container with latest Gemfile and restart"
echo 'cmd "bundle exec something" - Run the command in quotes in /app'
exit
fi
if [ -z $RAILS_ENV ]
then
echo "Using default RAILS_ENV value of 'development'"
RAILS_ENV="development"
fi
case "$1" in
rc) echo "Starting Console in Docker Container, RAILS_ENV = $RAILS_ENV"
vagrant ssh -c "sh /app/docker/scripts/rc.sh $RAILS_ENV"
;;
rdbm) echo "Running rake db:migrate in Docker container, RAILS_ENV = $RAILS_ENV"
vagrant ssh -c "sh /app/docker/scripts/rdbm.sh $RAILS_ENV"
;;
restart) echo "Restarting Docker Rails Container, RAILS_ENV = $RAILS_ENV"
vagrant ssh -c "sh /app/docker/scripts/restart.sh $RAILS_ENV"
;;
rebuild) echo "Rebuilding Docker Rails Container, RAILS_ENV = $RAILS_ENV"
vagrant ssh -c "sh /app/docker/scripts/rebuild.sh $RAILS_ENV"
;;
logs) echo "Tailing logs, RAILS_ENV = $RAILS_ENV"
vagrant ssh -c "sh /app/docker/scripts/logs.sh $RAILS_ENV"
;;
cmd) echo "running '$2' in docker container in /app, RAILS_ENV = $RAILS_ENV"
vagrant ssh -c "/app/docker/scripts/cmd.sh $RAILS_ENV '$2'"
;;
*) echo "Command not known"
;;
esac