File tree Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 254
254
*/
255
255
'artisan_path ' => base_path ('artisan ' ),
256
256
257
+ /*
258
+ |--------------------------------------------------------------------------
259
+ | Laravel Sail
260
+ |--------------------------------------------------------------------------
261
+ |
262
+ | If you are using Laravel Sail you may not have local PHP or Composer.
263
+ |
264
+ | This configuration option allows you to use local Git but still run Artisan commands with `sail` in front of them.
265
+ |
266
+ | The `artisan_path` configuration is ignored.
267
+ |
268
+ */
269
+ 'use_sail ' => false ,
270
+
257
271
/*
258
272
|--------------------------------------------------------------------------
259
273
| Validate paths
Original file line number Diff line number Diff line change @@ -4,4 +4,4 @@ if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
4
4
exec < /dev/tty
5
5
fi
6
6
7
- php {artisanPath} {command} $@ >&2
7
+ { php| sail} {artisanPath} {command} $@ >&2
Original file line number Diff line number Diff line change @@ -58,11 +58,25 @@ public function install(string $hookName): void
58
58
59
59
$ hookPath = $ this ->getGitHooksDir ().'/ ' .$ hookName ;
60
60
$ hookScript = str_replace (
61
- [ '{command} ' , ' {artisanPath} ' ] ,
62
- [ $ command, config ( ' git-hooks.artisan_path ' )] ,
61
+ '{command} ' ,
62
+ $ command ,
63
63
(string ) $ this ->getHookStub ()
64
64
);
65
65
66
+ if (config ('git-hooks.use_sail ' )) {
67
+ $ hookScript = str_replace (
68
+ ['{php|sail} ' , '{artisanPath} ' ],
69
+ ['vendor/bin/sail ' , 'artisan ' ],
70
+ $ hookScript
71
+ );
72
+ } else {
73
+ $ hookScript = str_replace (
74
+ ['{php|sail} ' , '{artisanPath} ' ],
75
+ ['php ' , config ('git-hooks.artisan_path ' )],
76
+ $ hookScript
77
+ );
78
+ }
79
+
66
80
file_put_contents ($ hookPath , $ hookScript );
67
81
chmod ($ hookPath , 0777 );
68
82
}
You can’t perform that action at this time.
0 commit comments