File tree 6 files changed +78
-12
lines changed
6 files changed +78
-12
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ nbproject
10
10
composer
11
11
.ht *
12
12
/vendor /
13
- .DS_Store
13
+ .DS_Store
14
+ .php_cs.cache
Original file line number Diff line number Diff line change @@ -6,13 +6,16 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6
6
7
7
8
8
if [ ! -e " data/config.php" ]; then
9
- cp " $DIR /data/config.php.example" " $DIR /data/config.php"
9
+ cp " $DIR /data/config.php.example" " $DIR /data/config.php"
10
10
fi
11
11
12
12
if ! which $PHPBIN 2> /dev/null; then
13
- PHPBIN=php
13
+ PHPBIN=php
14
14
fi
15
15
16
+ # Installing git hook
17
+ $DIR /hooks/install.sh
18
+
16
19
$PHPBIN composer.phar install
17
20
18
- $PHPBIN --server localhost:8000 --docroot " $DIR /web" " $DIR /web/index.php"
21
+ $PHPBIN --server localhost:8000 --docroot " $DIR /web" " $DIR /web/index.php"
Original file line number Diff line number Diff line change @@ -4,14 +4,18 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
4
5
5
6
6
if [ ! -e " $DIR /data/config.php" ]; then
7
- cp " $DIR /data/config.php.example" " $DIR /data/config.php"
7
+ cp " $DIR /data/config.php.example" " $DIR /data/config.php"
8
8
fi
9
9
10
+ # Installing git hook
11
+ $DIR /hooks/install.sh
12
+
10
13
docker run --rm -it --name " dev.lbry.io" \
11
- -v " $DIR :/usr/src/lbry.io" \
12
- -w " /usr/src/lbry.io" \
13
- -p " 127.0.0.1:8000:8000" \
14
- -u " $( id -u) :$( id -g) " \
15
- php:7-alpine \
16
- php composer.phar install
17
- php --server " 0.0.0.0:8000" --docroot " web/" " index.php"
14
+ -v " $DIR :/usr/src/lbry.io" \
15
+ -w " /usr/src/lbry.io" \
16
+ -p " 127.0.0.1:8000:8000" \
17
+ -u " $( id -u) :$( id -g) " \
18
+ php:7-alpine \
19
+ php composer.phar install
20
+
21
+ php --server " 0.0.0.0:8000" --docroot " web/" " index.php"
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ if [ -e .git/hooks/pre-commit ];
4
+ then
5
+ PRE_COMMIT_EXISTS=1
6
+ else
7
+ PRE_COMMIT_EXISTS=0
8
+ fi
9
+
10
+ cp ./hooks/pre-commit .git/hooks/pre-commit
11
+ chmod +x .git/hooks/pre-commit
12
+
13
+ if [ " $PRE_COMMIT_EXISTS " = 0 ];
14
+ then
15
+ echo " Pre-commit git hook is installed!"
16
+ else
17
+ echo " Pre-commit git hook is updated!"
18
+ fi
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ PROJECT=` php -r " echo dirname(dirname(dirname(realpath('$0 '))));" `
4
+ STAGED_FILES_CMD=` git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\ .php`
5
+
6
+ # Determine if a file list is passed
7
+ if [ " $# " -eq 1 ]
8
+ then
9
+ oIFS=$IFS
10
+ IFS='
11
+ '
12
+ SFILES=" $1 "
13
+ IFS=$oIFS
14
+ fi
15
+ SFILES=${SFILES:- $STAGED_FILES_CMD }
16
+
17
+ echo " Checking PHP Lint..."
18
+ for FILE in $SFILES
19
+ do
20
+ php -l -d display_errors=0 $PROJECT /$FILE
21
+ if [ $? != 0 ]
22
+ then
23
+ echo " Fix the error before commit."
24
+ exit 1
25
+ fi
26
+ FILES=" $FILES $PROJECT /$FILE "
27
+ done
28
+
29
+ if [ " $FILES " != " " ]
30
+ then
31
+ echo " Running php-cs-fixer"
32
+ $PROJECT /php-cs-fixer fix $FILES
33
+ git add $FILES
34
+ if [ $? != 0 ]
35
+ then
36
+ echo " Error was found"
37
+ fi
38
+ fi
39
+
40
+ exit $?
You can’t perform that action at this time.
0 commit comments