Skip to content

Commit f9207b4

Browse files
committed
Update README and add restart command
1 parent 3fe9f36 commit f9207b4

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2018 Maarten de Boer, Cloudstek
1+
Copyright 2019 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: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
## AppUp
1+
# AppUp
22

3-
The command that can save you typing 15 characters or more, each time!
3+
> The command that can save you typing 15 characters or more, each time!
44
5-
This plugins adds `start`, `stop`, `up` and `down` commands when it detects a docker-compose or Vagrant file in the current directory (e.g. your application). Just run `up` and get coding!
5+
This plugins adds `start`, `restart`, `stop`, `up` and `down` commands when it detects a docker-compose or Vagrant file in the current directory (e.g. your application). Just run `up` and get coding!
66

77
### Docker
88

9-
Aside from simply running `up`, you can also extend your configuration by running `up <name>`, which will run `docker-compose` with both `docker-compose.yml` and extend it with `docker-compose.<name>.yml`. For more on extending please see the official docker documentation: https://docs.docker.com/compose/extends. Additional arguments will be directly supplied to the docker-compose.
9+
Aside from simply running `up`, you can also extend your configuration by running `up <name>`, which will run `docker-compose` with both `docker-compose.yml` and extend it with `docker-compose.<name>.yml`. For more on extending please see the [official docker documentation](https://docs.docker.com/compose/extends). Additional arguments will be directly supplied to the docker-compose.
1010

1111
### Vagrant
1212

13-
Vagrant doesn't have a `down`, `start` or `stop` commands natively but don't worry, that's been taken care of and running those commands will actually run vagrant's equivalent commands. Additional arguments will be directly supplied to vagrant.
13+
Vagrant doesn't have a `down`, `restart`, `start` or `stop` commands natively but don't worry, that's been taken care of and running those commands will actually run vagrant's equivalent commands. Additional arguments will be directly supplied to vagrant.
14+
15+
## Command mapping
16+
17+
| Command | Vagrant command | Docker command |
18+
| ------- | ---------------------------------------------------------- | ------------------------------------------------------------ |
19+
| up | [up](https://www.vagrantup.com/docs/cli/up.html) | [up](https://docs.docker.com/compose/reference/up/) |
20+
| down | [destroy](https://www.vagrantup.com/docs/cli/destroy.html) | [down](https://docs.docker.com/compose/reference/down/) |
21+
| start | [up](https://www.vagrantup.com/docs/cli/up.html) | [start](https://docs.docker.com/compose/reference/start/) |
22+
| restart | [reload](https://www.vagrantup.com/docs/cli/reload.html) | [restart](https://docs.docker.com/compose/reference/restart/) |
23+
| stop | [halt](https://www.vagrantup.com/docs/cli/halt.html) | [stop](https://docs.docker.com/compose/reference/stop/) |
24+

appup.plugin.zsh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Docker
22
_appup_docker () {
3-
if command -v docker-compose >/dev/null 2>&1; then
3+
if hash docker-compose >/dev/null 2>&1; then
44
# Check if docker-machine has been started
5-
if command -v docker-machine >/dev/null 2>&1; then
5+
if hash docker-machine >/dev/null 2>&1; then
66
if docker-machine status | grep -qi "Stopped"; then
77
read -q "REPLY?Docker Machine is not running, would you like to start it? [y/n] "
88
echo ""
@@ -37,7 +37,7 @@ _appup_docker () {
3737

3838
# Vagrant
3939
_appup_vagrant () {
40-
if type vagrant >/dev/null 2>&1; then
40+
if hash vagrant >/dev/null 2>&1; then
4141
vagrant $1 "${@:2}"
4242
else
4343
echo >&2 "Vagrant file found but vagrant is not installed."
@@ -68,7 +68,17 @@ start () {
6868
if [ -e "docker-compose.yml" ]; then
6969
_appup_docker start "$@"
7070
elif [ -e "Vagrantfile" ]; then
71-
_appup_vagrant resume "$@"
71+
_appup_vagrant up "$@"
72+
elif hash start >/dev/null 2>&1; then
73+
env start "$@"
74+
fi
75+
}
76+
77+
restart () {
78+
if [ -e "docker-compose.yml" ]; then
79+
_appup_docker restart "$@"
80+
elif [ -e "Vagrantfile" ]; then
81+
_appup_vagrant reload "$@"
7282
elif hash start >/dev/null 2>&1; then
7383
env start "$@"
7484
fi
@@ -78,7 +88,7 @@ stop () {
7888
if [ -e "docker-compose.yml" ]; then
7989
_appup_docker stop "$@"
8090
elif [ -e "Vagrantfile" ]; then
81-
_appup_vagrant suspend "$@"
91+
_appup_vagrant halt "$@"
8292
elif hash stop >/dev/null 2>&1; then
8393
env stop "$@"
8494
fi

0 commit comments

Comments
 (0)