diff-lcs 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Contributing.md +84 -49
- data/History.md +246 -93
- data/Manifest.txt +15 -1
- data/README.rdoc +9 -8
- data/Rakefile +84 -3
- data/lib/diff/lcs/backports.rb +1 -1
- data/lib/diff/lcs/block.rb +1 -1
- data/lib/diff/lcs/hunk.rb +118 -48
- data/lib/diff/lcs/internals.rb +7 -3
- data/lib/diff/lcs/ldiff.rb +16 -20
- data/lib/diff/lcs.rb +32 -25
- data/spec/fixtures/ldiff/output.diff-c +2 -2
- data/spec/fixtures/ldiff/output.diff-u +2 -2
- data/spec/fixtures/ldiff/output.diff.chef +4 -0
- data/spec/fixtures/ldiff/output.diff.chef-c +15 -0
- data/spec/fixtures/ldiff/output.diff.chef-e +3 -0
- data/spec/fixtures/ldiff/output.diff.chef-f +3 -0
- data/spec/fixtures/ldiff/output.diff.chef-u +9 -0
- data/spec/fixtures/ldiff/output.diff.chef2 +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-c +20 -0
- data/spec/fixtures/ldiff/output.diff.chef2-d +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-e +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-f +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-u +16 -0
- data/spec/fixtures/new-chef +4 -0
- data/spec/fixtures/new-chef2 +17 -0
- data/spec/fixtures/old-chef +4 -0
- data/spec/fixtures/old-chef2 +14 -0
- data/spec/hunk_spec.rb +21 -10
- data/spec/issues_spec.rb +90 -3
- data/spec/ldiff_spec.rb +44 -31
- data/spec/spec_helper.rb +26 -25
- data/spec/traverse_sequences_spec.rb +2 -4
- metadata +36 -15
- data/autotest/discover.rb +0 -3
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'pathname'
|
5
|
-
|
5
|
+
|
6
|
+
require 'psych' if RUBY_VERSION >= '1.9'
|
6
7
|
|
7
8
|
if ENV['COVERAGE']
|
8
9
|
require 'simplecov'
|
@@ -27,7 +28,7 @@ if ENV['COVERAGE']
|
|
27
28
|
}
|
28
29
|
|
29
30
|
SimpleCov.start do
|
30
|
-
formatter SimpleCov::Formatter::MultiFormatter
|
31
|
+
formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -43,30 +44,31 @@ module CaptureSubprocessIO
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def capture_subprocess_io
|
46
|
-
_synchronize
|
47
|
-
|
48
|
-
require 'tempfile'
|
47
|
+
_synchronize { _capture_subprocess_io { yield } }
|
48
|
+
end
|
49
49
|
|
50
|
-
|
50
|
+
def _capture_subprocess_io
|
51
|
+
require 'tempfile'
|
51
52
|
|
52
|
-
|
53
|
-
$stdout.reopen captured_stdout
|
54
|
-
$stderr.reopen captured_stderr
|
53
|
+
captured_stdout, captured_stderr = Tempfile.new('out'), Tempfile.new('err')
|
55
54
|
|
56
|
-
|
55
|
+
orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
|
56
|
+
$stdout.reopen captured_stdout
|
57
|
+
$stderr.reopen captured_stderr
|
57
58
|
|
58
|
-
|
59
|
-
$stderr.rewind
|
59
|
+
yield
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
$stdout.rewind
|
62
|
+
$stderr.rewind
|
63
|
+
|
64
|
+
[captured_stdout.read, captured_stderr.read]
|
65
|
+
ensure
|
66
|
+
captured_stdout.unlink
|
67
|
+
captured_stderr.unlink
|
68
|
+
$stdout.reopen orig_stdout
|
69
|
+
$stderr.reopen orig_stderr
|
69
70
|
end
|
71
|
+
private :_capture_subprocess_io
|
70
72
|
end
|
71
73
|
|
72
74
|
require 'diff-lcs'
|
@@ -121,8 +123,8 @@ module Diff::LCS::SpecHelper
|
|
121
123
|
],
|
122
124
|
[
|
123
125
|
['-', 8, 'n'],
|
124
|
-
['-', 9, 'p'],
|
125
126
|
['+', 9, 'r'],
|
127
|
+
['-', 9, 'p'],
|
126
128
|
['+', 10, 's'],
|
127
129
|
['+', 11, 't']
|
128
130
|
]
|
@@ -146,10 +148,10 @@ module Diff::LCS::SpecHelper
|
|
146
148
|
],
|
147
149
|
[
|
148
150
|
['-', 9, 'r'],
|
149
|
-
['-', 10, 's'],
|
150
151
|
['+', 8, 'n'],
|
151
|
-
['-',
|
152
|
-
['+', 9, 'p']
|
152
|
+
['-', 10, 's'],
|
153
|
+
['+', 9, 'p'],
|
154
|
+
['-', 11, 't']
|
153
155
|
]
|
154
156
|
]
|
155
157
|
end
|
@@ -286,7 +288,6 @@ module Diff::LCS::SpecHelper
|
|
286
288
|
end
|
287
289
|
|
288
290
|
def finished_b(event)
|
289
|
-
p 'called #finished_b'
|
290
291
|
@done_b << [
|
291
292
|
event.old_element, event.old_position,
|
292
293
|
event.new_element, event.new_position
|
@@ -127,13 +127,11 @@ describe 'Diff::LCS.traverse_sequences' do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'has done markers differently-sized sequences' do
|
130
|
-
expect(@callback_s1_s2.done_a).to eq([['p', 9, '
|
130
|
+
expect(@callback_s1_s2.done_a).to eq([['p', 9, 't', 11]])
|
131
131
|
expect(@callback_s1_s2.done_b).to be_empty
|
132
132
|
|
133
|
-
# 20110731 I don't yet understand why this particular behaviour
|
134
|
-
# isn't transitive.
|
135
133
|
expect(@callback_s2_s1.done_a).to be_empty
|
136
|
-
expect(@callback_s2_s1.done_b).to
|
134
|
+
expect(@callback_s2_s1.done_b).to eq([['t', 11, 'p', 9]])
|
137
135
|
end
|
138
136
|
end
|
139
137
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diff-lcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hoe-doofus
|
@@ -112,41 +112,48 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
115
|
+
version: 6.3.1
|
116
|
+
- - "<"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '7'
|
116
119
|
type: :development
|
117
120
|
prerelease: false
|
118
121
|
version_requirements: !ruby/object:Gem::Requirement
|
119
122
|
requirements:
|
120
123
|
- - ">="
|
121
124
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
125
|
+
version: 6.3.1
|
126
|
+
- - "<"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '7'
|
123
129
|
- !ruby/object:Gem::Dependency
|
124
130
|
name: hoe
|
125
131
|
requirement: !ruby/object:Gem::Requirement
|
126
132
|
requirements:
|
127
133
|
- - "~>"
|
128
134
|
- !ruby/object:Gem::Version
|
129
|
-
version: '3.
|
135
|
+
version: '3.23'
|
130
136
|
type: :development
|
131
137
|
prerelease: false
|
132
138
|
version_requirements: !ruby/object:Gem::Requirement
|
133
139
|
requirements:
|
134
140
|
- - "~>"
|
135
141
|
- !ruby/object:Gem::Version
|
136
|
-
version: '3.
|
142
|
+
version: '3.23'
|
137
143
|
description: |-
|
138
144
|
Diff::LCS computes the difference between two Enumerable sequences using the
|
139
145
|
McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
|
140
146
|
to create a simple HTML diff output format and a standard diff-like tool.
|
141
147
|
|
142
|
-
This is release 1.4, providing a simple extension that allows for
|
143
|
-
Diff::LCS::Change objects to be treated implicitly as arrays
|
144
|
-
|
148
|
+
This is release 1.4.3, providing a simple extension that allows for
|
149
|
+
Diff::LCS::Change objects to be treated implicitly as arrays and fixes a
|
150
|
+
number of formatting issues.
|
145
151
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
to
|
152
|
+
Ruby versions below 2.5 are soft-deprecated, which means that older versions
|
153
|
+
are no longer part of the CI test suite. If any changes have been introduced
|
154
|
+
that break those versions, bug reports and patches will be accepted, but it
|
155
|
+
will be up to the reporter to verify any fixes prior to release. The next
|
156
|
+
major release will completely break compatibility.
|
150
157
|
email:
|
151
158
|
- halostatue@gmail.com
|
152
159
|
executables:
|
@@ -171,7 +178,6 @@ files:
|
|
171
178
|
- Manifest.txt
|
172
179
|
- README.rdoc
|
173
180
|
- Rakefile
|
174
|
-
- autotest/discover.rb
|
175
181
|
- bin/htmldiff
|
176
182
|
- bin/ldiff
|
177
183
|
- docs/COPYING.txt
|
@@ -199,6 +205,21 @@ files:
|
|
199
205
|
- spec/fixtures/ldiff/output.diff-e
|
200
206
|
- spec/fixtures/ldiff/output.diff-f
|
201
207
|
- spec/fixtures/ldiff/output.diff-u
|
208
|
+
- spec/fixtures/ldiff/output.diff.chef
|
209
|
+
- spec/fixtures/ldiff/output.diff.chef-c
|
210
|
+
- spec/fixtures/ldiff/output.diff.chef-e
|
211
|
+
- spec/fixtures/ldiff/output.diff.chef-f
|
212
|
+
- spec/fixtures/ldiff/output.diff.chef-u
|
213
|
+
- spec/fixtures/ldiff/output.diff.chef2
|
214
|
+
- spec/fixtures/ldiff/output.diff.chef2-c
|
215
|
+
- spec/fixtures/ldiff/output.diff.chef2-d
|
216
|
+
- spec/fixtures/ldiff/output.diff.chef2-e
|
217
|
+
- spec/fixtures/ldiff/output.diff.chef2-f
|
218
|
+
- spec/fixtures/ldiff/output.diff.chef2-u
|
219
|
+
- spec/fixtures/new-chef
|
220
|
+
- spec/fixtures/new-chef2
|
221
|
+
- spec/fixtures/old-chef
|
222
|
+
- spec/fixtures/old-chef2
|
202
223
|
- spec/hunk_spec.rb
|
203
224
|
- spec/issues_spec.rb
|
204
225
|
- spec/lcs_spec.rb
|
@@ -234,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
255
|
- !ruby/object:Gem::Version
|
235
256
|
version: '0'
|
236
257
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
258
|
+
rubygems_version: 3.1.6
|
238
259
|
signing_key:
|
239
260
|
specification_version: 4
|
240
261
|
summary: Diff::LCS computes the difference between two Enumerable sequences using
|
data/autotest/discover.rb
DELETED