Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile - github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 02866b7adec5029237ec8bfc88a7afa04ca4e20c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
VERSION = $(shell cat composer.json | sed -n 's/.*"version": "\([^"]*\)"/\1/p')

SHELL = /usr/bin/env bash

HAS_PSALM := $(shell ls ./vendor/bin/xpsalm 2> /dev/null)
XDSWI := $(shell command -v xd_swi 2> /dev/null)
HAS_PHPMD := $(shell command -v phpmd 2> /dev/null)
HAS_CSFIXER:= $(shell command -v php-cs-fixer 2> /dev/null)
XDSWI_STATUS:=$(shell command xd_swi stat 2> /dev/null)
CURRENT_BRANCH:=$(shell command git rev-parse --abbrev-ref HEAD 2> /dev/null)
DATENOW:=`date +'%Y-%m-%d'`
YELLOW=\033[0;33m
RED=\033[0;31m
WHITE=\033[0m
GREEN=\u001B[32m


default: install
.PHONY: tag install test csfixer create_testdb destroy_testdb run_local phpmd

version:
	@echo -e "Current version is: ${GREEN} $(VERSION) ${WHITE}" ;\
	echo -e "  master branch closest tag is $(GREEN)" `	git describe --tags master `;\
	echo -e "$(WHITE)  develop branch closest tag is $(GREEN)"  `	git describe --tags develop `;\
	echo -e "$(WHITE) "


install: fix_permissions composer_update
install: 
	@composer install --no-interaction --no-progress --no-suggest --prefer-dist ;\
	${MAKE} composer_validate  --no-print-directory



fix_permissions:
	@sudo chmod 777 temp -R ;\
	sudo chown -R $$USER:www-data temp/sessions ;\
	sudo chown -R $$USER:www-data temp/twigcache ;\
	sudo rm -R --force temp/twigcache/*

composer_update:
	@echo -e "updating composer with params ${YELLOW}--lock --root-reqs --prefer-dist --prefer-stable --no-suggest -a${WHITE}" ;\
	composer update  --lock --root-reqs --prefer-dist --prefer-stable --no-suggest -a

composer_validate:
	@composer check-platform-reqs ;\
	composer validate --strict ;\
	composer normalize

update_version:
	@echo "Current version is " ${VERSION} ;\
	echo "Next version is " $(v) ;\
	sed -i 's/"version": "$(VERSION)"/"version": "$(v)"/g' composer.json
	@${MAKE} composer_update --no-print-directory


mocktag:
	echo "Creating tag Tag v$(v) at $(DATENOW) - $(m)"


tag_and_push:
	@git commit -a -m "Creating Tag v$(v) at $(DATENOW) - $(m)" ;\
	git push ;\
	if [[ "$(CURRENT_BRANCH)" != "master" ]]; then \
		git checkout master ;\
		git merge $(CURRENT_BRANCH) ;\
	fi 
	
	git tag v$(v) ;\
	git push ;\
	git push --tags ;\
	git checkout $(CURRENT_BRANCH)



tag: test update_version csfixer lint tag_and_push	

test:
ifeq ("$(wildcard config.inc.php)","")
	cp config.inc.php-dist config.inc.php
endif
	./vendor/bin/codecept run unit --debug
	


csfixer:
	@if [ -f "vendor/bin/php-cs-fixer" ]; then \
		echo "XDEBUG was: "$(XDSWI_STATUS) ;\
		${MAKE} disable_xdebug  --no-print-directory ;\
		mkdir -p .build/php-cs-fixer ;\
        vendor/bin/php-cs-fixer fix --config=.php_cs --verbose ;\
		${MAKE} enable_xdebug new_status=$(XDSWI_STATUS)  --no-print-directory;\
    else \
        echo -e "$(GREEN)php-cs-fixer$(WHITE) is $(RED)NOT$(WHITE) installed. " ;\
        echo -e "Install it with $(GREEN)composer install --dev friendsofphp/php-cs-fixer$(WHITE)" ;\
    fi ;\
	sudo rm -rf temp/route.cache.php



disable_xdebug:
	@if [[ "$(XDSWI)" != "" ]]; then \
    	xd_swi off ;\
    fi 

enable_xdebug:
	@if [[ "$(XDSWI)" != "" ]]; then \
    	xd_swi $(new_status) ;\
    fi 

phpmd:
	@if [ "$(HAS_PHPMD)" == "" ]; then \
        echo -e "$(GREEN)phpmd$(WHITE) is $(RED)NOT$(WHITE) installed. " ;\
        echo -e "Install it with $(GREEN)phive install phpmd$(WHITE)" ;\
    else \
	    phpmd src text .phpmd.xml |  sed "s/.*\///" ;\
    fi ;\
    echo ""

var_dumper:
	@if [ -f "vendor/bin/var-dump-server" ]; then \
		vendor/bin/var-dump-server ;\
	else \
		 echo -e "$(GREEN)symfony/var-dumper$(WHITE) is $(RED)NOT$(WHITE) installed. " ;\
        echo -e "Install it with $(GREEN)composer require --dev symfony/var-dumper$(WHITE)" ;\
	fi;
	@echo ""

folder ?= src
psalm: FOLDER_BASENAME:=`basename $(folder)|sed 's/src//'`
psalm:
	@if [ -f "vendor/bin/psalm" ]; then \
		mkdir -p .build/psalm ;\
		${MAKE} disable_xdebug  --no-print-directory ;\
		vendor/bin/psalm --show-info=false \
			  --config=psalm.xml \
			  --set-baseline=.build/psalm/psalm-baseline$(FOLDER_BASENAME).xml \
			  --shepherd $(folder) ;\
		${MAKE} enable_xdebug new_status=$(XDSWI_STATUS)  --no-print-directory;\
	else \
	 	echo -e "$(GREEN)vimeo/psalm$(WHITE) is $(RED)NOT$(WHITE) installed. " ;\
		echo -e "Install it with $(GREEN)composer require --dev vimeo/psalm$(WHITE)" ;\
	fi
	@echo ""


phpstan:
	@${MAKE} disable_xdebug  --no-print-directory 
	@if [ ! -f "vendor/bin/phpstan" ]; then \
		echo -e "$(GREEN)phpstan$(WHITE) is $(RED)NOT$(WHITE) installed. " ;\
		echo -e "Install it with $(GREEN)composer require --dev phpstan/phpstan$(WHITE)" ;\
		exit 0 ;\
	fi
	
	@mkdir -p .build/phpstan ;\
	./vendor/bin/phpstan analyse --memory-limit=2G   ${error_format}  
	@${MAKE} enable_xdebug new_status=$(XDSWI_STATUS)  --no-print-directory ;\
	echo ""


lint:
	@if [ -f "vendor/bin/parallel-lint" ]; then \
		mkdir -p .build/parallel ;\
		${MAKE} disable_xdebug  --no-print-directory ;\
		vendor/bin/parallel-lint \
			--ignore-fails \
			  --exclude vendor \
			   $(folder) ;\
		${MAKE} enable_xdebug new_status=$(XDSWI_STATUS)  --no-print-directory;\
	else \
		echo -e "$(GREEN)parallel-lint$(WHITE) is $(RED)NOT$(WHITE) installed. " ;\
		echo -e "Install it with $(GREEN)composer require --dev jakub-onderka/php-parallel-lint$(WHITE)" ;\
	fi
	@find ./src -name \*.php -print0 | xargs -0 -n 1 php -l
	@echo ""



fixers: phpmd psalm phpstan

create_testdb:
	PGPASSWORD=scrutinizer psql   -U scrutinizer -h localhost -f tests/simpletest/data/ppatests_install.sql

destroy_testdb:
	PGPASSWORD=scrutinizer psql   -U scrutinizer -h localhost -f tests/simpletest/data/ppatests_remove.sql	

run_local:
	${MAKE} fix_permissions
	php -S localhost:8000 index.php