mirror of
https://github.com/shadoll/sscript.git
synced 2025-12-20 01:26:00 +00:00
first init
This commit is contained in:
3
.env.example
Normal file
3
.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
STREAM_NAME=announce
|
||||
ZULIP_HOST=shadoll.zulipchat.com
|
||||
ZULIP_HASH=VUsqHUhn5AKndXSUKddYpTsNJm7kPKNY
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!/**/.gitkeep
|
||||
.env
|
||||
14
package.json
Normal file
14
package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "sscripts",
|
||||
"version": "1.0.0",
|
||||
"description": "Useful Shell scripts for projects",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "sHa <sha@shadoll.dev>",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"hello.sh": "./scripts/hello.sh",
|
||||
"hello.js": "./scripts/hello.js"
|
||||
}
|
||||
}
|
||||
10
scripts/app.artisan.sh
Executable file
10
scripts/app.artisan.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
docker-compose exec app php artisan "$@"
|
||||
11
scripts/app.composer.sh
Executable file
11
scripts/app.composer.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
|
||||
docker-compose exec app composer "$@"
|
||||
10
scripts/app.git.sh
Executable file
10
scripts/app.git.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
docker-compose exec app git "$@"
|
||||
12
scripts/app.npm.sh
Executable file
12
scripts/app.npm.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
# appname=$(awk -F'=' '/^APPNAME/ { print $2}' ./docker/.env)
|
||||
|
||||
docker-compose exec app npm "$@"
|
||||
12
scripts/app.php.sh
Executable file
12
scripts/app.php.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
# appname=$(awk -F'=' '/^APPNAME/ { print $2}' ./docker/.env)
|
||||
|
||||
docker-compose exec app php "$@"
|
||||
10
scripts/app.yarn.sh
Executable file
10
scripts/app.yarn.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
docker-compose exec app yarn "$@"
|
||||
16
scripts/db.dump.sh
Executable file
16
scripts/db.dump.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=$(cd "$DIR"/.. && pwd)
|
||||
|
||||
DATABASE=$(awk -F'=' '/^MYSQL_DATABASE/ { print $2}' $ROOT/docker/config.env)
|
||||
PWD=$(awk -F'=' '/^MYSQL_ROOT_PASSWORD/ { print $2}' $ROOT/docker/config.env)
|
||||
|
||||
docker-compose exec db /usr/bin/mysqldump --skip-comments -uroot --password=$PWD $DATABASE > $ROOT/storage/database/dump/database.sql 2>/dev/null
|
||||
16
scripts/db.restore.sh
Executable file
16
scripts/db.restore.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=$(cd "$DIR"/.. && pwd)
|
||||
|
||||
DATABASE=$(awk -F'=' '/^MYSQL_DATABASE/ { print $2}' $ROOT/docker/config.env)
|
||||
PWD=$(awk -F'=' '/^MYSQL_ROOT_PASSWORD/ { print $2}' $ROOT/docker/config.env)
|
||||
|
||||
docker-compose exec db /usr/bin/mysql -uroot --password=$PWD $DATABASE < $ROOT/storage/database/dump/database.sql
|
||||
10
scripts/docker.down.sh
Executable file
10
scripts/docker.down.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
docker-compose down "$@"
|
||||
19
scripts/docker.firstrun.sh
Executable file
19
scripts/docker.firstrun.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=$(cd "$DIR"/.. && pwd)
|
||||
|
||||
$ROOT/bin/app.composer install
|
||||
$ROOT/bin/app.composer run-script post-root-package-install
|
||||
$ROOT/bin/app.composer dump-autoload --optimize
|
||||
|
||||
$ROOT/bin/fix_permissions
|
||||
|
||||
$ROOT/bin/db.restore
|
||||
10
scripts/docker.up.sh
Executable file
10
scripts/docker.up.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
docker-compose up -d "$@"
|
||||
16
scripts/fix_permissions.sh
Executable file
16
scripts/fix_permissions.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=$(cd "$DIR"/.. && pwd)
|
||||
|
||||
sudo chmod -R a=rwX,go-rwX "$ROOT"/docker/.ssh/
|
||||
|
||||
sudo chown -R :www-data $ROOT
|
||||
sudo chmod -R g+rwX $ROOT
|
||||
16
scripts/git.storage_push.sh
Executable file
16
scripts/git.storage_push.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
DIR=$(dirname $BASH_SOURCE)
|
||||
PROJECT=$(cd $DIR"/.."; pwd)
|
||||
cd $PROJECT/storage
|
||||
|
||||
git add . --all &&
|
||||
git commit -m "storage"
|
||||
git push origin master --force
|
||||
16
scripts/git.submodule_pull.sh
Executable file
16
scripts/git.submodule_pull.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=$(cd "$DIR"/.. && pwd)
|
||||
|
||||
chmod -R a=rwX,go-rwX "$ROOT"/docker/.ssh/
|
||||
|
||||
git submodule init
|
||||
ssh-agent sh -c "ssh-add -D; ssh-add $ROOT/docker/.ssh/id_rsa; git submodule update"
|
||||
11
scripts/hello.js
Executable file
11
scripts/hello.js
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// @package sscripts
|
||||
// @author sHa <sha@shadoll.dev>
|
||||
// @copyright 2019 shadoll
|
||||
// @version 19.6.7
|
||||
// @link https://shadoll.dev
|
||||
|
||||
const [,, ...args] = process.argv
|
||||
|
||||
console.log(`Hello ${args}`)
|
||||
10
scripts/hello.sh
Executable file
10
scripts/hello.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @copyright 2019 shadoll
|
||||
# @version 19.6.7
|
||||
# @link https://shadoll.dev
|
||||
#
|
||||
|
||||
echo "Hello! $@"
|
||||
34
scripts/zuilip.post-merge.sh
Executable file
34
scripts/zuilip.post-merge.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# @package sscripts
|
||||
# @author sHa <sha@shadoll.dev>
|
||||
# @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"
|
||||
8
sscripts.code-workspace
Normal file
8
sscripts.code-workspace
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
Reference in New Issue
Block a user