latest bump for RAD
This commit is contained in:
12
composer.lock
generated
12
composer.lock
generated
@@ -57,16 +57,16 @@
|
||||
},
|
||||
{
|
||||
"name": "open-function-computers-llc/rad-theme-engine",
|
||||
"version": "v1.0.38",
|
||||
"version": "v1.0.39",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/open-function-computers-llc/rad-theme-engine.git",
|
||||
"reference": "90a351370bbd5a92a2c68c226a2c0cf3f97ce8f4"
|
||||
"reference": "587358e1af452967fc7a664c10354859b35c8de0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/open-function-computers-llc/rad-theme-engine/zipball/90a351370bbd5a92a2c68c226a2c0cf3f97ce8f4",
|
||||
"reference": "90a351370bbd5a92a2c68c226a2c0cf3f97ce8f4",
|
||||
"url": "https://api.github.com/repos/open-function-computers-llc/rad-theme-engine/zipball/587358e1af452967fc7a664c10354859b35c8de0",
|
||||
"reference": "587358e1af452967fc7a664c10354859b35c8de0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -98,9 +98,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/open-function-computers-llc/rad-theme-engine/issues",
|
||||
"source": "https://github.com/open-function-computers-llc/rad-theme-engine/tree/v1.0.38"
|
||||
"source": "https://github.com/open-function-computers-llc/rad-theme-engine/tree/v1.0.39"
|
||||
},
|
||||
"time": "2025-06-13T18:23:21+00:00"
|
||||
"time": "2025-06-27T18:09:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "salesforce/handlebars-php",
|
||||
|
||||
14
vendor/composer/installed.json
vendored
14
vendor/composer/installed.json
vendored
@@ -54,17 +54,17 @@
|
||||
},
|
||||
{
|
||||
"name": "open-function-computers-llc/rad-theme-engine",
|
||||
"version": "v1.0.38",
|
||||
"version_normalized": "1.0.38.0",
|
||||
"version": "v1.0.39",
|
||||
"version_normalized": "1.0.39.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/open-function-computers-llc/rad-theme-engine.git",
|
||||
"reference": "90a351370bbd5a92a2c68c226a2c0cf3f97ce8f4"
|
||||
"reference": "587358e1af452967fc7a664c10354859b35c8de0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/open-function-computers-llc/rad-theme-engine/zipball/90a351370bbd5a92a2c68c226a2c0cf3f97ce8f4",
|
||||
"reference": "90a351370bbd5a92a2c68c226a2c0cf3f97ce8f4",
|
||||
"url": "https://api.github.com/repos/open-function-computers-llc/rad-theme-engine/zipball/587358e1af452967fc7a664c10354859b35c8de0",
|
||||
"reference": "587358e1af452967fc7a664c10354859b35c8de0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -75,7 +75,7 @@
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"time": "2025-06-13T18:23:21+00:00",
|
||||
"time": "2025-06-27T18:09:19+00:00",
|
||||
"bin": [
|
||||
"bin/rad"
|
||||
],
|
||||
@@ -98,7 +98,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/open-function-computers-llc/rad-theme-engine/issues",
|
||||
"source": "https://github.com/open-function-computers-llc/rad-theme-engine/tree/v1.0.38"
|
||||
"source": "https://github.com/open-function-computers-llc/rad-theme-engine/tree/v1.0.39"
|
||||
},
|
||||
"install-path": "../open-function-computers-llc/rad-theme-engine"
|
||||
},
|
||||
|
||||
10
vendor/composer/installed.php
vendored
10
vendor/composer/installed.php
vendored
@@ -3,7 +3,7 @@
|
||||
'name' => 'open-function-computers-llc/wp-theme',
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'edcad561a551ed7689bc2ae7fb39e1cde81aba2e',
|
||||
'reference' => '8271fb1d62dd4e4d76646ca581c1be4b236c781d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -20,9 +20,9 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'open-function-computers-llc/rad-theme-engine' => array(
|
||||
'pretty_version' => 'v1.0.38',
|
||||
'version' => '1.0.38.0',
|
||||
'reference' => '90a351370bbd5a92a2c68c226a2c0cf3f97ce8f4',
|
||||
'pretty_version' => 'v1.0.39',
|
||||
'version' => '1.0.39.0',
|
||||
'reference' => '587358e1af452967fc7a664c10354859b35c8de0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../open-function-computers-llc/rad-theme-engine',
|
||||
'aliases' => array(),
|
||||
@@ -31,7 +31,7 @@
|
||||
'open-function-computers-llc/wp-theme' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'edcad561a551ed7689bc2ae7fb39e1cde81aba2e',
|
||||
'reference' => '8271fb1d62dd4e4d76646ca581c1be4b236c781d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
||||
@@ -30,6 +30,7 @@ $arguments = array_slice($argv, 2);
|
||||
|
||||
$availableCommands = [
|
||||
"get-icon" => \ofc\Commands\GetIconCommand::class,
|
||||
'make:action' => \ofc\Commands\MakeActionCommand::class,
|
||||
|
||||
// TODO: additional commands go below
|
||||
// "swap-library" => \ofc\Commands\LibrarySwap::class,
|
||||
|
||||
@@ -8,10 +8,9 @@ class GetIconCommand
|
||||
{
|
||||
public static function run(array $args): void
|
||||
{
|
||||
if (count($args) !== 1) {
|
||||
fwrite(STDERR, "Usage: rad get-icon <icon-name>\n");
|
||||
var_dump($args);
|
||||
exit(1);
|
||||
if (!isset($args[0]) || $args[0] === '--help') {
|
||||
echo self::getHelp().PHP_EOL;
|
||||
exit(!isset($args[0]) || $args[0] === '--help'? 0 : 1);
|
||||
}
|
||||
|
||||
$icon = trim(strtolower($args[0]));
|
||||
|
||||
85
vendor/open-function-computers-llc/rad-theme-engine/src/Commands/MakeActionCommand.php
vendored
Normal file
85
vendor/open-function-computers-llc/rad-theme-engine/src/Commands/MakeActionCommand.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace ofc\Commands;
|
||||
|
||||
use function get_template_directory;
|
||||
|
||||
class MakeActionCommand
|
||||
{
|
||||
public static function run(array $args): void
|
||||
{
|
||||
if (!isset($args[0]) || $args[0] === '--help') {
|
||||
echo self::getHelp().PHP_EOL;
|
||||
exit(!isset($args[0]) || $args[0] === '--help'? 0 : 1);
|
||||
}
|
||||
|
||||
$actionName = preg_replace('/[^A-Za-z]/', '', $args[0]);
|
||||
|
||||
$templateRoot = getcwd();
|
||||
$actionsDir = $templateRoot . DIRECTORY_SEPARATOR . 'actions';
|
||||
$filePath = $actionsDir . DIRECTORY_SEPARATOR . "{$actionName}Action.php";
|
||||
|
||||
if (!is_dir($actionsDir) && !mkdir($actionsDir, 0775, true)) {
|
||||
fwrite(STDERR, "Error: Could not create directory: $actionsDir\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (file_exists($filePath)) {
|
||||
fwrite(STDERR, "Error: Action already exists at $filePath\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$stub = <<<PHP
|
||||
<?php
|
||||
|
||||
namespace Actions;
|
||||
|
||||
use ofc\\RadAction;
|
||||
|
||||
class {$actionName}Action extends RadAction
|
||||
{
|
||||
/**
|
||||
* @var string WordPress hook to attach to.
|
||||
*/
|
||||
protected string \$hookName = '';
|
||||
|
||||
/**
|
||||
* @var int Hook priority.
|
||||
*/
|
||||
protected int \$priority = 10;
|
||||
|
||||
/**
|
||||
* Your action callback.
|
||||
*/
|
||||
public function callback()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
PHP;
|
||||
|
||||
if (file_put_contents($filePath, $stub) === false) {
|
||||
fwrite(STDERR, "Error: Unable to write file: $filePath\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Action created: $filePath".PHP_EOL;
|
||||
}
|
||||
|
||||
public static function getHelp(): string
|
||||
{
|
||||
return <<<HELP
|
||||
Usage:
|
||||
rad make:action <ActionName>
|
||||
|
||||
Description:
|
||||
Creates a new Action class inside your current WordPress theme:
|
||||
{theme}/actions/<ActionName>Action.php
|
||||
TODO: link to the docs page.
|
||||
|
||||
Example:
|
||||
rad make:action DoThisOnInit
|
||||
HELP;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user