diff-lcs 1.1.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/Code-of-Conduct.md +74 -0
  4. data/Contributing.md +119 -0
  5. data/History.md +400 -0
  6. data/{License.rdoc → License.md} +6 -5
  7. data/Manifest.txt +36 -4
  8. data/README.rdoc +35 -23
  9. data/Rakefile +106 -11
  10. data/bin/htmldiff +7 -4
  11. data/bin/ldiff +4 -1
  12. data/docs/COPYING.txt +21 -22
  13. data/docs/artistic.txt +127 -0
  14. data/lib/diff/lcs/array.rb +1 -15
  15. data/lib/diff/lcs/backports.rb +9 -0
  16. data/lib/diff/lcs/block.rb +4 -18
  17. data/lib/diff/lcs/callbacks.rb +233 -230
  18. data/lib/diff/lcs/change.rb +114 -109
  19. data/lib/diff/lcs/htmldiff.rb +17 -18
  20. data/lib/diff/lcs/hunk.rb +232 -116
  21. data/lib/diff/lcs/internals.rb +308 -0
  22. data/lib/diff/lcs/ldiff.rb +138 -177
  23. data/lib/diff/lcs/string.rb +1 -15
  24. data/lib/diff/lcs.rb +597 -963
  25. data/lib/diff-lcs.rb +1 -3
  26. data/spec/change_spec.rb +89 -0
  27. data/spec/diff_spec.rb +32 -16
  28. data/spec/fixtures/aX +1 -0
  29. data/spec/fixtures/bXaX +1 -0
  30. data/spec/fixtures/ds1.csv +50 -0
  31. data/spec/fixtures/ds2.csv +51 -0
  32. data/spec/fixtures/ldiff/output.diff +4 -0
  33. data/spec/fixtures/ldiff/output.diff-c +7 -0
  34. data/spec/fixtures/ldiff/output.diff-e +3 -0
  35. data/spec/fixtures/ldiff/output.diff-f +3 -0
  36. data/spec/fixtures/ldiff/output.diff-u +5 -0
  37. data/spec/fixtures/ldiff/output.diff.chef +4 -0
  38. data/spec/fixtures/ldiff/output.diff.chef-c +15 -0
  39. data/spec/fixtures/ldiff/output.diff.chef-e +3 -0
  40. data/spec/fixtures/ldiff/output.diff.chef-f +3 -0
  41. data/spec/fixtures/ldiff/output.diff.chef-u +9 -0
  42. data/spec/fixtures/ldiff/output.diff.chef2 +7 -0
  43. data/spec/fixtures/ldiff/output.diff.chef2-c +20 -0
  44. data/spec/fixtures/ldiff/output.diff.chef2-d +7 -0
  45. data/spec/fixtures/ldiff/output.diff.chef2-e +7 -0
  46. data/spec/fixtures/ldiff/output.diff.chef2-f +7 -0
  47. data/spec/fixtures/ldiff/output.diff.chef2-u +16 -0
  48. data/spec/fixtures/new-chef +4 -0
  49. data/spec/fixtures/new-chef2 +17 -0
  50. data/spec/fixtures/old-chef +4 -0
  51. data/spec/fixtures/old-chef2 +14 -0
  52. data/spec/hunk_spec.rb +83 -0
  53. data/spec/issues_spec.rb +154 -0
  54. data/spec/lcs_spec.rb +36 -16
  55. data/spec/ldiff_spec.rb +87 -0
  56. data/spec/patch_spec.rb +198 -172
  57. data/spec/sdiff_spec.rb +99 -89
  58. data/spec/spec_helper.rb +149 -59
  59. data/spec/traverse_balanced_spec.rb +191 -167
  60. data/spec/traverse_sequences_spec.rb +105 -51
  61. metadata +218 -99
  62. data/.gemtest +0 -0
  63. data/History.rdoc +0 -54
  64. data/diff-lcs.gemspec +0 -51
  65. data/docs/artistic.html +0 -289
data/README.rdoc CHANGED
@@ -1,29 +1,26 @@
1
- = diff-lcs
1
+ = Diff::LCS
2
2
 
3
- == Description
4
- Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt
5
- longest common subsequence (LCS) algorithm to compute intelligent differences
6
- between two sequenced enumerable containers. The implementation is based on
7
- Mario I. Wolczko's {Smalltalk version 1.2}[ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st]
8
- (1993) and Ned Konz's Perl version
9
- {Algorithm::Diff 1.15}[http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/].
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]
10
8
 
