-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Gaal
committed
Aug 10, 2022
1 parent
c37a919
commit 97b6c99
Showing
8 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use Illuminate\Support\Facades\File; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
class SetupCommand extends Command | ||
{ | ||
protected $signature = 'setup'; | ||
|
||
protected $description = 'Runs a few commands to setup the project.'; | ||
|
||
public function handle() | ||
{ | ||
if (File::exists('aliases.json')) { | ||
$overwrite = $this->confirm('aliases.json already exists. Do you want to overwrite it?'); | ||
|
||
if ($overwrite === false) { | ||
return; | ||
} | ||
} | ||
|
||
File::copy(base_path().'/stubs/aliases.json.stub', getcwd().'/aliases.json'); | ||
|
||
$this->components->info('aliases.json created.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"app", | ||
"bootstrap", | ||
"config", | ||
"stubs", | ||
"vendor" | ||
], | ||
"files": [ | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"about": [ | ||
"echo 'A PHP CLI application that helps you organize your aliases.'" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\File; | ||
|
||
test('execute setup creates aliases.json file', function () { | ||
if (File::exists(base_path().'/aliases.json')) { | ||
File::delete(base_path().'/aliases.json'); | ||
} | ||
|
||
$this->artisan('setup') | ||
->assertExitCode(0); | ||
|
||
$this->assertTrue(File::exists('aliases.json')); | ||
}); | ||
|
||
test('execute setup asks for overwriting aliases.json file', function () { | ||
File::put( | ||
base_path().'/aliases.json', | ||
File::get(base_path().'/stubs/aliases.json.stub') | ||
); | ||
|
||
/** @var \Illuminate\Testing\PendingCommand $output */ | ||
$this->artisan('setup') | ||
->expectsConfirmation('aliases.json already exists. Do you want to overwrite it?') | ||
->assertExitCode(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters