diff_matcher 2.8.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/diff-csv +5 -16
- data/exe/diff-json +5 -11
- data/exe/diff-match +7 -0
- data/exe/diff-match-json +8 -0
- data/lib/diff_matcher/cli.rb +19 -0
- data/lib/diff_matcher/version.rb +1 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a39a9962e5431cf3cbacda911c0154150733fd65510c5840ab9c67a87bb05991
|
4
|
+
data.tar.gz: 6b6cc7b445d393cbe1d2644de6b15ba78268e68f70b97934f8e1b4b868e29ec9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50f9c16a0a4f4012b8df6a79e2f2f1ac9133a565c7e8746949a4259ddd8a42bea14478f9423f26ed76abc6c6a1772ab78264576dd37d1497ca7cc9afc75c8a79
|
7
|
+
data.tar.gz: 89f284d344accf4a9aeb1d5b75cb20ab9466683601dd31d99d4b588325eaa7793d1a43c614ed33780078e285e7c3395108ad02386cc8a8ea8b6a101dde7b0c26
|
data/exe/diff-csv
CHANGED
@@ -55,7 +55,7 @@
|
|
55
55
|
# Where, - 1 missing, + 1 additional
|
56
56
|
|
57
57
|
require 'csv'
|
58
|
-
require 'diff_matcher'
|
58
|
+
require 'diff_matcher/cli'
|
59
59
|
|
60
60
|
COL_SEP=ENV.fetch("COL_SEP", "\t")
|
61
61
|
KEY=ENV.fetch("KEY", "id")
|
@@ -72,18 +72,7 @@ def records(file, key=KEY, col_sep=COL_SEP)
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
color_enabled: true,
|
80
|
-
ignore_additional: ENV['IGNORE_ADDITIONAL'],
|
81
|
-
quiet: !ENV['VERBOSE']
|
82
|
-
}
|
83
|
-
|
84
|
-
diff=DiffMatcher.difference(data0, data1, diff_opts)
|
85
|
-
|
86
|
-
if diff
|
87
|
-
puts diff
|
88
|
-
exit 1
|
89
|
-
end
|
75
|
+
DiffMatcher::CLI.diff(
|
76
|
+
records(File.open(ARGV[0])),
|
77
|
+
records(File.open(ARGV[1]))
|
78
|
+
)
|
data/exe/diff-json
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'diff_matcher'
|
2
|
+
require 'diff_matcher/cli'
|
3
3
|
require 'json'
|
4
4
|
|
5
|
-
|
6
|
-
JSON.parse(File.read(
|
7
|
-
|
8
|
-
|
9
|
-
diff=DiffMatcher.difference(expected, actual, color_scheme: :default)
|
10
|
-
|
11
|
-
if diff
|
12
|
-
puts diff
|
13
|
-
exit 1
|
14
|
-
end
|
5
|
+
DiffMatcher::CLI.diff(
|
6
|
+
JSON.parse(File.read(ARGV[-2])),
|
7
|
+
JSON.parse(File.read(ARGV[-1]))
|
8
|
+
)
|
data/exe/diff-match
ADDED
data/exe/diff-match-json
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'diff_matcher'
|
2
|
+
|
3
|
+
module DiffMatcher
|
4
|
+
module CLI
|
5
|
+
def self.diff(expected, actual, opts={})
|
6
|
+
# TODO maybe parse opts from command line instead of ENV vars...
|
7
|
+
diff_opts = {
|
8
|
+
color_enabled: true,
|
9
|
+
ignore_additional: ENV['IGNORE_ADDITIONAL'],
|
10
|
+
quiet: !ENV['VERBOSE']
|
11
|
+
}
|
12
|
+
|
13
|
+
if (diff_string = DiffMatcher.difference(expected, actual, diff_opts))
|
14
|
+
puts diff_string
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/diff_matcher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diff_matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- locochris
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
DiffMatcher matches input data (eg. from a JSON API) against values,
|
@@ -18,6 +18,8 @@ email: chris@locomote.com.au
|
|
18
18
|
executables:
|
19
19
|
- diff-csv
|
20
20
|
- diff-json
|
21
|
+
- diff-match
|
22
|
+
- diff-match-json
|
21
23
|
- diff-mysql
|
22
24
|
extensions: []
|
23
25
|
extra_rdoc_files: []
|
@@ -39,8 +41,11 @@ files:
|
|
39
41
|
- doc/more_tapas_spec.rb
|
40
42
|
- exe/diff-csv
|
41
43
|
- exe/diff-json
|
44
|
+
- exe/diff-match
|
45
|
+
- exe/diff-match-json
|
42
46
|
- exe/diff-mysql
|
43
47
|
- lib/diff_matcher.rb
|
48
|
+
- lib/diff_matcher/cli.rb
|
44
49
|
- lib/diff_matcher/difference.rb
|
45
50
|
- lib/diff_matcher/escape_to_html.rb
|
46
51
|
- lib/diff_matcher/rspec.rb
|
@@ -60,7 +65,7 @@ licenses:
|
|
60
65
|
- BSD
|
61
66
|
- MIT
|
62
67
|
metadata: {}
|
63
|
-
post_install_message:
|
68
|
+
post_install_message:
|
64
69
|
rdoc_options: []
|
65
70
|
require_paths:
|
66
71
|
- lib
|
@@ -75,9 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
80
|
- !ruby/object:Gem::Version
|
76
81
|
version: '0'
|
77
82
|
requirements: []
|
78
|
-
|
79
|
-
|
80
|
-
signing_key:
|
83
|
+
rubygems_version: 3.1.4
|
84
|
+
signing_key:
|
81
85
|
specification_version: 4
|
82
86
|
summary: Generates a diff by matching against user-defined matchers written in ruby.
|
83
87
|
test_files:
|