diff-lcs 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,74 @@
1
+ # Contributing
2
+
3
+ Contribution to diff-lcs is encouraged in any form: a bug report, a feature
4
+ request, or code contributions. There are a few DOs and DON'Ts for
5
+
6
+ - DO:
7
+
8
+ - Keep the coding style that already exists for any updated Ruby code (support
9
+ or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
10
+
11
+ - Use thoughtfully-named topic branches for contributions. Rebase your commits
12
+ into logical chunks as necessary.
13
+
14
+ - Use [quality commit messages][qcm].
15
+
16
+ - Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
17
+ `CHANGELOG.md` as a separate commit from your main change. (Follow the style
18
+ in the `CHANGELOG.md` and provide a link to your PR.)
19
+
20
+ - Add or update tests, written in [RSpec][rspec], as appropriate.
21
+
22
+ - Add or update documentation, as appropriate.
23
+
24
+ - DO NOT:
25
+
26
+ - Modify `VERSION` in `lib/diff/lcs.rb`. When your patch is accepted and a
27
+ release is made, the version will be updated at that point.
28
+
29
+ - Modify `diff-lcs.gemspect`; it is a generated file. (You _may_ use
30
+ `rake gemspec` to regenerate it if your change involves metadata related to
31
+ gem itself).
32
+
33
+ - Modify the `Gemfile`.
34
+
35
+ ## Test Dependencies
36
+
37
+ diff-lcs uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds
38
+ a number of rake tasks. You will mostly be interested in `rake`, which runs
39
+ tests in the same way that `rake spec` does.
40
+
41
+ To assist with the installation of the development dependencies for diff-lcs, I
42
+ have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file.
43
+ `minitar.gemspec` file. This will permit you to use `bundle install` to install
44
+ the dependencies.
45
+
46
+ You can run tests with code coverage analysis by running `rake spec:coverage`.
47
+
48
+ ## Workflow
49
+
50
+ Here's the most direct way to get your work merged into the project:
51
+
52
+ - Fork the project.
53
+ - Clone your fork (`git clone git://github.com/<username>/diff-lcs.git`).
54
+ - Create a topic branch to contain your change
55
+ (`git checkout -b my_awesome_feature`).
56
+ - Hack away, add tests. Not necessarily in that order.
57
+ - Make sure everything still passes by running `rake`.
58
+ - If necessary, rebase your commits into logical chunks, without errors.
59
+ - Push the branch up (`git push origin my_awesome_feature`).
60
+ - Create a pull request against halostatue/diff-lcs and describe what your
61
+ change does and the why you think it should be merged.
62
+
63
+ ### Help Wanted
64
+
65
+ I want to automated the releases. I am **not** switching from Hoe for release
66
+ management, so the use of [rubygems/release-gem][release-gem] requires some care
67
+ (perhaps by exporting `VERSION=$(rake version)` to the job), but assistance in
68
+ getting this action going for an automated release would be greatly appreciated.
69
+
70
+ [hoe]: https://github.com/seattlerb/hoe
71
+ [qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
72
+ [release-gem]: https://github.com/rubygems/release-gem
73
+ [rspec]: http://rspec.info/documentation/
74
+ [standardrb]: https://github.com/standardrb/standard
data/CONTRIBUTORS.md ADDED
@@ -0,0 +1,48 @@
1
+ # Contributors
2
+
3
+ - Austin Ziegler (@halostatue) created diff-lcs.
4
+
5
+ Thanks to everyone else who has contributed to diff-lcs over the years:
6
+
7
+ - @ginriki
8
+ - @joshbronson
9
+ - @kevinmook
10
+ - @mckaz
11
+ - Akinori Musha
12
+ - Artem Ignatyev
13
+ - Brandon Fish
14
+ - Baptiste Courtois (@annih)
15
+ - Camille Drapier
16
+ - Cédric Boutillier
17
+ - Gregg Kellogg
18
+ - Jagdeep Singh
19
+ - Jason Gladish
20
+ - Jon Rowe
21
+ - Josef Strzibny
22
+ - Josep (@apuratepp)
23
+ - Josh Bronson
24
+ - Jun Aruga
25
+ - Justin Steele
26
+ - Kenichi Kamiya
27
+ - Kensuke Nagae
28
+ - Kevin Ansfield
29
+ - Koichi Ito
30
+ - Mark Friedgan
31
+ - Masato Nakamura
32
+ - Mark Young
33
+ - Michael Granger
34
+ - Myron Marston
35
+ - Nicolas Leger
36
+ - Oleg Orlov
37
+ - Patrick Linnane
38
+ - Paul Kunysch
39
+ - Pete Higgins
40
+ - Peter Goldstein
41
+ - Peter Wagenet
42
+ - Philippe Lafoucrière
43
+ - Ryan Lovelett
44
+ - Scott Steele
45
+ - Simon Courtois
46
+ - Tien (@tiendo1011)
47
+ - Tomas Jura
48
+ - Vít Ondruch
data/Contributing.md CHANGED
@@ -1,69 +1,58 @@
1
- ## Contributing
1
+ # Contributing
2
2
 
3
- I value any contribution to Diff::LCS you can provide: a bug report, a
4
- feature request, or code contributions. Code contributions to Diff::LCS are
5
- especially <del>welcome</del>encouraged. Because Diff::LCS is a complex
6
- codebase, there are a few guidelines:
3
+ Contribution to diff-lcs is encouraged in any form: a bug report, a feature
4
+ request, or code contributions. There are a few DOs and DON'Ts for
7
5
 
8
- - Code changes _will not_ be accepted without tests. The test suite is
9
- written with [RSpec][].
10
- - Match my coding style.
11
- - Use a thoughtfully-named topic branch that contains your change. Rebase
12
- your commits into logical chunks as necessary.
13
- - Use [quality commit messages][].
14
- - Do not change the version number; when your patch is accepted and a release
15
- is made, the version will be updated at that point.
16
- - Submit a GitHub pull request with your changes.
17
- - New or changed behaviours require appropriate documentation.
6
+ - DO:
18
7
 
19
- ### Test Dependencies
8
+ - Keep the coding style that already exists for any updated Ruby code (support
9
+ or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
20
10
 
21
- Diff::LCS uses Ryan Davis’s [Hoe][] to manage the release process, and it
22
- adds a number of rake tasks. You will mostly be interested in:
11
+ - Use thoughtfully-named topic branches for contributions. Rebase your commits
12
+ into logical chunks as necessary.
23
13
 
24
- ```sh
25
- $ rake
26
- ```
14
+ - Use [quality commit messages][qcm].
27
15
 
28
- which runs the tests the same way that:
16
+ - Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
17
+ `CHANGELOG.md` as a separate commit from your main change. (Follow the style
18
+ in the `CHANGELOG.md` and provide a link to your PR.)
29
19
 
30
- ```sh
31
- $ rake spec
32
- ```
20
+ - Add or update tests, written in [RSpec][rspec], as appropriate.
33
21
 
34
- will do.
22
+ - Add or update documentation, as appropriate.
35
23
 
36
- To assist with the installation of the development dependencies, I have
37
- provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file. This
38
- will permit you to do:
24
+ - DO NOT:
39
25
 
40
- ```sh
41
- $ bundle install
42
- ```
26
+ - Modify `VERSION` in `lib/diff/lcs.rb`. When your patch is accepted and a
27
+ release is made, the version will be updated at that point.
43
28
 
44
- to get the development dependencies. If you aleady have `hoe` installed, you
45
- can accomplish the same thing with:
29
+ - Modify `diff-lcs.gemspect`; it is a generated file. (You _may_ use
30
+ `rake gemspec` to regenerate it if your change involves metadata related to
31
+ gem itself).
46
32
 
47
- ```sh
48
- $ rake newb
49
- ```
33
+ - Modify the `Gemfile`.
50
34
 
51
- This task will install any missing dependencies, run the tests/specs, and
52
- generate the RDoc.
35
+ ## Test Dependencies
53
36
 
54
- You can run tests with code coverage analysis by running:
37
+ diff-lcs uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds
38
+ a number of rake tasks. You will mostly be interested in `rake`, which runs
39
+ tests in the same way that `rake spec` does.
55
40
 
56
- ```sh
57
- $ rake spec:coverage
58
- ```
41
+ To assist with the installation of the development dependencies for diff-lcs, I
42
+ have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file.
43
+ `minitar.gemspec` file. This will permit you to use `bundle install` to install
44
+ the dependencies.
59
45
 
60
- ### Workflow
46
+ You can run tests with code coverage analysis by running `rake spec:coverage`.
47
+
48
+ ## Workflow
61
49
 
62
50
  Here's the most direct way to get your work merged into the project:
63
51
 
64
52
  - Fork the project.
65
- - Clone down your fork (`git clone git://github.com/<username>/diff-lcs.git`).
66
- - Create a topic branch to contain your change (`git checkout -b my_awesome_feature`).
53
+ - Clone your fork (`git clone git://github.com/<username>/diff-lcs.git`).
54
+ - Create a topic branch to contain your change
55
+ (`git checkout -b my_awesome_feature`).
67
56
  - Hack away, add tests. Not necessarily in that order.
68
57
  - Make sure everything still passes by running `rake`.
69
58
  - If necessary, rebase your commits into logical chunks, without errors.
@@ -71,49 +60,15 @@ Here's the most direct way to get your work merged into the project:
71
60
  - Create a pull request against halostatue/diff-lcs and describe what your
72
61
  change does and the why you think it should be merged.
73
62
 
74
- ### Contributors
75
-
76
- - Austin Ziegler created Diff::LCS.
77
-
78
- Thanks to everyone else who has contributed code or bug reports to Diff::LCS:
79
-
80
- - @ginriki
81
- - @joshbronson
82
- - @kevinmook
83
- - @mckaz
84
- - Akinori Musha
85
- - Artem Ignatyev
86
- - Brandon Fish
87
- - Camille Drapier
88
- - Cédric Boutillier
89
- - Gregg Kellogg
90
- - Jagdeep Singh
91
- - Jason Gladish
92
- - Jon Rowe
93
- - Josef Strzibny
94
- - Josep (@apuratepp)
95
- - Josh Bronson
96
- - Jun Aruga
97
- - Kenichi Kamiya
98
- - Kensuke Nagae
99
- - Kevin Ansfield
100
- - Koichi Ito
101
- - Mark Friedgan
102
- - Michael Granger
103
- - Myron Marston
104
- - Nicolas Leger
105
- - Oleg Orlov
106
- - Paul Kunysch
107
- - Pete Higgins
108
- - Peter Wagenet
109
- - Philippe Lafoucrière
110
- - Ryan Lovelett
111
- - Scott Steele
112
- - Simon Courtois
113
- - Tien (@tiendo1011)
114
- - Tomas Jura
115
- - Vít Ondruch
63
+ ### Help Wanted
64
+
65
+ I want to automated the releases. I am **not** switching from Hoe for release
66
+ management, so the use of [rubygems/release-gem][release-gem] requires some care
67
+ (perhaps by exporting `VERSION=$(rake version)` to the job), but assistance in
68
+ getting this action going for an automated release would be greatly appreciated.
116
69
 
117
- [rspec]: http://rspec.info/documentation/
118
- [quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
119
70
  [hoe]: https://github.com/seattlerb/hoe
71
+ [qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
72
+ [release-gem]: https://github.com/rubygems/release-gem
73
+ [rspec]: http://rspec.info/documentation/
74
+ [standardrb]: https://github.com/standardrb/standard
@@ -1,4 +1,4 @@
1
- == License
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
- === MIT License
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
- === Perl Artistic License (version 2)
35
+ ## Perl Artistic License
36
+
36
37
  See the file docs/artistic.txt in the main distribution.
37
38
 
38
- === GNU GPL version 2
39
+ ## GNU GPL version 2
40
+
39
41
  See the file docs/COPYING.txt in the main distribution.
data/Manifest.txt CHANGED
@@ -1,11 +1,14 @@
1
1
  .rspec
2
- Code-of-Conduct.md
2
+ CHANGELOG.md
3
+ CODE_OF_CONDUCT.md
4
+ CONTRIBUTING.md
5
+ CONTRIBUTORS.md
3
6
  Contributing.md
4
- History.md
5
- License.md
7
+ LICENCE.md
6
8
  Manifest.txt
7
- README.rdoc
9
+ README.md
8
10
  Rakefile
11
+ SECURITY.md
9
12
  bin/htmldiff
10
13
  bin/ldiff
11
14
  docs/COPYING.txt
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # Diff::LCS
2
+
3
+ - home :: https://github.com/halostatue/diff-lcs
4
+ - changelog :: https://github.com/halostatue/diff-lcs/blob/main/CHANGELOG.md
5
+ - code :: https://github.com/halostatue/diff-lcs
6
+ - bugs :: https://github.com/halostatue/diff-lcs/issues
7
+ - rdoc :: http://rubydoc.info/github/halostatue/diff-lcs
8
+
9
+ <a href="https://github.com/halostatue/diff-lcs/actions">
10
+ <img src="https://github.com/halostatue/diff-lcs/workflows/CI/badge.svg" />
11
+ </a>
12
+
13
+ ## Description
14
+
15
+ Diff::LCS computes the difference between two Enumerable sequences using the
16
+ McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
17
+ to create a simple HTML diff output format and a standard diff-like tool.
18
+
19
+ This is release 1.4.3, providing a simple extension that allows for
20
+ Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number
21
+ of formatting issues.
22
+
23
+ Ruby versions below 2.5 are soft-deprecated, which means that older versions are
24
+ no longer part of the CI test suite. If any changes have been introduced that
25
+ break those versions, bug reports and patches will be accepted, but it will be
26
+ up to the reporter to verify any fixes prior to release. The next major release
27
+ will completely break compatibility.
28
+
29
+ ## Synopsis
30
+
31
+ Using this module is quite simple. By default, Diff::LCS does not extend objects
32
+ with the Diff::LCS interface, but will be called as if it were a function:
33
+
34
+ ```ruby
35
+ require 'diff/lcs'
36
+
37
+ seq1 = %w(a b c e h j l m n p)
38
+ seq2 = %w(b c d e f j k l m r s t)
39
+
40
+ lcs = Diff::LCS.LCS(seq1, seq2)
41
+ diffs = Diff::LCS.diff(seq1, seq2)
42
+ sdiff = Diff::LCS.sdiff(seq1, seq2)
43
+ seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
44
+ bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)
45
+ seq2 == Diff::LCS.patch!(seq1, diffs)
46
+ seq1 == Diff::LCS.unpatch!(seq2, diffs)
47
+ seq2 == Diff::LCS.patch!(seq1, sdiff)
48
+ seq1 == Diff::LCS.unpatch!(seq2, sdiff)
49
+ ```
50
+
51
+ Objects can be extended with Diff::LCS:
52
+
53
+ ```ruby
54
+ seq1.extend(Diff::LCS)
55
+ lcs = seq1.lcs(seq2)
56
+ diffs = seq1.diff(seq2)
57
+ sdiff = seq1.sdiff(seq2)
58
+ seq = seq1.traverse_sequences(seq2, callback_obj)
59
+ bal = seq1.traverse_balanced(seq2, callback_obj)
60
+ seq2 == seq1.patch!(diffs)
61
+ seq1 == seq2.unpatch!(diffs)
62
+ seq2 == seq1.patch!(sdiff)
63
+ seq1 == seq2.unpatch!(sdiff)
64
+ ```
65
+
66
+ By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be
67
+ extended for use this way.
68
+
69
+ Note that Diff::LCS requires a sequenced enumerable container, which means that
70
+ the order of enumeration is both predictable and consistent for the same set of
71
+ data. While it is theoretically possible to generate a diff for an unordered
72
+ hash, it will only be meaningful if the enumeration of the hashes is consistent.
73
+ In general, this will mean that containers that behave like String or Array will
74
+ perform best.
75
+
76
+ ## History
77
+
78
+ Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt longest
79
+ common subsequence (LCS) algorithm to compute intelligent differences between
80
+ two sequenced enumerable containers. The implementation is based on Mario I.
81
+ Wolczko's [Smalltalk version 1.2][smalltalk] (1993) and Ned Konz's Perl version
82
+ [Algorithm::Diff 1.15][perl]. `Diff::LCS#sdiff` and
83
+ `Diff::LCS#traverse_balanced` were originally written for the Perl version by
84
+ Mike Schilli.
85
+
86
+ The algorithm is described in <em>A Fast Algorithm for Computing Longest Common
87
+ Subsequences</em>, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor
88
+ improvements to improve the speed. A simplified description of the algorithm,
89
+ originally written for the Perl version, was written by Mark-Jason Dominus.
90
+
91
+ [smalltalk]: ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st
92
+ [perl]: http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/
data/Rakefile CHANGED
@@ -1,110 +1,86 @@
1
- # frozen_string_literal: true
1
+ require "rubygems"
2
+ require "rspec"
3
+ require "rspec/core/rake_task"
4
+ require "hoe"
5
+ require "rake/clean"
2
6
 
3
- require 'rubygems'
4
- require 'rspec'
5
- require 'rspec/core/rake_task'
6
- require 'hoe'
7
-
8
- # This is required until https://github.com/seattlerb/hoe/issues/112 is fixed
9
- class Hoe
10
- def with_config
11
- config = Hoe::DEFAULT_CONFIG
12
-
13
- rc = File.expand_path("~/.hoerc")
14
- homeconfig = load_config(rc)
15
- config = config.merge(homeconfig)
16
-
17
- localconfig = load_config(File.expand_path(File.join(Dir.pwd, ".hoerc")))
18
- config = config.merge(localconfig)
19
-
20
- yield config, rc
21
- end
22
-
23
- def load_config(name)
24
- File.exist?(name) ? safe_load_yaml(name) : {}
25
- end
26
-
27
- def safe_load_yaml(name)
28
- return safe_load_yaml_file(name) if YAML.respond_to?(:safe_load_file)
29
-
30
- data = IO.binread(name)
31
- YAML.safe_load(data, permitted_classes: [Regexp])
32
- rescue
33
- YAML.safe_load(data, [Regexp])
34
- end
35
-
36
- def safe_load_yaml_file(name)
37
- YAML.safe_load_file(name, permitted_classes: [Regexp])
38
- rescue
39
- YAML.safe_load_file(name, [Regexp])
40
- end
41
- end
42
-
43
- Hoe.plugin :bundler
7
+ Hoe.plugin :cov
44
8
  Hoe.plugin :doofus
45
9
  Hoe.plugin :gemspec2
46
- Hoe.plugin :git
10
+ Hoe.plugin :git2
11
+ Hoe.plugin :rubygems
47
12
 
48
- if RUBY_VERSION < '1.9'
49
- class Array #:nodoc:
13
+ if RUBY_VERSION < "1.9"
14
+ class Array # :nodoc:
50
15
  def to_h
51
16
  Hash[*flatten(1)]
52
17
  end
53
18
  end
54
19
 
55
- class Gem::Specification #:nodoc:
56
- def metadata=(*); end
20
+ class Gem::Specification # :nodoc:
21
+ def metadata=(*)
22
+ end
57
23
 
58
- def default_value(*); end
24
+ def default_value(*)
25
+ end
59
26
  end
60
27
 
61
- class Object #:nodoc:
28
+ class Object # :nodoc:
62
29
  def caller_locations(*)
63
30
  []
64
31
  end
65
32
  end
66
33
  end
67
34
 
68
- _spec = Hoe.spec 'diff-lcs' do
69
- developer('Austin Ziegler', 'halostatue@gmail.com')
35
+ _spec = Hoe.spec "diff-lcs" do
36
+ developer("Austin Ziegler", "halostatue@gmail.com")
37
+
38
+ self.history_file = "CHANGELOG.md"
39
+ self.readme_file = "README.md"
40
+ self.licenses = ["MIT", "Artistic-1.0-Perl", "GPL-2.0-or-later"]
70
41
 
71
- require_ruby_version '>= 1.8'
42
+ require_ruby_version ">= 1.8"
72
43
 
73
- self.history_file = 'History.md'
74
- self.readme_file = 'README.rdoc'
75
- self.licenses = ['MIT', 'Artistic-2.0', 'GPL-2.0+']
44
+ spec_extras[:metadata] = ->(val) {
45
+ val["rubygems_mfa_required"] = "true"
46
+ val["changelog_uri"] = "https://github.com/halostatue/diff-lcs/blob/main/CHANGELOG.md"
47
+ }
76
48
 
77
- extra_dev_deps << ['hoe-doofus', '~> 1.0']
78
- extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
79
- extra_dev_deps << ['hoe-git', '~> 1.6']
80
- extra_dev_deps << ['hoe-rubygems', '~> 1.0']
81
- extra_dev_deps << ['rspec', '>= 2.0', '< 4']
82
- extra_dev_deps << ['rake', '>= 10.0', '< 14']
83
- extra_dev_deps << ['rdoc', '>= 6.3.1', '< 7']
49
+ extra_dev_deps << ["hoe", ">= 3.0", "< 5"]
50
+ extra_dev_deps << ["hoe-doofus", "~> 1.0"]
51
+ extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
52
+ extra_dev_deps << ["hoe-git2", "~> 1.7"]
53
+ extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
54
+ extra_dev_deps << ["rspec", ">= 2.0", "< 4"]
55
+ extra_dev_deps << ["rake", ">= 10.0", "< 14"]
56
+ extra_dev_deps << ["rdoc", ">= 6.3.1", "< 7"]
84
57
  end
85
58
 
86
59
  desc "Run all specifications"
87
60
  RSpec::Core::RakeTask.new(:spec) do |t|
88
- rspec_dirs = %w(spec lib).join(":")
61
+ rspec_dirs = %w[spec lib].join(":")
89
62
  t.rspec_opts = ["-I#{rspec_dirs}"]
90
63
  end
91
64
 
92
65
  Rake::Task["spec"].actions.uniq! { |a| a.source_location }
93
66
 
67
+ # standard:disable Style/HashSyntax
94
68
  task :default => :spec unless Rake::Task["default"].prereqs.include?("spec")
95
69
  task :test => :spec unless Rake::Task["test"].prereqs.include?("spec")
70
+ # standard:enable Style/HashSyntax
96
71
 
97
- if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby'
72
+ if RUBY_VERSION >= "2.0" && RUBY_ENGINE == "ruby"
98
73
  namespace :spec do
99
74
  desc "Runs test coverage. Only works Ruby 2.0+ and assumes 'simplecov' is installed."
100
75
  task :coverage do
101
- ENV['COVERAGE'] = 'yes'
102
- Rake::Task['spec'].execute
76
+ ENV["COVERAGE"] = "yes"
77
+ Rake::Task["spec"].execute
103
78
  end
104
79
  end
105
80
  end
106
81
 
107
82
  task :ruby18 do
83
+ # standard:disable Layout/HeredocIndentation
108
84
  puts <<-MESSAGE
109
85
  You are starting a barebones Ruby 1.8 docker environment. You will need to
110
86
  do the following:
@@ -117,5 +93,6 @@ do the following:
117
93
  Don't forget to restore your Gemfile.lock after testing.
118
94
 
119
95
  MESSAGE
96
+ # standard:enable Layout/HeredocIndentation
120
97
  sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
121
98
  end
data/SECURITY.md ADDED
@@ -0,0 +1,41 @@
1
+ # diff-lcs Security
2
+
3
+ ## Supported Versions
4
+
5
+ Security reports are accepted for the most recent major release and the previous
6
+ version for a limited time after the initial major release version. After a
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).
9
+
10
+ Because diff-lcs 1.x supports a wide range of Ruby versions, security reports
11
+ will only be accepted when they can be demonstrated on Ruby 3.1 or higher.
12
+
13
+ > [!information]
14
+ >
15
+ > There will be a diff-lcs 2.0 released in 2025 which narrows support to modern
16
+ > versions of Ruby only.
17
+ >
18
+ > | Release Date | Support Ends | Security Support Ends |
19
+ > | ------------ | ------------ | --------------------- |
20
+ > | 2025 | +6 months | +12 months |
21
+ >
22
+ > If the 2.0.0 release happens on 2025-07-01, regular support for diff-lcs 1.x
23
+ > will end on 2026-12-31 and security support for diff-lcs 1.x will end on
24
+ > 2026-06-30.
25
+
26
+ ## Reporting a Vulnerability
27
+
28
+ By preference, use the [Tidelift security contact][tidelift]. Tidelift will
29
+ coordinate the fix and disclosure.
30
+
31
+ Alternatively, Send an email to [diff-lcs@halostatue.ca][email] with the text
32
+ `Diff::LCS` in the subject. Emails sent to this address should be encrypted
33
+ using [age][age] with the following public key:
34
+
35
+ ```
36
+ age1fc6ngxmn02m62fej5cl30lrvwmxn4k3q2atqu53aatekmnqfwumqj4g93w
37
+ ```
38
+
39
+ [tidelift]: https://tidelift.com/security
40
+ [email]: mailto:diff-lcs@halostatue.ca
41
+ [age]: https://github.com/FiloSottile/age
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 'diff/lcs'
5
- require 'diff/lcs/htmldiff'
4
+ require "diff/lcs"
5
+ require "diff/lcs/htmldiff"
6
6
 
7
7
  begin
8
- require 'text/format'
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], 'w') do |f|
27
+ File.open(ARGV[2], "w") do |f|
28
28
  htmldiff.options[:output] = f
29
29
  htmldiff.run
30
30
  end
data/docs/artistic.txt CHANGED
@@ -122,6 +122,6 @@ products derived from this software without specific prior written permission.
122
122
 
123
123
  10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
124
124
  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
125
- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
125
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
126
126
 
127
127
  The End
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'diff/lcs'
3
+ require "diff/lcs"
4
4
 
5
5
  class Array
6
6
  include Diff::LCS