Skip to content

Commit 5eae177

Browse files
Merge branch 'feature/installer' of https://github.com/mooxphp/moox into feature/installer
2 parents 0a0c778 + 9720e59 commit 5eae177

16 files changed

+55
-77
lines changed

packages/core/config/moox-installer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,3 @@
113113
'after_plugins' => null,
114114
],
115115
];
116-

packages/core/src/Console/Commands/MooxInstallCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* Moox Package Installer Command.
24-
*
24+
*
2525
* A dynamic, configurable installer for Moox packages.
2626
* Supports:
2727
* - Custom installers via traits
@@ -405,4 +405,3 @@ public function getRegistry(): InstallerRegistry
405405
return $this->registry;
406406
}
407407
}
408-

packages/core/src/Installer/AbstractAssetInstaller.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/**
1414
* Abstract base class for asset installers.
15-
*
15+
*
1616
* Provides common functionality for all asset installers including:
1717
* - Configuration management
1818
* - Item selection UI
@@ -239,10 +239,10 @@ protected function normalizeItemToString(mixed $item): ?string
239239

240240
/**
241241
* Publish assets for a package.
242-
*
243-
* @param string $packageName The composer package name (e.g., "moox/prompts")
244-
* @param string $type The asset type (e.g., "config", "migrations")
245-
* @param string|null $publishTag The exact publish tag from mooxInfo (e.g., "moox-prompts-config")
242+
*
243+
* @param string $packageName The composer package name (e.g., "moox/prompts")
244+
* @param string $type The asset type (e.g., "config", "migrations")
245+
* @param string|null $publishTag The exact publish tag from mooxInfo (e.g., "moox-prompts-config")
246246
*/
247247
protected function publishPackageAssets(string $packageName, string $type, ?string $publishTag = null): bool
248248
{
@@ -277,14 +277,12 @@ protected function publishPackageAssets(string $packageName, string $type, ?stri
277277

278278
$output = trim(Artisan::output());
279279

280-
281280
if ($result === 0 && ! str_contains($output, 'Nothing to publish')) {
282281
$published = true;
283282
break;
284-
}else{
283+
} else {
285284
note($output);
286285
}
287-
288286
} catch (\Exception $e) {
289287
continue;
290288
}
@@ -315,4 +313,3 @@ protected function getPackagePath(string $packageName): ?string
315313
return null;
316314
}
317315
}
318-

packages/core/src/Installer/Contracts/AssetInstallerInterface.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* Contract for asset installers.
7-
*
7+
*
88
* Implement this interface to create custom asset installers
99
* that can be registered with the Moox Installer.
1010
*/
@@ -39,17 +39,17 @@ public function checkExists(string $packageName, array $items): bool;
3939

4040
/**
4141
* Install the assets.
42-
*
43-
* @param array $assets Array of package assets with structure:
44-
* [['package' => string, 'data' => array, 'provider' => ?string], ...]
42+
*
43+
* @param array $assets Array of package assets with structure:
44+
* [['package' => string, 'data' => array, 'provider' => ?string], ...]
4545
* @return bool True if installation was successful
4646
*/
4747
public function install(array $assets): bool;
4848

4949
/**
5050
* Get items from mooxInfo for this installer type.
51-
*
52-
* @param array $mooxInfo The mooxInfo array from the service provider
51+
*
52+
* @param array $mooxInfo The mooxInfo array from the service provider
5353
* @return array The items relevant to this installer
5454
*/
5555
public function getItemsFromMooxInfo(array $mooxInfo): array;
@@ -71,4 +71,3 @@ public function getConfig(): array;
7171
*/
7272
public function setConfig(array $config): void;
7373
}
74-

packages/core/src/Installer/Contracts/PanelAwareInstallerInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* Contract for installers that need panel awareness.
7-
*
7+
*
88
* Implement this interface for installers that need to interact
99
* with Filament panels (e.g., plugin installers).
1010
*/
@@ -25,4 +25,3 @@ public function getPanelPath(): ?string;
2525
*/
2626
public function requiresPanelSelection(): bool;
2727
}
28-

packages/core/src/Installer/InstallerRegistry.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* Registry for managing asset installers.
14-
*
14+
*
1515
* This registry provides a centralized way to:
1616
* - Register custom installers
1717
* - Configure installer behavior
@@ -58,7 +58,7 @@ public static function resetInstance(): void
5858

5959
/**
6060
* Register the default installers.
61-
*
61+
*
6262
* Installers are only enabled if explicitly defined in the config.
6363
* If an installer is not in the config, it will be disabled by default.
6464
*/
@@ -78,12 +78,12 @@ protected function registerDefaultInstallers(): void
7878
// Only enable installer if it's explicitly defined in config
7979
$isConfigured = array_key_exists($type, $configuredInstallers);
8080
$config = $configuredInstallers[$type] ?? [];
81-
81+
8282
// If not in config, disable by default
8383
if (! $isConfigured) {
8484
$config['enabled'] = false;
8585
}
86-
86+
8787
$this->register($type, new $installerClass($config));
8888
}
8989
}
@@ -126,7 +126,7 @@ public function has(string $type): bool
126126

