diffy 2.1.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of diffy might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.travis.yml +1 -0
- data/CHANGELOG +2 -0
- data/CONTRIBUTORS +2 -0
- data/README.md +4 -4
- data/VERSION +1 -1
- data/diffy.gemspec +4 -4
- data/lib/diffy/diff.rb +2 -1
- data/lib/diffy/html_formatter.rb +18 -9
- data/spec/diffy_spec.rb +7 -4
- metadata +7 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 76ce8cec51c77bf0432c2d9a953bfdd181b1ceea
|
4
|
+
data.tar.gz: 47d22a7082256b6f54ac767c4d8611e2e52519ee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e081b4c0c64904d11d4fb20aea33476b2181f4e4123bce3dd739a217b812da09add950fefeedd3f52177a540c1999d845c7a1610389481408f21d6faa5f6d3f6
|
7
|
+
data.tar.gz: 06870ff6c73584776b531591418cae5fd5d8890912c6062f7e03a9ed2ac66c06fde3fa01f6aba4d75ad0167c62c14a1c3aec85caefa20deece3a174a09a75a24
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
data/CONTRIBUTORS
CHANGED
data/README.md
CHANGED
@@ -151,10 +151,10 @@ And even deals a bit with the formatting!
|
|
151
151
|
|
152
152
|
### Empty Diff Behavior
|
153
153
|
|
154
|
-
By default diffy will return
|
155
|
-
differences
|
156
|
-
|
157
|
-
`:allow_empty_diff =>
|
154
|
+
By default diffy will return empty string if there are no
|
155
|
+
differences in inputs. In previous versions the full text of its first input
|
156
|
+
was returned in this case. To restore this behaviour simply use the
|
157
|
+
`:allow_empty_diff => false` option when initializing.
|
158
158
|
|
159
159
|
### Plus and Minus symbols in HTML output
|
160
160
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/diffy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "diffy"
|
8
|
-
s.version = "
|
8
|
+
s.version = "3.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sam Goldstein"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-07-15"
|
13
13
|
s.description = "Convenient diffing in ruby"
|
14
14
|
s.email = "sgrock@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,11 +38,11 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.homepage = "http://github.com/samg/diffy/tree/master"
|
39
39
|
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
40
40
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = "
|
41
|
+
s.rubygems_version = "2.0.2"
|
42
42
|
s.summary = "A convenient way to diff string in ruby"
|
43
43
|
|
44
44
|
if s.respond_to? :specification_version then
|
45
|
-
s.specification_version =
|
45
|
+
s.specification_version = 4
|
46
46
|
|
47
47
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
48
|
s.add_development_dependency(%q<rspec>, ["~> 2.0"])
|
data/lib/diffy/diff.rb
CHANGED
data/lib/diffy/html_formatter.rb
CHANGED
@@ -40,7 +40,11 @@ module Diffy
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def wrap_lines(lines)
|
43
|
-
|
43
|
+
if lines.empty?
|
44
|
+
%'<div class="diff"/>'
|
45
|
+
else
|
46
|
+
%'<div class="diff">\n <ul>\n#{lines.join("\n")}\n </ul>\n</div>\n'
|
47
|
+
end
|
44
48
|
end
|
45
49
|
|
46
50
|
def highlighted_words
|
@@ -61,14 +65,19 @@ module Diffy
|
|
61
65
|
dir2 = chunk2.each_char.first
|
62
66
|
case [dir1, dir2]
|
63
67
|
when ['-', '+']
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
if chunk1.each_char.take(3).join("") =~ /^(---|\+\+\+|\\\\)/ and
|
69
|
+
chunk2.each_char.take(3).join("") =~ /^(---|\+\+\+|\\\\)/
|
70
|
+
ERB::Util.h(chunk1)
|
71
|
+
else
|
72
|
+
line_diff = Diffy::Diff.new(
|
73
|
+
split_characters(chunk1),
|
74
|
+
split_characters(chunk2)
|
75
|
+
)
|
76
|
+
hi1 = reconstruct_characters(line_diff, '-')
|
77
|
+
hi2 = reconstruct_characters(line_diff, '+')
|
78
|
+
processed << (index + 1)
|
79
|
+
[hi1, hi2]
|
80
|
+
end
|
72
81
|
else
|
73
82
|
ERB::Util.h(chunk1)
|
74
83
|
end
|
data/spec/diffy_spec.rb
CHANGED
@@ -35,7 +35,8 @@ describe Diffy::Diff do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should show everything" do
|
38
|
-
Diffy::Diff.new(@path1, @path2, :source => 'files').
|
38
|
+
Diffy::Diff.new(@path1, @path2, :source => 'files', :allow_empty_diff => false).
|
39
|
+
to_s.should == <<-DIFF
|
39
40
|
foo
|
40
41
|
bar
|
41
42
|
bang
|
@@ -70,10 +71,12 @@ describe Diffy::Diff do
|
|
70
71
|
@path1, @path2 = tempfile(string1), tempfile(string2)
|
71
72
|
end
|
72
73
|
it "should not raise invalid encoding issues" do
|
73
|
-
|
74
|
+
desired = <<-DIFF
|
74
75
|
-Foo ICS95095010000000000083320000BS01030000004100+\xFF00000000000000000
|
75
76
|
+Bar ICS95095010000000000083320000BS01030000004100+\xFF00000000000000000
|
76
77
|
DIFF
|
78
|
+
desired.force_encoding("ASCII-8BIT") if desired.respond_to?(:force_encoding)
|
79
|
+
Diffy::Diff.new(@path1, @path2, :source => 'files').to_s.should == desired
|
77
80
|
end
|
78
81
|
end
|
79
82
|
|
@@ -173,7 +176,7 @@ describe Diffy::Diff do
|
|
173
176
|
|
174
177
|
describe "options[:diff]" do
|
175
178
|
it "should accept an option to diff" do
|
176
|
-
@diff = Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "-w")
|
179
|
+
@diff = Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "-w", :allow_empty_diff => false)
|
177
180
|
@diff.to_s.should == <<-DIFF
|
178
181
|
foo
|
179
182
|
bar
|
@@ -198,7 +201,7 @@ describe Diffy::Diff do
|
|
198
201
|
end
|
199
202
|
|
200
203
|
it "should show everything" do
|
201
|
-
Diffy::Diff.new(@string1, @string2).to_s.should == <<-DIFF
|
204
|
+
Diffy::Diff.new(@string1, @string2, :allow_empty_diff => false).to_s.should == <<-DIFF
|
202
205
|
foo
|
203
206
|
bar
|
204
207
|
bang
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sam Goldstein
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -70,6 +65,7 @@ files:
|
|
70
65
|
- spec/diffy_spec.rb
|
71
66
|
homepage: http://github.com/samg/diffy/tree/master
|
72
67
|
licenses: []
|
68
|
+
metadata: {}
|
73
69
|
post_install_message:
|
74
70
|
rdoc_options:
|
75
71
|
- --inline-source
|
@@ -77,21 +73,19 @@ rdoc_options:
|
|
77
73
|
require_paths:
|
78
74
|
- lib
|
79
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
76
|
requirements:
|
82
|
-
- -
|
77
|
+
- - '>='
|
83
78
|
- !ruby/object:Gem::Version
|
84
79
|
version: '0'
|
85
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
81
|
requirements:
|
88
|
-
- -
|
82
|
+
- - '>='
|
89
83
|
- !ruby/object:Gem::Version
|
90
84
|
version: '0'
|
91
85
|
requirements: []
|
92
86
|
rubyforge_project:
|
93
|
-
rubygems_version:
|
87
|
+
rubygems_version: 2.0.2
|
94
88
|
signing_key:
|
95
|
-
specification_version:
|
89
|
+
specification_version: 4
|
96
90
|
summary: A convenient way to diff string in ruby
|
97
91
|
test_files: []
|