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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 654d73d87ae08ffa4d070f14d320563bee63e21e
4
- data.tar.gz: 380d639aa659830cec67be1a49d08be14d5864ad
3
+ metadata.gz: beecb0033db3c1e9c3c90d8c008cf3ed0a5b3343
4
+ data.tar.gz: 240ccbca2632cf8ec4bdd01116b3199fe94214b5
5
5
  SHA512:
6
- metadata.gz: f1bc607ce29b614eb86e047c46c77cd6a8685f0343ba6ed904f1d3e83a6bd6b4802342bd7c7dd6dfb5324b1873164b0f26b0a16f5b5838bd695d7ebd1584b9dc
7
- data.tar.gz: d6de49305acd3dabed20c7e2e011f93145a1404de37a7e6e30432bc9720adebcf619047a8532bfc27d16f2f1e8196fde48be46213efc72b1723a40e6c2a11dd5
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
- #> [{:op => :replace, :path => "", :value => 2}]
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.
@@ -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))
@@ -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 = ['ttyl@captaintrain.com']
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
@@ -1,3 +1,3 @@
1
1
  module JsonDiff
2
- VERSION = '0.3.2'
2
+ VERSION = '0.4.0'
3
3
  end
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.3.2
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: 2016-09-06 00:00:00.000000000 Z
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
- - ttyl@captaintrain.com
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.4.5.1
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.