Skip to content

Commit

Permalink
Merge pull request #28 from askdkc/no-more-self-template
Browse files Browse the repository at this point in the history
No more self template
  • Loading branch information
askdkc authored Nov 22, 2022
2 parents 7cfd5e6 + 9b04577 commit e3797a0
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 237 deletions.
38 changes: 0 additions & 38 deletions src/Commands/BreezejpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,6 @@ public function handle(): int
(new Filesystem)->ensureDirectoryExists(lang_path());
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/lang/', lang_path());

$this->info('Laravel BreezeのProfile用に翻訳可能なbladeを準備します');

if (! (new Filesystem)->exists(resource_path('views/profile/'))) {
$this->warn('先にLaravel Breezeをインストールしてください');
$this->warn('その後、breezejpコマンドの再実行をお願いします');

if ($this->confirm('強制的に実行しますか?(Breezeを使わずバリデーションの日本語化利用時等はyesを選択)', false)) {
(new Filesystem)->ensureDirectoryExists(resource_path('views/profile/'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/resources/views', resource_path('views'));
$this->info('実行完了');

if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) {
$repoUrl = 'https://github.com/askdkc/breezejp';

if (PHP_OS_FAMILY == 'Darwin') {
exec("open {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Windows') {
exec("start {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Linux') {
exec("xdg-open {$repoUrl}");
}

$this->line('Thank you! / ありがとう💓');
}

$this->info('日本語ファイルのインストールが完了しました!');

return self::SUCCESS;
}

return self::FAILURE;
}

(new Filesystem)->ensureDirectoryExists(resource_path('views/profile/'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/resources/views', resource_path('views'));

if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) {
$repoUrl = 'https://github.com/askdkc/breezejp';

Expand Down
29 changes: 0 additions & 29 deletions stubs/default/resources/views/profile/edit.blade.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 1 addition & 14 deletions tests/CommandTest.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
<?php

test('breezejp command stop successfully because Breeze is not installed', closure: function () {
test('breezejp command successfully run and see all the published files', closure: function () {
$this->artisan('breezejp')
->expectsOutput('Laravel Breeze用に日本語翻訳ファイルを準備します')
->expectsOutput('Laravel BreezeのProfile用に翻訳可能なbladeを準備します')
->expectsOutput('先にLaravel Breezeをインストールしてください')
->expectsConfirmation('強制的に実行しますか?(Breezeを使わずバリデーションの日本語化利用時等はyesを選択)', 'no')
->assertExitCode(1);
});

test('breezejp command forcefully run and see all the published files', closure: function () {
$this->artisan('breezejp')
->expectsOutput('Laravel Breeze用に日本語翻訳ファイルを準備します')
->expectsOutput('Laravel BreezeのProfile用に翻訳可能なbladeを準備します')
->expectsOutput('先にLaravel Breezeをインストールしてください')
->expectsConfirmation('強制的に実行しますか?(Breezeを使わずバリデーションの日本語化利用時等はyesを選択)', 'yes')
->expectsOutput('実行完了')
->expectsConfirmation('GitHubリポジトリにスターの御協力をお願いします🙏', 'no')
->expectsOutput('日本語ファイルのインストールが完了しました!')
->assertExitCode(0);
Expand Down
9 changes: 0 additions & 9 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ protected function setUp(): void
unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/lang/ja/validation.php');
rmdir(__DIR__.'/../vendor/orchestra/testbench-core/laravel/lang/ja');
}

if (is_dir(__DIR__.'/../vendor/orchestra/testbench-core/laravel/resources/views/profile')) {
unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/resources/views/profile/edit.blade.php');
unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/resources/views/profile/partials/delete-user-form.blade.php');
unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/resources/views/profile/partials/update-password-form.blade.php');
unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/resources/views/profile/partials/update-profile-information-form.blade.php');
rmdir(__DIR__.'/../vendor/orchestra/testbench-core/laravel/resources/views/profile/partials');
rmdir(__DIR__.'/../vendor/orchestra/testbench-core/laravel/resources/views/profile');
}
}

protected function getPackageProviders($app)
Expand Down

0 comments on commit e3797a0

Please sign in to comment.