Skip to content

Commit 7677c92

Browse files
fix issues prompting for horizon
1 parent a56344e commit 7677c92

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

src/LaravelPreset.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Support\Arr;
66
use Illuminate\Filesystem\Filesystem;
77
use sixlive\DotenvEditor\DotenvEditor;
8+
use Illuminate\Support\Facades\Log;
89

910
class LaravelPreset
1011
{
@@ -16,6 +17,8 @@ class LaravelPreset
1617

1718
protected $packages = [];
1819

20+
protected $useHorizon = false;
21+
1922
public function __construct($command)
2023
{
2124
$this->command = $command;
@@ -38,6 +41,8 @@ public function run()
3841

3942
// prompt for installing horizon
4043
if ($this->command->confirm('Are you going to use Laravel Horizon?')) {
44+
$this->useHorizon = $this->command->confirm('Use horizon instead of queue:work?');
45+
4146
array_push($this->packages, 'laravel/horizon');
4247
}
4348

@@ -98,23 +103,17 @@ protected function publishStubs()
98103
}
99104
});
100105

101-
if (Arr::has($this->packages, 'laravel/horizon')) {
102-
$useHorizon = $this->command->confirm(' Use horizon instead of queue:work?');
103-
} else {
104-
$useHorizon = false;
105-
}
106-
107106
switch ($this->options['database']) {
108107
case 'PostgreSQL':
109-
if ($useHorizon) {
108+
if ($this->useHorizon) {
110109
copy(__DIR__ . '/stubs/postgres/docker-compose-horizon.yaml', base_path('docker-compose.yaml'));
111110
} else {
112111
copy(__DIR__ . '/stubs/postgres/docker-compose.yaml', base_path('docker-compose.yaml'));
113112
}
114113
copy(__DIR__ . '/stubs/postgres/Dockerfile', base_path('Dockerfile'));
115114
break;
116115
default:
117-
if ($useHorizon) {
116+
if ($this->useHorizon) {
118117
copy(__DIR__ . '/stubs/mysql/docker-compose-horizon.yaml', base_path('docker-compose.yaml'));
119118
} else {
120119
copy(__DIR__ . '/stubs/mysql/docker-compose.yaml', base_path('docker-compose.yaml'));
@@ -130,7 +129,7 @@ protected function publishStubs()
130129
copy(__DIR__ . '/stubs/phpunit.xml', base_path('phpunit.xml'));
131130
}
132131

133-
protected function updateDotEnv(string $file)
132+
protected function updateDotEnv(string $file, bool $copyFile = false)
134133
{
135134
$editor = new DotenvEditor;
136135
$editor->load(base_path($file));

src/stubs/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ composer:
77
docker run --interactive --tty --volume $(PWD):/app composer install --ignore-platform-reqs --no-interaction --no-plugins --prefer-dist
88
down:
99
docker-compose down
10+
horizon:
11+
docker-compose exec app php artisan horizon:install
1012
logs:
1113
docker-compose logs -f
1214
migrate:
@@ -31,6 +33,8 @@ ssh-queue:
3133
docker-compose exec queue bash
3234
tag:
3335
docker tag "$(IMAGE):$(TAG)" "$(IMAGE):$(TAG)"
36+
telescope:
37+
docker-compose exec app php artisan telescope:install
3438
testdox:
3539
docker-compose exec app ./vendor/bin/phpunit --testdox
3640
tinker:

src/stubs/postgres/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ FROM composer as vendor
33
COPY database/ database/
44
# uncomment if using nova
55
# COPY nova/ nova/
6+
# uncomment when developing packages locally
7+
# COPY packages/ packages/
68
COPY composer.json composer.json
79
COPY composer.lock composer.lock
810
RUN composer install --ignore-platform-reqs --no-interaction --no-plugins --no-scripts --prefer-dist

0 commit comments

Comments
 (0)