Skip to content

Commit 4656f26

Browse files
author
Benjamin Delespierre
committed
Updating markdown installation instructions
Fix: #50 The previous installation instructions, even when you follow them step by step, doesn't install the git hooks properly. This update correct that so new user will be able to install the package easily.
1 parent e6cd28d commit 4656f26

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

README.md

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,50 @@ $ composer require bruli/php-git-hooks --dev
3636
If you don't have composer, you need download the binary file and run it:
3737

3838
```bash
39-
wget http://getcomposer.org/composer.phar
39+
$ wget http://getcomposer.org/composer.phar
4040
# or
41-
curl -O http://getcomposer.org/composer.phar
41+
$ curl -O http://getcomposer.org/composer.phar
4242

43-
php composer.phar install
43+
$ php composer.phar install
4444
```
4545

4646
## Step 2: Configuration
47-
### Composer configuration.
48-
After download all repositories, composer ask you about configuration.
4947

50-
<img style="border:1px solid #ccc; padding:1px" src="https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/composer-config.png" />
51-
52-
### Composer configuration in Symfony2 projects.
48+
### Using Composer
5349

54-
In Symfony2 projects you need add this lines in your composer.json:
50+
First, you will need to add the following lines to your `composer.json`
5551

5652
```json
5753
"scripts": {
5854
"post-install-cmd": [
59-
...other lines...
6055
"PhpGitHooks\\Application\\Composer\\ConfiguratorScript::buildConfig"
6156
],
6257
"post-update-cmd": [
63-
...other lines...
6458
"PhpGitHooks\\Application\\Composer\\ConfiguratorScript::buildConfig"
6559
]
60+
}
6661
```
6762

68-
**Important: To use 2.X version you need symfony 2.7 version.**
63+
Then, launch `$ composer install` and composer should ask you about configuration
64+
65+
<img style="border:1px solid #ccc; padding:1px" src="https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/composer-config.png" />
66+
67+
**Important:** To use 2.X version you need symfony 2.7 version.
6968

7069
### Bin directory configuration.
7170

72-
If your project haven't a "bin" directory, you can add this in your compose.json file.
71+
If your project doesn't have a "bin/" directory, you can add this in your `composer.json` file.
7372

7473
```json
75-
"config": {
76-
"bin-dir": "bin"
77-
}
74+
"config": {
75+
"bin-dir": "bin"
76+
}
7877
```
7978

80-
**Note: Not necessary for Symfony projects.**
79+
**Note:** This is not necessary for Symfony projects.
8180

8281
### Manual config file for git hooks.
82+
8383
You can configure php-git-hooks, creating a php-git-hooks.yml file with...
8484

8585
```yaml
@@ -102,7 +102,7 @@ pre-commit:
102102
standard: PSR2
103103
phpmd: true
104104
composer: true
105-
message:
105+
message:
106106
right-message: 'HEY, GOOD JOB!!'
107107
error-message: 'FIX YOUR CODE!!'
108108
commit-msg:
@@ -114,16 +114,18 @@ commit-msg:
114114
115115
### Update from v1.3.*
116116
117-
Php-cs-fixer configuration in php-git-hooks.yml file, is not compatible with 2.0 version.
117+
Php-cs-fixer configuration in php-git-hooks.yml file, is not compatible with 2.0 version.
118118
You should remove php-cs-fixer entry and execute "composer install".
119119
120120
Most easy way to update is delete php-git-hooks.yml and execute "composer install". You will see all the configuration questions again.
121121
122122
### Config file for phpunit.
123-
If you want use phpunit tool, you must create a phpunit.xml.dist in your project root directory.
123+
124+
If you want use phpunit tool, you must create a phpunit.xml.dist in your project root directory.
124125
Alternatively you can copy from vendor/bruli/php-git-hooks/phpunit.xml.dist in your project root directory.
125126
126127
### Config file for phpmd.
128+
127129
The same case that phpunit. You must create a PmdRules.xml in your project root directory or copy from php-git-hook directory.
128130
129131
## Step 3: Enabling hooks.
@@ -135,19 +137,23 @@ The most easy way to enable hook is copy hook file into your .git/hooks director
135137
You can enable this hooks with composer or manually executing
136138
137139
```bash
138-
$cp vendor/bruli/php-git-hooks/hooks/pre-commit .git/hooks
140+
$ cp vendor/bruli/php-git-hooks/hooks/pre-commit .git/hooks
139141
```
140142

141143
#For commit-msg hook:
142144

143145
```bash
144-
$cp vendor/bruli/php-git-hooks/hooks/commit-msg .git/hooks
146+
$ cp vendor/bruli/php-git-hooks/hooks/commit-msg .git/hooks
145147
```
146148

147149
### execute.
150+
148151
####Valid pre-commit.
152+
149153
<img style="border:1px solid #ccc; padding:1px" src="https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/pre-commit.png" />
154+
150155
####Fail pre-commit.
156+
151157
<img style="border:1px solid #ccc; padding:1px" src="https://raw.githubusercontent.com/bruli/php-git-hooks/master/Resources/docs/images/pre-commit-failed.png" />
152158

153159
## Credits
@@ -157,4 +163,4 @@ You can enable this hooks with composer or manually executing
157163

158164
## License
159165

160-
php-git-hooks is released under the MIT License. See the bundled LICENSE file for details.
166+
php-git-hooks is released under the [MIT License](https://opensource.org/licenses/MIT). See the bundled LICENSE file for details.

0 commit comments

Comments
 (0)