json-diff 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/json-diff +28 -0
- data/json-diff.gemspec +3 -1
- data/lib/json-diff/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beecb0033db3c1e9c3c90d8c008cf3ed0a5b3343
|
4
|
+
data.tar.gz: 240ccbca2632cf8ec4bdd01116b3199fe94214b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b94f9b1e432b7f8a7ad6302fad09b7de74ed42c227337ab08831068d37e2c2cdee671fd77d8785efd4d23e72ce17b80192bdab9ed3d09f8bf640fb520a161f3
|
7
|
+
data.tar.gz: 6e6e3ea10644f747d3c5a896bea90867138d187a230205c358ac043765870cc0e1603da1cc1e515ae2c24008b85946b8a8768a7c51620aa3935a899105e6253d
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ gem install json-diff # Or `gem 'json-diff'` in your Gemfile.
|
|
9
9
|
```ruby
|
10
10
|
require 'json-diff'
|
11
11
|
JsonDiff.diff(1, 2)
|
12
|
-
#> [{
|
12
|
+
#> [{'op' => 'replace', 'path' => '', 'value' => 2}]
|
13
13
|
```
|
14
14
|
|
15
15
|
Outputs [RFC6902][]. Look at [hana][] for a JSON patch algorithm that can use this output.
|
data/bin/json-diff
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "json"
|
3
|
+
require "json-diff"
|
4
|
+
|
5
|
+
HELP = <<-HELP
|
6
|
+
Produce a JSON description of the difference between two JSON files.
|
7
|
+
Usage:
|
8
|
+
json-diff FILE1 FILE2
|
9
|
+
HELP
|
10
|
+
|
11
|
+
if ARGV.first == "-h"
|
12
|
+
puts HELP
|
13
|
+
exit(0)
|
14
|
+
end
|
15
|
+
|
16
|
+
before_filename = ARGV.shift
|
17
|
+
after_filename = ARGV.shift
|
18
|
+
|
19
|
+
if before_filename == nil || after_filename == nil
|
20
|
+
puts "A file is missing to compute the difference between two files"
|
21
|
+
exit(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
before_file = IO.read(before_filename)
|
25
|
+
after_file = IO.read(after_filename)
|
26
|
+
before = JSON.parse(before_file)
|
27
|
+
after = JSON.parse(after_file)
|
28
|
+
puts JSON.pretty_generate(JsonDiff.diff(before, after))
|
data/json-diff.gemspec
CHANGED
@@ -7,9 +7,11 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = JsonDiff::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ['Thaddée Tyl']
|
10
|
-
s.email = ['
|
10
|
+
s.email = ['thaddee.tyl@gmail.com']
|
11
11
|
s.homepage = 'http://github.com/espadrine/json-diff'
|
12
12
|
s.summary = %q{Compute the difference between two JSON-serializable Ruby objects.}
|
13
13
|
s.description = %q{Take two Ruby objects that can be serialized to JSON. Output an array of operations (additions, deletions, moves) that would convert the first one to the second one.}
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
|
+
s.bindir = "bin"
|
16
|
+
s.executables = ["json-diff"]
|
15
17
|
end
|
data/lib/json-diff/version.rb
CHANGED
metadata
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thaddée Tyl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Take two Ruby objects that can be serialized to JSON. Output an array
|
14
14
|
of operations (additions, deletions, moves) that would convert the first one to
|
15
15
|
the second one.
|
16
16
|
email:
|
17
|
-
-
|
18
|
-
executables:
|
17
|
+
- thaddee.tyl@gmail.com
|
18
|
+
executables:
|
19
|
+
- json-diff
|
19
20
|
extensions: []
|
20
21
|
extra_rdoc_files: []
|
21
22
|
files:
|
@@ -26,6 +27,7 @@ files:
|
|
26
27
|
- Makefile
|
27
28
|
- README.md
|
28
29
|
- Rakefile
|
30
|
+
- bin/json-diff
|
29
31
|
- json-diff.gemspec
|
30
32
|
- lib/json-diff.rb
|
31
33
|
- lib/json-diff/diff.rb
|
@@ -56,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
58
|
version: '0'
|
57
59
|
requirements: []
|
58
60
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
61
|
+
rubygems_version: 2.5.1
|
60
62
|
signing_key:
|
61
63
|
specification_version: 4
|
62
64
|
summary: Compute the difference between two JSON-serializable Ruby objects.
|