11
- This is release 1.1.3, fixing several small bugs found over the years. Version
12
- 1.1.0 added new features, including the ability to #patch and #unpatch changes
13
- as well as a new contextual diff callback, Diff::LCS::ContextDiffCallbacks,
14
- that should improve the context sensitivity of patching.
15
-
16
- This library is called Diff::LCS because of an early version of Algorithm::Diff
17
- which was restrictively licensed. This version has seen a minor license change:
18
- instead of being under Ruby's license as an option, the third optional license
19
- is the MIT license.
9
+ == Description
20
10
 
21
- == Where
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.
22
14
 
23
- * {GitHub}[https://github.com/halostatue/diff-lcs]
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.
24
18
 
25
- This is the new home of Diff::LCS (diff-lcs). The Ruwiki page still refers to
26
- it, but development is not happening there any longer.
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.
27
24
 
28
25
  == Synopsis
29
26
 
@@ -64,9 +61,24 @@ extended for use this way.
64
61
 
65
62
  Note that Diff::LCS requires a sequenced enumerable container, which means that
66
63
  the order of enumeration is both predictable and consistent for the same set of
67
- data. While it is theoretically possible to generate a diff for unordereded
64
+ data. While it is theoretically possible to generate a diff for an unordered
68
65
  hash, it will only be meaningful if the enumeration of the hashes is
69
66
  consistent. In general, this will mean that containers that behave like String
70
67
  or Array will perform best.
71
68
 
72
- :include: License.rdoc
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.
data/Rakefile CHANGED
@@ -1,26 +1,121 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rspec'
5
+ require 'rspec/core/rake_task'
5
6
  require 'hoe'
6
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
44
  Hoe.plugin :doofus
8
- Hoe.plugin :gemspec
45
+ Hoe.plugin :gemspec2
9
46
  Hoe.plugin :git
10
47
 
11
- Hoe.spec 'diff-lcs' do
12
- self.rubyforge_name = 'ruwiki'
48
+ if RUBY_VERSION < '1.9'
49
+ class Array #:nodoc:
50
+ def to_h
51
+ Hash[*flatten(1)]
52
+ end
53
+ end
13
54
 
14
- developer('Austin Ziegler', 'austin@rubyforge.org')
55
+ class Gem::Specification #:nodoc:
56
+ def metadata=(*); end
57
+
58
+ def default_value(*); end
59
+ end
60
+
61
+ class Object #:nodoc:
62
+ def caller_locations(*)
63
+ []
64
+ end
65
+ end
66
+ end
15
67
 
16
- self.remote_rdoc_dir = 'diff-lcs/rdoc'
17
- self.rsync_args << ' --exclude=statsvn/'
68
+ _spec = Hoe.spec 'diff-lcs' do
69
+ developer('Austin Ziegler', 'halostatue@gmail.com')
18
70
 
19
- self.history_file = 'History.rdoc'
71
+ require_ruby_version '>= 1.8'
72
+
73
+ self.history_file = 'History.md'
20
74
  self.readme_file = 'README.rdoc'
21
- self.extra_rdoc_files = FileList["*.rdoc"].to_a
75
+ self.licenses = ['MIT', 'Artistic-2.0', 'GPL-2.0+']
76
+
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']
84
+ end
22
85
 
23
- self.extra_dev_deps << ['rspec', '~> 2.0']
86
+ desc "Run all specifications"
87
+ RSpec::Core::RakeTask.new(:spec) do |t|
88
+ rspec_dirs = %w(spec lib).join(":")
89
+ t.rspec_opts = ["-I#{rspec_dirs}"]
24
90
  end
25
91
 
26
- # vim: syntax=ruby
92
+ Rake::Task["spec"].actions.uniq! { |a| a.source_location }
93
+
94
+ task :default => :spec unless Rake::Task["default"].prereqs.include?("spec")
95
+ task :test => :spec unless Rake::Task["test"].prereqs.include?("spec")
96
+
97
+ if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby'
98
+ namespace :spec do
99
+ desc "Runs test coverage. Only works Ruby 2.0+ and assumes 'simplecov' is installed."
100
+ task :coverage do
101
+ ENV['COVERAGE'] = 'yes'
102
+ Rake::Task['spec'].execute
103
+ end
104
+ end
105
+ end
106
+
107
+ task :ruby18 do
108
+ puts <<-MESSAGE
109
+ You are starting a barebones Ruby 1.8 docker environment. You will need to
110
+ do the following:
111
+
112
+ - mv Gemfile.lock{,.v2}
113
+ - gem install bundler --version 1.17.2 --no-ri --no-rdoc
114
+ - ruby -S bundle
115
+ - rake
116
+
117
+ Don't forget to restore your Gemfile.lock after testing.
118
+
119
+ MESSAGE
120
+ sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
121
+ end
data/bin/htmldiff CHANGED
@@ -1,4 +1,5 @@
1
- #!ruby -w
1
+ #! /usr/bin/env ruby -w
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'diff/lcs'
4
5
  require 'diff/lcs/htmldiff'
@@ -10,8 +11,8 @@ rescue LoadError
10
11
  end
11
12
 
12
13
  if ARGV.size < 2 or ARGV.size > 3
13
- $stderr.puts "usage: #{File.basename($0)} old new [output.html]"
14
- $stderr.puts " #{File.basename($0)} old new > output.html"
14
+ warn "usage: #{File.basename($0)} old new [output.html]"
15
+ warn " #{File.basename($0)} old new > output.html"
15
16
  exit 127
16
17
  end
17
18
 
@@ -23,10 +24,12 @@ options = { :title => "diff #{ARGV[0]} #{ARGV[1]}" }
23
24
  htmldiff = Diff::LCS::HTMLDiff.new(left, right, options)
24
25
 
25
26
  if ARGV[2]
26
- File.open(ARGV[2], "w") do |f|
27
+ File.open(ARGV[2], 'w') do |f|
27
28
  htmldiff.options[:output] = f
28
29
  htmldiff.run
29
30
  end
30
31
  else
31
32
  htmldiff.run
32
33
  end
34
+
35
+ # vim: ft=ruby
data/bin/ldiff CHANGED
@@ -1,6 +1,9 @@
1
- #!ruby -w
1
+ #! /usr/bin/env ruby -w
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'diff/lcs'
4
5
  require 'diff/lcs/ldiff'
5
6
 
6
7
  exit Diff::LCS::Ldiff.run(ARGV)
8
+
9
+ # vim: ft=ruby
data/docs/COPYING.txt CHANGED
@@ -1,12 +1,12 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 2, June 1991
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
3
 
4
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
6
  Everyone is permitted to copy and distribute verbatim copies
7
7
  of this license document, but changing it is not allowed.
8
8
 
9
- Preamble
9
+ Preamble
10
10
 
11
11
  The licenses for most software are designed to take away your
12
12
  freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
15
15
  General Public License applies to most of the Free Software
16
16
  Foundation's software and to any other program whose authors commit to
17
17
  using it. (Some other Free Software Foundation software is covered by
18
- the GNU Library General Public License instead.) You can apply it to
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
19
  your programs, too.
20
20
 
21
21
  When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
55
55
 
56
56
  The precise terms and conditions for copying, distribution and
57
57
  modification follow.
58
-
59
- GNU GENERAL PUBLIC LICENSE
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
60
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
61
 
62
62
  0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
110
110
  License. (Exception: if the Program itself is interactive but
111
111
  does not normally print such an announcement, your work based on
112
112
  the Program is not required to print an announcement.)
113
-
113
+
114
114
  These requirements apply to the modified work as a whole. If
115
115
  identifiable sections of that work are not derived from the Program,
116
116
  and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
168
168
  access to copy the source code from the same place counts as
169
169
  distribution of the source code, even though third parties are not
170
170
  compelled to copy the source along with the object code.
171
-
171
+
172
172
  4. You may not copy, modify, sublicense, or distribute the Program
173
173
  except as expressly provided under this License. Any attempt
174
174
  otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
225
225
 
226
226
  This section is intended to make thoroughly clear what is believed to
227
227
  be a consequence of the rest of this License.
228
-
228
+
229
229
  8. If the distribution and/or use of the Program is restricted in
230
230
  certain countries either by patents or by copyrighted interfaces, the
231
231
  original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
255
255
  of preserving the free status of all derivatives of our free software and
256
256
  of promoting the sharing and reuse of software generally.
257
257
 
258
- NO WARRANTY
258
+ NO WARRANTY
259
259
 
260
260
  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
261
  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
277
  PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
278
  POSSIBILITY OF SUCH DAMAGES.
279
279
 
280
- END OF TERMS AND CONDITIONS
281
-
282
- How to Apply These Terms to Your New Programs
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
283
 
284
284
  If you develop a new program, and you want it to be of the greatest
285
285
  possible use to the public, the best way to achieve this is to make it
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
291
291
  the "copyright" line and a pointer to where the full notice is found.
292
292
 
293
293
  <one line to give the program's name and a brief idea of what it does.>
294
- Copyright (C) 19yy <name of author>
294
+ Copyright (C) <year> <name of author>
295
295
 
296
296
  This program is free software; you can redistribute it and/or modify
297
297
  it under the terms of the GNU General Public License as published by
@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
303
303
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
304
  GNU General Public License for more details.
305
305
 
306
- You should have received a copy of the GNU General Public License
307
- along with this program; if not, write to the Free Software
308
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
309
-
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
310
309
 
311
310
  Also add information on how to contact you by electronic and paper mail.
312
311
 
313
312
  If the program is interactive, make it output a short notice like this
314
313
  when it starts in an interactive mode:
315
314
 
316
- Gnomovision version 69, Copyright (C) 19yy name of author
315
+ Gnomovision version 69, Copyright (C) year name of author
317
316
  Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318
317
  This is free software, and you are welcome to redistribute it
319
318
  under certain conditions; type `show c' for details.
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
336
335
  This General Public License does not permit incorporating your program into
337
336
  proprietary programs. If your program is a subroutine library, you may
338
337
  consider it more useful to permit linking proprietary applications with the
339
- library. If this is what you want to do, use the GNU Library General
338
+ library. If this is what you want to do, use the GNU Lesser General
340
339
  Public License instead of this License.
data/docs/artistic.txt ADDED
@@ -0,0 +1,127 @@
1
+ The "Artistic License"
2
+
3
+ Preamble
4
+
5
+ The intent of this document is to state the conditions under which a
6
+ Package may be copied, such that the Copyright Holder maintains some
7
+ semblance of artistic control over the development of the package,
8
+ while giving the users of the package the right to use and distribute
9
+ the Package in a more-or-less customary fashion, plus the right to make
10
+ reasonable modifications.
11
+
12
+ Definitions:
13
+
14
+ "Package" refers to the collection of files distributed by the
15
+ Copyright Holder, and derivatives of that collection of files
16
+ created through textual modification.
17
+
18
+ "Standard Version" refers to such a Package if it has not been
19
+ modified, or has been modified in accordance with the wishes
20
+ of the Copyright Holder as specified below.
21
+
22
+ "Copyright Holder" is whoever is named in the copyright or
23
+ copyrights for the package.
24
+
25
+ "You" is you, if you're thinking about copying or distributing
26
+ this Package.
27
+
28
+ "Reasonable copying fee" is whatever you can justify on the
29
+ basis of media cost, duplication charges, time of people involved,
30
+ and so on. (You will not be required to justify it to the
31
+ Copyright Holder, but only to the computing community at large
32
+ as a market that must bear the fee.)
33
+
34
+ "Freely Available" means that no fee is charged for the item
35
+ itself, though there may be fees involved in handling the item.
36
+ It also means that recipients of the item may redistribute it
37
+ under the same conditions they received it.
38
+
39
+ 1. You may make and give away verbatim copies of the source form of the
40
+ Standard Version of this Package without restriction, provided that you
41
+ duplicate all of the original copyright notices and associated disclaimers.
42
+
43
+ 2. You may apply bug fixes, portability fixes and other modifications
44
+ derived from the Public Domain or from the Copyright Holder. A Package
45
+ modified in such a way shall still be considered the Standard Version.
46
+
47
+ 3. You may otherwise modify your copy of this Package in any way, provided
48
+ that you insert a prominent notice in each changed file stating how and
49
+ when you changed that file, and provided that you do at least ONE of the
50
+ following:
51
+
52
+ a) place your modifications in the Public Domain or otherwise make them
53
+ Freely Available, such as by posting said modifications to Usenet or
54
+ an equivalent medium, or placing the modifications on a major archive
55
+ site such as uunet.uu.net, or by allowing the Copyright Holder to include
56
+ your modifications in the Standard Version of the Package.
57
+
58
+ b) use the modified Package only within your corporation or organization.
59
+
60
+ c) rename any non-standard executables so the names do not conflict
61
+ with standard executables, which must also be provided, and provide
62
+ a separate manual page for each non-standard executable that clearly
63
+ documents how it differs from the Standard Version.
64
+
65
+ d) make other distribution arrangements with the Copyright Holder.
66
+
67
+ 4. You may distribute the programs of this Package in object code or
68
+ executable form, provided that you do at least ONE of the following:
69
+
70
+ a) distribute a Standard Version of the executables and library files,
71
+ together with instructions (in the manual page or equivalent) on where
72
+ to get the Standard Version.
73
+
74
+ b) accompany the distribution with the machine-readable source of
75
+ the Package with your modifications.
76
+
77
+ c) give non-standard executables non-standard names, and clearly
78
+ document the differences in manual pages (or equivalent), together
79
+ with instructions on where to get the Standard Version.
80
+
81
+ d) make other distribution arrangements with the Copyright Holder.
82
+
83
+ 5. You may charge a reasonable copying fee for any distribution of this
84
+ Package. You may charge any fee you choose for support of this
85
+ Package. You may not charge a fee for this Package itself. However,
86
+ you may distribute this Package in aggregate with other (possibly
87
+ commercial) programs as part of a larger (possibly commercial) software
88
+ distribution provided that you do not advertise this Package as a
89
+ product of your own. You may embed this Package's interpreter within
90
+ an executable of yours (by linking); this shall be construed as a mere
91
+ form of aggregation, provided that the complete Standard Version of the
92
+ interpreter is so embedded.
93
+
94
+ 6. The scripts and library files supplied as input to or produced as
95
+ output from the programs of this Package do not automatically fall
96
+ under the copyright of this Package, but belong to whoever generated
97
+ them, and may be sold commercially, and may be aggregated with this
98
+ Package. If such scripts or library files are aggregated with this
99
+ Package via the so-called "undump" or "unexec" methods of producing a
100
+ binary executable image, then distribution of such an image shall
101
+ neither be construed as a distribution of this Package nor shall it
102
+ fall under the restrictions of Paragraphs 3 and 4, provided that you do
103
+ not represent such an executable image as a Standard Version of this
104
+ Package.
105
+
106
+ 7. C subroutines (or comparably compiled subroutines in other
107
+ languages) supplied by you and linked into this Package in order to
108
+ emulate subroutines and variables of the language defined by this
109
+ Package shall not be considered part of this Package, but are the
110
+ equivalent of input as in Paragraph 6, provided these subroutines do
111
+ not change the language in any way that would cause it to fail the
112
+ regression tests for the language.
113
+
114
+ 8. Aggregation of this Package with a commercial distribution is always
115
+ permitted provided that the use of this Package is embedded; that is,
116
+ when no overt attempt is made to make this Package's interfaces visible
117
+ to the end user of the commercial distribution. Such use shall not be
118
+ construed as a distribution of this Package.
119
+
120
+ 9. The name of the Copyright Holder may not be used to endorse or promote
121
+ products derived from this software without specific prior written permission.
122
+
123
+ 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
124
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
125
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
126
+
127
+ The End
@@ -1,18 +1,4 @@
1
- #! /usr/env/bin ruby
2
- #--
3
- # Copyright 2004 Austin Ziegler <diff-lcs@halostatue.ca>
4
- # adapted from:
5
- # Algorithm::Diff (Perl) by Ned Konz <perl@bike-nomad.com>
6
- # Smalltalk by Mario I. Wolczko <mario@wolczko.com>
7
- # implements McIlroy-Hunt diff algorithm
8
- #
9
- # This program is free software. It may be redistributed and/or modified under
10
- # the terms of the GPL version 2 (or later), the Perl Artistic licence, or the
11
- # Ruby licence.
12
- #
13
- # $Id$
14
- #++
15
- # Includes Diff::LCS into the Array built-in class.
1
+ # frozen_string_literal: true
16
2
 
17
3
  require 'diff/lcs'
18
4
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ unless 0.respond_to?(:positive?)
4
+ class Fixnum # rubocop:disable Lint/UnifiedInteger, Style/Documentation
5
+ def positive?
6
+ self > 0 # rubocop:disable Style/NumericPredicate
7
+ end
8
+ end
9
+ end
@@ -1,22 +1,8 @@
1
- #! /usr/env/bin ruby
2
- #--
3
- # Copyright 2004 Austin Ziegler <diff-lcs@halostatue.ca>
4
- # adapted from:
5
- # Algorithm::Diff (Perl) by Ned Konz <perl@bike-nomad.com>
6
- # Smalltalk by Mario I. Wolczko <mario@wolczko.com>
7
- # implements McIlroy-Hunt diff algorithm
8
- #
9
- # This program is free software. It may be redistributed and/or modified under
10
- # the terms of the GPL version 2 (or later), the Perl Artistic licence, or the
11
- # Ruby licence.
12
- #
13
- # $Id$
14
- #++
15
- # Contains Diff::LCS::Block for bin/ldiff.
1
+ # frozen_string_literal: true
16
2
 
17
- # A block is an operation removing, adding, or changing a group of items.
18
- # Basically, this is just a list of changes, where each change adds or
19
- # deletes a single item. Used by bin/ldiff.
3
+ # A block is an operation removing, adding, or changing a group of items.
4
+ # Basically, this is just a list of changes, where each change adds or
5
+ # deletes a single item. Used by bin/ldiff.
20
6
  class Diff::LCS::Block
21
7
  attr_reader :changes, :insert, :remove
22
8