Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3905064
D2544.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D2544.diff
View Options
diff --git a/Makefile b/Makefile
new file mode 100644
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,46 @@
+# -------------------------------------------------------------
+# Makefile for Keruald monorepo
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Keruald
+# Description: Generate repository needed files to start dev
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+RM=rm -f
+RMDIR=rm -rf
+
+GENERATED_FROM_TEMPLATES=phpcs.xml phpunit.xml
+
+# -------------------------------------------------------------
+# Main targets
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+all: build-dev build-repo
+
+clean: clean-dev clean-repo
+
+regenerate: clean-repo build-repo clean-dev build-dev
+
+# -------------------------------------------------------------
+# Build targets for libraries development
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+build-dev: vendor
+
+clean-dev:
+ ${RMDIR} vendor
+
+vendor:
+ composer update
+
+# -------------------------------------------------------------
+# Build targets for monorepo maintenance
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+build-repo: $(GENERATED_FROM_TEMPLATES)
+
+clean-repo:
+ ${RM} $(GENERATED_FROM_TEMPLATES)
+
+$(GENERATED_FROM_TEMPLATES):
+ _utils/templates/resolve.py _templates/$@.in > $@
diff --git a/_templates/phpcs.xml.in b/_templates/phpcs.xml.in
new file mode 100644
--- /dev/null
+++ b/_templates/phpcs.xml.in
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ =============================================================
+ PHP_CodeSniffer configuration
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Project: Keruald
+ License: Trivial work, not eligible to copyright
+ Source file: _templates/phpcs.xml.in
+ =============================================================
+
+ <auto-generated>
+ This file is automatically generated from a template.
+
+ Changes to this file may cause incorrect behavior
+ and will be lost if the state is redeployed.
+ </auto-generated>
+-->
+
+<ruleset name="Nasqueron">
+ <rule ref="vendor/nasqueron/codestyle/CodeSniffer/ruleset.xml" />
+
+ <!--
+ OmniTools exception
+ Allow dprint_r() and dieprint_r() legacy debug function names
+ -->
+ <rule ref="Generic.NamingConventions.CamelCapsFunctionName.NotCamelCaps">
+ <exclude-pattern>*/_register_to_global_space.php</exclude-pattern>
+ </rule>
+ {% for package in packages %}
+ <file>{{ package }}/src</file>
+ <file>{{ package }}/tests</file>
+ {% endfor %}
+</ruleset>
diff --git a/_templates/phpunit.xml.in b/_templates/phpunit.xml.in
new file mode 100644
--- /dev/null
+++ b/_templates/phpunit.xml.in
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ =============================================================
+ PHPUnit configuration
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Project: Keruald
+ License: Trivial work, not eligible to copyright
+ Source file: _templates/phpunit.xml.in
+ =============================================================
+
+ <auto-generated>
+ This file is automatically generated from a template.
+
+ Changes to this file may cause incorrect behavior
+ and will be lost if the state is redeployed.
+ </auto-generated>
+-->
+
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
+ bootstrap="vendor/autoload.php"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ stopOnFailure="false">
+ <php>
+ <ini name="display_errors" value="On" />
+ <ini name="display_startup_errors" value="On" />
+ <ini name="error_reporting" value="On" />
+ </php>
+ <testsuites>
+
+ {%- for package in packages %}
+ <testsuite name="Unit tests for keruald/{{ package }}">
+ <directory suffix="Test.php">./{{ package }}/tests</directory>
+ </testsuite>
+ {%- endfor %}
+ </testsuites>
+ <coverage processUncoveredFiles="true">
+ <include>
+
+ {%- for package in packages %}
+ <directory suffix=".php">{{ package }}/src/</directory>
+ {%- endfor %}
+ </include>
+ </coverage>
+</phpunit>
diff --git a/_utils/templates/resolve.py b/_utils/templates/resolve.py
new file mode 100755
--- /dev/null
+++ b/_utils/templates/resolve.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+
+# -------------------------------------------------------------
+# Generate a template from relevant metadata
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Keruald
+# Description: Generate a template from metadata
+# License: BSD-2-Clause
+# Dependencies: Jinja2
+# -------------------------------------------------------------
+
+
+import sys
+import yaml
+from jinja2 import Environment, FileSystemLoader
+
+
+METADATA_FILE = "metadata.yml"
+
+
+# -------------------------------------------------------------
+# Template
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def prepare_template_engine():
+ return Environment(
+ loader=FileSystemLoader('.')
+ )
+
+
+def get_metadata(metadata_path):
+ return yaml.safe_load(open(metadata_path))
+
+
+def generate_template(template_path, metadata_path):
+ env = prepare_template_engine()
+ template = env.get_template(template_path)
+
+ return template.render(get_metadata(metadata_path))
+
+
+# -------------------------------------------------------------
+# Application entry point
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+def run(template_path):
+ content = generate_template(template_path, METADATA_FILE)
+ print(content)
+
+
+if __name__ == "__main__":
+ argc = len(sys.argv)
+
+ if argc < 2:
+ print(f"Usage: {sys.argv[0]} <argument>", file=sys.stderr)
+ sys.exit(1)
+
+ run(sys.argv[1])
diff --git a/metadata.yml b/metadata.yml
new file mode 100644
--- /dev/null
+++ b/metadata.yml
@@ -0,0 +1,34 @@
+# -------------------------------------------------------------
+# Metadata for Keruald packages
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Keruald
+# Description: Configuration for utilities
+# License: Trivial work, not eligible to copyright.
+#
+# If eligible, this data is made available under
+# the Public Domain Dedication and License v1.0
+# whose full text can be found at:
+# http://opendatacommons.org/licenses/pddl/1.0/
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Packages
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Each package matches the following artifacts:
+#
+# — a subdirectory here
+# — a main repository on DevCentral
+# — a mirror repository on GitHub in keruald/ organization
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+packages:
+ - commands
+ - database
+ - omnitools
+ - report
+
+packages_namespaces:
+ commands: Keruald\Commands
+ database: Keruald\Database
+ omnitools: Keruald\OmniTools
+ report: Keruald\Reporting
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+
+<!--
+ =============================================================
+ PHP_CodeSniffer configuration
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Project: Keruald
+ License: Trivial work, not eligible to copyright
+ Source file: _templates/phpcs.xml.in
+ =============================================================
+
+ <auto-generated>
+ This file is automatically generated from a template.
+
+ Changes to this file may cause incorrect behavior
+ and will be lost if the state is redeployed.
+ </auto-generated>
+-->
+
+<ruleset name="Nasqueron">
+ <rule ref="vendor/nasqueron/codestyle/CodeSniffer/ruleset.xml" />
+
+ <!--
+ OmniTools exception
+ Allow dprint_r() and dieprint_r() legacy debug function names
+ -->
+ <rule ref="Generic.NamingConventions.CamelCapsFunctionName.NotCamelCaps">
+ <exclude-pattern>*/_register_to_global_space.php</exclude-pattern>
+ </rule>
+
+ <file>commands/src</file>
+ <file>commands/tests</file>
+
+ <file>database/src</file>
+ <file>database/tests</file>
+
+ <file>omnitools/src</file>
+ <file>omnitools/tests</file>
+
+ <file>report/src</file>
+ <file>report/tests</file>
+
+</ruleset>
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ =============================================================
+ PHPUnit configuration
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ Project: Keruald
+ License: Trivial work, not eligible to copyright
+ Source file: _templates/phpunit.xml.in
+ =============================================================
+
+ <auto-generated>
+ This file is automatically generated from a template.
+
+ Changes to this file may cause incorrect behavior
+ and will be lost if the state is redeployed.
+ </auto-generated>
+-->
+
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
+ bootstrap="vendor/autoload.php"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ stopOnFailure="false">
+ <php>
+ <ini name="display_errors" value="On" />
+ <ini name="display_startup_errors" value="On" />
+ <ini name="error_reporting" value="On" />
+ </php>
+ <testsuites>
+ <testsuite name="Unit tests for keruald/commands">
+ <directory suffix="Test.php">./commands/tests</directory>
+ </testsuite>
+ <testsuite name="Unit tests for keruald/database">
+ <directory suffix="Test.php">./database/tests</directory>
+ </testsuite>
+ <testsuite name="Unit tests for keruald/omnitools">
+ <directory suffix="Test.php">./omnitools/tests</directory>
+ </testsuite>
+ <testsuite name="Unit tests for keruald/report">
+ <directory suffix="Test.php">./report/tests</directory>
+ </testsuite>
+ </testsuites>
+ <coverage processUncoveredFiles="true">
+ <include>
+ <directory suffix=".php">commands/src/</directory>
+ <directory suffix=".php">database/src/</directory>
+ <directory suffix=".php">omnitools/src/</directory>
+ <directory suffix=".php">report/src/</directory>
+ </include>
+ </coverage>
+</phpunit>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 18, 23:01 (2 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2305693
Default Alt Text
D2544.diff (11 KB)
Attached To
Mode
D2544: Configure PHPUnit and PHP_CodeSniffer
Attached
Detach File
Event Timeline
Log In to Comment