Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#215 lando pull -vvv #234

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions scripts/pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DATABASE=${TERMINUS_ENV:-dev}
FILES=${TERMINUS_ENV:-dev}
RSYNC=false
NO_AUTH=false
VERBOSITY=""

# Set helpers
FRAMEWORK=${FRAMEWORK:-drupal}
Expand Down Expand Up @@ -77,6 +78,14 @@ while (( "$#" )); do
NO_AUTH=true
shift
;;
-vv|--verbose)
VERBOSITY="-vv"
shift
;;
-vvv|--debug)
VERBOSITY="-vvv"
shift
;;
--)
shift
break
Expand All @@ -100,7 +109,7 @@ fi
if [ "$CODE" != "none" ]; then
# Validate before we begin
lando_pink "Validating you can pull code from $CODE..."
terminus env:info $SITE.$CODE
terminus env:info $VERBOSITY $SITE.$CODE
lando_green "Confirmed!"

# Get the git branch
Expand Down Expand Up @@ -135,7 +144,7 @@ if [ "$DATABASE" != "none" ]; then

# Validate before we begin
lando_pink "Validating you can pull the database from $DATABASE..."
terminus env:info $SITE.$DATABASE
terminus env:info $VERBOSITY $SITE.$DATABASE
lando_green "Confirmed!"

# Destroy existing tables
Expand All @@ -153,7 +162,7 @@ EOF

# Wake up the database so we can actually connect
lando_pink "Making sure your site is awake..."
terminus env:wake $SITE.$DATABASE
terminus env:wake $VERBOSITY $SITE.$DATABASE

# Importing database
echo "Pulling your database... This miiiiight take a minute"
Expand Down Expand Up @@ -185,7 +194,7 @@ if [ "$FILES" != "none" ]; then

# Validate before we begin
lando_pink "Validating you can pull files from $FILES..."
terminus env:info $SITE.$FILES
terminus env:info $VERBOSITY $SITE.$FILES
lando_green "Confirmed!"

# Make sure the filemount actually exists
Expand All @@ -212,7 +221,7 @@ if [ "$FILES" != "none" ]; then
$LANDO_WEBROOT/$FILEMOUNT"

# Verify we have a files dump, it not let's switch to rsync mode
if ! terminus backup:list $SITE.$FILES --element=files --format=list | grep "files" 2>&1; then
if ! terminus backup:list $VERBOSITY $SITE.$FILES --element=files --format=list | grep "files" 2>&1; then
RSYNC=true
fi

Expand Down
21 changes: 15 additions & 6 deletions scripts/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ MESSAGE="My Awesome Lando-based commit"
CODE=${TERMINUS_ENV:-dev}
DATABASE=${TERMINUS_ENV:-dev}
FILES=${TERMINUS_ENV:-dev}
VERBOSITY=""

# Set helpers
FRAMEWORK=${FRAMEWORK:-drupal}
Expand Down Expand Up @@ -79,6 +80,14 @@ while (( "$#" )); do
shift 2
fi
;;
-vv|--verbose)
VERBOSITY="-vv"
shift
;;
-vvv|--debug)
VERBOSITY="-vvv"
shift
;;
--)
shift
break
Expand Down Expand Up @@ -113,7 +122,7 @@ fi
if [ "$CODE" != "none" ]; then
# Validate before we begin
lando_pink "Validating you can push code to $CODE..."
terminus env:info $SITE.$CODE
terminus env:info $VERBOSITY $SITE.$CODE
lando_green "Confirmed!"

# Get connection mode
Expand All @@ -129,7 +138,7 @@ if [ "$CODE" != "none" ]; then
exit 5
else
lando_yellow "Changing connection mode to git for the pushy push"
terminus connection:set $SITE.$CODE git
terminus connection:set $VERBOSITY $SITE.$CODE git
fi
fi
lando_green "Connected with git"
Expand Down Expand Up @@ -159,20 +168,20 @@ if [ "$CODE" != "none" ]; then
# Set the mode back to what it was before because we are responsible denizens
if [ "$CONNECTION_MODE" != "git" ]; then
echo "Changing connection mode back to $CONNECTION_MODE"
terminus connection:set $SITE.$CODE $CONNECTION_MODE
terminus connection:set $VERBOSITY $SITE.$CODE $CONNECTION_MODE
fi
fi

# Push the database
if [ "$DATABASE" != "none" ]; then
# Validate before we begin
lando_pink "Validating you can push data to $DATABASE..."
terminus env:info $SITE.$DATABASE
terminus env:info $VERBOSITY $SITE.$DATABASE
lando_green "Confirmed!"

# Wake up the site so we can actually connect
lando_pink "Making sure your database is awake!"
terminus env:wake $SITE.$DATABASE
terminus env:wake $VERBOSITY $SITE.$DATABASE
lando_green "Awake!"

# And push
Expand All @@ -186,7 +195,7 @@ fi
if [ "$FILES" != "none" ]; then
# Validate before we begin
lando_pink "Validating you can push files to $FILES..."
terminus env:info $SITE.$FILES
terminus env:info $VERBOSITY $SITE.$FILES
lando_green "Confirmed!"

# Build the rsync command
Expand Down
Loading