diff-lcs 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Contributing.md +2 -0
- data/History.md +86 -55
- data/License.md +6 -4
- data/Rakefile +36 -27
- data/bin/htmldiff +4 -4
- 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 +19 -19
- data/lib/diff/lcs/htmldiff.rb +24 -16
- data/lib/diff/lcs/hunk.rb +35 -30
- data/lib/diff/lcs/internals.rb +17 -17
- data/lib/diff/lcs/ldiff.rb +37 -35
- data/lib/diff/lcs.rb +57 -55
- 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 +19 -19
- data/spec/issues_spec.rb +48 -42
- data/spec/lcs_spec.rb +11 -11
- data/spec/ldiff_spec.rb +13 -11
- 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 +28 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3538bd306feb87c5a2d957b3956a9b8ede2a2782db387f9f253115053c2066a1
|
4
|
+
data.tar.gz: af8dd06512d39de79534212726c6ed9beba9560e110a1026666181a21dbb5dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3598cd0dc37b22112495d82949a3d846751ca2dc3717dffe313acf6740761df98ed6d9f158ebc1fc7be6739bb3ac774ee3d8a0c4ccb4f2f651aaa5c45b49e9d9
|
7
|
+
data.tar.gz: 77f4c9705752143e88953395b991d4105de3e744f524421ff9a3933aa18febf82854462835ede955b72c62884143f27b9278f968f4629f40bbce2192ca44aa5b
|
data/Contributing.md
CHANGED
@@ -94,6 +94,7 @@ Thanks to everyone else who has contributed code or bug reports to Diff::LCS:
|
|
94
94
|
- Josep (@apuratepp)
|
95
95
|
- Josh Bronson
|
96
96
|
- Jun Aruga
|
97
|
+
- Justin Steele
|
97
98
|
- Kenichi Kamiya
|
98
99
|
- Kensuke Nagae
|
99
100
|
- Kevin Ansfield
|
@@ -105,6 +106,7 @@ Thanks to everyone else who has contributed code or bug reports to Diff::LCS:
|
|
105
106
|
- Oleg Orlov
|
106
107
|
- Paul Kunysch
|
107
108
|
- Pete Higgins
|
109
|
+
- Peter Goldstein
|
108
110
|
- Peter Wagenet
|
109
111
|
- Philippe Lafoucrière
|
110
112
|
- Ryan Lovelett
|
data/History.md
CHANGED
@@ -1,10 +1,33 @@
|
|
1
1
|
# History
|
2
2
|
|
3
|
+
## 1.5.1 / 2024-01-31
|
4
|
+
|
5
|
+
- Peter Goldstein updated CI configuration to add Ruby 3.1 and Masato Nakamura
|
6
|
+
added Ruby 3.2 and 3.3. [#82][], [#89][]
|
7
|
+
|
8
|
+
- Updated the CI configuration, resolving [#82][] to add Ruby 3.1. Masato
|
9
|
+
|
10
|
+
- Switched to [standard ruby][] formatting.
|
11
|
+
|
12
|
+
- Justin Steele converted the licence file to Markdown. [#84][]
|
13
|
+
|
14
|
+
- Updated the gem SPDX identifier for GPL 2.0 or later, resolving [#86][] by Vit
|
15
|
+
Ondruch.
|
16
|
+
|
17
|
+
- Resolve a potential security issue with `ldiff` in its use of `IO.read`
|
18
|
+
instead of `File.read`. [#91][]
|
19
|
+
|
20
|
+
- Added MFA authentication requirement for release to RubyGems. [#90][]
|
21
|
+
|
22
|
+
- Added dependabot management for actions and gems. [#90][]
|
23
|
+
|
24
|
+
- Updated CodeQL coniguration. [#90][]
|
25
|
+
|
3
26
|
## 1.5.0 / 2021-12-23
|
4
27
|
|
5
28
|
- Updated the CI configuration and monkey-patch Hoe.
|
6
29
|
|
7
|
-
- Kenichi Kamiya fixed a test configuration deprecation in SimpleCov. [#69]
|
30
|
+
- Kenichi Kamiya fixed a test configuration deprecation in SimpleCov. [#69][]
|
8
31
|
|
9
32
|
- Tien introduced several corrections and code improvements:
|
10
33
|
|
@@ -14,34 +37,34 @@
|
|
14
37
|
That is, `LCS(s2, s1)` should produce a sequence that is transitive with
|
15
38
|
`LCS(s1, s2)` on traversal, and applying the diff computed from those
|
16
39
|
results would result in equivalent changes that could be played forward or
|
17
|
-
backward as appropriate. [#71], [#75]
|
40
|
+
backward as appropriate. [#71][], [#75][]
|
18
41
|
|
19
42
|
- The above fix resulted in a changed order of the longest common subsequence
|
20
43
|
when callbacks were applied. After analysis, it was determined that the
|
21
44
|
computed subsequence was _equivalent_ to the prior version, so the test was
|
22
45
|
updated. This also resulted in the clarification of documentation when
|
23
|
-
traversing the subsequences. [#79]
|
46
|
+
traversing the subsequences. [#79][]
|
24
47
|
|
25
48
|
- An infinite loop case in the case where Diff::LCS would be included into an
|
26
|
-
enumerable class has been fixed. [#73]
|
49
|
+
enumerable class has been fixed. [#73][]
|
27
50
|
|
28
|
-
- Clarified the purpose of a threshold test in calculation of LCS. [#72],
|
29
|
-
[#80]
|
51
|
+
- Clarified the purpose of a threshold test in calculation of LCS. [#72][],
|
52
|
+
[#80][]
|
30
53
|
|
31
54
|
- Removed autotest directory
|
32
55
|
|
33
56
|
## 1.4.4 / 2020-07-01
|
34
57
|
|
35
58
|
- Fixed an issue reported by Jun Aruga in the Diff::LCS::Ldiff binary text
|
36
|
-
detection. [#44]
|
59
|
+
detection. [#44][]
|
37
60
|
|
38
61
|
- Fixed a theoretical issue reported by Jun Aruga in Diff::LCS::Hunk to raise
|
39
|
-
a more useful exception. [#43]
|
62
|
+
a more useful exception. [#43][]
|
40
63
|
|
41
64
|
- Added documentation that should address custom object issues as reported in
|
42
|
-
[#35].
|
65
|
+
[#35][].
|
43
66
|
|
44
|
-
- Fixed more diff errors, in part reported in [#65].
|
67
|
+
- Fixed more diff errors, in part reported in [#65][].
|
45
68
|
|
46
69
|
- The use of `Numeric#abs` is incorrect in `Diff::LCS::Block#diff_size`. The
|
47
70
|
diff size _must_ be accurate for correct change placement.
|
@@ -89,19 +112,19 @@
|
|
89
112
|
|
90
113
|
- Made the use of `psych` dependent on `RUBY_VERSION >= 1.9`.
|
91
114
|
|
92
|
-
Resolves [#63].
|
115
|
+
Resolves [#63][].
|
93
116
|
|
94
117
|
## 1.4.2 / 2020-06-23
|
95
118
|
|
96
|
-
- Camille Drapier fixed a small issue with RuboCop configuration. [#59]
|
119
|
+
- Camille Drapier fixed a small issue with RuboCop configuration. [#59][]
|
97
120
|
|
98
121
|
- Applied another fix (and unit test) to fix an issue for the Chef team.
|
99
|
-
[#60], [#61]
|
122
|
+
[#60][], [#61][]
|
100
123
|
|
101
124
|
## 1.4.1 / 2020-06-23
|
102
125
|
|
103
|
-
- Fix an issue where diff sizes could be negative, and they should be. [#57],
|
104
|
-
[#58]
|
126
|
+
- Fix an issue where diff sizes could be negative, and they should be. [#57][],
|
127
|
+
[#58][]
|
105
128
|
|
106
129
|
## 1.4 / 2020-06-23
|
107
130
|
|
@@ -109,12 +132,12 @@
|
|
109
132
|
of the CI process any longer.
|
110
133
|
|
111
134
|
- Akinora MUSHA (knu) added the ability for Diff::LCS::Change objects to be
|
112
|
-
implicitly treated arrays. Originally provided as pull request [#47], but it
|
113
|
-
introduced a number of test failures as documented in [#48], and remediation
|
114
|
-
of Diff::LCS itself was introduced in [#49].
|
135
|
+
implicitly treated arrays. Originally provided as pull request [#47][], but it
|
136
|
+
introduced a number of test failures as documented in [#48][], and remediation
|
137
|
+
of Diff::LCS itself was introduced in [#49][].
|
115
138
|
|
116
|
-
- Resolved [#5] with some tests comparing output from `system` calls to
|
117
|
-
`bin/ldiff` with some pre-generated output. Resolved [#6] with these tests.
|
139
|
+
- Resolved [#5][] with some tests comparing output from `system` calls to
|
140
|
+
`bin/ldiff` with some pre-generated output. Resolved [#6][] with these tests.
|
118
141
|
|
119
142
|
- Resolved a previously undetected `bin/ldiff` issue with `--context` output not
|
120
143
|
matching `diff --context` output.
|
@@ -122,30 +145,30 @@
|
|
122
145
|
- Resolved an issue with later versions of Ruby not working with an `OptParse`
|
123
146
|
specification of `Numeric`; this has been changed to `Integer`.
|
124
147
|
|
125
|
-
- Brandon Fish added truffleruby in [#52].
|
148
|
+
- Brandon Fish added truffleruby in [#52][].
|
126
149
|
|
127
|
-
- Fixed two missing classes as reported in [#53].
|
150
|
+
- Fixed two missing classes as reported in [#53][].
|
128
151
|
|
129
152
|
## 1.3 / 2017-01-18
|
130
153
|
|
131
154
|
- Bugs fixed:
|
132
155
|
|
133
|
-
- Fixed an error for bin/ldiff --version. Fixes issue [#21].
|
156
|
+
- Fixed an error for bin/ldiff --version. Fixes issue [#21][].
|
134
157
|
|
135
158
|
- Force Diff::LCS::Change and Diff::LCS::ContextChange to only perform
|
136
159
|
equality comparisons against themselves. Provided by Kevin Mook in pull
|
137
|
-
request [#29].
|
160
|
+
request [#29][].
|
138
161
|
|
139
162
|
- Fix tab expansion in htmldiff, provided by Mark Friedgan in pull request
|
140
|
-
[#25].
|
163
|
+
[#25][].
|
141
164
|
|
142
|
-
- Silence Ruby 2.4 Fixnum deprecation warnings. Fixes issue [#38] and pull
|
143
|
-
request [#36].
|
165
|
+
- Silence Ruby 2.4 Fixnum deprecation warnings. Fixes issue [#38][] and pull
|
166
|
+
request [#36][].
|
144
167
|
|
145
|
-
- Ensure that test dependencies are loaded properly. Fixes issue [#33] and
|
146
|
-
pull request [#34].
|
168
|
+
- Ensure that test dependencies are loaded properly. Fixes issue [#33][] and
|
169
|
+
pull request [#34][].
|
147
170
|
|
148
|
-
- Fix issue [#1] with incorrect intuition of patch direction. Tentative fix,
|
171
|
+
- Fix issue [#1][] with incorrect intuition of patch direction. Tentative fix,
|
149
172
|
but the previous failure cases pass now.
|
150
173
|
|
151
174
|
- Tooling changes:
|
@@ -167,16 +190,17 @@
|
|
167
190
|
- Bugs fixed:
|
168
191
|
|
169
192
|
- Comparing arrays flattened them too far, especially with Diff::LCS.sdiff.
|
170
|
-
Fixed by Josh Bronson in pull request [#23].
|
193
|
+
Fixed by Josh Bronson in pull request [#23][].
|
171
194
|
|
172
195
|
## 1.2.4 / 2013-04-20
|
173
196
|
|
174
197
|
- Bugs fixed:
|
175
198
|
|
176
199
|
- A bug was introduced after 1.1.3 when pruning common sequences at the start
|
177
|
-
of comparison. Paul Kunysch (@pck) fixed this in pull request [#18].
|
200
|
+
of comparison. Paul Kunysch (@pck) fixed this in pull request [#18][].
|
201
|
+
Thanks!
|
178
202
|
|
179
|
-
- The Rubinius (1.9 mode) bug in [rubinius/rubinius#2268] has been fixed by
|
203
|
+
- The Rubinius (1.9 mode) bug in [rubinius/rubinius#2268][] has been fixed by
|
180
204
|
the Rubinius team two days after it was filed. Thanks for fixing this so
|
181
205
|
quickly!
|
182
206
|
|
@@ -188,12 +212,12 @@
|
|
188
212
|
|
189
213
|
- The new encoding detection for diff output generation (added in 1.2.2)
|
190
214
|
introduced a bug if the left side of the comparison was the empty set.
|
191
|
-
Originally found in [rspec/rspec-expectations#238] and
|
192
|
-
[rspec/rspec-expectations#239]. Jon Rowe developed a reasonable heuristic
|
215
|
+
Originally found in [rspec/rspec-expectations#238][] and
|
216
|
+
[rspec/rspec-expectations#239][]. Jon Rowe developed a reasonable heuristic
|
193
217
|
(left side, right side, empty string literal) to avoid this bug.
|
194
218
|
|
195
219
|
- There is a known issue with Rubinius in 1.9 mode reported in
|
196
|
-
[rubinius/rubinius#2268] and demonstrated in the Travis CI builds. For all
|
220
|
+
[rubinius/rubinius#2268][] and demonstrated in the Travis CI builds. For all
|
197
221
|
other tested platforms, diff-lcs is considered stable. As soon as a suitably
|
198
222
|
small test-case can be created for the Rubinius team to examine, this will
|
199
223
|
be added to the Rubinius issue around this.
|
@@ -205,8 +229,8 @@
|
|
205
229
|
- Diff::LCS::Hunk could not properly generate a difference for comparison sets
|
206
230
|
that are not US-ASCII-compatible because of the use of literal regular
|
207
231
|
expressions and strings. Jon Rowe found this in
|
208
|
-
[rspec/rspec-expectations#219] and provided a first pass implementation in
|
209
|
-
pull request [#15]. I've reworked it because of test failures in Rubinius
|
232
|
+
[rspec/rspec-expectations#219][] and provided a first pass implementation in
|
233
|
+
pull request [#15][]. I've reworked it because of test failures in Rubinius
|
210
234
|
when running in Ruby 1.9 mode. This coerces the added values to the encoding
|
211
235
|
of the old dataset (as determined by the first piece of the old dataset).
|
212
236
|
|
@@ -216,9 +240,9 @@
|
|
216
240
|
|
217
241
|
- Bugs Fixed:
|
218
242
|
|
219
|
-
- As seen in [rspec/rspec-expectations#200], the release of Diff::LCS 1.2
|
243
|
+
- As seen in [rspec/rspec-expectations#200][], the release of Diff::LCS 1.2
|
220
244
|
introduced an unnecessary public API change to Diff::LCS::Hunk (see the
|
221
|
-
change at [rspec/rspec-expectations@3d6fc82c] for details). The new method
|
245
|
+
change at [rspec/rspec-expectations@3d6fc82c][] for details). The new method
|
222
246
|
name (and behaviour) is more correct, but I should not have renamed the
|
223
247
|
function or should have at least provided an alias. This release restores
|
224
248
|
Diff::LCS::Hunk#unshift as an alias to #merge. Note that the old #unshift
|
@@ -235,25 +259,25 @@
|
|
235
259
|
|
236
260
|
- Bugs Fixed:
|
237
261
|
|
238
|
-
- Fixed issue [#1] patch direction detection.
|
262
|
+
- Fixed issue [#1][] patch direction detection.
|
239
263
|
|
240
|
-
- Resolved issue [#2] by handling `string[string.size, 1]` properly (it
|
264
|
+
- Resolved issue [#2][] by handling `string[string.size, 1]` properly (it
|
241
265
|
returns `""` not `nil`).
|
242
266
|
|
243
267
|
- Michael Granger (ged) fixed an implementation error in Diff::LCS::Change and
|
244
|
-
added specs in pull request [#8]. Thanks!
|
268
|
+
added specs in pull request [#8][]. Thanks!
|
245
269
|
|
246
270
|
- Made the code auto-testable.
|
247
271
|
|
248
272
|
- Vít Ondruch (voxik) provided the latest version of the GPL2 license file in
|
249
|
-
pull request [#10]. Thanks!
|
273
|
+
pull request [#10][]. Thanks!
|
250
274
|
|
251
275
|
- Fixed a documentation issue with the includable versions of #patch! and
|
252
276
|
#unpatch! where they implied that they would replace the original value.
|
253
277
|
Given that Diff::LCS.patch always returns a copy, the documentation was
|
254
278
|
incorrect and has been corrected. To provide the behaviour that was
|
255
279
|
originally documented, two new methods were added to provide this behaviour.
|
256
|
-
Found by scooter-dangle in issue [#12]. Thanks!
|
280
|
+
Found by scooter-dangle in issue [#12][]. Thanks!
|
257
281
|
|
258
282
|
- Code Style Changes:
|
259
283
|
|
@@ -261,11 +285,11 @@
|
|
261
285
|
|
262
286
|
- Calling class methods using `.` instead of `::`.
|
263
287
|
|
264
|
-
- Vít Ondruch (voxik) removed unnecessary shebangs in pull request [#9].
|
288
|
+
- Vít Ondruch (voxik) removed unnecessary shebangs in pull request [#9][].
|
265
289
|
Thanks!
|
266
290
|
|
267
291
|
- Kenichi Kamiya (kachick) removed some warnings of an unused variable in
|
268
|
-
lucky pull request [#13]. Thanks!
|
292
|
+
lucky pull request [#13][]. Thanks!
|
269
293
|
|
270
294
|
- Embarked on a major refactoring to make the files a little more manageable
|
271
295
|
and understand the code on a deeper level.
|
@@ -285,9 +309,9 @@
|
|
285
309
|
- Bugs fixed:
|
286
310
|
|
287
311
|
- Eliminated the explicit use of RubyGems in both bin/htmldiff and bin/ldiff.
|
288
|
-
Resolves issue [#4].
|
312
|
+
Resolves issue [#4][].
|
289
313
|
|
290
|
-
- Eliminated Ruby warnings. Resolves issue [#3].
|
314
|
+
- Eliminated Ruby warnings. Resolves issue [#3][].
|
291
315
|
|
292
316
|
## 1.1.2 / 2004-10-20
|
293
317
|
|
@@ -349,12 +373,6 @@
|
|
349
373
|
|
350
374
|
- Initial release based mostly on Perl's Algorithm::Diff.
|
351
375
|
|
352
|
-
[rubinius/rubinius#2268]: https://github.com/rubinius/rubinius/issues/2268
|
353
|
-
[rspec/rspec-expectations#239]: https://github.com/rspec/rspec-expectations/issues/239
|
354
|
-
[rspec/rspec-expectations#238]: https://github.com/rspec/rspec-expectations/issues/238
|
355
|
-
[rspec/rspec-expectations#219]: https://github.com/rspec/rspec-expectations/issues/219
|
356
|
-
[rspec/rspec-expectations@3d6fc82c]: https://github.com/rspec/rspec-expectations/commit/3d6fc82c
|
357
|
-
[rspec/rspec-expectations#200]: https://github.com/rspec/rspec-expectations/pull/200
|
358
376
|
[#1]: https://github.com/halostatue/diff-lcs/issues/1
|
359
377
|
[#2]: https://github.com/halostatue/diff-lcs/issues/2
|
360
378
|
[#3]: https://github.com/halostatue/diff-lcs/issues/3
|
@@ -398,3 +416,16 @@
|
|
398
416
|
[#75]: https://github.com/halostatue/diff-lcs/issues/75
|
399
417
|
[#79]: https://github.com/halostatue/diff-lcs/issues/79
|
400
418
|
[#80]: https://github.com/halostatue/diff-lcs/issues/80
|
419
|
+
[#82]: https://github.com/halostatue/diff-lcs/pull/82
|
420
|
+
[#84]: https://github.com/halostatue/diff-lcs/pull/84
|
421
|
+
[#86]: https://github.com/halostatue/diff-lcs/pull/86
|
422
|
+
[#89]: https://github.com/halostatue/diff-lcs/pull/89
|
423
|
+
[#90]: https://github.com/halostatue/diff-lcs/pull/90
|
424
|
+
[#91]: https://github.com/halostatue/diff-lcs/issues/91
|
425
|
+
[rspec/rspec-expectations#200]: https://github.com/rspec/rspec-expectations/pull/200
|
426
|
+
[rspec/rspec-expectations#219]: https://github.com/rspec/rspec-expectations/issues/219
|
427
|
+
[rspec/rspec-expectations#238]: https://github.com/rspec/rspec-expectations/issues/238
|
428
|
+
[rspec/rspec-expectations#239]: https://github.com/rspec/rspec-expectations/issues/239
|
429
|
+
[rspec/rspec-expectations@3d6fc82c]: https://github.com/rspec/rspec-expectations/commit/3d6fc82c
|
430
|
+
[rubinius/rubinius#2268]: https://github.com/rubinius/rubinius/issues/2268
|
431
|
+
[standard ruby]: https://github.com/standardrb/standard
|
data/License.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# License
|
2
2
|
|
3
3
|
This software is available under three licenses: the GNU GPL version 2 (or at
|
4
4
|
your option, a later version), the Perl Artistic license, or the MIT license.
|
@@ -12,7 +12,7 @@ licensing terms.
|
|
12
12
|
* Adapted from Algorithm::Diff (Perl) by Ned Konz and a Smalltalk version by
|
13
13
|
Mario I. Wolczko.
|
14
14
|
|
15
|
-
|
15
|
+
## MIT License
|
16
16
|
|
17
17
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
18
18
|
this software and associated documentation files (the "Software"), to deal in
|
@@ -32,8 +32,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
32
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
33
33
|
SOFTWARE.
|
34
34
|
|
35
|
-
|
35
|
+
## Perl Artistic License
|
36
|
+
|
36
37
|
See the file docs/artistic.txt in the main distribution.
|
37
38
|
|
38
|
-
|
39
|
+
## GNU GPL version 2
|
40
|
+
|
39
41
|
See the file docs/COPYING.txt in the main distribution.
|
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "rubygems"
|
4
|
+
require "rspec"
|
5
|
+
require "rspec/core/rake_task"
|
6
|
+
require "hoe"
|
7
7
|
|
8
8
|
# This is required until https://github.com/seattlerb/hoe/issues/112 is fixed
|
9
9
|
class Hoe
|
@@ -45,66 +45,74 @@ Hoe.plugin :doofus
|
|
45
45
|
Hoe.plugin :gemspec2
|
46
46
|
Hoe.plugin :git
|
47
47
|
|
48
|
-
if RUBY_VERSION <
|
49
|
-
class Array
|
48
|
+
if RUBY_VERSION < "1.9"
|
49
|
+
class Array # :nodoc:
|
50
50
|
def to_h
|
51
51
|
Hash[*flatten(1)]
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
class Gem::Specification
|
56
|
-
def metadata=(*)
|
55
|
+
class Gem::Specification # :nodoc:
|
56
|
+
def metadata=(*)
|
57
|
+
end
|
57
58
|
|
58
|
-
def default_value(*)
|
59
|
+
def default_value(*)
|
60
|
+
end
|
59
61
|
end
|
60
62
|
|
61
|
-
class Object
|
63
|
+
class Object # :nodoc:
|
62
64
|
def caller_locations(*)
|
63
65
|
[]
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
_spec = Hoe.spec
|
69
|
-
developer(
|
70
|
+
_spec = Hoe.spec "diff-lcs" do
|
71
|
+
developer("Austin Ziegler", "halostatue@gmail.com")
|
72
|
+
|
73
|
+
require_ruby_version ">= 1.8"
|
70
74
|
|
71
|
-
|
75
|
+
self.history_file = "History.md"
|
76
|
+
self.readme_file = "README.rdoc"
|
77
|
+
self.licenses = ["MIT", "Artistic-2.0", "GPL-2.0-or-later"]
|
72
78
|
|
73
|
-
|
74
|
-
self.readme_file = 'README.rdoc'
|
75
|
-
self.licenses = ['MIT', 'Artistic-2.0', 'GPL-2.0+']
|
79
|
+
spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }
|
76
80
|
|
77
|
-
extra_dev_deps << [
|
78
|
-
extra_dev_deps << [
|
79
|
-
extra_dev_deps << [
|
80
|
-
extra_dev_deps << [
|
81
|
-
extra_dev_deps << [
|
82
|
-
extra_dev_deps << [
|
83
|
-
extra_dev_deps << [
|
81
|
+
extra_dev_deps << ["hoe", ">= 3.0", "< 5"]
|
82
|
+
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
|
83
|
+
extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
|
84
|
+
extra_dev_deps << ["hoe-git2", "~> 1.7"]
|
85
|
+
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
|
86
|
+
extra_dev_deps << ["rspec", ">= 2.0", "< 4"]
|
87
|
+
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
|
88
|
+
extra_dev_deps << ["rdoc", ">= 6.3.1", "< 7"]
|
84
89
|
end
|
85
90
|
|
86
91
|
desc "Run all specifications"
|
87
92
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
88
|
-
rspec_dirs = %w
|
93
|
+
rspec_dirs = %w[spec lib].join(":")
|
89
94
|
t.rspec_opts = ["-I#{rspec_dirs}"]
|
90
95
|
end
|
91
96
|
|
92
97
|
Rake::Task["spec"].actions.uniq! { |a| a.source_location }
|
93
98
|
|
99
|
+
# standard:disable Style/HashSyntax
|
94
100
|
task :default => :spec unless Rake::Task["default"].prereqs.include?("spec")
|
95
101
|
task :test => :spec unless Rake::Task["test"].prereqs.include?("spec")
|
102
|
+
# standard:enable Style/HashSyntax
|
96
103
|
|
97
|
-
if RUBY_VERSION >=
|
104
|
+
if RUBY_VERSION >= "2.0" && RUBY_ENGINE == "ruby"
|
98
105
|
namespace :spec do
|
99
106
|
desc "Runs test coverage. Only works Ruby 2.0+ and assumes 'simplecov' is installed."
|
100
107
|
task :coverage do
|
101
|
-
ENV[
|
102
|
-
Rake::Task[
|
108
|
+
ENV["COVERAGE"] = "yes"
|
109
|
+
Rake::Task["spec"].execute
|
103
110
|
end
|
104
111
|
end
|
105
112
|
end
|
106
113
|
|
107
114
|
task :ruby18 do
|
115
|
+
# standard:disable Layout/HeredocIndentation
|
108
116
|
puts <<-MESSAGE
|
109
117
|
You are starting a barebones Ruby 1.8 docker environment. You will need to
|
110
118
|
do the following:
|
@@ -117,5 +125,6 @@ do the following:
|
|
117
125
|
Don't forget to restore your Gemfile.lock after testing.
|
118
126
|
|
119
127
|
MESSAGE
|
128
|
+
# standard:enable Layout/HeredocIndentation
|
120
129
|
sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
|
121
130
|
end
|
data/bin/htmldiff
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#! /usr/bin/env ruby -w
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "diff/lcs"
|
5
|
+
require "diff/lcs/htmldiff"
|
6
6
|
|
7
7
|
begin
|
8
|
-
require
|
8
|
+
require "text/format"
|
9
9
|
rescue LoadError
|
10
10
|
Diff::LCS::HTMLDiff.can_expand_tabs = false
|
11
11
|
end
|
@@ -24,7 +24,7 @@ options = { :title => "diff #{ARGV[0]} #{ARGV[1]}" }
|
|
24
24
|
htmldiff = Diff::LCS::HTMLDiff.new(left, right, options)
|
25
25
|
|
26
26
|
if ARGV[2]
|
27
|
-
File.open(ARGV[2],
|
27
|
+
File.open(ARGV[2], "w") do |f|
|
28
28
|
htmldiff.options[:output] = f
|
29
29
|
htmldiff.run
|
30
30
|
end
|
data/lib/diff/lcs/array.rb
CHANGED
data/lib/diff/lcs/backports.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
unless 0.respond_to?(:positive?)
|
4
|
-
class Fixnum #
|
4
|
+
class Fixnum # standard:disable Lint/UnifiedInteger
|
5
5
|
def positive?
|
6
|
-
self > 0
|
6
|
+
self > 0
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/lib/diff/lcs/block.rb
CHANGED
@@ -25,13 +25,13 @@ class Diff::LCS::Block
|
|
25
25
|
def op
|
26
26
|
case [@remove.empty?, @insert.empty?]
|
27
27
|
when [false, false]
|
28
|
-
|
28
|
+
"!"
|
29
29
|
when [false, true]
|
30
|
-
|
30
|
+
"-"
|
31
31
|
when [true, false]
|
32
|
-
|
32
|
+
"+"
|
33
33
|
else # [true, true]
|
34
|
-
|
34
|
+
"^"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/lib/diff/lcs/callbacks.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "diff/lcs/change"
|
4
4
|
|
5
|
-
module Diff::LCS
|
5
|
+
module Diff::LCS
|
6
6
|
# This callback object implements the default set of callback events,
|
7
7
|
# which only returns the event itself. Note that #finished_a and
|
8
8
|
# #finished_b are not implemented -- I haven't yet figured out where they
|
@@ -50,7 +50,9 @@ module Diff::LCS # rubocop:disable Style/Documentation
|
|
50
50
|
BalancedCallbacks = DefaultCallbacks
|
51
51
|
|
52
52
|
def self.callbacks_for(callbacks)
|
53
|
-
callbacks.new
|
53
|
+
callbacks.new
|
54
|
+
rescue
|
55
|
+
callbacks
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
@@ -107,7 +109,7 @@ class Diff::LCS::DiffCallbacks
|
|
107
109
|
# Returns the difference set collected during the diff process.
|
108
110
|
attr_reader :diffs
|
109
111
|
|
110
|
-
def initialize # :yields self
|
112
|
+
def initialize # :yields: self
|
111
113
|
@hunk = []
|
112
114
|
@diffs = []
|
113
115
|
|
@@ -131,11 +133,11 @@ class Diff::LCS::DiffCallbacks
|
|
131
133
|
end
|
132
134
|
|
133
135
|
def discard_a(event)
|
134
|
-
@hunk << Diff::LCS::Change.new(
|
136
|
+
@hunk << Diff::LCS::Change.new("-", event.old_position, event.old_element)
|
135
137
|
end
|
136
138
|
|
137
139
|
def discard_b(event)
|
138
|
-
@hunk << Diff::LCS::Change.new(
|
140
|
+
@hunk << Diff::LCS::Change.new("+", event.new_position, event.new_element)
|
139
141
|
end
|
140
142
|
|
141
143
|
def finish_hunk
|
@@ -302,7 +304,7 @@ class Diff::LCS::SDiffCallbacks
|
|
302
304
|
# Returns the difference set collected during the diff process.
|
303
305
|
attr_reader :diffs
|
304
306
|
|
305
|
-
def initialize
|
307
|
+
def initialize # :yields: self
|
306
308
|
@diffs = []
|
307
309
|
yield self if block_given?
|
308
310
|
end
|