Skip to content

Commit

Permalink
add playground makefile inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
boxblinkracer committed Nov 14, 2024
1 parent 1521ed2 commit ec0b4fb
Show file tree
Hide file tree
Showing 27 changed files with 129 additions and 718 deletions.
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/playground/custom-xml/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

FOLDER := custom-xml

include ../makefile

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/phpunuhi.xsd"
xsi:noNamespaceSchemaLocation="../../../schema/dev-main.xsd"
bootstrap="autoload.php"
>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 2 additions & 36 deletions tests/playground/ini/makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
# Makefile Project

.PHONY: help
.DEFAULT_GOAL := help
FOLDER := ini

include ../makefile

#------------------------------------------------------------------------------------------------

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

#------------------------------------------------------------------------------------------------

status: ## Status command
cd ../../.. && php bin/phpunuhi status --configuration=./tests/playground/ini/phpunuhi.xml

list: ## List available translation IDs
cd ../../.. && php bin/phpunuhi list:translations --configuration=./tests/playground/ini/phpunuhi.xml

validate: ## Validate command
cd ../../.. && php bin/phpunuhi validate --configuration=./tests/playground/ini/phpunuhi.xml --report-format=junit --report-output=./tests/playground/ini/.exports

structure: ## Fix Structure
cd ../../.. && php bin/phpunuhi fix:structure --configuration=./tests/playground/ini/phpunuhi.xml

html: ## Exports a HTML
cd ../../.. && php bin/phpunuhi export --configuration=./tests/playground/ini/phpunuhi.xml --format=html --dir=./tests/playground/ini/.exports

csv: ## Exports a CSV
cd ../../.. && php bin/phpunuhi export --configuration=./tests/playground/ini/phpunuhi.xml --format=csv --dir=./tests/playground/ini/.exports

list: ## List Translate
cd ../../.. && php bin/phpunuhi list:translations --configuration=./tests/playground/ini/phpunuhi.xml

translate: ## Translate
cd ../../.. && php bin/phpunuhi translate --configuration=./tests/playground/ini/phpunuhi.xml --service=googleweb

migrate: ## Migrate command
cd ../../.. && php bin/phpunuhi migrate --configuration=./tests/playground/ini/phpunuhi.xml --output=json
2 changes: 1 addition & 1 deletion tests/playground/ini/phpunuhi.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/phpunuhi.xsd"
xsi:noNamespaceSchemaLocation="../../../schema/dev-main.xsd"
>

<translations>
Expand Down
68 changes: 2 additions & 66 deletions tests/playground/json/makefile
Original file line number Diff line number Diff line change
@@ -1,69 +1,5 @@
# Makefile Project

.PHONY: help
.DEFAULT_GOAL := help
FOLDER := json

include ../makefile

#------------------------------------------------------------------------------------------------

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

#------------------------------------------------------------------------------------------------

status: ## Status command
cd ../../.. && php bin/phpunuhi status --configuration=./tests/playground/json/phpunuhi.xml

list: ## List Translate
cd ../../.. && php bin/phpunuhi list:translations --configuration=./tests/playground/json/phpunuhi.xml

validate: ## Validate command
cd ../../.. && php bin/phpunuhi validate:all --configuration=./tests/playground/json/phpunuhi.xml --report-format=junit --report-output=./tests/playground/json/.exports/junit.xml

validate-mess: ## Validate mess command
cd ../../.. && php bin/phpunuhi validate:mess --configuration=./tests/playground/json/phpunuhi.xml --report-format=junit --report-output=./tests/playground/json/.exports/junit.xml

fix-mess: ## Fix mess command
cd ../../.. && php bin/phpunuhi fix:mess --configuration=./tests/playground/json/phpunuhi.xml

validate-json: ## Validate command with json report
cd ../../.. && php bin/phpunuhi validate --configuration=./tests/playground/json/phpunuhi.xml --report-format=json --report-output=./tests/playground/json/.exports/report.json

validate-structure: ## Fix Structure
cd ../../.. && php bin/phpunuhi validate:structure --configuration=./tests/playground/json/phpunuhi.xml

validate-spelling: ## Validate Spelling
cd ../../.. && php bin/phpunuhi validate:spelling --service=aspell --configuration=./tests/playground/json/phpunuhi.xml

validate-similarity: ## Validate Similarity
cd ../../.. && php bin/phpunuhi validate:similarity --configuration=./tests/playground/json/phpunuhi.xml

fix-structure: ## Fix Structure
cd ../../.. && php bin/phpunuhi fix:structure --configuration=./tests/playground/json/phpunuhi.xml

fix-spelling: ## Fix Spelling
cd ../../.. && php bin/phpunuhi fix:spelling --service=aspell --configuration=./tests/playground/json/phpunuhi.xml

keys: ## Fix Keys
cd ../../.. && php bin/phpunuhi fix:structure --configuration=./tests/playground/json/phpunuhi.xml

html: ## Exports a HTML
cd ../../.. && php bin/phpunuhi export --configuration=./tests/playground/json/phpunuhi.xml --format=html --empty --dir=./tests/playground/json/.exports

