diff-lcs 1.6.2 → 2.0.0.beta.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/CONTRIBUTING.md +85 -34
- data/LICENCE.md +39 -11
- data/Manifest.txt +3 -13
- data/Rakefile +30 -72
- data/SECURITY.md +27 -23
- data/lib/diff/lcs/block.rb +29 -24
- data/lib/diff/lcs/callbacks.rb +240 -242
- data/lib/diff/lcs/change.rb +84 -91
- data/lib/diff/lcs/hunk.rb +92 -155
- data/lib/diff/lcs/internals.rb +92 -96
- data/lib/diff/lcs/ldiff.rb +21 -34
- data/lib/diff/lcs/version.rb +1 -1
- data/lib/diff/lcs.rb +439 -466
- data/licenses/dco.txt +34 -0
- data/spec/hunk_spec.rb +0 -11
- data/spec/lcs_spec.rb +6 -6
- data/spec/ldiff_spec.rb +1 -1
- data/spec/spec_helper.rb +14 -16
- metadata +90 -35
- data/.rspec +0 -1
- data/bin/htmldiff +0 -35
- data/lib/diff/lcs/backports.rb +0 -13
- data/lib/diff/lcs/htmldiff.rb +0 -160
- data/mise.toml +0 -5
- data/spec/fixtures/ldiff/output.diff-e +0 -3
- data/spec/fixtures/ldiff/output.diff-f +0 -3
- data/spec/fixtures/ldiff/output.diff.chef-e +0 -3
- data/spec/fixtures/ldiff/output.diff.chef-f +0 -3
- data/spec/fixtures/ldiff/output.diff.chef2-e +0 -7
- data/spec/fixtures/ldiff/output.diff.chef2-f +0 -7
- /data/{docs → licenses}/COPYING.txt +0 -0
- /data/{docs → licenses}/artistic.txt +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd303077c3c47d39b1a910a88cfba8e39af2d2882845fafd1884a89b772e3a6d
|
|
4
|
+
data.tar.gz: c0b593b8eaf428ac8615671eb2760c58281be09769cfb6df4b672011dd73c720
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92cb3417833f94c81dad165cc462aad0edd2dd5fed5f2a148d46cb6ceae9a5a91ba92fedb0fbf31d46c49e576cd320b4945a3d7f377cee593c6416731c4e5afe
|
|
7
|
+
data.tar.gz: 8ca265ed0f666f0f13f864b89a0eaa9765be5adcc6dc8df2cf526feeaa8f8713cca2bb66533861e6ef15356fb6db44e02ec40e8047090560910e6ef6228d6538
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0.beta.1 / 2025-12-31
|
|
4
|
+
|
|
5
|
+
This release has significant **breaking changes**.
|
|
6
|
+
|
|
7
|
+
- diff-lcs 2 supports Ruby 3.2 or higher. This allowed:
|
|
8
|
+
|
|
9
|
+
- readability improvements (endless methods, pattern matching);
|
|
10
|
+
|
|
11
|
+
- support for immutable Data classes (`Diff::LCS::Block`, `Diff::LCS::Change`,
|
|
12
|
+
and `Diff::LCS::ContextChange`);
|
|
13
|
+
|
|
14
|
+
- removal of compatibility shims;
|
|
15
|
+
|
|
16
|
+
- reduction in conditional tests in loops, especially for String character
|
|
17
|
+
extraction (compare `string ? seq[i, 1] : seq[i]` to `seq[i]`); and
|
|
18
|
+
|
|
19
|
+
- optimizations to string and relying on standard encoding support present
|
|
20
|
+
since Ruby 2.1.
|
|
21
|
+
|
|
22
|
+
The primary API (methods and class methods on `Diff::LCS`) has not changed,
|
|
23
|
+
with one exception noted below. Internal APIs (including `Diff::LCS::Block`,
|
|
24
|
+
`Diff::LCS::Change`, `Diff::LCS::ContextChange`, and `Diff::LCS::Hunk`) have
|
|
25
|
+
changed for compatibility.
|
|
26
|
+
|
|
27
|
+
- The `htmldiff` binary and supporting code have been removed without
|
|
28
|
+
replacement.
|
|
29
|
+
|
|
30
|
+
- `ldiff` no longer supports `ed`-script output (`ed` and `reverse_ed` formats).
|
|
31
|
+
As Baptiste Courtois says in [#108][pull-108], the "implementation was broken
|
|
32
|
+
for a while and no-one reported it."
|
|
33
|
+
|
|
34
|
+
- The method `Diff::LCS.LCS` has been removed as an alias for `Diff::LCS.lcs`.
|
|
35
|
+
Most callers are using `Diff::LCS.lcs` and modern Ruby did-you-mean support
|
|
36
|
+
should assist with this update.
|
|
37
|
+
|
|
3
38
|
## 1.6.2 / 2025-05-12
|
|
4
39
|
|
|
5
40
|
- Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
|
|
@@ -504,6 +539,7 @@
|
|
|
504
539
|
[pull-103]: https://github.com/halostatue/diff-lcs/pull/103
|
|
505
540
|
[pull-104]: https://github.com/halostatue/diff-lcs/pull/104
|
|
506
541
|
[pull-105]: https://github.com/halostatue/diff-lcs/pull/105
|
|
542
|
+
[pull-108]: https://github.com/halostatue/diff-lcs/pull/108
|
|
507
543
|
[pull-129]: https://github.com/halostatue/diff-lcs/pull/129
|
|
508
544
|
[pull-147]: https://github.com/halostatue/diff-lcs/pull/147
|
|
509
545
|
[pull-148]: https://github.com/halostatue/diff-lcs/pull/148
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
Contribution to diff-lcs is encouraged
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Contribution to diff-lcs is encouraged: bug reports, feature requests, or code
|
|
4
|
+
contributions. New features should be proposed and discussed in an
|
|
5
|
+
[issue][issues].
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Before contributing patches, please read the [Licence](./LICENCE.md).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
|
|
9
|
+
diff-lcs is governed under the [Contributor Covenant Code of Conduct][cccoc].
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
into logical chunks as necessary.
|
|
11
|
+
## Code Guidelines
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
I have several guidelines to contributing code through pull requests:
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
in the `CHANGELOG.md` and provide a link to your PR.)
|
|
15
|
+
- All code changes require tests. In most cases, this will be added or updated
|
|
16
|
+
unit tests. I use [RSpec][rspec].
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
- I use code formatters, static analysis tools, and linting to ensure consistent
|
|
19
|
+
styles and formatting. There should be no warning output from test run
|
|
20
|
+
processes. I use [Standard Ruby][standardrb].
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
in alternative documentation generators.
|
|
22
|
+
- Proposed changes should be on a thoughtfully-named topic branch and organized
|
|
23
|
+
into logical commit chunks as appropriate.
|
|
27
24
|
|
|
28
|
-
-
|
|
25
|
+
- Use [Conventional Commits][conventional] with my
|
|
26
|
+
[conventions](#commit-conventions).
|
|
27
|
+
|
|
28
|
+
- Versions must not be updated in pull requests unless otherwise directed. This
|
|
29
|
+
means that you must not:
|
|
29
30
|
|
|
30
31
|
- Modify `VERSION` in `lib/diff/lcs/version.rb`. When your patch is accepted
|
|
31
32
|
and a release is made, the version will be updated at that point.
|
|
@@ -36,6 +37,30 @@ contributions.
|
|
|
36
37
|
|
|
37
38
|
- Modify the `Gemfile`.
|
|
38
39
|
|
|
40
|
+
- Documentation should be added or updated as appropriate for new or updated
|
|
41
|
+
functionality. The documentation is RDoc; diff-lcs does not use extensions
|
|
42
|
+
that may be present in alternative documentation generators.
|
|
43
|
+
|
|
44
|
+
- All GitHub Actions checks marked as required must pass before a pull request
|
|
45
|
+
may be accepted and merged.
|
|
46
|
+
|
|
47
|
+
- Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
|
|
48
|
+
`CHANGELOG.md` as a separate commit from your main change. (Follow the style
|
|
49
|
+
in the `CHANGELOG.md` and provide a link to your PR.)
|
|
50
|
+
|
|
51
|
+
- Include your DCO sign-off in each commit message (see [LICENCE](LICENCE.md)).
|
|
52
|
+
|
|
53
|
+
## AI Contribution Policy
|
|
54
|
+
|
|
55
|
+
diff-lcs is a library with complex interactions and subtle decisions (some of
|
|
56
|
+
them possibly even wrong). It is extremely important that contributions of any
|
|
57
|
+
sort be well understood by the submitter and that the developer can attest to
|
|
58
|
+
the [Developer Certificate of Origin][dco] for each pull request (see
|
|
59
|
+
[LICENCE](LICENCE.md)).
|
|
60
|
+
|
|
61
|
+
Any contribution (bug, feature request, or pull request) that uses undeclared AI
|
|
62
|
+
output will be rejected.
|
|
63
|
+
|
|
39
64
|
## Test Dependencies
|
|
40
65
|
|
|
41
66
|
diff-lcs uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds
|
|
@@ -44,28 +69,54 @@ tests in the same way that `rake spec` does.
|
|
|
44
69
|
|
|
45
70
|
To assist with the installation of the development dependencies for diff-lcs, I
|
|
46
71
|
have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file.
|
|
47
|
-
|
|
48
|
-
the dependencies.
|
|
72
|
+
This will permit you to use `bundle install` to install the dependencies.
|
|
49
73
|
|
|
50
74
|
You can run tests with code coverage analysis by running `rake spec:coverage`.
|
|
51
75
|
|
|
52
|
-
##
|
|
76
|
+
## Commit Conventions
|
|
77
|
+
|
|
78
|
+
diff-lcs has adopted a variation of the Conventional Commits format for commit
|
|
79
|
+
messages. The following types are permitted:
|
|
80
|
+
|
|
81
|
+
| Type | Purpose |
|
|
82
|
+
| ------- | ----------------------------------------------------- |
|
|
83
|
+
| `feat` | A new feature |
|
|
84
|
+
| `fix` | A bug fix |
|
|
85
|
+
| `chore` | A code change that is neither a bug fix nor a feature |
|
|
86
|
+
| `docs` | Documentation updates |
|
|
87
|
+
| `deps` | Dependency updates, including GitHub Actions. |
|
|
88
|
+
|
|
89
|
+
I encourage the use of [Tim Pope's][tpope-qcm] or [Chris Beam's][cbeams]
|
|
90
|
+
guidelines on the writing of commit messages
|
|
91
|
+
|
|
92
|
+
I require the use of [git][trailers1] [trailers][trailers2] for specific
|
|
93
|
+
additional metadata and strongly encourage it for others. The conditionally
|
|
94
|
+
required metadata trailers are:
|
|
95
|
+
|
|
96
|
+
- `Breaking-Change`: if the change is a breaking change. **Do not** use the
|
|
97
|
+
shorthand form (`feat!(scope)`) or `BREAKING CHANGE`.
|
|
98
|
+
|
|
99
|
+
- `Signed-off-by`: this is required for all developers except me, as outlined in
|
|
100
|
+
the [Licence](./LICENCE.md#developer-certificate-of-origin).
|
|
53
101
|
|
|
54
|
-
|
|
102
|
+
- `Fixes` or `Resolves`: If a change fixes one or more open [issues][issues],
|
|
103
|
+
that issue must be included in the `Fixes` or `Resolves` trailer. Multiple
|
|
104
|
+
issues should be listed comma separated in the same trailer:
|
|
105
|
+
`Fixes: #1, #5, #7`, but _may_ appear in separate trailers. While both `Fixes`
|
|
106
|
+
and `Resolves` are synonyms, only _one_ should be used in a given commit or
|
|
107
|
+
pull request.
|
|
55
108
|
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
- Create a topic branch to contain your change
|
|
59
|
-
(`git checkout -b my_awesome_feature`).
|
|
60
|
-
- Hack away, add tests. Not necessarily in that order.
|
|
61
|
-
- Make sure everything still passes by running `rake`.
|
|
62
|
-
- If necessary, rebase your commits into logical chunks, without errors.
|
|
63
|
-
- Push the branch up (`git push origin my_awesome_feature`).
|
|
64
|
-
- Create a pull request against halostatue/diff-lcs and describe what your
|
|
65
|
-
change does and the why you think it should be merged.
|
|
109
|
+
- `Related to`: If a change does not fix an issue, those issue references should
|
|
110
|
+
be included in this trailer.
|
|
66
111
|
|
|
112
|
+
[cbeams]: https://cbea.ms/git-commit/
|
|
113
|
+
[cccoc]: ./CODE_OF_CONDUCT.md
|
|
114
|
+
[conventional]: https://www.conventionalcommits.org/en/v1.0.0/
|
|
115
|
+
[dco]: licences/dco.txt
|
|
67
116
|
[hoe]: https://github.com/seattlerb/hoe
|
|
68
|
-
[
|
|
69
|
-
[release-gem]: https://github.com/rubygems/release-gem
|
|
117
|
+
[issues]: https://github.com/halostatue/diff-lcs/issues
|
|
70
118
|
[rspec]: http://rspec.info/documentation/
|
|
71
119
|
[standardrb]: https://github.com/standardrb/standard
|
|
120
|
+
[tpope-qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
|
121
|
+
[trailers1]: https://git-scm.com/docs/git-interpret-trailers
|
|
122
|
+
[trailers2]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---trailerlttokengtltvaluegt
|
data/LICENCE.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# Licence
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
- SPDX-License-Identifier: [MIT][mit] OR [GPL-2.0-or-later][gpl2-or-later] OR
|
|
4
|
+
[Artistic-1.0-Perl][artistic-perl]
|
|
5
|
+
|
|
6
|
+
This software is available under three disjunctive licences: the GNU GPL version
|
|
7
|
+
2 (or at your option, a later version), the Perl Artistic license, or the MIT
|
|
8
|
+
license. Note that my preference for licensing is the MIT license, but
|
|
9
|
+
Algorithm::Diff was dually originally licensed with the Perl Artistic and the
|
|
10
|
+
GNU GPL ("the same terms as Perl itself") and given that the Ruby implementation
|
|
11
|
+
originally hewed pretty closely to the Perl version, I must maintain the
|
|
12
|
+
additional licensing terms.
|
|
13
|
+
|
|
14
|
+
- Copyright 2004-2026 Austin Ziegler and contributors.
|
|
12
15
|
- Adapted from Algorithm::Diff (Perl) by Ned Konz and a Smalltalk version by
|
|
13
16
|
Mario I. Wolczko.
|
|
14
17
|
|
|
@@ -33,8 +36,33 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
33
36
|
|
|
34
37
|
## Perl Artistic License
|
|
35
38
|
|
|
36
|
-
See
|
|
39
|
+
See [licences/artistic.txt](licences/artistic.txt) in the main distribution.
|
|
37
40
|
|
|
38
41
|
## GNU GPL version 2
|
|
39
42
|
|
|
40
|
-
See the file
|
|
43
|
+
See the file [licences/COPYING.txt](licences/COPYING.txt) in the main
|
|
44
|
+
distribution.
|
|
45
|
+
|
|
46
|
+
## Developer Certificate of Origin
|
|
47
|
+
|
|
48
|
+
All contributors **must** certify they are willing and able to provide their
|
|
49
|
+
contributions under the terms of _all_ of this project's licences with the
|
|
50
|
+
certification of the [Developer Certificate of Origin (Version 1.1)][dco].
|
|
51
|
+
|
|
52
|
+
Such certification is provided by ensuring that a `Signed-off-by`
|
|
53
|
+
[commit trailer][trailer] is present on every commit:
|
|
54
|
+
|
|
55
|
+
Signed-off-by: FirstName LastName <email@example.org>
|
|
56
|
+
|
|
57
|
+
The `Signed-off-by` trailer can be automatically added by git with the `-s` or
|
|
58
|
+
`--signoff` option on `git commit`:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
git commit --signoff
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
[artistic-perl]: https://spdx.org/licenses/Artistic-1.0-Perl.html
|
|
65
|
+
[gpl2-or-later]: https://spdx.org/licenses/GPL-2.0-or-later.html
|
|
66
|
+
[mit]: https://spdx.org/licenses/MIT.html
|
|
67
|
+
[trailer]: https://git-scm.com/docs/git-interpret-trailers
|
|
68
|
+
[dco]: licences/dco.txt
|
data/Manifest.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
.rspec
|
|
2
1
|
CHANGELOG.md
|
|
3
2
|
CODE_OF_CONDUCT.md
|
|
4
3
|
CONTRIBUTING.md
|
|
@@ -8,24 +7,21 @@ Manifest.txt
|
|
|
8
7
|
README.md
|
|
9
8
|
Rakefile
|
|
10
9
|
SECURITY.md
|
|
11
|
-
bin/htmldiff
|
|
12
10
|
bin/ldiff
|
|
13
|
-
docs/COPYING.txt
|
|
14
|
-
docs/artistic.txt
|
|
15
11
|
lib/diff-lcs.rb
|
|
16
12
|
lib/diff/lcs.rb
|
|
17
13
|
lib/diff/lcs/array.rb
|
|
18
|
-
lib/diff/lcs/backports.rb
|
|
19
14
|
lib/diff/lcs/block.rb
|
|
20
15
|
lib/diff/lcs/callbacks.rb
|
|
21
16
|
lib/diff/lcs/change.rb
|
|
22
|
-
lib/diff/lcs/htmldiff.rb
|
|
23
17
|
lib/diff/lcs/hunk.rb
|
|
24
18
|
lib/diff/lcs/internals.rb
|
|
25
19
|
lib/diff/lcs/ldiff.rb
|
|
26
20
|
lib/diff/lcs/string.rb
|
|
27
21
|
lib/diff/lcs/version.rb
|
|
28
|
-
|
|
22
|
+
licenses/COPYING.txt
|
|
23
|
+
licenses/artistic.txt
|
|
24
|
+
licenses/dco.txt
|
|
29
25
|
spec/change_spec.rb
|
|
30
26
|
spec/diff_spec.rb
|
|
31
27
|
spec/fixtures/123_x
|
|
@@ -51,8 +47,6 @@ spec/fixtures/ldiff/error.diff.missing_new_line2-e
|
|
|
51
47
|
spec/fixtures/ldiff/error.diff.missing_new_line2-f
|
|
52
48
|
spec/fixtures/ldiff/output.diff
|
|
53
49
|
spec/fixtures/ldiff/output.diff-c
|
|
54
|
-
spec/fixtures/ldiff/output.diff-e
|
|
55
|
-
spec/fixtures/ldiff/output.diff-f
|
|
56
50
|
spec/fixtures/ldiff/output.diff-u
|
|
57
51
|
spec/fixtures/ldiff/output.diff.bin1
|
|
58
52
|
spec/fixtures/ldiff/output.diff.bin1-c
|
|
@@ -66,14 +60,10 @@ spec/fixtures/ldiff/output.diff.bin2-f
|
|
|
66
60
|
spec/fixtures/ldiff/output.diff.bin2-u
|
|
67
61
|
spec/fixtures/ldiff/output.diff.chef
|
|
68
62
|
spec/fixtures/ldiff/output.diff.chef-c
|
|
69
|
-
spec/fixtures/ldiff/output.diff.chef-e
|
|
70
|
-
spec/fixtures/ldiff/output.diff.chef-f
|
|
71
63
|
spec/fixtures/ldiff/output.diff.chef-u
|
|
72
64
|
spec/fixtures/ldiff/output.diff.chef2
|
|
73
65
|
spec/fixtures/ldiff/output.diff.chef2-c
|
|
74
66
|
spec/fixtures/ldiff/output.diff.chef2-d
|
|
75
|
-
spec/fixtures/ldiff/output.diff.chef2-e
|
|
76
|
-
spec/fixtures/ldiff/output.diff.chef2-f
|
|
77
67
|
spec/fixtures/ldiff/output.diff.chef2-u
|
|
78
68
|
spec/fixtures/ldiff/output.diff.empty.vs.four_lines
|
|
79
69
|
spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c
|
data/Rakefile
CHANGED
|
@@ -3,50 +3,23 @@ require "rspec"
|
|
|
3
3
|
require "rspec/core/rake_task"
|
|
4
4
|
require "hoe"
|
|
5
5
|
require "rake/clean"
|
|
6
|
-
|
|
7
|
-
MAINTENANCE = ENV["MAINTENANCE"] == "true"
|
|
8
|
-
BUILD_DOCS = MAINTENANCE || ENV["DOCS"] == "true"
|
|
9
|
-
TRUSTED_RELEASE = ENV["rubygems_release_gem"] == "true"
|
|
6
|
+
require "rdoc/task"
|
|
10
7
|
|
|
11
8
|
Hoe.plugin :halostatue
|
|
12
9
|
Hoe.plugin :rubygems
|
|
13
10
|
|
|
14
11
|
Hoe.plugins.delete :debug
|
|
15
12
|
Hoe.plugins.delete :newb
|
|
13
|
+
Hoe.plugins.delete :publish
|
|
16
14
|
Hoe.plugins.delete :signing
|
|
17
|
-
Hoe.plugins.delete :publish unless BUILD_DOCS
|
|
18
|
-
|
|
19
|
-
if RUBY_VERSION < "1.9"
|
|
20
|
-
class Array # :nodoc:
|
|
21
|
-
def to_h
|
|
22
|
-
Hash[*flatten(1)]
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
class Gem::Specification # :nodoc:
|
|
27
|
-
def metadata=(*)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def default_value(*)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
15
|
|
|
34
|
-
|
|
35
|
-
def caller_locations(*)
|
|
36
|
-
[]
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
_spec = Hoe.spec "diff-lcs" do
|
|
16
|
+
hoe = Hoe.spec "diff-lcs" do
|
|
42
17
|
developer("Austin Ziegler", "halostatue@gmail.com")
|
|
43
18
|
|
|
44
|
-
self.trusted_release =
|
|
19
|
+
self.trusted_release = ENV["rubygems_release_gem"] == "true"
|
|
45
20
|
|
|
46
|
-
require_ruby_version ">=
|
|
21
|
+
require_ruby_version ">= 3.2.0", "< 5"
|
|
47
22
|
|
|
48
|
-
self.history_file = "CHANGELOG.md"
|
|
49
|
-
self.readme_file = "README.md"
|
|
50
23
|
self.licenses = ["MIT", "Artistic-1.0-Perl", "GPL-2.0-or-later"]
|
|
51
24
|
|
|
52
25
|
spec_extras[:metadata] = ->(val) {
|
|
@@ -54,19 +27,15 @@ _spec = Hoe.spec "diff-lcs" do
|
|
|
54
27
|
}
|
|
55
28
|
|
|
56
29
|
extra_dev_deps << ["hoe", "~> 4.0"]
|
|
57
|
-
extra_dev_deps << ["hoe-halostatue", "~> 2.
|
|
58
|
-
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
|
|
30
|
+
extra_dev_deps << ["hoe-halostatue", "~> 2.1", ">= 2.1.1"]
|
|
59
31
|
extra_dev_deps << ["rspec", ">= 2.0", "< 4"]
|
|
60
32
|
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
|
|
61
33
|
extra_dev_deps << ["rdoc", ">= 6.3.1", "< 7"]
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
tasks.each do |task|
|
|
68
|
-
rake_tasks.delete(task)
|
|
69
|
-
end
|
|
34
|
+
extra_dev_deps << ["simplecov", "~> 0.9"]
|
|
35
|
+
extra_dev_deps << ["simplecov-lcov", "~> 0.9"]
|
|
36
|
+
extra_dev_deps << ["standard", "~> 1.50"]
|
|
37
|
+
extra_dev_deps << ["standard-thread_safety", "~> 1.0"]
|
|
38
|
+
extra_dev_deps << ["fasterer", "~> 0.11"]
|
|
70
39
|
end
|
|
71
40
|
|
|
72
41
|
desc "Run all specifications"
|
|
@@ -75,41 +44,30 @@ RSpec::Core::RakeTask.new(:spec) do |t|
|
|
|
75
44
|
t.rspec_opts = ["-I#{rspec_dirs}"]
|
|
76
45
|
end
|
|
77
46
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
47
|
+
namespace :spec do
|
|
48
|
+
desc "Runs test coverage. Only works Ruby 2.0+ and assumes 'simplecov' is installed."
|
|
49
|
+
task :coverage do
|
|
50
|
+
Rake::Task["spec"].execute
|
|
51
|
+
end
|
|
81
52
|
end
|
|
82
53
|
|
|
54
|
+
task coverage: "spec:coverage"
|
|
83
55
|
Rake::Task["spec"].actions.uniq! { |a| a.source_location }
|
|
84
56
|
|
|
85
|
-
|
|
86
|
-
task :
|
|
87
|
-
task :test => :spec unless Rake::Task["test"].prereqs.include?("spec")
|
|
88
|
-
# standard:enable Style/HashSyntax
|
|
57
|
+
task default: :spec unless Rake::Task["default"].prereqs.include?("spec")
|
|
58
|
+
task test: :spec unless Rake::Task["test"].prereqs.include?("spec")
|
|
89
59
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
task :coverage do
|
|
94
|
-
ENV["COVERAGE"] = "true"
|
|
95
|
-
Rake::Task["spec"].execute
|
|
96
|
-
end
|
|
97
|
-
end
|
|
60
|
+
task :version do
|
|
61
|
+
require "diff/lcs/version"
|
|
62
|
+
puts Diff::LCS::VERSION
|
|
98
63
|
end
|
|
99
64
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
cd diff-lcs
|
|
109
|
-
gem install pkg/diff-lcs-#{Diff::LCS::VERSION}
|
|
110
|
-
|
|
111
|
-
MESSAGE
|
|
112
|
-
# standard:enable Layout/HeredocIndentation
|
|
113
|
-
sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
|
|
114
|
-
end
|
|
65
|
+
RDoc::Task.new do |config|
|
|
66
|
+
config.title = "diff-lcs"
|
|
67
|
+
# config.main = "lib/diff/lcs.rb"
|
|
68
|
+
config.main = "README.md"
|
|
69
|
+
config.rdoc_dir = "doc"
|
|
70
|
+
config.rdoc_files = hoe.spec.require_paths - ["Manifest.txt"] + hoe.spec.extra_rdoc_files
|
|
71
|
+
config.markup = "markdown"
|
|
115
72
|
end
|
|
73
|
+
task docs: :rerdoc
|
data/SECURITY.md
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
# diff-lcs Security
|
|
2
2
|
|
|
3
|
+
## LLM-Generated Security Report Policy
|
|
4
|
+
|
|
5
|
+
Absolutely no security reports will be accepted that have been generated by LLM
|
|
6
|
+
agents.
|
|
7
|
+
|
|
3
8
|
## Supported Versions
|
|
4
9
|
|
|
5
|
-
Security reports are accepted for the most recent major release
|
|
6
|
-
|
|
7
|
-
major release, the previous version will receive full support for six months and
|
|
8
|
-
security support for an additional six months (for a total of twelve months).
|
|
10
|
+
Security reports are accepted for the most recent major release, with a limited
|
|
11
|
+
window of support after the initial major release.
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
will
|
|
13
|
+
- Bug reports will be accepted up to three months after release.
|
|
14
|
+
- Security reports will be accepted up to six months after release.
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
>
|
|
16
|
-
> versions of Ruby only.
|
|
16
|
+
All issues raised must be demonstrated on the minimum supported Ruby version.
|
|
17
|
+
|
|
18
|
+
> [!important]
|
|
17
19
|
>
|
|
18
|
-
>
|
|
19
|
-
>
|
|
20
|
-
> | 2025 | +6 months | +12 months |
|
|
20
|
+
> Because diff-lcs 1 has been the only version for over twenty years, security
|
|
21
|
+
> reports will be accepted for one year after the release of diff-lcs 2.
|
|
21
22
|
>
|
|
22
|
-
>
|
|
23
|
-
>
|
|
24
|
-
> 2026-
|
|
23
|
+
> | Version | Release Date | Support Ends | Security Support Ends |
|
|
24
|
+
> | ------- | ------------ | ------------ | --------------------- |
|
|
25
|
+
> | 1.x | 2010 | 2026-04-30 | 2027-01-31 |
|
|
26
|
+
> | 2.x | 2026-01-31 | - | - |
|
|
25
27
|
|
|
26
28
|
## Reporting a Vulnerability
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
coordinate the fix and disclosure.
|
|
30
|
+
Report vulnerabilities via the [Tidelift security contact][tidelift]. Tidelift
|
|
31
|
+
will coordinate the fix and disclosure.
|
|
30
32
|
|
|
31
|
-
Alternatively,
|
|
32
|
-
|
|
33
|
-
using [age][age]
|
|
33
|
+
Alternatively, create a [private vulnerability report][advisory] with GitHub or
|
|
34
|
+
send an email to [security@ruby.halostatue.ca][email] with the text `diff-lcs`
|
|
35
|
+
in the subject. Emails sent to this address should be encrypted using [age][age]
|
|
36
|
+
with the following public key:
|
|
34
37
|
|
|
35
38
|
```
|
|
36
39
|
age1fc6ngxmn02m62fej5cl30lrvwmxn4k3q2atqu53aatekmnqfwumqj4g93w
|
|
37
40
|
```
|
|
38
41
|
|
|
39
|
-
[
|
|
40
|
-
[email]: mailto:diff-lcs@halostatue.ca
|
|
42
|
+
[advisory]: https://github.com/halostatue/diff-lcs/security/advisories/new
|
|
41
43
|
[age]: https://github.com/FiloSottile/age
|
|
44
|
+
[email]: mailto:security@ruby.halostatue.ca
|
|
45
|
+
[tidelift]: https://tidelift.com/security
|
data/lib/diff/lcs/block.rb
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
# Basically, this is just a list of changes, where each change adds or
|
|
5
|
-
# deletes a single item. Used by bin/ldiff.
|
|
6
|
-
class Diff::LCS::Block
|
|
7
|
-
attr_reader :changes, :insert, :remove
|
|
3
|
+
Diff::LCS::Block = Data.define(:changes, :insert, :remove) # :nodoc:
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
# A block is an operation removing, adding, or changing a group of items, a list of
|
|
6
|
+
# changes, where each change adds or deletes a single item.
|
|
7
|
+
#
|
|
8
|
+
# Used by bin/ldiff.
|
|
9
|
+
class Diff::LCS::Block
|
|
10
|
+
def self.from_chunk(chunk)
|
|
11
|
+
changes, insert, remove = [], [], []
|
|
13
12
|
|
|
14
|
-
chunk.each do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
chunk.each do
|
|
14
|
+
changes << _1
|
|
15
|
+
remove << _1 if _1.deleting?
|
|
16
|
+
insert << _1 if _1.adding?
|
|
18
17
|
end
|
|
18
|
+
|
|
19
|
+
new(changes: changes.freeze, remove: remove.freeze, insert: insert.freeze)
|
|
19
20
|
end
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
class << self
|
|
23
|
+
private :new, :[]
|
|
23
24
|
end
|
|
24
25
|
|
|
26
|
+
private :with
|
|
27
|
+
|
|
28
|
+
def diff_size = insert.size - remove.size
|
|
29
|
+
|
|
25
30
|
def op
|
|
26
|
-
case [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
case [remove, insert]
|
|
32
|
+
# Unchanged
|
|
33
|
+
in [[], []] then "^"
|
|
34
|
+
# Delete
|
|
35
|
+
in [_, []] then "-"
|
|
36
|
+
# Insert
|
|
37
|
+
in [[], _] then "+"
|
|
38
|
+
# Conflict
|
|
39
|
+
in [_, _] then "!"
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
end
|