diff --git a/package.json b/package.json index 864566d..2a33bf8 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "url": "https://github.com/shadoll/sscript/issues" }, "bin": { - "hello.sh": "./scripts/hello.sh", "hello.js": "./scripts/hello.js", "git.storage_push": "./scripts/git/storage_push.sh", "git.submodule_pull": "./scripts/git/submodule_pull.sh", diff --git a/scripts/db/dump.sh b/scripts/db/dump.sh index c48d41f..da90c35 100755 --- a/scripts/db/dump.sh +++ b/scripts/db/dump.sh @@ -22,5 +22,4 @@ USR=$(awk -F'=' '/^DB_USERNAME/ { print $2}' $PROJECT/.env) PWD=$(awk -F'=' '/^DB_PASSWORD/ { print $2}' $PROJECT/.env) HOST=$(awk -F'=' '/^DB_HOST/ { print $2}' $PROJECT/.env) -docker-compose exec $HOST /usr/bin/mysqldump --skip-comments -u$USR --password=$PWD $DATABASE > $PROJECT/storage/database/dump/database.sql 2>/dev/null -sed '1d' $PROJECT/storage/database/dump/database.sql > $PROJECT/storage/database/dump/database.sql +docker-compose exec $HOST /usr/bin/mysqldump --skip-comments -u$USR --password=$PWD $DATABASE | tail -n +2 > $PROJECT/storage/database/dump/database.sql 2>/dev/null diff --git a/scripts/db/dump_root.sh b/scripts/db/dump_root.sh index 7354c3b..0c95143 100755 --- a/scripts/db/dump_root.sh +++ b/scripts/db/dump_root.sh @@ -21,5 +21,4 @@ DATABASE=$(awk -F'=' '/^DB_DATABASE/ { print $2}' $PROJECT/.env) PWD=$(awk -F'=' '/^DB_ROOT_PASSWORD/ { print $2}' $PROJECT/.env) HOST=$(awk -F'=' '/^DB_HOST/ { print $2}' $PROJECT/.env) -docker-compose exec $HOST /usr/bin/mysqldump --skip-comments -uroot --password=$PWD $DATABASE > $PROJECT/storage/database/dump/database.sql 2>/dev/null -sed '1d' $PROJECT/storage/database/dump/database.sql > $PROJECT/storage/database/dump/database.sql +docker-compose exec $HOST /usr/bin/mysqldump --skip-comments -uroot --password=$PWD $DATABASE | tail -n +2 > $PROJECT/storage/database/dump/database.sql 2>/dev/null diff --git a/scripts/hello.sh b/scripts/hello.sh deleted file mode 100755 index 218e016..0000000 --- a/scripts/hello.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# -# @package sscripts -# @author sHa -# @copyright 2019 shadoll -# @version 19.6.7 -# @link https://shadoll.dev -# - -echo "Hello! $@" diff --git a/scripts/slack/post_merge b/scripts/slack/post_merge new file mode 100644 index 0000000..0400214 --- /dev/null +++ b/scripts/slack/post_merge @@ -0,0 +1,32 @@ +#!/bin/sh +# +# @category Boxes +# @package git scripts +# @author sHa +# @copyright 2019 Fabrika-Klientov +# @version 19.9.26 +# @link https://fabrika-klientov.ua + +DIR=`dirname "$(readlink -f "$0")"` +DIR=${DIR%/*} +if [ "${DIR##*/}" = ".git" ]; then + DIR=${DIR%/*} +fi + +HOST=`hostname` +USER=`whoami` +REPO=$(basename -s .git `git config --get remote.origin.url`) +BRANCH=`git branch | grep \* | cut -d ' ' -f2` + +[ -f $DIR/.env ] && CHANNEL=$(grep -e '^SLACK_CHANNEL=.*' $DIR/.env | cut -d '=' -f2) +[ -z "$CHANNEL" ] && CHANNEL="general" + +[ -f $DIR/.env ] && TOKEN=$(grep -e '^SLACK_TOKEN=.*' $DIR/.env | cut -d '=' -f2) +#[ -z "$TOKEN" ] && TOKEN="" + +[ -f $DIR/.env ] && APP=$(grep -e '^APP_NAME=.*' $DIR/.env | cut -d '=' -f2) +[ -z "$APP" ] && APP="App" + +if [ "$TOKEN" ]; then + curl -X GET --get --data-urlencode "text=*$APP⎇$BRANCH* merged on $USER@$HOST" 'https://slack.com/api/chat.postMessage?token='$TOKEN'&channel='$CHANNEL +fi diff --git a/scripts/zuilip.post-merge.sh b/scripts/zuilip.post-merge.sh deleted file mode 100755 index defbad2..0000000 --- a/scripts/zuilip.post-merge.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# @package sscripts -# @author sHa -# @copyright 2019 shadoll -# @version 19.6.7 -# @link https://shadoll.dev -# - -DIR=`dirname "$(readlink -f "$0")"` -DIR=${DIR%/*} -if [ "${DIR##*/}" = ".git" ]; then - DIR=${DIR%/*} -fi - -test -z "$STREAM" && test -f $DIR/.env && STREAM=$(grep -e '^STREAM_NAME=.*' $DIR/.env | cut -d '=' -f2) -test -z "$STREAM" && STREAM="announce" - -test -z "$HASH" && test -f $DIR/.env && HASH=$(grep -e '^ZULIP_HASH=.*' $DIR/.env | cut -d '=' -f2) -test -z "$HASH" && HASH="VUsqHUhn5AKndXSUKddYpTsNJm7kPKNY" - -test -z "$URL" && test -f $DIR/.env && URL=$(grep -e '^ZULIP_HOST=.*' $DIR/.env | cut -d '=' -f2) -test -z "$URL" && URL="VUsqHUhn5AKndXSUKddYpTsNJm7kPKNY" - -HOST=`hostname` -REPO=$(basename -s .git `git config --get remote.origin.url`) -BRANCH=`git branch | grep \* | cut -d ' ' -f2` - -curl https://$URL/api/v1/messages \ - -u githook-bot@$URL:$HASH \ - -d "type=stream" \ - -d "to=$STREAM" \ - -d "subject=$REPO / $BRANCH" \ - -d "content=merged on $HOST"