build-text 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e56e9d24d3f0ec039b6380bb7e921f9ef7713c5
4
- data.tar.gz: fd4360cd52c71b0474f94fb4e4c6d1d6517a637c
3
+ metadata.gz: 6a07b6c0d25cb2997fd69da6e9efbff841605427
4
+ data.tar.gz: 5ca566c8d0de6367608545fcf572d223380a32d4
5
5
  SHA512:
6
- metadata.gz: 887249e37b4e6df5368acbd13c3733997e9095ae3ddb6f8fa58b8604881c2229bce72cae0cd2740f7dcc03d8ef70da42a805fd7f9b3bc6a04687a4c9098f1e59
7
- data.tar.gz: ee42f4d82827b140c98e4a47c2efbd123881c195b0bbb0d1fa84536daa95c681bcb8016c6a9babf0db066397d949971e70fed170439f6fb3d1c6ca34ccce9df0
6
+ metadata.gz: bddb50ac6a6ba513c1ba00ad8f26546cb07affd152f9c9efbd89bfeed7df16eed85fdd486caed2f66e246f594da68f82fb234d4e47a151658a50b2b8248c76d6
7
+ data.tar.gz: 2e834e7af0c6cc94a1ff325fd0c0a1c093378d9848d4005ae0637081b19d97e32751feaa9ab2d2206e28edd652e07dbaf24549fe10c916ec9f429b9e1679cd6a
@@ -32,16 +32,26 @@ module Build
32
32
  while o < old_text.size and n < new_text.size and l < lcs.size
33
33
  if !similar(old_text[o], lcs[l])
34
34
  changes << Difference.new(:old, old_text[o])
35
- o+=1
35
+ o += 1
36
36
  elsif !similar(new_text[n], lcs[l])
37
37
  changes << Difference.new(:new, new_text[n])
38
- n+=1
38
+ n += 1
39
39
  else
40
40
  changes << Difference.new(:both, lcs[l])
41
- o+=1; n+=1; l+=1
41
+ o += 1; n += 1; l += 1
42
42
  end
43
43
  end
44
-
44
+
45
+ while o < old_text.size
46
+ changes << Difference.new(:old, old_text[o])
47
+ o += 1
48
+ end
49
+
50
+ while n < new_text.size
51
+ changes << Difference.new(:old, new_text[n])
52
+ n += 1
53
+ end
54
+
45
55
  changes.map do |change|
46
56
  change.value
47
57
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Build
22
22
  module Text
23
- VERSION = "1.0.0"
23
+ VERSION = "1.0.1"
24
24
  end
25
25
  end
@@ -43,4 +43,11 @@ EOF
43
43
 
44
44
  expect(merged).to be == MERGED.lines
45
45
  end
46
+
47
+ it "can merge last lines" do
48
+ a = ["# Run tests:\n", "script:\n", " - teapot -c test fetch\n"]
49
+ b = [" - teapot -c test fetch\n", " - teapot -c test build Test/UnitTest2\n"]
50
+
51
+ expect(Build::Text::Merge.combine(a, b)).to be == ["# Run tests:\n", "script:\n", " - teapot -c test fetch\n", " - teapot -c test build Test/UnitTest2\n"]
52
+ end
46
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-text
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-06 00:00:00.000000000 Z
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler