git.delta.rocks / unique-network / refs/commits / cd77dae50bc3

difftreelog

fix code review requests

Grigoriy Simonov2023-09-22parent: #1e4737b.patch.diff
in: master

5 files changed

modified.envrcdiffbeforeafterboth
after · .envrc
1#!/bin/sh23# Load .envrc from parent directories4source_up_if_exists5# Load .envrc-dev6source_env_if_exists .envrc-dev7# Common variables from .env8dotenv910RED='\033[0;31m'11GREEN='\033[0;32m'12RESET='\033[0m'1314dep_not_found=false15function check_bdk {16    if ! has $1; then17        echo -e "${RED}$1 not found (wanted for beadeker discovery)${RESET}"18        dep_not_found=true19    fi20}2122if ! diff .githooks/pre-commit .git/hooks/pre-commit  >/dev/null; then23echo -e "${RED}Hooks are updated, run make git-hooks${RESET}"24fi2526watch_file .baedeker/.bdk-env/discover.env27if test -f .baedeker/.bdk-env/discover.env; then28    check_bdk baedeker29    check_bdk docker30    check_bdk jq31    if $dep_not_found; then32        echo -e "${RED}Not performing bdk discovery${RESET}"33        exit 034    fi3536    echo -e "${GREEN}Baedeker env updated${RESET}"37    nginx_id=$(docker compose -f .baedeker/.bdk-env/docker-compose.yml ps --format=json | jq -s 'flatten' | jq -r '.[] | select(.Service == "nginx") | .ID' -e)38    if ! [ $? -eq 0 ]; then39        echo -e "${RED}Nginx container not found${RESET}"40        exit 041    fi42    nginx_ip=$(docker inspect $nginx_id | jq -r -e '.[0].NetworkSettings.Networks[].IPAddress')43    if ! [ $? -eq 0 ]; then44        echo -e "${RED}Nginx container network misconfigured?${RESET}"45        exit 046    fi47    tmpenv=$(mktemp)48    cat .baedeker/.bdk-env/discover.env | sed "s|BALANCER_URL|$nginx_ip|g" > $tmpenv49    dotenv $tmpenv50    echo -e "${GREEN}Enjoy your baedeker networks at $(echo $BDK_BALANCER || sed "s|BALANCER_URL|$nginx_ip|g")${RESET}"51fi
modified.githooks/pre-commitdiffbeforeafterboth
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # Pre-push hook verifying that inappropriate code will not be pushed.
 
modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -167,3 +167,13 @@
 .PHONY: clippy
 clippy:
 	cargo clippy --features=quartz-runtime,unique-runtime,try-runtime,runtime-benchmarks --tests
+
+.PHONY: git-hooks
+git-hooks:
+	cp .githooks/pre-commit .git/hooks/pre-commit
+
+.PHONY: init
+init:
+	make git-hooks
+	cd tests
+	yarn install
modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -159,6 +159,11 @@
 cd tests && yarn eslint --ext .ts,.js src/
 ```
 
+### Enable checking of code style on commits
+```bash
+make git-hooks
+```
+
 
 ## Karura token transfer
 
deletedinit.shdiffbeforeafterboth
--- a/init.sh
+++ /dev/null
@@ -1 +0,0 @@
-git config --local core.hooksPath ./.githooks
\ No newline at end of file