diff-lcs 1.5.1 → 1.6.1

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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +506 -0
  3. data/CODE_OF_CONDUCT.md +128 -0
  4. data/CONTRIBUTING.md +71 -0
  5. data/CONTRIBUTORS.md +48 -0
  6. data/{License.md → LICENCE.md} +15 -16
  7. data/Manifest.txt +61 -5
  8. data/README.md +92 -0
  9. data/Rakefile +19 -50
  10. data/SECURITY.md +41 -0
  11. data/docs/artistic.txt +1 -1
  12. data/lib/diff/lcs/change.rb +1 -1
  13. data/lib/diff/lcs/htmldiff.rb +2 -0
  14. data/lib/diff/lcs/hunk.rb +38 -22
  15. data/lib/diff/lcs/ldiff.rb +65 -49
  16. data/lib/diff/lcs/version.rb +7 -0
  17. data/lib/diff/lcs.rb +10 -9
  18. data/mise.toml +5 -0
  19. data/spec/fixtures/123_x +2 -0
  20. data/spec/fixtures/456_x +2 -0
  21. data/spec/fixtures/empty +0 -0
  22. data/spec/fixtures/file1.bin +0 -0
  23. data/spec/fixtures/file2.bin +0 -0
  24. data/spec/fixtures/four_lines +4 -0
  25. data/spec/fixtures/four_lines_with_missing_new_line +4 -0
  26. data/spec/fixtures/ldiff/diff.missing_new_line1-e +1 -0
  27. data/spec/fixtures/ldiff/diff.missing_new_line1-f +1 -0
  28. data/spec/fixtures/ldiff/diff.missing_new_line2-e +1 -0
  29. data/spec/fixtures/ldiff/diff.missing_new_line2-f +1 -0
  30. data/spec/fixtures/ldiff/error.diff.chef-e +2 -0
  31. data/spec/fixtures/ldiff/error.diff.chef-f +2 -0
  32. data/spec/fixtures/ldiff/error.diff.missing_new_line1-e +1 -0
  33. data/spec/fixtures/ldiff/error.diff.missing_new_line1-f +1 -0
  34. data/spec/fixtures/ldiff/error.diff.missing_new_line2-e +1 -0
  35. data/spec/fixtures/ldiff/error.diff.missing_new_line2-f +1 -0
  36. data/spec/fixtures/ldiff/output.diff.bin1 +0 -0
  37. data/spec/fixtures/ldiff/output.diff.bin1-c +0 -0
  38. data/spec/fixtures/ldiff/output.diff.bin1-e +0 -0
  39. data/spec/fixtures/ldiff/output.diff.bin1-f +0 -0
  40. data/spec/fixtures/ldiff/output.diff.bin1-u +0 -0
  41. data/spec/fixtures/ldiff/output.diff.bin2 +1 -0
  42. data/spec/fixtures/ldiff/output.diff.bin2-c +1 -0
  43. data/spec/fixtures/ldiff/output.diff.bin2-e +1 -0
  44. data/spec/fixtures/ldiff/output.diff.bin2-f +1 -0
  45. data/spec/fixtures/ldiff/output.diff.bin2-u +1 -0
  46. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines +5 -0
  47. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c +9 -0
  48. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-e +6 -0
  49. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-f +6 -0
  50. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-u +7 -0
  51. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty +5 -0
  52. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-c +9 -0
  53. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-e +1 -0
  54. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-f +1 -0
  55. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-u +7 -0
  56. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context +4 -0
  57. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-c +9 -0
  58. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-e +3 -0
  59. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-f +3 -0
  60. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-u +6 -0
  61. data/spec/fixtures/ldiff/output.diff.missing_new_line1 +5 -0
  62. data/spec/fixtures/ldiff/output.diff.missing_new_line1-c +14 -0
  63. data/spec/fixtures/ldiff/output.diff.missing_new_line1-e +0 -0
  64. data/spec/fixtures/ldiff/output.diff.missing_new_line1-f +0 -0
  65. data/spec/fixtures/ldiff/output.diff.missing_new_line1-u +9 -0
  66. data/spec/fixtures/ldiff/output.diff.missing_new_line2 +5 -0
  67. data/spec/fixtures/ldiff/output.diff.missing_new_line2-c +14 -0
  68. data/spec/fixtures/ldiff/output.diff.missing_new_line2-e +0 -0
  69. data/spec/fixtures/ldiff/output.diff.missing_new_line2-f +0 -0
  70. data/spec/fixtures/ldiff/output.diff.missing_new_line2-u +9 -0
  71. data/spec/hunk_spec.rb +1 -1
  72. data/spec/issues_spec.rb +32 -32
  73. data/spec/ldiff_spec.rb +21 -10
  74. data/spec/patch_spec.rb +1 -1
  75. data/spec/spec_helper.rb +93 -93
  76. metadata +86 -64
  77. data/Code-of-Conduct.md +0 -74
  78. data/Contributing.md +0 -121
  79. data/History.md +0 -431
  80. data/README.rdoc +0 -84
