diff-lcs 1.4.2 → 1.4.3

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: f8c970551b0fef2c712a6dbdc87453ecbd383a6c5b69f0c1e20e7525a9f4d1ef
4
- data.tar.gz: 6a46ef91155a305417163c3e92503b567e47bf69413e697101b613ed8665c016
3
+ metadata.gz: 3aa8c326a9b00349dc45116d256c9424b59dfcc86209c2104c8e37fe3f4f2b7e
4
+ data.tar.gz: c322b671558bfa75c6dd01c000d433b87021bbd8fc66047042f0386366600533
5
5
  SHA512:
6
- metadata.gz: 9612854483a3dc37cab0f7ec561d23c4ff2c4d190c4d526c18ae45de8c42a2b48f4809fc7da78de524703a7424b7bfd128bb6705424ffa8c139d7a8a59eea10f
7
- data.tar.gz: 16586385ffdfd194afd04f1da73ba3b358b7f324f3dfa5c76b8d37e4ffee0eff257ae7c718d85164d02130c9424b04b130521f87dc4d812d9426bbba6806dfd2
6
+ metadata.gz: e4411d9509d05782ae5bd1a0ec75d684de3060a7722858b08075502b1719c52e7bc65931fb913d650b804bc5b0927a894514edeff907b173c1f66464e5a76454
7
+ data.tar.gz: 1a73c4dff58592cbf20a4bbf42493bc9dec4a02b728e6d07f6315cbdb25f1ce43fd39defff7d2799da31c759b4f7f2411e9d0c9be4a72adc4c84a38d28a7d909
data/History.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # History
2
2
 
