Skip to content

Commit 73e4bd6

Browse files
committed
Created two composer.jsons, one for dev and the main one for the phar.
1 parent c9ea10b commit 73e4bd6

File tree

8 files changed

+86
-60
lines changed

8 files changed

+86
-60
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
/CHANGELOG.md export-ignore
1111
/CONTRIBUTING.md export-ignore
1212
/phpunit.xml.dist export-ignore
13+
/composer.build.json export-ignore
14+
/composer.release.json export-ignore

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/build
33
/vendor
44
/.phpunit.result.cache
5+
/composer.release.json
56
/composer.lock

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,23 @@ Afterwards make sure you have the global Composer binaries directory in your ``P
7474
```bash
7575
$ export PATH="$PATH:$HOME/.composer/vendor/bin"
7676
```
77+
### For Development
78+
79+
Because this repo is now a phar-first repo, you need to manually use the dev composer.json:
80+
81+
```
82+
mv composer.json composer.release.json
83+
cp composer.build.json composer.json
84+
composer install
85+
```
86+
87+
If you wish to build the phar:
88+
89+
```
90+
./bin/build-phar.sh
91+
```
92+
93+
If you wish to test the phar file, it will not work if there is an existing vendor directory.
7794

7895
## Usage Example
7996

@@ -178,6 +195,11 @@ $percent = $number / intval(100);
178195
```
179196
would mark 100 as not magic.
180197

198+
## Installation
199+
200+
201+
202+
181203
## Contributing
182204

183205
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information.

bin/build-phar.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ echo "Running a fresh \`composer install --no-dev\` to insure the latest depende
2828
echo "Removing vendor/ and composer.lock ..."
2929
rm -v composer.lock
3030
rm -rf vendor
31+
git checkout composer.json
32+
mv composer.json composer.release.json
33+
cp composer.build.json composer.json
3134
composer install --no-dev
3235

36+
3337
# Build the phar
3438
echo "Building phpmnd.phar..."
3539
box compile
40+
41+
mv composer.release.json composer.json
42+
rm -rf vendor

bin/createPhar

Lines changed: 0 additions & 56 deletions
This file was deleted.

bin/phpmnd.phar

2.34 MB
Binary file not shown.

composer.build.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "povils/phpmnd",
3+
"type": "application",
4+
"description": "A tool to detect Magic numbers in codebase",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Povilas Susinskas",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"support": {
13+
"issues": "https://github.com/povils/phpmnd/issues"
14+
},
15+
"require": {
16+
"php": "^7.4 || ^8.0",
17+
"composer-runtime-api": "^2.0",
18+
"nikic/php-parser": "^4.18 || ^5.0",
19+
"php-parallel-lint/php-console-highlighter": "^1.0",
20+
"phpunit/php-timer": "^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
21+
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0",
22+
"symfony/finder": "^4.4 || ^5.0 || ^6.0 || ^7.0"
23+
},
24+
"require-dev": {
25+
"phpunit/phpunit": "^9.6",
26+
"squizlabs/php_codesniffer": "^2.8.1||^3.5"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"Povils\\PHPMND\\": "src/"
31+
}
32+
},
33+
"autoload-dev": {
34+
"psr-4": {
35+
"Povils\\PHPMND\\Tests\\": "tests/"
36+
}
37+
},
38+
"config": {
39+
"sort-packages": true
40+
},
41+
"bin": [
42+
"bin/phpmnd",
43+
"bin/phpmnd.phar"
44+
],
45+
"scripts": {
46+
"test": "phpunit",
47+
"cs-check": "phpcs -p --standard=PSR2 --runtime-set ignore_warnings_on_exit 1 src tests --ignore=tests/Fixtures/Files",
48+
"cs-fix": "phpcbf -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests --ignore=tests/Fixtures/Files"
49+
}
50+
}

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
},
1515
"require": {
1616
"php": "^7.4 || ^8.0",
17-
"composer-runtime-api": "^2.0",
17+
"composer-runtime-api": "^2.0"
18+
},
19+
"require-dev": {
1820
"nikic/php-parser": "^4.18 || ^5.0",
1921
"php-parallel-lint/php-console-highlighter": "^1.0",
2022
"phpunit/php-timer": "^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
2123
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0",
22-
"symfony/finder": "^4.4 || ^5.0 || ^6.0 || ^7.0"
23-
},
24-
"require-dev": {
24+
"symfony/finder": "^4.4 || ^5.0 || ^6.0 || ^7.0",
2525
"phpunit/phpunit": "^9.6",
2626
"squizlabs/php_codesniffer": "^2.8.1||^3.5"
2727
},

0 commit comments

Comments
 (0)