-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
126 lines (92 loc) · 3.11 KB
/
Makefile
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
MODULE := "btcpay"
MODULE_FOLDER := "./modules"
BUILD_FOLDER := "./build"
ZIP_NAME := "${MODULE}.zip"
ZIP_DEBUG_NAME := "${MODULE}_debug.zip"
MODULE_OUT := "${BUILD_FOLDER}/${ZIP_NAME}"
.PHONY: all build install update upgrade clean lint lint-fix
all: build
build: ## Build the bastard binary file
# Installing all dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer install --no-dev
# Dump autoloader
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer dump-autoload -o --no-dev
# Removing the old ZIP if present
@rm -f $(MODULE_OUT)
# Make the build folder
@mkdir -p $(BUILD_FOLDER)
# Copy the license to the module
@cp ./LICENSE "$(MODULE_FOLDER)/$(MODULE)"
# Copy the README to the module root and docs
@cp ./README.md "$(MODULE_FOLDER)/$(MODULE)"
@cp ./README.md "$(MODULE_FOLDER)/$(MODULE)/docs"
# Zip the module
@cd $(MODULE_FOLDER) \
&& zip -r $(ZIP_NAME) $(MODULE) \
&& mv $(ZIP_NAME) "../$(BUILD_FOLDER)"
debug: ## Build the bastard binary file as debug file
# Installing all dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer install
# Dump autoloader
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer dump-autoload -o
# Removing the old ZIP if present
@rm -f $(MODULE_OUT)
# Make the build folder
@mkdir -p $(BUILD_FOLDER)
# Copy the license to the module
@cp ./LICENSE "$(MODULE_FOLDER)/$(MODULE)"
# Copy the README to the module
@cp ./README.md "$(MODULE_FOLDER)/$(MODULE)"
# Zip the module
@cd $(MODULE_FOLDER) \
&& zip -r $(ZIP_DEBUG_NAME) $(MODULE) \
&& mv $(ZIP_DEBUG_NAME) "../$(BUILD_FOLDER)"
bump: ## Bump all package versions
# Bump all root dependencies
@composer install
# Bump all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer install
install: ## Install everything for development
# Installing all root dependencies
@composer install
# Installing all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer install
update: ## Update all dependencies (including development)
# Upgrading all root dependencies
@composer update
# Upgrading all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer update
upgrade: ## Upgrade all dependencies (including development)
# Upgrading all root dependencies
@composer upgrade
# Upgrading all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer upgrade
clean: ## Remove previous builds
# Removing the ZIP
@rm -f $(MODULE_OUT)
# Remove the vendor
@rm -rf "$(MODULE_FOLDER)/$(MODULE)/vendor"
# Remove all unnecessary modules
@ls -d $(MODULE_FOLDER)/* | grep -v $(MODULE) | xargs rm -rf
lint: ## Lints the module
# Run PHP CS Fixer
@./vendor/bin/php-cs-fixer fix --diff --dry-run -v
# Run PHPCS
@./vendor/bin/phpcs --cache -p
# Run PHP Parallel Lint
@./vendor/bin/parallel-lint --exclude ./modules/btcpay/vendor ./modules/btcpay
lint-fix: ## Resolves linter issues
# Run PHP CS Fixer
@./vendor/bin/php-cs-fixer fix -v
# Run PHPCBF
@./vendor/bin/phpcbf --cache -p
help: ## Display this help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'