Skip to content

Commit

Permalink
chore: theme install
Browse files Browse the repository at this point in the history
  • Loading branch information
jevantang committed Mar 13, 2023
1 parent 5c98cbb commit 6b2abaa
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Commands/ThemeInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ThemeInstallCommand extends Command
{
protected $signature = 'theme:install {path}
{--seed}
{--is_dir}
';

protected $description = 'Install the theme from the specified path';
Expand All @@ -24,6 +25,29 @@ public function handle()
{
try {
$path = $this->argument('path');

if ($this->option('is_dir')) {
$pluginDirectory = $path;

if (strpos($pluginDirectory, '/') == false) {
$pluginDirectory = "extensions/themes/{$pluginDirectory}";
}

if (str_starts_with($pluginDirectory, '/')) {
$pluginDirectory = realpath($pluginDirectory);
} else {
$pluginDirectory = realpath(base_path($pluginDirectory));
}

$path = $pluginDirectory;
}

if (!$path || !file_exists($path)) {
$this->error('Failed to unzip, couldn\'t find the theme path');

return Command::FAILURE;
}

$extensionPath = str_replace(base_path().'/', '', config('themes.paths.themes'));
if (! str_contains($path, $extensionPath)) {
$exitCode = $this->call('theme:unzip', [
Expand Down

0 comments on commit 6b2abaa

Please sign in to comment.