Skip to content

Commit ee9fe6d

Browse files
authored
Merge pull request #56 from c3limited/ChangeBinDirectory
Change bin directory
2 parents 2e5e855 + c713e6c commit ee9fe6d

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ php:
55
- 7.1
66
install: composer install --no-interaction --prefer-source
77
script:
8-
- bin/phpunit
9-
- bin/phpcs --standard=Magento Magento/ --extensions=php
8+
- vendor/bin/phpunit
9+
- vendor/bin/phpcs --standard=Magento Magento/ --extensions=php

README.md

+19-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@
22

33
A set of Magento rules for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) tool.
44

5-
### Installation
6-
For development puposes you can install Magento Coding Standard by cloning this GitHub repo
5+
#### Installation within a Magento 2 site
6+
To use within your Magento 2 project you can use:
7+
````
8+
composer require --dev magento/magento-coding-standard
9+
````
10+
Due to security, when installed this way the Magento standard for phpcs cannot be added automatically.
11+
You can achieve this by adding the following to your project's `composer.json`:
12+
````
13+
"scripts": {
14+
"post-install-cmd": "vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/",
15+
"post-update-cmd": "vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/"
16+
}
17+
````
18+
19+
### Installation for development
20+
You can install Magento Coding Standard by cloning this GitHub repo
721
```
822
$ git clone [email protected]:magento/magento-coding-standard.git
923
$ cd magento-coding-standard
@@ -13,17 +27,16 @@ It is possible also to install a standalone application via [Composer](https://g
1327
```
1428
$ composer create-project magento/magento-coding-standard --stability=dev magento-coding-standard
1529
```
16-
Or require `magento/magento-coding-standard` inside your project using `composer require` command.
1730

1831
#### Verify installation
1932
Command should return the list of installed coding standards including Magento.
2033
```
21-
$ bin/phpcs -i
34+
$ vendor/bin/phpcs -i
2235
```
2336
### Usage
2437
Once installed, you can run `phpcs` from the command-line to analyse your code `MyAwesomeExtension`
2538
```
26-
$ bin/phpcs --standard=Magento app/code/MyAwesomeExtension
39+
$ vendor/bin/phpcs --standard=Magento app/code/MyAwesomeExtension
2740
```
2841
## Where to contribute
2942
- Documentation of existing rules. See [ExtDN PHP CodeSniffer rules for Magento 2](https://github.com/extdn/extdn-phpcs) as a good example.
@@ -43,7 +56,7 @@ $ bin/phpcs --standard=Magento app/code/MyAwesomeExtension
4356
All rules should be covered by unit tests. Each `Test.php` class should be accompanied by a `Test.inc` file to allow for unit testing based upon the PHP CodeSniffer parent class `AbstractSniffUnitTest`.
4457
You can verify your code by running
4558
```
46-
$ bin/phpunit
59+
$ vendor/bin/phpunit
4760
```
4861

4962
## License

composer.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
"require-dev": {
1414
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
1515
},
16-
"config": {
17-
"bin-dir": "bin"
18-
},
1916
"scripts": {
20-
"post-install-cmd": "bin/phpcs --config-set installed_paths ../../..",
21-
"post-update-cmd": "bin/phpcs --config-set installed_paths ../../.."
17+
"post-install-cmd": "vendor/bin/phpcs --config-set installed_paths ../../..",
18+
"post-update-cmd": "vendor/bin/phpcs --config-set installed_paths ../../.."
2219
}
2320
}

0 commit comments

Comments
 (0)