From 9b53fcfaef200546d5a9f467269396aa1ad9eb54 Mon Sep 17 00:00:00 2001 From: rdrew Date: Mon, 25 May 2026 10:39:31 -0300 Subject: [PATCH] [nb] Add: my_dev_scripts.md --- .index | 1 + my_dev_scripts.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 my_dev_scripts.md diff --git a/.index b/.index index f00ffbe..5370b5f 100644 --- a/.index +++ b/.index @@ -33,3 +33,4 @@ linux_recording.md d11_theme_reqirements.md +my_dev_scripts.md diff --git a/my_dev_scripts.md b/my_dev_scripts.md new file mode 100644 index 0000000..ac74d51 --- /dev/null +++ b/my_dev_scripts.md @@ -0,0 +1,79 @@ +# My Dev Scripts + +## BS hot reload + +``` +var browserSync = require("browser-sync"); +browserSync({ + //proxy: 'http://137.149.200.93', + proxy: "https://newspapers2.islandarchives.ca", + // files: "css/**/*.css", + files: ["css/**/*.css", "js/**/*.js"], + plugins: ["bs-rewrite-rules"], + serveStatic: ["."], + rewriteRules: [ + { + match: /\/themes\/custom\/olivesnews/g, + replace: "", + }, + ], +}); +``` + +## Code sync Local > Server via git repo + +``` +#!/bin/bash + +#====NEED TO AUTOMATE AUTH IN ADVANCE: +#(check for and create if missing on server) +#mkdir -p ~/.ssh +#chmod 700 ~/.ssh +#touch ~/.ssh/authorized_keys +#chmod 600 ~/.ssh/authorized_keys +#(run these on local) +#ssh-keygen -t ed25519 +#ssh-copy-id rdrew@newspapers2.islandarchives.ca +# -------------------------------------------------------- + +# --- CONFIGURATION (Edit these for new environments) --- +# SERVER="newspapers2.islandarchives.ca" +SERVER="137.149.52.48" +THEME_DIR="/var/www/islandnewspapers2/web/themes/custom/olivesnews" +SITE_ROOT="/var/www/islandnewspapers2/web/sites/islandnewspapers2" +DRUSH_PATH="/var/www/islandnewspapers2/vendor/drush/drush/drush" +# -------------------------------------------------------- + +# 1. Check if a commit message was provided +if [ -z "$1" ]; then + echo "โŒ Error: Please provide a commit message." + echo "Usage: ./deploy.sh 'Your message here'" + exit 1 +fi + +COMMIT_MSG="$1" + +echo "๐Ÿš€ Starting deployment workflow..." + +# 2. Local Git workflow +echo "๐Ÿ“ฆ Committing and pushing local changes..." +git add --all +git commit -m "$COMMIT_MSG" +git push + +# 3. Remote Server workflow +echo "๐Ÿ”— Connecting to $SERVER..." + +# We wrap the remote commands in a single string for SSH +# The '&&' ensures that if one step fails, the script stops immediately. +ssh "$SERVER" " + echo '๐Ÿ“ฅ Pulling code into theme folder...' && \ + cd $THEME_DIR && \ + git pull && \ + echo '๐Ÿงน Rebuilding Drupal cache...' && \ + cd $SITE_ROOT && \ + $DRUSH_PATH cr +" + +echo "โœ… Done! Deployment successful." +```