From bc5fe5a5cffbf825a6abdca1a97f1d65178ce897 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Thu, 26 Jul 2018 08:50:20 -0700 Subject: [PATCH] added scripts --- .gitignore | 1 - README.md | 6 ++++++ codemirror | 2 +- scripts/.gitignore | 1 + scripts/sync-blog.sh | 5 +++++ scripts/sync-dev.sh | 7 +++++++ scripts/sync-production.sh | 10 ++++++++++ scripts/sync-staging.sh | 6 ++++++ scripts/sync-tools.sh | 5 +++++ scripts/sync-version-prod.sh | 28 ++++++++++++++++++++++++++++ 10 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 scripts/.gitignore create mode 100755 scripts/sync-blog.sh create mode 100755 scripts/sync-dev.sh create mode 100755 scripts/sync-production.sh create mode 100755 scripts/sync-staging.sh create mode 100755 scripts/sync-tools.sh create mode 100755 scripts/sync-version-prod.sh diff --git a/.gitignore b/.gitignore index cc0a0d40..6f3ebe83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *~ node_modules -scripts blog local release diff --git a/README.md b/README.md index bc2cf475..0d559812 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # 8bitworkshop 8bitworkshop.com + + git submodule init + git submodule update + npm i + npm run build + diff --git a/codemirror b/codemirror index 4334727f..ebf81921 160000 --- a/codemirror +++ b/codemirror @@ -1 +1 @@ -Subproject commit 4334727f0e07acd4541b0a7b8f81a5984cd4aafe +Subproject commit ebf81921f80024e3e94c7a8e1235ab59464fa5ef diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 00000000..137e6783 --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1 @@ +env.sh diff --git a/scripts/sync-blog.sh b/scripts/sync-blog.sh new file mode 100755 index 00000000..a7f4a876 --- /dev/null +++ b/scripts/sync-blog.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +. ./scripts/env.sh +rsync --stats -arilv -e "ssh -p 2222" ./blog/ $RSYNC_PATH/blog/ +#rsync --stats -arilv -e "ssh -p 2222" ./scripts/ pzp@104.131.86.119:./backups diff --git a/scripts/sync-dev.sh b/scripts/sync-dev.sh new file mode 100755 index 00000000..59f56bf8 --- /dev/null +++ b/scripts/sync-dev.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +. ./scripts/env.sh +DESTPATH=$RSYNC_PATH/dev/ +git ls-files -z | rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules -aril -e "ssh -p 2222" --files-from - -0 . $DESTPATH +git archive --format tar.gz --prefix 8bitworkshop- HEAD tools/ > release/8bitworkshop-tools.tgz +rsync --stats -arilvz -e "ssh -p 2222" ./gen ./mame $DESTPATH/ diff --git a/scripts/sync-production.sh b/scripts/sync-production.sh new file mode 100755 index 00000000..36b9e0c5 --- /dev/null +++ b/scripts/sync-production.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. ./scripts/env.sh +DESTPATH=$RSYNC_PATH/ +echo "Upload HEAD to production? [Press Enter]" +read +git ls-files -z | rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules -aril -e "ssh -p 2222" --files-from - -0 . $DESTPATH +git archive --format tar.gz --prefix 8bitworkshop- HEAD tools/ > release/8bitworkshop-tools.tgz +#rsync --stats -arilvz -e "ssh -p 2222" ./mame $DESTPATH/ +echo "Done." diff --git a/scripts/sync-staging.sh b/scripts/sync-staging.sh new file mode 100755 index 00000000..f7210bbc --- /dev/null +++ b/scripts/sync-staging.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +DESTPATH=$RSYNC_PATH/staging/ +git ls-files -z | rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules -aril -e "ssh -p 2222" --files-from - -0 . $DESTPATH +git archive --format tar.gz --prefix 8bitworkshop- HEAD tools/ > release/8bitworkshop-tools.tgz +rsync --stats -arilvz -e "ssh -p 2222" ./mame $DESTPATH/ diff --git a/scripts/sync-tools.sh b/scripts/sync-tools.sh new file mode 100755 index 00000000..9c3bacaf --- /dev/null +++ b/scripts/sync-tools.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +. ./scripts/env.sh +DESTPATH=$RSYNC_PATH/ +rsync --stats -arilv -e "ssh -p 2222" ./release/ $DESTPATH/release diff --git a/scripts/sync-version-prod.sh b/scripts/sync-version-prod.sh new file mode 100755 index 00000000..25bb8111 --- /dev/null +++ b/scripts/sync-version-prod.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +. ./scripts/env.sh +VERSION=`git tag | tail -1` +#VERSION=`git tag -l HEAD` +if [ "$VERSION" == "" ]; then + echo "No version at HEAD! Tag it first!" + exit 1 +fi +DESTPATH=$RSYNC_PATH/v$VERSION +DEVPATH=/var/www/8bitworkshop.com/dev +TMPDIR=/tmp/8bitws/$VERSION +grep "var VERSION" redir.html +echo "Upload version $VERSION to production? (edited redir.html?)" +read +echo "Listing submodules..." +SUBMODS=`git submodule | cut -d ' ' -f 3` +echo "Extracting to $TMPDIR..." +rm -fr $TMPDIR +mkdir -p $TMPDIR +git archive $VERSION | tar x -C $TMPDIR +echo "Copying to $DESTPATH..." +rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules --copy-dest=$DEVPATH -aril -e "ssh -p 2222" $TMPDIR/ $SUBMODS $DESTPATH +rsync -a -e "ssh -p 2222" redir.html $DESTPATH/../index.html +#git ls-files -z | +git archive --format tar.gz --prefix 8bitworkshop- HEAD tools/ > release/8bitworkshop-tools.tgz +#rsync --stats -arilvz -e "ssh -p 2222" ./mame $DESTPATH/ +echo "Done."