csv: ## Exports a CSV
cd ../../.. && php bin/phpunuhi export --configuration=./tests/playground/json/phpunuhi.xml --format=csv --empty --dir=./tests/playground/json/.exports

csvimport: ## Imports a CSV
cd ../../.. && php bin/phpunuhi import --configuration=./tests/playground/json/phpunuhi.xml --format=csv --set=json --file=./tests/playground/json/.exports/json.csv

htmlimport: ## Imports a HTML
cd ../../.. && php bin/phpunuhi import --configuration=./tests/playground/json/phpunuhi.xml --format=html --set=json --file=./tests/playground/json/import.html.txt

translate: ## Translate
cd ../../.. && php bin/phpunuhi translate --configuration=./tests/playground/json/phpunuhi.xml --service=googleweb

migrate: ## Migrate command
cd ../../.. && php bin/phpunuhi migrate --configuration=./tests/playground/json/phpunuhi.xml --output=ini

scan: ## Scans all TWIG files
cd ../../.. && php bin/phpunuhi scan:usage --configuration=./tests/playground/json/phpunuhi.xml --dir=./tests/playground/json/templates --scanner=mjml --verbose
2 changes: 1 addition & 1 deletion tests/playground/json/phpunuhi.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/phpunuhi.xsd"
xsi:noNamespaceSchemaLocation="../../../schema/dev-main.xsd"
>

<imports>
Expand Down
97 changes: 97 additions & 0 deletions tests/playground/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Central Makefile

MAKEFILE_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))

#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
TEST_FOLDER := ./tests/playground/$(FOLDER)/phpunuhi.xml

BINARY := cd ../../.. && php bin/phpunuhi
DOCKER := docker run --rm -it -v $(MAKEFILE_DIR)$(FOLDER):/app boxblinkracer/phpunuhi:dev-main
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# TOGGLE BETWEEN BINARY OR DOCKER
EXECUTE := $(BINARY) --configuration=$(TEST_FOLDER)
# EXECUTE := $(DOCKER) --configuration=./phpunuhi.xml

REPORT_FORMAT := junit
EXPORT_FORMAT := html
SPELLING_SERVICE := aspell
TRANSLATION_SERVICE := googleweb
#--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------

help:
@printf "\033[33mStatus:\033[0m\n"
@grep -Eh '^[a-zA-Z_-]+:.*?##1 .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##1 "}; {printf "\033[33m - %-30s\033[0m %s\n", $$1, $$2}'
@echo "--------------------------------------------------------------------------------------------"
@printf "\033[36mValidation:\033[0m\n"
@grep -Eh '^[a-zA-Z_-]+:.*?##2 .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##2 "}; {printf "\033[36m - %-30s\033[0m %s\n", $$1, $$2}'
@echo "--------------------------------------------------------------------------------------------"
@printf "\033[32mReports:\033[0m\n"
@grep -Eh '^[a-zA-Z_-]+:.*?##3 .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##3 "}; {printf "\033[32m - %-30s\033[0m %s\n", $$1, $$2}'
@echo "--------------------------------------------------------------------------------------------"
@printf "\033[35mOthers:\033[0m\n"
@grep -Eh '^[a-zA-Z_-]+:.*?##4 .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##4 "}; {printf "\033[35m - %-30s\033[0m %s\n", $$1, $$2}'

#--------------------------------------------------------------------------------

services: ##1 services
$(EXECUTE) services

status: ##1 status
$(EXECUTE) status

list-translations: ##1 list:translations
$(EXECUTE) list:translations

list-translation-keys: ##1 list:translation-keys
$(EXECUTE) list:translation-keys

#--------------------------------------------------------------------------------

validate-all: ##2 validate:all
$(EXECUTE) validate:all --report-format=$(REPORT_FORMAT) --report-output=./tests/playground/$(FOLDER)/.exports

validate-mess: ##2 validate:mess
$(EXECUTE) validate:mess --report-format=$(REPORT_FORMAT) --report-output=./tests/playground/$(FOLDER)/.exports

validate-coverage: ##2 validate:coverage
$(EXECUTE) validate:coverage

validate-structure: ##2 validate:structure
$(EXECUTE) validate:structure

validate-spelling: ##2 validate:spelling
$(EXECUTE) validate:spelling --service=$(SPELLING_SERVICE)

validate-similarity: ##2 validate:similarity
$(EXECUTE) validate:similarity

#--------------------------------------------------------------------------------

export: ##3 export
$(EXECUTE) export --format=$(EXPORT_FORMAT) --dir=./tests/playground/$(FOLDER)/.exports

import: ##3 import
$(EXECUTE) import --format=$(EXPORT_FORMAT) --dir=./tests/playground/$(FOLDER)/.exports

#--------------------------------------------------------------------------------

fix-structure: ##4 fix:structure
$(EXECUTE) fix:structure

fix-mess: ##4 fix:mess
$(EXECUTE) fix:mess

fix-spelling: ## fix:spelling
$(EXECUTE) fix:spelling --service=$(SPELLING_SERVICE)

translate: ##4 translate
$(EXECUTE) translate --service=$(TRANSLATION_SERVICE)