3
+ ## 1.4.3 / 2020-06-29
4
+
5
+ - Fixed several issues with the 1.4 on Rubies older than 2.0. Some of this was
6
+ providing useful shim functions to Hoe 3.x (which dropped these older
7
+ Rubies a while ago). Specifically:
8
+
9
+ - Removed Array#lazy from a method in Diff::LCS::Hunk.
10
+ - Changed some unit tests to use old-style Symbol-keyed hashes.
11
+ - Changed some unit test helper functions to no longer use keyword
12
+ parameters, but only a trailing options hash.
13
+ - Made the use of `psych` dependent on `RUBY_VERSION >= 1.9`.
14
+
15
+ Resolves [#63][].
16
+
3
17
  ## 1.4.2 / 2020-06-23
4
18
 
5
19
  - Camille Drapier fixed a small issue with RuboCop configuration. [#59][]
@@ -261,3 +275,4 @@
261
275
  [#59]: https://github.com/halostatue/diff-lcs/pull/59
262
276
  [#60]: https://github.com/halostatue/diff-lcs/issues/60
263
277
  [#61]: https://github.com/halostatue/diff-lcs/pull/61
278
+ [#63]: https://github.com/halostatue/diff-lcs/issues/63
@@ -12,14 +12,15 @@ Diff::LCS computes the difference between two Enumerable sequences using the
12
12
  McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
13
13
  to create a simple HTML diff output format and a standard diff-like tool.
14
14
 
15
- This is release 1.4, providing a simple extension that allows for
16
- Diff::LCS::Change objects to be treated implicitly as arrays. Ruby versions
17
- below 2.5 are soft-deprecated.
18
-
19
- This means that older versions are no longer part of the CI test suite. If any
20
- changes have been introduced that break those versions, bug reports and patches
21
- will be accepted, but it will be up to the reporter to verify any fixes prior
22
- to release. A future release will completely break compatibility.
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.
23
24
 
24
25
  == Synopsis
25
26
 
data/Rakefile CHANGED
@@ -6,10 +6,27 @@ require 'hoe'
6
6
 
7
7
  Hoe.plugin :bundler
8
8
  Hoe.plugin :doofus
9
- Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS']
10
9
  Hoe.plugin :gemspec2
11
10
  Hoe.plugin :git
12
- Hoe.plugin :travis
11
+
12
+ if RUBY_VERSION < '1.9'
13
+ class Array
14
+ def to_h
15
+ Hash[*self.flatten(1)]
16
+ end
17
+ end
18
+
19
+ class Gem::Specification
20
+ def metadata=(*)
21
+ end
22
+ end
23
+
24
+ class Object
25
+ def caller_locations(*)
26
+ []
27
+ end
28
+ end
29
+ end
13
30
 
14
31
  _spec = Hoe.spec 'diff-lcs' do
15
32
  developer('Austin Ziegler', 'halostatue@gmail.com')
@@ -49,7 +49,7 @@ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
49
49
  # a x b y c z p d q
50
50
  # a b c a x b y c z
51
51
  module Diff::LCS
52
- VERSION = '1.4.2'
52
+ VERSION = '1.4.3'
53
53
  end
54
54
 
55
55
  require 'diff/lcs/callbacks'
@@ -20,7 +20,7 @@ class Diff::LCS::Hunk
20
20
  before = after = file_length_difference
21
21
  after += @blocks[0].diff_size
22
22
  @file_length_difference = after # The caller must get this manually
23
- @max_diff_size = @blocks.lazy.map { |e| e.diff_size }.max
23
+ @max_diff_size = @blocks.map { |e| e.diff_size }.max
24
24
 
25
25
  # Save the start & end of each array. If the array doesn't exist (e.g.,
26
26
  # we're only adding items in this block), then figure out the line
@@ -10,10 +10,10 @@ RSpec.describe 'bin/ldiff' do
10
10
  let(:output_diff_e) { read_fixture('-e') }
11
11
  let(:output_diff_f) { read_fixture('-f') }
12
12
  let(:output_diff_u) { read_fixture('-u') }
13
- let(:output_diff_chef) { read_fixture('-u', base: 'output.diff.chef') }
13
+ let(:output_diff_chef) { read_fixture('-u', :base => 'output.diff.chef') }
14
14
 
15
15
  specify do
16
- expect(run_ldiff('-u', left: 'old-chef', right: 'new-chef')).to eq(output_diff_chef)
16
+ expect(run_ldiff('-u', :left => 'old-chef', :right => 'new-chef')).to eq(output_diff_chef)
17
17
  end
18
18
 
19
19
  specify do
@@ -36,8 +36,11 @@ RSpec.describe 'bin/ldiff' do
36
36
  expect(run_ldiff('-u')).to eq(output_diff_u)
37
37
  end
38
38
 
39
- def read_fixture(flag = nil, base: 'output.diff')
40
- clean_data(IO.binread("spec/fixtures/ldiff/#{base}#{flag}"), flag)
39
+ def read_fixture(flag = nil, options = {})
40
+ base = options.fetch(:base, 'output.diff')
41
+ name = "spec/fixtures/ldiff/#{base}#{flag}"
42
+ data = IO.__send__(IO.respond_to?(:binread) ? :binread : :read, name)
43
+ clean_data(data, flag)
41
44
  end
42
45
 
43
46
  def clean_data(data, flag)
@@ -69,11 +72,14 @@ RSpec.describe 'bin/ldiff' do
69
72
  )
70
73
  end
71
74
 
72
- def run_ldiff(flag = nil, left: 'aX', right: 'bXaX')
75
+ def run_ldiff(flag = nil, options = {})
76
+ left = options.fetch(:left, 'aX')
77
+ right = options.fetch(:right, 'bXaX')
73
78
  stdout, stderr = capture_subprocess_io do
74
79
  system("ruby -Ilib bin/ldiff #{flag} spec/fixtures/#{left} spec/fixtures/#{right}")
75
80
  end
76
- expect(stderr).to be_empty
81
+
82
+ expect(stderr).to be_empty if RUBY_VERSION >= '1.9'
77
83
  expect(stdout).not_to be_empty
78
84
  clean_data(stdout, flag)
79
85
  end
@@ -2,7 +2,9 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'pathname'
5
- require 'psych'
5
+
6
+ require 'psych' if RUBY_VERSION >= '1.9'
7
+
6
8
 
7
9
  if ENV['COVERAGE']
8
10
  require 'simplecov'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diff-lcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-24 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hoe-doofus
@@ -139,14 +139,15 @@ description: |-
139
139
  McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
140
140
  to create a simple HTML diff output format and a standard diff-like tool.
141
141
 
142
- This is release 1.4, providing a simple extension that allows for
143
- Diff::LCS::Change objects to be treated implicitly as arrays. Ruby versions
144
- below 2.5 are soft-deprecated.
142
+ This is release 1.4.3, providing a simple extension that allows for
143
+ Diff::LCS::Change objects to be treated implicitly as arrays and fixes a
144
+ number of formatting issues.
145
145
 
146
- This means that older versions are no longer part of the CI test suite. If any
147
- changes have been introduced that break those versions, bug reports and patches
148
- will be accepted, but it will be up to the reporter to verify any fixes prior
149
- to release. A future release will completely break compatibility.
146
+ Ruby versions below 2.5 are soft-deprecated, which means that older versions
147
+ are no longer part of the CI test suite. If any changes have been introduced
148
+ that break those versions, bug reports and patches will be accepted, but it
149
+ will be up to the reporter to verify any fixes prior to release. The next
150
+ major release will completely break compatibility.
150
151
  email:
151
152
  - halostatue@gmail.com
152
153
  executables: