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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae30490620e0407789851f3b58ecdbf8c0de16b4ec6695b19a77d1809cadfe59
4
- data.tar.gz: a00b708d6ded4b931c75858c41040e10fc4362d3fbeb55c2f6f63ee8eaf20164
3
+ metadata.gz: a39a9962e5431cf3cbacda911c0154150733fd65510c5840ab9c67a87bb05991
4
+ data.tar.gz: 6b6cc7b445d393cbe1d2644de6b15ba78268e68f70b97934f8e1b4b868e29ec9
5
5
  SHA512:
6
- metadata.gz: 35619bf1f55bdb50a50f69e90483c233236cec6bce7f721dcf8e007533653cadec5b492499d795de648af323d31c4d4142a60daac2386d37641ee41a354c7fa9
7
- data.tar.gz: 47a9e874d8da2f0d5b623b5077487d1b07138a6d74d04eae2ee32c873f841332cc4ffc26e9cc61c36402176a6636ba2c0b14b56985a24136475261b709b3a9af
6
+ metadata.gz: 50f9c16a0a4f4012b8df6a79e2f2f1ac9133a565c7e8746949a4259ddd8a42bea14478f9423f26ed76abc6c6a1772ab78264576dd37d1497ca7cc9afc75c8a79
7
+ data.tar.gz: 89f284d344accf4a9aeb1d5b75cb20ab9466683601dd31d99d4b588325eaa7793d1a43c614ed33780078e285e7c3395108ad02386cc8a8ea8b6a101dde7b0c26
@@ -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
- data0 = records(File.open(ARGV[0]))
76
- data1 = records(File.open(ARGV[1]))
77
-
78
- diff_opts = {
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
+ )
@@ -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
- expected, actual = ARGV.first(2).map do |f|
6
- JSON.parse(File.read(f))
7
- end
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
+ )
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ require 'diff_matcher/cli'
3
+
4
+ DiffMatcher::CLI.diff(
5
+ eval(File.read(ARGV[-2])),
6
+ eval(File.read(ARGV[-1]))
7
+ )
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require 'diff_matcher/cli'
3
+ require 'json'
4
+
5
+ DiffMatcher::CLI.diff(
6
+ eval(File.read(ARGV[-2])),
7
+ JSON.parse(File.read(ARGV[-1]))
8
+ )
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DiffMatcher
2
- VERSION = "2.8.0"
2
+ VERSION = "2.8.1"
3
3
  end
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.0
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-14 00:00:00.000000000 Z
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
- rubyforge_project:
79
- rubygems_version: 2.7.6
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: