Skip to content

Commit

Permalink
Allow skip of sail checks (#224)
Browse files Browse the repository at this point in the history
* When setting the SKIP_SAIL_CHECKS env variable the docker exec will speed up a bit

* Update sail

* Update sail

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
cdarken and taylorotwell authored Aug 23, 2021
1 parent 480eaf8 commit 267fafe
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions bin/sail
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,6 @@ export SAIL_SHARE_DASHBOARD=${SAIL_SHARE_DASHBOARD:-4040}
export SAIL_SHARE_SERVER_HOST=${SAIL_SHARE_SERVER_HOST:-"laravel-sail.site"}
export SAIL_SHARE_SERVER_PORT=${SAIL_SHARE_SERVER_PORT:-8080}

# Ensure that Docker is running...
if ! docker info > /dev/null 2>&1; then
echo -e "${WHITE}Docker is not running.${NC}" >&2

exit 1
fi

# Determine if Sail is currently up...
PSRESULT="$(docker-compose ps -q)"

if docker-compose ps | grep $APP_SERVICE | grep 'Exit'; then
echo -e "${WHITE}Shutting down old Sail processes...${NC}" >&2

docker-compose down > /dev/null 2>&1

EXEC="no"
elif [ -n "$PSRESULT" ]; then
EXEC="yes"
else
EXEC="no"
fi

# Function that outputs Sail is not running...
function sail_is_not_running {
echo -e "${WHITE}Sail is not running.${NC}" >&2
Expand All @@ -65,6 +43,31 @@ function sail_is_not_running {
exit 1
}

if [ -z "$SAIL_SKIP_CHECKS" ]; then
# Ensure that Docker is running...
if ! docker info > /dev/null 2>&1; then
echo -e "${WHITE}Docker is not running.${NC}" >&2

exit 1
fi

# Determine if Sail is currently up...
PSRESULT="$(docker-compose ps -q)"
if docker-compose ps | grep $APP_SERVICE | grep 'Exit'; then
echo -e "${WHITE}Shutting down old Sail processes...${NC}" >&2

docker-compose down > /dev/null 2>&1

EXEC="no"
elif [ -n "$PSRESULT" ]; then
EXEC="yes"
else
EXEC="no"
fi
else
EXEC="yes"
fi

if [ $# -gt 0 ]; then
# Proxy PHP commands to the "php" binary on the application container...
if [ "$1" == "php" ]; then
Expand Down

0 comments on commit 267fafe

Please sign in to comment.