Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
Made pre-commit command configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus Aviles committed Jul 25, 2017
1 parent 99f7e43 commit cecaf76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config/git-sniffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// run the commands only in this environment
'env' => 'local',

// pre-commit command
'precommit_command' => 'php artisan git-sniffer:check',

// full path for phpcs bin
'phpcs_bin' => './vendor/bin/phpcs',

Expand Down
7 changes: 3 additions & 4 deletions src/CopyHookCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ public function fire()
}

$preCommitHook = $hooksDir . '/pre-commit';
$preCommitResource = $this->files->dirname(__DIR__) . '/resources/pre-commit';
$preCommitContents = '#!/bin/bash'
. PHP_EOL . $this->config->get('git-sniffer.precommit_command', 'php artisan git-sniffer:check');

if ($this->files->exists($preCommitResource)) {
$this->files->copy($preCommitResource, $preCommitHook);
}
$this->files->put($preCommitHook, $preCommitContents);
}
}

0 comments on commit cecaf76

Please sign in to comment.