Skip to content

Commit 78a4c73

Browse files
chore: update mago
1 parent d8ca40a commit 78a4c73

File tree

8 files changed

+57
-58
lines changed

8 files changed

+57
-58
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"orchestra/testbench": "^9.0",
1818
"pestphp/pest": "^3.0",
1919
"pestphp/pest-plugin-laravel": "^3.0",
20-
"carthage-software/mago": "1.0.0-beta.2"
20+
"carthage-software/mago": "1.0.0-beta.5"
2121
},
2222
"autoload": {
2323
"psr-4": {

src/Http/Controllers/UploadController.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ public function __invoke(
2121
BackupRepository $repo,
2222
Backuper $backuper,
2323
): JsonResponse {
24-
return $chunky->put(ChunkyUploadDto::fromRequest($request), onCompleted: function (string $completeFile) use (
25-
$repo,
26-
$backuper,
27-
): void {
28-
$backup = $repo->add($completeFile);
24+
return $chunky->put(
25+
ChunkyUploadDto::fromRequest($request),
26+
onCompleted: function (string $completeFile) use ($repo, $backuper): void {
27+
$backup = $repo->add($completeFile);
2928

30-
$backuper->addMetaFromZipToBackupMeta($completeFile, $backup);
29+
$backuper->addMetaFromZipToBackupMeta($completeFile, $backup);
3130

32-
$backuper->enforceMaxBackups();
33-
});
31+
$backuper->enforceMaxBackups();
32+
},
33+
);
3434
}
3535

3636
public function test(Request $request, Chunky $chunky): JsonResponse

src/Pipes/Assets.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,24 @@ public static function getKey(): string
2222

2323
public function restore(string $restoringFromPath, Closure $next): string
2424
{
25-
AssetContainer::all()
26-
->filter(static::isLocal(...))
27-
->each(function (Container $container) use ($restoringFromPath): void {
28-
File::cleanDirectory($container->diskPath());
29-
File::copyDirectory(
30-
"{$this->getDirectoryPath($restoringFromPath)}/{$container->handle()}",
31-
$container->diskPath(),
32-
);
33-
});
25+
AssetContainer::all()->filter(static::isLocal(...))->each(function (Container $container) use (
26+
$restoringFromPath,
27+
): void {
28+
File::cleanDirectory($container->diskPath());
29+
File::copyDirectory(
30+
"{$this->getDirectoryPath($restoringFromPath)}/{$container->handle()}",
31+
$container->diskPath(),
32+
);
33+
});
3434

3535
return $next($restoringFromPath);
3636
}
3737

3838
public function backup(Zipper $zip, Closure $next): Zipper
3939
{
40-
AssetContainer::all()
41-
->filter(static::isLocal(...))
42-
->each(function (Container $container) use ($zip): void {
43-
$zip->addDirectory($container->diskPath(), static::getKey() . '/' . $container->handle());
44-
});
40+
AssetContainer::all()->filter(static::isLocal(...))->each(function (Container $container) use ($zip): void {
41+
$zip->addDirectory($container->diskPath(), static::getKey() . '/' . $container->handle());
42+
});
4543

4644
return $next($zip);
4745
}

src/Pipes/StacheData.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,18 @@ public function backup(Zipper $zip, Closure $next): Zipper
4646
->filter(static::shouldBackupStore(...))
4747
->filter(static::storeHasSafeDirectory(...))
4848
->filter(fn(Store $store) => File::isDirectory($store->directory()))
49-
->whenNotEmpty(
50-
function (Collection $stores) use ($zip, $next): Zipper {
51-
$stores->each(fn(Store $store) => $zip->addDirectory(
52-
path: realpath($store->directory()),
53-
prefix: static::prefixer($store),
54-
));
49+
->whenNotEmpty(function (Collection $stores) use ($zip, $next): Zipper {
50+
$stores->each(fn(Store $store) => $zip->addDirectory(
51+
path: realpath($store->directory()),
52+
prefix: static::prefixer($store),
53+
));
5554

56-
return $next($zip);
57-
},
58-
default: fn() => $this->skip(
59-
reason: 'No stores found to backup, is the Stache configured correctly?',
60-
next: $next,
61-
zip: $zip,
62-
),
63-
);
55+
return $next($zip);
56+
}, default: fn() => $this->skip(
57+
reason: 'No stores found to backup, is the Stache configured correctly?',
58+
next: $next,
59+
zip: $zip,
60+
));
6461
}
6562

6663
private static function prefixer(Store $store): string

src/ServiceProvider.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,19 @@ private function configureNavigation(): void
9494
private function configurePermissions(): void
9595
{
9696
Permission::extend(static function (PermissionContract $permission): void {
97-
$permission->group('itiden-backup', 'Backup', static fn() => $permission
98-
->register('manage backups')
99-
->label('Manage Backups')
100-
->children([
101-
$permission->make('create backups')->label('Create Backups'),
102-
$permission->make('restore backups')->label('Restore From Backups'),
103-
$permission->make('download backups')->label('Download Backups'),
104-
$permission->make('delete backups')->label('Delete Backups'),
105-
]));
97+
$permission->group(
98+
'itiden-backup',
99+
'Backup',
100+
static fn() => $permission
101+
->register('manage backups')
102+
->label('Manage Backups')
103+
->children([
104+
$permission->make('create backups')->label('Create Backups'),
105+
$permission->make('restore backups')->label('Restore From Backups'),
106+
$permission->make('download backups')->label('Download Backups'),
107+
$permission->make('delete backups')->label('Delete Backups'),
108+
]),
109+
);
106110
});
107111
}
108112
}

