Init
This commit is contained in:
commit
60ca58f5ba
80 changed files with 9458 additions and 0 deletions
9
lib/project-types/GenericProject.php
Normal file
9
lib/project-types/GenericProject.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/ProjectTypeBase.php';
|
||||
|
||||
class GenericProject extends ProjectTypeBase {
|
||||
public static function typeSlug(): string { return 'generic'; }
|
||||
public static function typeName(): string { return 'Generic'; }
|
||||
public static function typeIcon(): string { return 'bi-folder'; }
|
||||
public static function description(): string { return 'Generic project directory'; }
|
||||
}
|
||||
29
lib/project-types/HexoProject.php
Normal file
29
lib/project-types/HexoProject.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/ProjectTypeBase.php';
|
||||
|
||||
class HexoProject extends ProjectTypeBase {
|
||||
public static function typeSlug(): string { return 'hexo'; }
|
||||
public static function typeName(): string { return 'Hexo'; }
|
||||
public static function typeIcon(): string { return 'bi-hexagon-fill'; }
|
||||
public static function description(): string { return 'Hexo static site generator'; }
|
||||
|
||||
public static function tabs(): array {
|
||||
return ['dashboard', 'analytics', 'posts', 'config', 'files',
|
||||
'run', 'themes', 'plugins', 'git',
|
||||
'notes', 'settings'];
|
||||
}
|
||||
|
||||
public static function commands(): array {
|
||||
return [
|
||||
['id' => 'generate', 'label' => 'Generate', 'cmd' => 'hexo generate'],
|
||||
['id' => 'clean', 'label' => 'Clean', 'cmd' => 'hexo clean'],
|
||||
['id' => 'deploy', 'label' => 'Deploy', 'cmd' => 'hexo deploy'],
|
||||
['id' => 'version', 'label' => 'Hexo version','cmd' => 'hexo version'],
|
||||
];
|
||||
}
|
||||
|
||||
public static function detectFromPath(string $path): bool {
|
||||
return file_exists($path . '/_config.yml')
|
||||
&& (is_dir($path . '/source') || is_dir($path . '/themes'));
|
||||
}
|
||||
}
|
||||
25
lib/project-types/ProjectTypeBase.php
Normal file
25
lib/project-types/ProjectTypeBase.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
abstract class ProjectTypeBase {
|
||||
abstract public static function typeSlug(): string;
|
||||
abstract public static function typeName(): string;
|
||||
abstract public static function typeIcon(): string;
|
||||
|
||||
/** Tabs shown on the project page, in order */
|
||||
public static function tabs(): array {
|
||||
return ['dashboard', 'analytics', 'files', 'notes', 'settings'];
|
||||
}
|
||||
|
||||
/** Whitelisted commands available in the command runner */
|
||||
public static function commands(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
/** Return true if this type can be auto-detected from the given path */
|
||||
public static function detectFromPath(string $path): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function description(): string {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
17
lib/project-types/StorageProject.php
Normal file
17
lib/project-types/StorageProject.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/ProjectTypeBase.php';
|
||||
|
||||
class StorageProject extends ProjectTypeBase {
|
||||
public static function typeSlug(): string { return 'storage'; }
|
||||
public static function typeName(): string { return 'Storage'; }
|
||||
public static function typeIcon(): string { return 'bi-hdd'; }
|
||||
public static function description(): string { return 'File storage directory'; }
|
||||
|
||||
public static function tabs(): array {
|
||||
return ['dashboard', 'analytics', 'media', 'files', 'notes', 'settings'];
|
||||
}
|
||||
|
||||
public static function detectFromPath(string $path): bool {
|
||||
return is_dir($path . '/uploads') || is_dir($path . '/files') || is_dir($path . '/storage');
|
||||
}
|
||||
}
|
||||
17
lib/project-types/WebsiteProject.php
Normal file
17
lib/project-types/WebsiteProject.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/ProjectTypeBase.php';
|
||||
|
||||
class WebsiteProject extends ProjectTypeBase {
|
||||
public static function typeSlug(): string { return 'website'; }
|
||||
public static function typeName(): string { return 'Website'; }
|
||||
public static function typeIcon(): string { return 'bi-globe'; }
|
||||
public static function description(): string { return 'Static or PHP website'; }
|
||||
|
||||
public static function tabs(): array {
|
||||
return ['dashboard', 'analytics', 'files', 'git', 'notes', 'settings'];
|
||||
}
|
||||
|
||||
public static function detectFromPath(string $path): bool {
|
||||
return file_exists($path . '/index.html') || file_exists($path . '/index.php');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue