Skip to content

Commit

Permalink
feat: Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
seebeen committed Sep 24, 2023
1 parent 7308fb5 commit db89c63
Show file tree
Hide file tree
Showing 12 changed files with 2,547 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.php]
indent_size = 4

[phpcs.xml]
indent_size = 4
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.phpcs.xml export-ignore
CHANGELOG.md export-ignore
composer.lock export-ignore
4 changes: 4 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"]
}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.OBLAK_BOT_TOKEN }}
- name: Publish a composer package
uses: better-php-actions/publish-composer-package@v1
with:
package_slug: "whmcs-dev-helper"
package_name: "WHMCS Development Helper"
with_gpg: true
gpg_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
release_token: ${{ secrets.OBLAK_BOT_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode
vendor
34 changes: 34 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<ruleset name="composer-installer">
<description>Coding standards for AutoConstructor Composer Plugin</description>

<arg name="extensions" value="php"/>
<!-- Show sniff codes in all reports, and progress when running -->
<arg value="sp"/>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="."/>

<file>.</file>
<exclude-pattern>*/.git*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>

<rule ref="PSR12"/>
<rule ref="PSR1"/>

<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="40" />
</properties>
</rule>

<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>*/tests/bootstrap\.php$</exclude-pattern>
</rule>

<!-- Fixture method names in the test classes will be in snake_case because of the PHPUnit Polyfills. -->
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>*/tests/</exclude-pattern>
</rule>

</ruleset>
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div align="center">

# WHMCS Dev Helper

</div>

Composer module which makes your WHMCS Module development easier 😊
9 changes: 9 additions & 0 deletions bin/module-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e

find ./modules/ -mindepth 2 -maxdepth 2 -type d | while read -r dir; do
if [ -f "$dir/composer.json" ]; then
printf "Installing Composer modules for: %s\n" "$(basename "$dir")"
composer --working-dir="$dir" install --quiet --no-dev --no-interaction --no-suggest
fi
done
24 changes: 24 additions & 0 deletions bin/pack
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e

rm -rf build && mkdir build

while IFS= read -r MODULE_PATH
do
MODULE_PATH="${MODULE_PATH%%/*}"
mkdir -p "build/$MODULE_PATH"
cp -ar "$MODULE_PATH/" "build/"
done < .manifest

cp .manifest build/
find "$(dirname "$(find build/modules -mindepth 2 -maxdepth 3 -type f -name composer.json)")" -name "composer.*" -type f -exec rm -f {} \;

cp scripts/install build/

MODULE_NAME="$(basename "$(pwd)")"

pushd build

zip -qr "../$MODULE_NAME.zip" .

popd && rm -rf build
46 changes: 46 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "oblak/whmcs-dev-helper",
"description": "Development utilities for WHMCS modules",
"type": "composer-plugin",
"version": "1.0.0",
"license": "MIT",
"authors": [
{
"name": "Sibin Grasic",
"email": "[email protected]",
"homepage": "https://oblak.host",
"role": "CTO"
},
{
"name": "Contributors",
"homepage": "https://github.com/oblakhost/whmcs-dev-helper/graphs/contributors"
}
],
"support": {
"issues": "https://github.com/oblakhost/whmcs-dev-helper/issues",
"source": "https://github.com/oblakhost/whmcs-dev-helper"
},
"bin": [
"bin/module-install",
"bin/pack"
],
"autoload": {
"psr-4": {
"Oblak\\Composer\\Plugin\\": "src"
}
},
"require": {
"php": "^8.0 | ^8.1",
"composer-plugin-api": "^2.0"
},
"require-dev": {
"composer/composer": "^2.0",
"oblak/whmcs-stubs": "^7.10"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"class": "\\Oblak\\Composer\\Plugin\\WHMCSDevPlugin"
},
"scripts": {}
}
Loading

0 comments on commit db89c63

Please sign in to comment.