-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocko
More file actions
executable file
·79 lines (65 loc) · 1.94 KB
/
Copy pathdocko
File metadata and controls
executable file
·79 lines (65 loc) · 1.94 KB
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
#!/bin/bash
#
# A script to make working with docker/compose to have
# less typing.
#
# For local development only.
#
# this file can be sourced, so you don't have to do ./ before running every command
# > . ./docko
# then
# rundocko db-setup
config=docker-compose.dev.yml
function docko-dev {
docker-compose -f $config $*
}
function docko-test {
docker-compose -f docker-compose.ci.yml $*
}
function docko-test-run {
docko-test run --rm --service-ports web $*
}
function rundocko {
# First arg
given_command=$1
# The rest of the args
arguments=${@:2}
case $given_command in
# Docker-Compose Management
build) docko-dev build $arguments;;
down) docko-dev down --remove-orphans;;
ps) docko-dev ps;;
stop) docko-dev stop $arguments;;
up) docko-dev up;;
up:build) docko-dev up --build;;
# Running the App / Consoles
run) docko-dev run --rm web $arguments;;
bundle) docko-dev run --rm web bundle $arguments;;
rake) docko-dev run --rm web rake $arguments;;
bash) docko-dev run --rm web bash;;
dev) docko-dev run --rm --service-ports web $arguments;;
c) docko-dev run --rm web rails console;;
# Local Database Management
db-setup) docko-dev run --rm web rake db:create db:schema:load;;
db-reset) docko-dev run --rm web rake db:drop db:create db:schema:load;;
db-import) ./scripts/deployment/local-dev/import-db-backup.sh;;
# Testing
test) docko-test-run $arguments;;
test-prepare) docko-test-run rake db:schema:load;;
rspec)
rspec_params=$arguments
if [[ -z "$rspec_params" ]]; then
# because specs are co-located, we need to tell rpsec
# where to look
rspec_params="spec/ app/"
fi
echo "running: rspec $rspec_params"
docko-test-run bundle exec rspec $rspec_params
;;
*) echo 'command not recognized';;
esac
}
# Also allow non-sourced running
if [ $1 ]; then
rundocko $*
fi