Skip to content

Commit 211318d

Browse files
authored
Merge pull request #8 from swaggest/v3
extracting CLI to separate package
2 parents 64972f5 + e6954a5 commit 211318d

14 files changed

+1766
-584
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/vendor
22
/.idea
3-
/json-diff
4-
/json-diff.tar.gz
5-
/composer.lock
63
/composer.phar
74
/clover.xml

.scrutinizer.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
checks:
2+
php:
3+
code_rating: true
4+
duplication: true
15
filter:
26
paths: [src/*]
37
excluded_paths: [vendor/*, tests/*]
@@ -15,4 +19,10 @@ tools:
1519
excluded_dirs: [vendor, tests]
1620
php_cpd:
1721
enabled: true
18-
excluded_dirs: [vendor, tests]
22+
excluded_dirs: [vendor, tests]
23+
build:
24+
nodes:
25+
analysis:
26+
tests:
27+
override:
28+
- php-scrutinizer-run

.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ cache:
1919

2020
# execute any number of scripts before the test run, custom env's are available as variables
2121
before_script:
22-
- ls -la $HOME/.composer/cache
23-
- test -f $HOME/.composer/cache/composer.lock.$(phpenv version-name) && cp $HOME/.composer/cache/composer.lock.$(phpenv version-name) ./composer.lock || echo "No composer.lock cached"
2422
- composer install --dev --no-interaction --prefer-dist
25-
- test -f $HOME/.composer/cache/composer.lock.$(phpenv version-name) || cp ./composer.lock $HOME/.composer/cache/composer.lock.$(phpenv version-name)
2623
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then test -f $HOME/.composer/cache/phpstan.phar || wget https://github.com/phpstan/phpstan/releases/download/0.9.1/phpstan.phar -O $HOME/.composer/cache/phpstan.phar; fi
2724
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then test -f $HOME/.composer/cache/ocular.phar || wget https://scrutinizer-ci.com/ocular.phar -O $HOME/.composer/cache/ocular.phar; fi
2825
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then test -f $HOME/.composer/cache/cctr || wget https://codeclimate.com/downloads/test-reporter/test-reporter-0.1.4-linux-amd64 -O $HOME/.composer/cache/cctr && chmod +x $HOME/.composer/cache/cctr; fi

README.md

+1-129
Original file line numberDiff line numberDiff line change
@@ -162,132 +162,4 @@ $this->assertEquals($diff->getRearranged(), $original);
162162

163163
## CLI tool
164164

165-
### Usage
166-
167-
```
168-
bin/json-diff --help
169-
JSON diff and apply tool for PHP, https://github.com/swaggest/json-diff
170-
Usage:
171-
json-diff <action>
172-
action Action name
173-
Allowed values: diff, apply, rearrange, info
174-
```
175-
176-
```
177-
bin/json-diff diff --help
178-
v2.0.0 json-diff diff
179-
JSON diff and apply tool for PHP, https://github.com/swaggest/json-diff
180-
Make patch from two json documents, output to STDOUT
181-
Usage:
182-
json-diff diff <originalPath> <newPath>
183-
originalPath Path to old (original) json file
184-
newPath Path to new json file
185-
186-
Options:
187-
--pretty Pretty-print result JSON
188-
--rearrange-arrays Rearrange arrays to match original
189-
```
190-
191-
```
192-
bin/json-diff apply --help
193-
v2.0.0 json-diff apply
194-
JSON diff and apply tool for PHP, https://github.com/swaggest/json-diff
195-
Apply patch to base json document, output to STDOUT
196-
Usage:
197-
json-diff apply [patchPath] [basePath]
198-
patchPath Path to JSON patch file
199-
basePath Path to JSON base file
200-
201-
Options:
202-
--pretty Pretty-print result JSON
203-
--rearrange-arrays Rearrange arrays to match original
204-
```
205-
206-
```
207-
bin/json-diff rearrange --help
208-
v2.0.0 json-diff rearrange
209-
JSON diff and apply tool for PHP, https://github.com/swaggest/json-diff
210-
Rearrange json document in the order of another (original) json document
211-
Usage:
212-
json-diff rearrange <originalPath> <newPath>
213-
originalPath Path to old (original) json file
214-
newPath Path to new json file
215-
216-
Options:
217-
--pretty Pretty-print result JSON
218-
--rearrange-arrays Rearrange arrays to match original
219-
```
220-
221-
```
222-
bin/json-diff info --help
223-
v2.0.0 json-diff info
224-
JSON diff and apply tool for PHP, https://github.com/swaggest/json-diff
225-
Show diff info for two JSON documents
226-
Usage:
227-
json-diff info <originalPath> <newPath>
228-
originalPath Path to old (original) json file
229-
newPath Path to new json file
230-
231-
Options:
232-
--pretty Pretty-print result JSON
233-
--rearrange-arrays Rearrange arrays to match original
234-
--with-contents Add content to output
235-
--with-paths Add paths to output
236-
```
237-
238-
### Examples
239-
240-
Using with standard `diff`
241-
242-
```
243-
json-diff rearrange ./composer.json ./composer2.json | diff ./composer.json -
244-
3c3
245-
< "description": "JSON diff and merge tool for PHP",
246-
---
247-
> "description": "JSON diff and merge tool for PHPH",
248-
5,11d4
249-
< "license": "MIT",
250-
< "authors": [
251-
< {
252-
< "name": "Viacheslav Poturaev",
253-
< "email": "[email protected]"
254-
< }
255-
< ],
256-
25,28c18
257-
< },
258-
< "bin": [
259-
< "bin/json-diff"
260-
< ]
261-
---
262-
> }
263-
```
264-
265-
Showing differences in `JSON` mode
266-
267-
```
268-
bin/json-diff info tests/assets/original.json tests/assets/new.json --with-paths --pretty
269-
{
270-
"addedCnt": 4,
271-
"modifiedCnt": 4,
272-
"removedCnt": 3,
273-
"addedPaths": [
274-
"/key3/sub3",
275-
"/key4/0/c",
276-
"/key4/2/c",
277-
"/key5"
278-
],
279-
"modifiedPaths": [
280-
"/key1/0",
281-
"/key3/sub1",
282-
"/key3/sub2",
283-
"/key4/0/a",
284-
"/key4/1/a",
285-
"/key4/1/b"
286-
],
287-
"removedPaths": [
288-
"/key2",
289-
"/key3/sub0",
290-
"/key4/0/b"
291-
]
292-
}
293-
```
165+
Moved to [`swaggest/json-diff-cli`](https://github.com/swaggest/json-diff-cli)

bin/json-diff

-12
This file was deleted.

composer.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "swaggest/json-diff",
3-
"description": "JSON diff and rearrange tool for PHP",
4-
"type": "tool",
3+
"description": "JSON diff and rearrange library for PHP",
4+
"type": "library",
55
"license": "MIT",
66
"authors": [
77
{
@@ -10,7 +10,6 @@
1010
}
1111
],
1212
"require-dev": {
13-
"php-yaoi/php-yaoi": "^1",
1413
"phpunit/phpunit": "^4.8.23",
1514
"phpunit/php-code-coverage": "2.2.4",
1615
"codeclimate/php-test-reporter": "^0.4.0"
@@ -25,7 +24,9 @@
2524
"Swaggest\\JsonDiff\\Tests\\": "tests/src"
2625
}
2726
},
28-
"bin": [
29-
"bin/json-diff"
30-
]
27+
"config": {
28+
"platform": {
29+
"php": "5.4.45"
30+
}
31+
}
3132
}

0 commit comments

Comments
 (0)