migrate: ##4 migrate
$(EXECUTE) migrate --output=json

scan: ##4 scan
$(EXECUTE) scan:usage --dir=./tests/playground/json/templates --scanner=mjml --verbose
38 changes: 2 additions & 36 deletions tests/playground/php/makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,5 @@
# Makefile Project

.PHONY: help
.DEFAULT_GOAL := help
FOLDER := php

include ../makefile

#------------------------------------------------------------------------------------------------

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

#------------------------------------------------------------------------------------------------

status: ## Status command
cd ../../.. && php bin/phpunuhi status --configuration=./tests/playground/php/phpunuhi.xml

list: ## List available translation IDs
cd ../../.. && php bin/phpunuhi list:translations --configuration=./tests/playground/ini/phpunuhi.xml

validate: ## Validate command
cd ../../.. && php bin/phpunuhi validate --configuration=./tests/playground/php/phpunuhi.xml --report-format=junit --report-output=./tests/playground/php/.exports/junit.xml

validate-json: ## Validate command with json report
cd ../../.. && php bin/phpunuhi validate --configuration=./tests/playground/php/phpunuhi.xml --report-format=json --report-output=./tests/playground/php/.exports/report.json

csv: ## Exports a CSV
cd ../../.. && php bin/phpunuhi export --configuration=./tests/playground/php/phpunuhi.xml --format=csv --dir=./tests/playground/php/.exports

structure: ## Fix Structure
cd ../../.. && php bin/phpunuhi fix:structure --configuration=./tests/playground/php/phpunuhi.xml

html: ## Exports a HTML
cd ../../.. && php bin/phpunuhi export --configuration=./tests/playground/php/phpunuhi.xml --format=html --dir=./tests/playground/php/.exports

translate: ## Translate
cd ../../.. && php bin/phpunuhi translate --configuration=./tests/playground/php/phpunuhi.xml --service=googleweb

migrate: ## Migrate command
cd ../../.. && php bin/phpunuhi migrate --configuration=./tests/playground/php/phpunuhi.xml --output=json
2 changes: 1 addition & 1 deletion tests/playground/php/phpunuhi.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/phpunuhi.xsd"
xsi:noNamespaceSchemaLocation="../../../schema/dev-main.xsd"
>

<translations>
Expand Down
29 changes: 2 additions & 27 deletions tests/playground/po/makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
# Makefile Project

.PHONY: help
.DEFAULT_GOAL := help
FOLDER := po

include ../makefile

#------------------------------------------------------------------------------------------------

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

#------------------------------------------------------------------------------------------------

status: ## Status command
cd ../../.. && php bin/phpunuhi status --configuration=./tests/playground/po/phpunuhi.xml

list: ## List Translate
cd ../../.. && php bin/phpunuhi list:translations --configuration=./tests/playground/po/phpunuhi.xml

validate: ## Validate command
cd ../../.. && php bin/phpunuhi validate --configuration=./tests/playground/po/phpunuhi.xml --report-format=junit --report-output=./tests/playground/po/.exports/junit.xml

structure: ## Fix Structure
cd ../../.. && php bin/phpunuhi fix:structure --configuration=./tests/playground/po/phpunuhi.xml

translate: ## Translate
cd ../../.. && php bin/phpunuhi translate --configuration=./tests/playground/po/phpunuhi.xml --service=googleweb

migrate: ## Migrate command
cd ../../.. && php bin/phpunuhi migrate --configuration=./tests/playground/po/phpunuhi.xml --output=json
2 changes: 1 addition & 1 deletion tests/playground/po/phpunuhi.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/phpunuhi.xsd"
xsi:noNamespaceSchemaLocation="../../../schema/dev-main.xsd"
>

<translations>
Expand Down
26 changes: 2 additions & 24 deletions tests/playground/resx/makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
# Makefile Project

.PHONY: help
.DEFAULT_GOAL := help
FOLDER := resx

include ../makefile

#------------------------------------------------------------------------------------------------

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

#------------------------------------------------------------------------------------------------

status: ## Status command
cd ../../.. && php bin/phpunuhi status --configuration=./tests/playground/resx/phpunuhi.xml

list: ## List available translation IDs
cd ../../.. && php bin/phpunuhi list:translations --configuration=./tests/playground/resx/phpunuhi.xml

fix-structure: ## Fix Keys
cd ../../.. && php bin/phpunuhi fix:structure --configuration=./tests/playground/resx/phpunuhi.xml

validate: ## Validate command
cd ../../.. && php bin/phpunuhi validate --configuration=./tests/playground/resx/phpunuhi.xml --report-format=junit --report-output=./tests/playground/resx/.exports/junit.xml

translate: ## Translate
cd ../../.. && php bin/phpunuhi translate --configuration=./tests/playground/resx/phpunuhi.xml --service=googleweb
2 changes: 1 addition & 1 deletion tests/playground/resx/phpunuhi.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<phpunuhi
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../config.xsd"
xsi:noNamespaceSchemaLocation="../../../schema/dev-main.xsd"
>
<translations>

Expand Down
Loading

0 comments on commit ec0b4fb

Please sign in to comment.