Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit b427aeb

Browse files
Merge pull request #14 from DarkGhostHunter/master
Fixes sample file publishing
2 parents 638bf56 + daa0269 commit b427aeb

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

src/Console/Commands/PublishCommand.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,10 @@ public function handle(): void
4747

4848
// Add the manifest if it doesn't exists, or if the user confirms the replace.
4949
if ($this->filesystem->missing($path) || $this->confirm('A manifest file already exists. Overwrite?')) {
50-
$this->putFile($path);
51-
$this->info("Manifest published. Check it at: $path");
52-
}
53-
}
54-
55-
/**
56-
* Puts the stub into the application directory.
57-
*
58-
* @param string $path
59-
*/
60-
protected function putFile(string $path): void
61-
{
62-
if ($this->filesystem->exists($path)) {
63-
$this->filesystem->replace(static::STUB_PATH, $path);
64-
} else {
65-
$this->filesystem->ensureDirectoryExists(base_path('settings'));
50+
$this->filesystem->ensureDirectoryExists($this->laravel->basePath('settings'));
6651
$this->filesystem->copy(static::STUB_PATH, $path);
52+
53+
$this->info("Manifest published. Check it at: $path");
6754
}
6855
}
6956
}

stubs/users.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
S:\Composer\Laravel\Laraset\vendor\orchestra\testbench-core\laravel\settings/users.php
1+
<?php
2+
3+
use DarkGhostHunter\Laraconfig\Facades\Setting;
4+
5+
Setting::name('dark_mode')->boolean();

tests/Console/Commands/PublishCommandTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public function test_replaces_manifest_once_confirmed(): void
6767
->assertExitCode(0);
6868

6969
static::assertFileExists($this->app->basePath('settings/users.php'));
70-
static::assertStringEqualsFile(
70+
71+
sleep(10);
72+
73+
static::assertFileEquals(
7174
__DIR__ . '/../../../stubs/users.php',
7275
$this->app->basePath('settings/users.php')
7376
);

0 commit comments

Comments
 (0)