127127
/**
128128
* Get all registered installers.
129-
*
129+
*
130130
* @return array<string, AssetInstallerInterface>
131131
*/
132132
public function all(): array
@@ -136,15 +136,14 @@ public function all(): array
136136

137137
/**
138138
* Get all enabled installers sorted by priority.
139-
*
139+
*
140140
* @return array<string, AssetInstallerInterface>
141141
*/
142142
public function getEnabled(): array
143143
{
144144
$enabled = array_filter(
145145
$this->installers,
146-
fn (AssetInstallerInterface $installer, string $type) =>
147-
$installer->isEnabled() && ! ($this->skipped[$type] ?? false),
146+
fn (AssetInstallerInterface $installer, string $type) => $installer->isEnabled() && ! ($this->skipped[$type] ?? false),
148147
ARRAY_FILTER_USE_BOTH
149148
);
150149

@@ -331,4 +330,3 @@ public function without(array $types): self
331330
return $new;
332331
}
333332
}
334-

packages/core/src/Installer/Installers/ConfigInstaller.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use function Moox\Prompts\info;
99
use function Moox\Prompts\note;
10-
use function Moox\Prompts\warning;
1110

1211
/**
1312
* Installer for configuration files.
@@ -48,7 +47,7 @@ public function checkExists(string $packageName, array $items): bool
4847
// Handle both array format and string format
4948
$configName = is_array($configFile) ? ($configFile['name'] ?? '') : $configFile;
5049
$configPath = config_path($configName.'.php');
51-
50+
5251
if (File::exists($configPath)) {
5352
return true;
5453
}
@@ -101,7 +100,7 @@ public function install(array $assets): bool
101100
$published = true;
102101
$publishedPackages[] = $packageName;
103102
note(' ✅ Published');
104-
}
103+
}
105104
}
106105

107106
// Show summary

packages/core/src/Installer/Installers/MigrationInstaller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function checkExists(string $packageName, array $items): bool
5858
if (is_array($migrationName)) {
5959
$migrationName = $migrationName['name'] ?? '';
6060
}
61-
61+
6262
foreach ($existingFiles as $file) {
6363
$filename = $file->getFilename();
6464
// Remove timestamp prefix if exists (format: YYYY_MM_DD_HHMMSS_name.php)

packages/core/src/Installer/Installers/PluginInstaller.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,28 @@
22

33
namespace Moox\Core\Installer\Installers;
44

5+
use Filament\Support\Commands\Concerns\CanGeneratePanels;
6+
use Filament\Support\Commands\Concerns\CanManipulateFiles;
7+
use Illuminate\Support\Facades\File;
8+
use Moox\Core\Installer\AbstractAssetInstaller;
9+
use Moox\Core\Installer\Contracts\PanelAwareInstallerInterface;
10+
11+
use function Moox\Prompts\confirm;
512
use function Moox\Prompts\info;
13+
use function Moox\Prompts\multiselect;
614
use function Moox\Prompts\note;
7-
use function Moox\Prompts\text;
815
use function Moox\Prompts\select;
9-
10-
use function Moox\Prompts\confirm;
16+
use function Moox\Prompts\text;
1117
use function Moox\Prompts\warning;
12-
use Illuminate\Console\OutputStyle;
13-
use Illuminate\Support\Facades\File;
14-
use function Moox\Prompts\multiselect;
15-
use Filament\Commands\MakePanelCommand;
16-
use Illuminate\Support\Facades\Artisan;
17-
use Moox\Core\Installer\AbstractAssetInstaller;
18-
use Symfony\Component\Console\Input\ArrayInput;
19-
use Symfony\Component\Console\Output\ConsoleOutput;
20-
use Filament\Support\Commands\Concerns\CanGeneratePanels;
21-
use Filament\Support\Commands\Concerns\CanManipulateFiles;
22-
use Moox\Core\Installer\Contracts\PanelAwareInstallerInterface;
2318

2419
/**
2520
* Installer for Filament plugins.
2621
*/
2722
class PluginInstaller extends AbstractAssetInstaller implements PanelAwareInstallerInterface
2823
{
29-
3024
use CanGeneratePanels;
3125
use CanManipulateFiles;
26+
3227
protected ?string $panelPath = null;
3328

3429
protected $panelSelector = null;
@@ -368,4 +363,3 @@ protected function registerPluginsInPanel(array $pluginClasses, string $panelPat
368363
}
369364
}
370365
}
371-

packages/core/src/Installer/Installers/SeederInstaller.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,3 @@ protected function resolveSeederClass(string $packageName, string $seeder): ?str
155155
return null;
156156
}
157157
}
158-

0 commit comments

Comments
 (0)