tests/Unit/BackuperTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
->extractTo($unzipped, config('backup.password'))
5656
->close();
5757

58-
$paths = collect(File::allFiles($unzipped))
59-
->map(fn(SplFileInfo $file) => $file->getRelativePathname())
60-
->toArray();
58+
$paths = collect(File::allFiles($unzipped))->map(
59+
fn(SplFileInfo $file) => $file->getRelativePathname(),
60+
)->toArray();
6161

6262
expect($paths)->toEqualCanonicalizing([
6363
// since the default collection store and entries store have the same directory, we will get duplicates.
@@ -89,9 +89,9 @@
8989
->extractTo($unzipped, config('backup.password'))
9090
->close();
9191

92-
$paths = collect(File::allFiles($unzipped))
93-
->map(fn(SplFileInfo $file) => $file->getRelativePathname())
94-
->toArray();
92+
$paths = collect(File::allFiles($unzipped))->map(
93+
fn(SplFileInfo $file) => $file->getRelativePathname(),
94+
)->toArray();
9595

9696
expect($paths)->toEqualCanonicalizing([
9797
'stache-content::form-submissions/1743066599.5568.yaml',

tests/Unit/ChunkyTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@
4545
$uploadedFile = null;
4646

4747
$responses = $dtos->map(function (ChunkyUploadDto $r) use (&$uploadedFile): JsonResponse {
48-
return app(Chunky::class)
49-
->put($r, onCompleted: function (string $file) use (&$uploadedFile): void {
50-
$uploadedFile = $file;
51-
});
48+
return app(Chunky::class)->put($r, onCompleted: function (string $file) use (&$uploadedFile): void {
49+
$uploadedFile = $file;
50+
});
5251
});
5352

5453
expect($responses->every(fn(JsonResponse $res): bool => $res->getStatusCode() === 201))->toBeTrue();

tests/Unit/ZipperTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@
7474
});
7575

7676
it('can unzip directory', function (): void {
77-
$files = collect(File::allFiles(fixtures_path('content/collections')))
78-
->map(fn(SplFileInfo $file): string => $file->getPathname());
77+
$files = collect(File::allFiles(fixtures_path('content/collections')))->map(
78+
fn(SplFileInfo $file): string => $file->getPathname(),
79+
);
7980

8081
$target = storage_path('test.zip');
8182

0 commit comments

Comments
 (0)