Skip to content

Commit 018bd65

Browse files
committed
Rename options
1 parent 6a1275d commit 018bd65

File tree

5 files changed

+34
-30
lines changed

5 files changed

+34
-30
lines changed

src/Commands/InstallCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class InstallCommand extends Command
99
{
10-
protected $signature = 'hook:install {name} {version?} {--enable} {--without-migrating} {--without-seeding} {--without-publishing}';
10+
protected $signature = 'hook:install {name} {version?} {--enable} {--no-migrate} {--no-seed} {--no-publish}';
1111

1212
protected $description = 'Download and install a hook from remote https://larapack.io';
1313

@@ -32,9 +32,9 @@ public function handle()
3232
$this->hooks->install(
3333
$name,
3434
$this->argument('version'),
35-
!$this->option('without-migrating'),
36-
!$this->option('without-seeding'),
37-
!$this->option('without-publishing')
35+
!$this->option('no-migrate'),
36+
!$this->option('no-seed'),
37+
!$this->option('no-publish')
3838
);
3939

4040
if ($this->option('enable')) {

src/Commands/UninstallCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class UninstallCommand extends Command
99
{
10-
protected $signature = 'hook:uninstall {name} {--delete} {--without-unmigrating} {--without-unseeding} {--without-unpublishing}';
10+
protected $signature = 'hook:uninstall {name} {--delete} {--no-unmigrate} {--no-unseed} {--no-unpublish}';
1111

1212
protected $description = 'Uninstall a hook';
1313

@@ -32,9 +32,9 @@ public function handle()
3232
$this->hooks->uninstall(
3333
$name,
3434
$this->option('delete'),
35-
!$this->option('without-unmigrating'),
36-
!$this->option('without-unseeding'),
37-
!$this->option('without-unpublishing')
35+
!$this->option('no-unmigrate'),
36+
!$this->option('no-unseed'),
37+
!$this->option('no-unpublish')
3838
);
3939

4040
$this->info("Hook [{$name}] have been uninstalled.");

src/Commands/UpdateCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class UpdateCommand extends Command
99
{
10-
protected $signature = 'hook:update {name} {version?} {--without-migrating} {--without-seeding} {--without-publishing} {--force-publish}';
10+
protected $signature = 'hook:update {name} {version?} {--no-migrate} {--no-seed} {--no-publish} {--force}';
1111

1212
protected $description = 'Update a hook';
1313

@@ -38,10 +38,10 @@ public function handle()
3838
$updated = $this->hooks->update(
3939
$name,
4040
$version,
41-
!$this->option('without-migrating'),
42-
!$this->option('without-seeding'),
43-
!$this->option('without-publishing'),
44-
$this->option('force-publish')
41+
!$this->option('no-migrate'),
42+
!$this->option('no-seed'),
43+
!$this->option('no-publish'),
44+
$this->option('force')
4545
);
4646

4747
return $updated

src/Hooks.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,17 @@ public function uninstall($name, $delete = false, $unmigrate = true, $unseed = t
317317
*
318318
* @param $name
319319
* @param string|null $version
320+
* @param bool $migrate
321+
* @param bool $seed
322+
* @param bool $publish
323+
* @param bool $force
320324
*
321325
* @throws \Larapack\Hooks\Exceptions\HookNotFoundException
322326
* @throws \Larapack\Hooks\Exceptions\HookNotInstalledException
323327
*
324328
* @return bool
325329
*/
326-
public function update($name, $version, $migrate, $seed, $publish, $forcePublishing)
330+
public function update($name, $version, $migrate = true, $seed = true, $publish = true, $force = false)
327331
{
328332
// Check if hook exists
329333
if (!$this->downloaded($name)) {
@@ -348,7 +352,7 @@ public function update($name, $version, $migrate, $seed, $publish, $forcePublish
348352
}
349353
}
350354

351-
if (!$forcePublishing) {
355+
if (!$force) {
352356
$this->makeTemponaryBackup($this->hooks[$name]);
353357
}
354358

@@ -379,7 +383,7 @@ public function update($name, $version, $migrate, $seed, $publish, $forcePublish
379383
}
380384

381385
if ($publish) {
382-
$this->publishHook($this->hooks[$name], $forcePublishing);
386+
$this->publishHook($this->hooks[$name], $force);
383387
}
384388

385389
$this->clearTemponaryFiles();

tests/HooksTest.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,8 @@ public function test_installing_without_migrating_hook()
677677
$this->artisan('hook:install', [
678678
'name' => 'migrating-hook',
679679
'version' => 'v1.0.0',
680-
'--without-migrating' => true,
681-
'--without-seeding' => true,
680+
'--no-migrate' => true,
681+
'--no-seed' => true,
682682
]);
683683

684684
$this->assertFalse(Schema::hasTable('tests'));
@@ -729,7 +729,7 @@ public function test_uninstalling_without_unmigrating_hook()
729729
// Uninstall hook
730730
$this->artisan('hook:uninstall', [
731731
'name' => 'migrating-hook',
732-
'--without-unmigrating' => true,
732+
'--no-unmigrate' => true,
733733
]);
734734

735735
$this->assertTrue(Schema::hasTable('tests'));
@@ -795,8 +795,8 @@ public function test_updating_without_remigrating_hook()
795795
$this->artisan('hook:update', [
796796
'name' => 'migrating-hook',
797797
'version' => 'v2.0.0',
798-
'--without-migrating' => true,
799-
'--without-seeding' => true,
798+
'--no-migrate' => true,
799+
'--no-seed' => true,
800800
]);
801801

802802
$this->assertTrue(Schema::hasTable('tests'));
@@ -831,7 +831,7 @@ public function test_installing_without_seeding_hook()
831831
$this->artisan('hook:install', [
832832
'name' => 'migrating-hook',
833833
'version' => 'v1.0.0',
834-
'--without-seeding' => true,
834+
'--no-seed' => true,
835835
]);
836836

837837
$this->assertTrue(Schema::hasTable('tests'));
@@ -856,7 +856,7 @@ public function test_unseeding_hook()
856856
// Uninstall hook
857857
$this->artisan('hook:uninstall', [
858858
'name' => 'migrating-hook',
859-
'--without-unmigrating' => true,
859+
'--no-unmigrate' => true,
860860
]);
861861

862862
$this->assertTrue(Schema::hasTable('tests'));
@@ -881,8 +881,8 @@ public function test_uninstalling_without_unseeding()
881881
// Uninstall hook
882882
$this->artisan('hook:uninstall', [
883883
'name' => 'migrating-hook',
884-
'--without-unmigrating' => true,
885-
'--without-unseeding' => true,
884+
'--no-unmigrate' => true,
885+
'--no-unseed' => true,
886886
]);
887887

888888
$this->assertTrue(Schema::hasTable('tests'));
@@ -935,7 +935,7 @@ public function test_updating_without_reseeding()
935935
$this->artisan('hook:update', [
936936
'name' => 'migrating-hook',
937937
'version' => 'v2.0.0',
938-
'--without-seeding' => true,
938+
'--no-seed' => true,
939939
]);
940940

941941
$this->assertTrue(Schema::hasTable('tests'));
@@ -973,7 +973,7 @@ public function test_installing_without_publishing_assets()
973973
$this->artisan('hook:install', [
974974
'name' => 'migrating-hook',
975975
'version' => 'v1.0.0',
976-
'--without-publishing' => true,
976+
'--no-publish' => true,
977977
]);
978978

979979
$this->assertFalse($filesystem->exists(base_path('public/vendor')));
@@ -1061,7 +1061,7 @@ public function test_uninstalling_without_unpublishing_assets()
10611061
// Uninstall hook
10621062
$this->artisan('hook:uninstall', [
10631063
'name' => 'migrating-hook',
1064-
'--without-unpublishing' => true,
1064+
'--no-unpublish' => true,
10651065
]);
10661066

10671067
$this->assertTrue($filesystem->exists(base_path('public/vendor/migration-hook/assets')));
@@ -1127,7 +1127,7 @@ public function test_updating_without_republishing_assets()
11271127
$this->artisan('hook:update', [
11281128
'name' => 'migrating-hook',
11291129
'version' => 'v2.0.0',
1130-
'--without-publishing' => true,
1130+
'--no-publish' => true,
11311131
]);
11321132

11331133
$this->assertTrue($filesystem->exists(base_path('public/vendor/migration-hook/assets/script.js')));
@@ -1203,7 +1203,7 @@ public function test_force_republishing_assets_on_update_with_custom_changed_fil
12031203
$this->artisan('hook:update', [
12041204
'name' => 'migrating-hook',
12051205
'version' => 'v2.0.0',
1206-
'--force-publish' => true,
1206+
'--force' => true,
12071207
]);
12081208

12091209
$this->assertTrue($filesystem->exists(base_path('public/vendor/migration-hook/assets/script.js')));

0 commit comments

Comments
 (0)