Add a custom utility plugin

This commit is contained in:
Yuri Sizov
2022-12-07 18:42:21 +03:00
parent 5b1bf67c6d
commit a9cbd34d64
8 changed files with 74 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ jobs:
# Copy project files.
cp -r ../themes/* themes
cp -r ../plugins/* plugins
cp -r ../docker/php/config/* config
# Fix up the config for CI.
sed -i "s/'host' => 'mariadb'/'host' => 'localhost'/g" config/database.php

2
.gitignore vendored
View File

@@ -21,6 +21,8 @@ node_modules
# Winter CMS files
# Themes
!/themes
# Custom plugins
!/plugins
# Docker
/docker/mariadb/init/*.sql

View File

@@ -8,6 +8,7 @@
!/.github/
!/docker/
!/themes/
!/plugins/
!/ISSUE_TEMPLATE.md
!/README.md
!/lighthouserc.js

View File

@@ -34,3 +34,4 @@ services:
- "8080:80"
volumes:
- ../themes/godotengine:/var/www/html/themes/godotengine
- ../plugins/godotengine:/var/www/html/plugins/godotengine

View File

@@ -21,6 +21,8 @@ if [ ! -e $CONTAINER_ALREADY_STARTED ]; then
php artisan plugin:install "pikanji.agent"
php artisan plugin:install "rainlab.blog"
php artisan plugin:install "sobored.rss"
# Make sure custom plugins are properly initialized.
php artisan plugin:refresh "godotengine.utility"
echo "Updating file permissions for newly created files..."
chown www-data:www-data -R .

View File

@@ -0,0 +1,21 @@
<?php
namespace GodotEngine\Utility;
class Plugin extends \System\Classes\PluginBase
{
public function pluginDetails()
{
return [
'name' => 'GodotEngine Utility',
'description' => 'Provides utility functions for Godot Engine website.',
'author' => 'Godot Engine',
'icon' => 'icon-leaf',
'homepage' => 'https://godotengine.org'
];
}
public function register()
{
$this->registerConsoleCommand('godotengine.ping', 'GodotEngine\Utility\Console\Ping');
}
}

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,45 @@
<?php namespace GodotEngine\Utility\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class Ping extends Command
{
/**
* @var string The console command name.
*/
protected $name = 'godotengine:ping';
/**
* @var string The console command description.
*/
protected $description = 'Ping the plugin to make sure it is working.';
/**
* Get the console command arguments.
* @return array
*/
protected function getArguments()
{
return [];
}
/**
* Get the console command options.
* @return array
*/
protected function getOptions()
{
return [];
}
/**
* Execute the console command.
* @return void
*/
public function handle()
{
$this->output->writeln('GodotEngine.Utility pongs in response!');
}
}