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 +4 -4
- data/lib/build/text/merge.rb +14 -4
- data/lib/build/text/version.rb +1 -1
- data/spec/build/text/merge_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a07b6c0d25cb2997fd69da6e9efbff841605427
|
4
|
+
data.tar.gz: 5ca566c8d0de6367608545fcf572d223380a32d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bddb50ac6a6ba513c1ba00ad8f26546cb07affd152f9c9efbd89bfeed7df16eed85fdd486caed2f66e246f594da68f82fb234d4e47a151658a50b2b8248c76d6
|
7
|
+
data.tar.gz: 2e834e7af0c6cc94a1ff325fd0c0a1c093378d9848d4005ae0637081b19d97e32751feaa9ab2d2206e28edd652e07dbaf24549fe10c916ec9f429b9e1679cd6a
|
data/lib/build/text/merge.rb
CHANGED
@@ -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
|
data/lib/build/text/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|