Skip to content

Commit e8d2ee5

Browse files
[ Fix ] Update command creates hooks as non-executable (#82)
* remove deprecated binary reference * update command should ensure hooks are executable * lint * update php version to 8.4 in CI * increase memory limit in stan script * update legacy GH actions set-output * revert to legacy set-output in test.yml
1 parent 6f0fc83 commit e8d2ee5

File tree

8 files changed

+27
-13
lines changed

8 files changed

+27
-13
lines changed

.github/workflows/larastan.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
operating-system:
99
- ubuntu-latest
1010
php-version:
11-
- "8.2"
11+
- "8.4"
1212
name: php ${{ matrix.php-version }} on ${{ matrix.operating-system }}
1313
runs-on: ${{ matrix.operating-system }}
1414
steps:
@@ -22,7 +22,7 @@ jobs:
2222
coverage: none
2323
- name: Get composer cache directory
2424
id: composer-cache
25-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
25+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2626
- name: Setup composer cache
2727
uses: actions/cache@v4
2828
with:

.github/workflows/pint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
operating-system:
1212
- ubuntu-latest
1313
php-version:
14-
- "8.2"
14+
- "8.4"
1515
name: php ${{ matrix.php-version }} on ${{ matrix.operating-system }}
1616
runs-on: ${{ matrix.operating-system }}
1717
steps:
@@ -20,12 +20,12 @@ jobs:
2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
23-
php-version: "8.2"
23+
php-version: "8.4"
2424
extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo, tokenizer, xml
2525
coverage: none
2626
- name: Get composer cache directory
2727
id: composer-cache
28-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
28+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2929
- name: Setup composer cache
3030
uses: actions/cache@v4
3131
with:

.github/workflows/test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- "8.1"
1414
- "8.2"
1515
- "8.3"
16+
- "8.4"
1617
name: php ${{ matrix.php-version }} on ${{ matrix.operating-system }}
1718
runs-on: ${{ matrix.operating-system }}
1819
steps:

.github/workflows/types.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
operating-system:
99
- ubuntu-latest
1010
php-version:
11-
- "8.2"
11+
- "8.4"
1212
name: php ${{ matrix.php-version }} on ${{ matrix.operating-system }}
1313
runs-on: ${{ matrix.operating-system }}
1414
steps:
@@ -22,7 +22,7 @@ jobs:
2222
coverage: none
2323
- name: Get composer cache directory
2424
id: composer-cache
25-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
25+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2626
- name: Setup composer cache
2727
uses: actions/cache@v4
2828
with:

app/Commands/Install.php

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function handle(): int
7474
$this->info('Verifying hooks are executable...');
7575
}
7676
exec('chmod +x '.Platform::cwd('.git/hooks').'/*');
77-
exec('chmod +x '.Whisky::base_path('bin/run-hook'));
7877
}
7978

8079
$this->info('Git hooks installed successfully.');

app/Commands/Update.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use LaravelZero\Framework\Commands\Command;
66
use ProjektGopher\Whisky\Hook;
7+
use ProjektGopher\Whisky\Platform;
78

89
/**
910
* TODO: This has a lot of duplication wrt Commands\Uninstall and Commands\Install.
@@ -14,6 +15,12 @@ class Update extends Command
1415

1516
protected $description = 'Update git hooks';
1617

18+
public function __construct(
19+
public Platform $platform,
20+
) {
21+
parent::__construct();
22+
}
23+
1724
public function handle(): int
1825
{
1926
Hook::all(Hook::FROM_GIT)->each(function (Hook $hook): void {
@@ -42,7 +49,14 @@ public function handle(): int
4249
}
4350
});
4451

45-
$this->line('done.');
52+
if ($this->platform->isNotWindows()) {
53+
if ($this->option('verbose')) {
54+
$this->info('Verifying hooks are executable...');
55+
}
56+
exec('chmod +x '.Platform::cwd('.git/hooks').'/*');
57+
}
58+
59+
$this->line('Git hooks updated successfully.');
4660

4761
return Command::SUCCESS;
4862
}

app/Hook.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ public function getSnippets(): Collection
148148
]);
149149
}
150150

151-
////////////////////////////////////////
152-
//// Static methods ////
153-
////////////////////////////////////////
151+
// //////////////////////////////////////
152+
// // Static methods ////
153+
// //////////////////////////////////////
154154

155155
/**
156156
* Static Constructor.

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"vendor/bin/pint"
6464
],
6565
"stan": [
66-
"vendor/bin/phpstan analyse"
66+
"vendor/bin/phpstan analyse --memory-limit=1G"
6767
],
6868
"test": [
6969
"@php whisky test"

0 commit comments

Comments
 (0)