diff-lcs 1.6.1 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb036eaab7330d135a91816336705b672bcc3d3fc55b235392f0b0d2faaf2e76
4
- data.tar.gz: d55364ad8b6a75e697ad90aaffac2d14168c8ef5710b4999d264775de0a220af
3
+ metadata.gz: 34fc249139fb5ed40b525cf33d8e4e3d3702384f74d1e67e63d8eed54a09133c
4
+ data.tar.gz: 46739e6b242db46dd6d01c4bb26d7c51fc07ccaebd7ecd58c305d758f30dfc33
5
5
  SHA512:
6
- metadata.gz: ca32f0e74df9eaab1530842477fca4cbcd730fde728dfeefd8d6e6f212e8ed0086e7cd288a1fb8e2a79ebed18591cda677ddce75ed2bd0863620993ba34aa553
7
- data.tar.gz: 2ce80458cd347340b44d8d5cf56c7e11ee145f93559641233ce928bb7ac54e9966a07904e52e1f46f975714b13f28d70832d762185e3d7e867d8caff5fc14ad3
6
+ metadata.gz: c482d6b11cb38b840ee4a4c11785c592a7a537e5f855cca99739a578e8d833b05ad43cba4ac8e40e4ae1fa876633d9d96c18c29acef63bf72532c352d98b05e6
7
+ data.tar.gz: 7c6da2681b6a2ddf4ebda85deb24aeaeea29218cfa452d40717e1963c117c95230da2c01c18b806cb0916a804263aa7ac0230c4adcbb8fb1b30a95faee5a4dda
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.2 / 2025-05-12
4
+
5
+ - Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
6
+
7
+ - Fix issues found with `htmldiff` in Ruby 1.8 (which is used approximately
8
+ never, since the code change which broke Ruby 1.8 was made 6 years ago).
9
+ [#148][pull-148]
10
+
11
+ - Fixed some standardrb formatting and configuration issues.
12
+
3
13
  ## 1.6.1 / 2025-03-25
4
14
 
5
15
  - Performed further work on `Diff::LCS::Ldiff` improvements ([#46][issue-46])
@@ -495,6 +505,8 @@
495
505
  [pull-104]: https://github.com/halostatue/diff-lcs/pull/104
496
506
  [pull-105]: https://github.com/halostatue/diff-lcs/pull/105
497
507
  [pull-129]: https://github.com/halostatue/diff-lcs/pull/129
508
+ [pull-147]: https://github.com/halostatue/diff-lcs/pull/147
509
+ [pull-148]: https://github.com/halostatue/diff-lcs/pull/148
498
510
  [rspec-expectations#200]: https://github.com/rspec/rspec-expectations/pull/200
499
511
  [rspec-expectations#219]: https://github.com/rspec/rspec-expectations/issues/219
500
512
  [rspec-expectations#238]: https://github.com/rspec/rspec-expectations/issues/238
data/CONTRIBUTORS.md CHANGED
@@ -14,6 +14,7 @@ Thanks to everyone else who has contributed to diff-lcs over the years:
14
14
  - Baptiste Courtois (@annih)
15
15
  - Camille Drapier
16
16
  - Cédric Boutillier
17
+ - @earlopain
17
18
  - Gregg Kellogg
18
19
  - Jagdeep Singh
19
20
  - Jason Gladish
data/README.md CHANGED
@@ -16,7 +16,7 @@ Diff::LCS computes the difference between two Enumerable sequences using the
16
16
  McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
17
17
  to create a simple HTML diff output format and a standard diff-like tool.
18
18
 
19
- This is release 1.4.3, providing a simple extension that allows for
19
+ This is release 1.6.1, providing a simple extension that allows for
20
20
  Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number
21
21
  of formatting issues.
22
22
 
data/Rakefile CHANGED
@@ -4,13 +4,17 @@ require "rspec/core/rake_task"
4
4
  require "hoe"
5
5
  require "rake/clean"
6
6
 
7
+ MAINTENANCE = ENV["MAINTENANCE"] == "true"
8
+ BUILD_DOCS = MAINTENANCE || ENV["DOCS"] == "true"
9
+ TRUSTED_RELEASE = ENV["rubygems_release_gem"] == "true"
10
+
7
11
  Hoe.plugin :halostatue
8
12
  Hoe.plugin :rubygems
9
13
 
10
14
  Hoe.plugins.delete :debug
11
15
  Hoe.plugins.delete :newb
12
- Hoe.plugins.delete :publish
13
16
  Hoe.plugins.delete :signing
17
+ Hoe.plugins.delete :publish unless BUILD_DOCS
14
18
 
15
19
  if RUBY_VERSION < "1.9"
16
20
  class Array # :nodoc:
@@ -37,7 +41,7 @@ end
37
41
  _spec = Hoe.spec "diff-lcs" do
38
42
  developer("Austin Ziegler", "halostatue@gmail.com")
39
43
 
40
- self.trusted_release = ENV["rubygems_release_gem"] == "true"
44
+ self.trusted_release = TRUSTED_RELEASE
41
45
 
42
46
  require_ruby_version ">= 1.8"
43
47
 
@@ -57,12 +61,25 @@ _spec = Hoe.spec "diff-lcs" do
57
61
  extra_dev_deps << ["rdoc", ">= 6.3.1", "< 7"]
58
62
  end
59
63
 
64
+ if BUILD_DOCS
65
+ rake_tasks = Rake.application.instance_variable_get(:@tasks)
66
+ tasks = ["publish_docs", "publish_on_announce", "debug_email", "post_blog", "announce"]
67
+ tasks.each do |task|
68
+ rake_tasks.delete(task)
69
+ end
70
+ end
71
+
60
72
  desc "Run all specifications"
61
73
  RSpec::Core::RakeTask.new(:spec) do |t|
62
74
  rspec_dirs = %w[spec lib].join(":")
63
75
  t.rspec_opts = ["-I#{rspec_dirs}"]
64
76
  end
65
77
 
78
+ task :version do
79
+ require "diff/lcs/version"
80
+ puts Diff::LCS::VERSION
81
+ end
82
+
66
83
  Rake::Task["spec"].actions.uniq! { |a| a.source_location }
67
84
 
68
85
  # standard:disable Style/HashSyntax
@@ -80,20 +97,19 @@ if RUBY_VERSION >= "3.0" && RUBY_ENGINE == "ruby"
80
97
  end
81
98
  end
82
99
 
83
- task :ruby18 do
84
- # standard:disable Layout/HeredocIndentation
85
- puts <<-MESSAGE
86
- You are starting a barebones Ruby 1.8 docker environment. You will need to
87
- do the following:
100
+ if MAINTENANCE
101
+ task ruby18: :package do
102
+ require "diff/lcs/version"
103
+ # standard:disable Layout/HeredocIndentation
104
+ puts <<-MESSAGE
105
+ You are starting a barebones Ruby 1.8 docker environment for testing.
106
+ A snapshot package has been built, so install it with:
88
107
 
89
- - mv Gemfile.lock{,.v2}
90
- - gem install bundler --version 1.17.2 --no-ri --no-rdoc
91
- - ruby -S bundle
92
- - rake
108
+ cd diff-lcs
109
+ gem install pkg/diff-lcs-#{Diff::LCS::VERSION}
93
110
 
94
- Don't forget to restore your Gemfile.lock after testing.
95
-
96
- MESSAGE
97
- # standard:enable Layout/HeredocIndentation
98
- sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
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
99
115
  end
@@ -5,5 +5,9 @@ unless 0.respond_to?(:positive?)
5
5
  def positive?
6
6
  self > 0
7
7
  end
8
+
9
+ def negative?
10
+ self < 0
11
+ end
8
12
  end
9
13
  end
@@ -45,9 +45,9 @@ class Diff::LCS::Change
45
45
  arr = arr.flatten(1)
46
46
  case arr.size
47
47
  when 5
48
- Diff::LCS::ContextChange.new(*(arr[0...5]))
48
+ Diff::LCS::ContextChange.new(*arr[0...5])
49
49
  when 3
50
- Diff::LCS::Change.new(*(arr[0...3]))
50
+ Diff::LCS::Change.new(*arr[0...3])
51
51
  else
52
52
  fail "Invalid change array format provided."
53
53
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "cgi"
3
+ require "erb"
4
4
 
5
5
  # Produce a simple HTML diff view.
6
6
  class Diff::LCS::HTMLDiff
@@ -126,8 +126,8 @@ h1 { margin-left: 2em; }
126
126
  @right.map! { |line| formatter.expand(line.chomp) }
127
127
  end
128
128
 
129
- @left.map! { |line| CGI.escapeHTML(line.chomp) }
130
- @right.map! { |line| CGI.escapeHTML(line.chomp) }
129
+ @left.map! { |line| ERB::Util.html_escape(line.chomp) }
130
+ @right.map! { |line| ERB::Util.html_escape(line.chomp) }
131
131
 
132
132
  # standard:disable Layout/HeredocIndentation
133
133
  @options[:output] << <<-OUTPUT
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Diff
4
4
  module LCS
5
- VERSION = "1.6.1"
5
+ VERSION = "1.6.2"
6
6
  end
7
7
  end
data/lib/diff/lcs.rb CHANGED
@@ -333,7 +333,7 @@ class << Diff::LCS
333
333
  if callbacks.respond_to?(:finished_a) && !run_finished_a
334
334
  ax = string ? seq1[-1, 1] : seq1[-1]
335
335
  bx = string ? seq2[bj, 1] : seq2[bj]
336
- event = Diff::LCS::ContextChange.new(">", (a_size - 1), ax, bj, bx)
336
+ event = Diff::LCS::ContextChange.new(">", a_size - 1, ax, bj, bx)
337
337
  event = yield event if block_given?
338
338
  callbacks.finished_a(event)
339
339
  run_finished_a = true
@@ -355,7 +355,7 @@ class << Diff::LCS
355
355
  if callbacks.respond_to?(:finished_b) && !run_finished_b
356
356
  ax = string ? seq1[ai, 1] : seq1[ai]
357
357
  bx = string ? seq2[-1, 1] : seq2[-1]
358
- event = Diff::LCS::ContextChange.new("<", ai, ax, (b_size - 1), bx)
358
+ event = Diff::LCS::ContextChange.new("<", ai, ax, b_size - 1, bx)
359
359
  event = yield event if block_given?
360
360
  callbacks.finished_b(event)
361
361
  run_finished_b = true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diff-lcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-25 00:00:00.000000000 Z
10
+ date: 2025-05-12 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: hoe
@@ -116,7 +116,7 @@ description: |-
116
116
  McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
117
117
  to create a simple HTML diff output format and a standard diff-like tool.
118
118
 
119
- This is release 1.4.3, providing a simple extension that allows for
119
+ This is release 1.6.1, providing a simple extension that allows for
120
120
  Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number
121
121
  of formatting issues.
122
122