diff-lcs 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +491 -0
- data/CODE_OF_CONDUCT.md +128 -0
- data/CONTRIBUTING.md +74 -0
- data/CONTRIBUTORS.md +48 -0
- data/Contributing.md +45 -90
- data/{License.md → LICENCE.md} +6 -4
- data/Manifest.txt +7 -4
- data/README.md +92 -0
- data/Rakefile +43 -66
- data/SECURITY.md +41 -0
- data/bin/htmldiff +4 -4
- data/docs/artistic.txt +1 -1
- data/lib/diff/lcs/array.rb +1 -1
- data/lib/diff/lcs/backports.rb +2 -2
- data/lib/diff/lcs/block.rb +4 -4
- data/lib/diff/lcs/callbacks.rb +9 -7
- data/lib/diff/lcs/change.rb +20 -20
- data/lib/diff/lcs/htmldiff.rb +26 -16
- data/lib/diff/lcs/hunk.rb +66 -45
- data/lib/diff/lcs/internals.rb +17 -17
- data/lib/diff/lcs/ldiff.rb +86 -74
- data/lib/diff/lcs.rb +66 -63
- data/lib/diff-lcs.rb +1 -1
- data/spec/change_spec.rb +50 -50
- data/spec/diff_spec.rb +14 -14
- data/spec/hunk_spec.rb +20 -20
- data/spec/issues_spec.rb +76 -70
- data/spec/lcs_spec.rb +11 -11
- data/spec/ldiff_spec.rb +30 -17
- data/spec/patch_spec.rb +84 -84
- data/spec/sdiff_spec.rb +111 -109
- data/spec/spec_helper.rb +76 -74
- data/spec/traverse_balanced_spec.rb +191 -189
- data/spec/traverse_sequences_spec.rb +31 -31
- metadata +55 -30
- data/Code-of-Conduct.md +0 -74
- data/History.md +0 -400
- data/README.rdoc +0 -84
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
|
-
describe
|
6
|
-
describe
|
7
|
-
describe
|
5
|
+
describe "Diff::LCS.traverse_sequences" do
|
6
|
+
describe "callback with no finishers" do
|
7
|
+
describe "over (seq1, seq2)" do
|
8
8
|
before(:each) do
|
9
9
|
@callback_s1_s2 = simple_callback_no_finishers
|
10
10
|
Diff::LCS.traverse_sequences(seq1, seq2, @callback_s1_s2)
|
@@ -13,27 +13,27 @@ describe 'Diff::LCS.traverse_sequences' do
|
|
13
13
|
Diff::LCS.traverse_sequences(seq2, seq1, @callback_s2_s1)
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
16
|
+
it "has the correct LCS result on left-matches" do
|
17
17
|
expect(@callback_s1_s2.matched_a).to eq(correct_lcs)
|
18
18
|
expect(@callback_s2_s1.matched_a).to eq(correct_lcs)
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
21
|
+
it "has the correct LCS result on right-matches" do
|
22
22
|
expect(@callback_s1_s2.matched_b).to eq(correct_lcs)
|
23
23
|
expect(@callback_s2_s1.matched_b).to eq(correct_lcs)
|
24
24
|
end
|
25
25
|
|
26
|
-
it
|
26
|
+
it "has the correct skipped sequences with the left sequence" do
|
27
27
|
expect(@callback_s1_s2.discards_a).to eq(skipped_seq1)
|
28
28
|
expect(@callback_s2_s1.discards_a).to eq(skipped_seq2)
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
31
|
+
it "has the correct skipped sequences with the right sequence" do
|
32
32
|
expect(@callback_s1_s2.discards_b).to eq(skipped_seq2)
|
33
33
|
expect(@callback_s2_s1.discards_b).to eq(skipped_seq1)
|
34
34
|
end
|
35
35
|
|
36
|
-
it
|
36
|
+
it "does not have anything done markers from the left or right sequences" do
|
37
37
|
expect(@callback_s1_s2.done_a).to be_empty
|
38
38
|
expect(@callback_s1_s2.done_b).to be_empty
|
39
39
|
expect(@callback_s2_s1.done_a).to be_empty
|
@@ -41,64 +41,64 @@ describe 'Diff::LCS.traverse_sequences' do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
describe
|
44
|
+
describe "over (hello, hello)" do
|
45
45
|
before(:each) do
|
46
46
|
@callback = simple_callback_no_finishers
|
47
47
|
Diff::LCS.traverse_sequences(hello, hello, @callback)
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
51
|
-
expect(@callback.matched_a).to eq(hello.
|
50
|
+
it "has the correct LCS result on left-matches" do
|
51
|
+
expect(@callback.matched_a).to eq(hello.chars)
|
52
52
|
end
|
53
53
|
|
54
|
-
it
|
55
|
-
expect(@callback.matched_b).to eq(hello.
|
54
|
+
it "has the correct LCS result on right-matches" do
|
55
|
+
expect(@callback.matched_b).to eq(hello.chars)
|
56
56
|
end
|
57
57
|
|
58
|
-
it
|
58
|
+
it "has the correct skipped sequences with the left sequence" do
|
59
59
|
expect(@callback.discards_a).to be_empty
|
60
60
|
end
|
61
61
|
|
62
|
-
it
|
62
|
+
it "has the correct skipped sequences with the right sequence" do
|
63
63
|
expect(@callback.discards_b).to be_empty
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
66
|
+
it "does not have anything done markers from the left or right sequences" do
|
67
67
|
expect(@callback.done_a).to be_empty
|
68
68
|
expect(@callback.done_b).to be_empty
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
describe
|
72
|
+
describe "over (hello_ary, hello_ary)" do
|
73
73
|
before(:each) do
|
74
74
|
@callback = simple_callback_no_finishers
|
75
75
|
Diff::LCS.traverse_sequences(hello_ary, hello_ary, @callback)
|
76
76
|
end
|
77
77
|
|
78
|
-
it
|
78
|
+
it "has the correct LCS result on left-matches" do
|
79
79
|
expect(@callback.matched_a).to eq(hello_ary)
|
80
80
|
end
|
81
81
|
|
82
|
-
it
|
82
|
+
it "has the correct LCS result on right-matches" do
|
83
83
|
expect(@callback.matched_b).to eq(hello_ary)
|
84
84
|
end
|
85
85
|
|
86
|
-
it
|
86
|
+
it "has the correct skipped sequences with the left sequence" do
|
87
87
|
expect(@callback.discards_a).to be_empty
|
88
88
|
end
|
89
89
|
|
90
|
-
it
|
90
|
+
it "has the correct skipped sequences with the right sequence" do
|
91
91
|
expect(@callback.discards_b).to be_empty
|
92
92
|
end
|
93
93
|
|
94
|
-
it
|
94
|
+
it "does not have anything done markers from the left or right sequences" do
|
95
95
|
expect(@callback.done_a).to be_empty
|
96
96
|
expect(@callback.done_b).to be_empty
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
describe
|
101
|
+
describe "callback with finisher" do
|
102
102
|
before(:each) do
|
103
103
|
@callback_s1_s2 = simple_callback
|
104
104
|
Diff::LCS.traverse_sequences(seq1, seq2, @callback_s1_s2)
|
@@ -106,32 +106,32 @@ describe 'Diff::LCS.traverse_sequences' do
|
|
106
106
|
Diff::LCS.traverse_sequences(seq2, seq1, @callback_s2_s1)
|
107
107
|
end
|
108
108
|
|
109
|
-
it
|
109
|
+
it "has the correct LCS result on left-matches" do
|
110
110
|
expect(@callback_s1_s2.matched_a).to eq(correct_lcs)
|
111
111
|
expect(@callback_s2_s1.matched_a).to eq(correct_lcs)
|
112
112
|
end
|
113
113
|
|
114
|
-
it
|
114
|
+
it "has the correct LCS result on right-matches" do
|
115
115
|
expect(@callback_s1_s2.matched_b).to eq(correct_lcs)
|
116
116
|
expect(@callback_s2_s1.matched_b).to eq(correct_lcs)
|
117
117
|
end
|
118
118
|
|
119
|
-
it
|
119
|
+
it "has the correct skipped sequences for the left sequence" do
|
120
120
|
expect(@callback_s1_s2.discards_a).to eq(skipped_seq1)
|
121
121
|
expect(@callback_s2_s1.discards_a).to eq(skipped_seq2)
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it "has the correct skipped sequences for the right sequence" do
|
125
125
|
expect(@callback_s1_s2.discards_b).to eq(skipped_seq2)
|
126
126
|
expect(@callback_s2_s1.discards_b).to eq(skipped_seq1)
|
127
127
|
end
|
128
128
|
|
129
|
-
it
|
130
|
-
expect(@callback_s1_s2.done_a).to eq([[
|
129
|
+
it "has done markers differently-sized sequences" do
|
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
133
|
expect(@callback_s2_s1.done_a).to be_empty
|
134
|
-
expect(@callback_s2_s1.done_b).to eq([[
|
134
|
+
expect(@callback_s2_s1.done_b).to eq([["t", 11, "p", 9]])
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diff-lcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.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: 2025-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: hoe
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5'
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: hoe-doofus
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +59,19 @@ dependencies:
|
|
39
59
|
- !ruby/object:Gem::Version
|
40
60
|
version: '1.1'
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: hoe-
|
62
|
+
name: hoe-git2
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
44
64
|
requirements:
|
45
65
|
- - "~>"
|
46
66
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
67
|
+
version: '1.7'
|
48
68
|
type: :development
|
49
69
|
prerelease: false
|
50
70
|
version_requirements: !ruby/object:Gem::Requirement
|
51
71
|
requirements:
|
52
72
|
- - "~>"
|
53
73
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
74
|
+
version: '1.7'
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
76
|
name: hoe-rubygems
|
57
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,33 +147,33 @@ dependencies:
|
|
127
147
|
- !ruby/object:Gem::Version
|
128
148
|
version: '7'
|
129
149
|
- !ruby/object:Gem::Dependency
|
130
|
-
name:
|
150
|
+
name: simplecov
|
131
151
|
requirement: !ruby/object:Gem::Requirement
|
132
152
|
requirements:
|
133
153
|
- - "~>"
|
134
154
|
- !ruby/object:Gem::Version
|
135
|
-
version: '
|
155
|
+
version: '0.21'
|
136
156
|
type: :development
|
137
157
|
prerelease: false
|
138
158
|
version_requirements: !ruby/object:Gem::Requirement
|
139
159
|
requirements:
|
140
160
|
- - "~>"
|
141
161
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
162
|
+
version: '0.21'
|
143
163
|
description: |-
|
144
164
|
Diff::LCS computes the difference between two Enumerable sequences using the
|
145
165
|
McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
|
146
166
|
to create a simple HTML diff output format and a standard diff-like tool.
|
147
167
|
|
148
168
|
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
|
-
|
169
|
+
Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number
|
170
|
+
of formatting issues.
|
151
171
|
|
152
|
-
Ruby versions below 2.5 are soft-deprecated, which means that older versions
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
172
|
+
Ruby versions below 2.5 are soft-deprecated, which means that older versions are
|
173
|
+
no longer part of the CI test suite. If any changes have been introduced that
|
174
|
+
break those versions, bug reports and patches will be accepted, but it will be
|
175
|
+
up to the reporter to verify any fixes prior to release. The next major release
|
176
|
+
will completely break compatibility.
|
157
177
|
email:
|
158
178
|
- halostatue@gmail.com
|
159
179
|
executables:
|
@@ -161,23 +181,29 @@ executables:
|
|
161
181
|
- ldiff
|
162
182
|
extensions: []
|
163
183
|
extra_rdoc_files:
|
164
|
-
-
|
184
|
+
- CHANGELOG.md
|
185
|
+
- CODE_OF_CONDUCT.md
|
186
|
+
- CONTRIBUTING.md
|
187
|
+
- CONTRIBUTORS.md
|
165
188
|
- Contributing.md
|
166
|
-
-
|
167
|
-
- License.md
|
189
|
+
- LICENCE.md
|
168
190
|
- Manifest.txt
|
169
|
-
- README.
|
191
|
+
- README.md
|
192
|
+
- SECURITY.md
|
170
193
|
- docs/COPYING.txt
|
171
194
|
- docs/artistic.txt
|
172
195
|
files:
|
173
196
|
- ".rspec"
|
174
|
-
-
|
197
|
+
- CHANGELOG.md
|
198
|
+
- CODE_OF_CONDUCT.md
|
199
|
+
- CONTRIBUTING.md
|
200
|
+
- CONTRIBUTORS.md
|
175
201
|
- Contributing.md
|
176
|
-
-
|
177
|
-
- License.md
|
202
|
+
- LICENCE.md
|
178
203
|
- Manifest.txt
|
179
|
-
- README.
|
204
|
+
- README.md
|
180
205
|
- Rakefile
|
206
|
+
- SECURITY.md
|
181
207
|
- bin/htmldiff
|
182
208
|
- bin/ldiff
|
183
209
|
- docs/COPYING.txt
|
@@ -232,16 +258,15 @@ files:
|
|
232
258
|
homepage: https://github.com/halostatue/diff-lcs
|
233
259
|
licenses:
|
234
260
|
- MIT
|
235
|
-
- Artistic-
|
236
|
-
- GPL-2.0
|
261
|
+
- Artistic-1.0-Perl
|
262
|
+
- GPL-2.0-or-later
|
237
263
|
metadata:
|
238
|
-
|
239
|
-
|
240
|
-
bug_tracker_uri: https://github.com/halostatue/diff-lcs/issues
|
264
|
+
rubygems_mfa_required: 'true'
|
265
|
+
changelog_uri: https://github.com/halostatue/diff-lcs/blob/main/CHANGELOG.md
|
241
266
|
post_install_message:
|
242
267
|
rdoc_options:
|
243
268
|
- "--main"
|
244
|
-
- README.
|
269
|
+
- README.md
|
245
270
|
require_paths:
|
246
271
|
- lib
|
247
272
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -255,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
280
|
- !ruby/object:Gem::Version
|
256
281
|
version: '0'
|
257
282
|
requirements: []
|
258
|
-
rubygems_version: 3.
|
283
|
+
rubygems_version: 3.5.22
|
259
284
|
signing_key:
|
260
285
|
specification_version: 4
|
261
286
|
summary: Diff::LCS computes the difference between two Enumerable sequences using
|
data/Code-of-Conduct.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|