Skip to content
Merged
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# General Development Scripts

# Git
## Git

Helper/Setup/Template scripts for working with git.

Expand All @@ -9,7 +9,7 @@ Helper/Setup/Template scripts for working with git.

<!-- add details of process.cmd etc -->

# Ethereum
## Ethereum

Helper/Setup/Template scripts for working with Ethereum/Ethereum clients

Expand All @@ -22,4 +22,4 @@ Helper/Setup/Template scripts for working with Ethereum/Ethereum clients
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
14 changes: 12 additions & 2 deletions db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
## Prerequisites

## Linux

* docker needs to be installed
* sqlcmd needs to be installed e.g. ``yay -Sy mssql-tools``

### Mac OS X

* docker needs to be installed
* sqlcmd needs to be installed see [mssql-tools](https://ports.macports.org/port/mssql-tools/)

Expand All @@ -21,9 +23,10 @@
[1] Assumes appropriate license for Redgate SQLCompare

These scripts use the following files:

* ``~/.database`` - file containing properties for talking to mssql

```
```text
SERVER=localhost
USER=sa
PASSWORD=NotTellingYou!
Expand All @@ -33,9 +36,10 @@ Note: if SERVER is set as localhost then the local docker instance will be used

* ``Repo/.database`` => file containing the DatabaseName for synchronising

```
```text
DB=MyDatabaseName
```

### Common Command line parameters

* ``--server servername`` - overrides the server name in ~/.database
Expand All @@ -51,21 +55,27 @@ DB=MyDatabaseName
* Uses ~/.database to set get the connection details for the database

Usage:

```bash
./install-mssql --data /home/mssql
```

### ``createmssqldb``

* Creates a named database reading ``Repo/.database`` for DB name and ``~/.database`` for connection details

### ``updatedb``

* Updates a named database reading ``Repo/.database`` for DB name and ``~/.database`` for connection details reading the db schema from ``Repo/db`` folder.

### ``extractdb``

* Saves a named database reading ``Repo/.database`` for DB name and ``~/.database`` for connection details saving the db schema from ``Repo/db`` folder.

Note:

* this does not update the content of static data tables

### ``dbappsettings``

* Creates\updates appsettings-local.json in each project with the connection string to the DB
46 changes: 46 additions & 0 deletions development/pre-commit-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#! /bin/sh

die() {
if [ -t 2 ]; then
printf '\n\033[31m✗\033[0m %s\n' "$*" >&2
else
printf '\n✗ %s\n' "$*" >&2
fi
exit 1
}

success() {
if [ -t 1 ]; then
printf '\n\033[32m✓\033[0m %s\n' "$*"
else
printf '\n✓ %s\n' "$*"
fi
}

info() {
if [ -t 1 ]; then
printf '\n\033[32m→\033[0m %s\n' "$*"
else
printf '\n→ %s\n' "$*"
fi
}

# Same check at every level: does <hooks-folder>/pre-commit exist and is it
# executable? Tried in order: repo's own hooks folder, system, global.
hook_in() {
[ -n "$1" ] && [ -x "$1/pre-commit" ] && printf '%s/pre-commit\n' "$1"
}

GIT_DIR=$(git rev-parse --absolute-git-dir 2>/dev/null)
REPO_HOOKS_DIR=""
[ -n "$GIT_DIR" ] && REPO_HOOKS_DIR="$GIT_DIR/hooks"
HOOK=$(hook_in "$REPO_HOOKS_DIR")

[ -n "$HOOK" ] || HOOK=$(hook_in "$(git config --system --get core.hooksPath 2>/dev/null)")
[ -n "$HOOK" ] || HOOK=$(hook_in "$(git config --global --get core.hooksPath 2>/dev/null)")

[ -n "$HOOK" ] || die "No pre-commit hook found in the repo's hooks folder, system hooksPath, or global hooksPath"

info "Running $HOOK --all-files"
"$HOOK" --all-files || die "pre-commit hook failed"
success "Pre-commit checks passed"
Loading