data/README.rdoc DELETED
@@ -1,84 +0,0 @@
1
- = Diff::LCS
2
-
3
- home :: https://github.com/halostatue/diff-lcs
4
- code :: https://github.com/halostatue/diff-lcs
5
- bugs :: https://github.com/halostatue/diff-lcs/issues
6
- rdoc :: http://rubydoc.info/github/halostatue/diff-lcs
7
- continuous integration :: {<img src="https://github.com/halostatue/diff-lcs/workflows/CI/badge.svg" />}[https://github.com/halostatue/diff-lcs/actions]
8
-
9
- == Description
10
-
11
- Diff::LCS computes the difference between two Enumerable sequences using the
12
- McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
13
- to create a simple HTML diff output format and a standard diff-like tool.
14
-
15
- This is release 1.4.3, providing a simple extension that allows for
16
- Diff::LCS::Change objects to be treated implicitly as arrays and fixes a
17
- number of formatting issues.
18
-
19
- Ruby versions below 2.5 are soft-deprecated, which means that older versions
20
- are no longer part of the CI test suite. If any changes have been introduced
21
- that break those versions, bug reports and patches will be accepted, but it
22
- will be up to the reporter to verify any fixes prior to release. The next
23
- major release will completely break compatibility.
24
-
25
- == Synopsis
26
-
27
- Using this module is quite simple. By default, Diff::LCS does not extend
28
- objects with the Diff::LCS interface, but will be called as if it were a
29
- function:
30
-
31
- require 'diff/lcs'
32
-
33
- seq1 = %w(a b c e h j l m n p)
34
- seq2 = %w(b c d e f j k l m r s t)
35
-
36
- lcs = Diff::LCS.LCS(seq1, seq2)
37
- diffs = Diff::LCS.diff(seq1, seq2)
38
- sdiff = Diff::LCS.sdiff(seq1, seq2)
39
- seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
40
- bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)
41
- seq2 == Diff::LCS.patch!(seq1, diffs)
42
- seq1 == Diff::LCS.unpatch!(seq2, diffs)
43
- seq2 == Diff::LCS.patch!(seq1, sdiff)
44
- seq1 == Diff::LCS.unpatch!(seq2, sdiff)
45
-
46
- Objects can be extended with Diff::LCS:
47
-
48
- seq1.extend(Diff::LCS)
49
- lcs = seq1.lcs(seq2)
50
- diffs = seq1.diff(seq2)
51
- sdiff = seq1.sdiff(seq2)
52
- seq = seq1.traverse_sequences(seq2, callback_obj)
53
- bal = seq1.traverse_balanced(seq2, callback_obj)
54
- seq2 == seq1.patch!(diffs)
55
- seq1 == seq2.unpatch!(diffs)
56
- seq2 == seq1.patch!(sdiff)
57
- seq1 == seq2.unpatch!(sdiff)
58
-
59
- By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be
60
- extended for use this way.
61
-
62
- Note that Diff::LCS requires a sequenced enumerable container, which means that
63
- the order of enumeration is both predictable and consistent for the same set of
64
- data. While it is theoretically possible to generate a diff for an unordered
65
- hash, it will only be meaningful if the enumeration of the hashes is
66
- consistent. In general, this will mean that containers that behave like String
67
- or Array will perform best.
68
-
69
- == History
70
-
71
- Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt
72
- longest common subsequence (LCS) algorithm to compute intelligent differences
73
- between two sequenced enumerable containers. The implementation is based on
74
- Mario I. Wolczko's
75
- {Smalltalk version 1.2}[ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st]
76
- (1993) and Ned Konz's Perl version
77
- {Algorithm::Diff 1.15}[http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/].
78
- Diff::LCS#sdiff and Diff::LCS#traverse_balanced were originally written for the
79
- Perl version by Mike Schilli.
80
-
81
- The algorithm is described in <em>A Fast Algorithm for Computing Longest Common
82
- Subsequences</em>, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor
83
- improvements to improve the speed. A simplified description of the algorithm,
84
- originally written for the Perl version, was written by Mark-Jason Dominus.