Skip to content

Commit 925835c

Browse files
committed
Release v1.3.0
2 parents 63d613b + 8260a2c commit 925835c

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2019 Maarten de Boer, Cloudstek
1+
Copyright 2019-2020 Maarten de Boer, Cloudstek
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,15 @@ Vagrant doesn't have a `down`, `restart`, `start` or `stop` commands natively bu
4848
## Updating
4949

5050
1. Go to the directory where you cloned the plugin repository
51-
2. Run `git pull origin master`
51+
2. Run `git pull origin master`
52+
53+
## Configuration options
54+
55+
AppUp has a few configuration options to customise its behaviour. Please make sure you define these in `~/.zshrc` *before* you load any plugins.
56+
57+
| Name | Values | Default | Description |
58+
| -------------------- | ---------- | ------- | ------------------------------------------------------------ |
59+
| APPUP_CHECK_STARTED | true/false | true | Enable/disable checking if docker is running completely. |
60+
| APPUP_DOCKER_MACHINE | true/false | true | If both docker (e.g. Docker Desktop) and docker-machine are installed, check if docker-machine (when `true`) or docker (when `false`) is running. |
61+
| | | | |
62+

appup.plugin.zsh

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
11
# Docker
22
_appup_docker () {
33
if hash docker-compose >/dev/null 2>&1; then
4-
# Check if docker-machine has been started
5-
if hash docker-machine >/dev/null 2>&1; then
6-
if docker-machine status | grep -qi "Stopped"; then
7-
read -q "REPLY?Docker Machine is not running, would you like to start it? [y/n] "
4+
# Check if docker has been started
5+
if [ "${APPUP_CHECK_STARTED:-true}" = true ]; then
6+
if hash docker-machine >/dev/null 2>&1 && [ "${APPUP_DOCKER_MACHINE:-true}" = true ]; then
7+
if docker-machine status | grep -qi "Stopped"; then
8+
read -r -k 1 "REPLY?Docker Machine is not running, would you like to start it? [y/N] "
9+
echo ""
10+
11+
if [[ "$REPLY" == "y" ]]; then
12+
docker-machine start default && eval $(docker-machine env default)
13+
echo ""
14+
else
15+
return 0
16+
fi
17+
fi
18+
elif docker ps 2>&1 | grep -qi "Is the docker daemon running?"; then
19+
read -r -k 1 "REPLY?Docker for Mac is not running, would you like to start it? [y/N] "
820
echo ""
921

1022
if [[ "$REPLY" == "y" ]]; then
11-
docker-machine start default && eval $(docker-machine env default)
23+
open -a Docker
24+
1225
echo ""
26+
echo "Waiting for docker to start.."
27+
echo ""
28+
29+
# Wait for it to start
30+
while true; do
31+
if docker ps 2>&1 | grep -qi "Is the docker daemon running?" || docker ps 2>&1 | grep -qi "connection refused"; then
32+
sleep 5
33+
else
34+
break
35+
fi
36+
done
1337
else
14-
return
38+
return0
1539
fi
1640
fi
1741
fi
@@ -65,6 +89,7 @@ _appup_vagrant () {
6589
fi
6690
}
6791

92+
# Commands
6893
up () {
6994
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
7095
_appup_docker up "$@"

tests/_support/bin/docker-machine

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env zsh
2+
3+
if [ "$1" = "status" ]; then
4+
echo ${DM_STARTED:-Started}
5+
return 0
6+
fi
7+
8+
echo docker-machine "$@"

0 commit comments

Comments
 (0)