diffy 2.0.6 → 2.0.7
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.
- data/CHANGELOG +5 -0
- data/CONTRIBUTORS +1 -0
- data/README.md +7 -0
- data/VERSION +1 -1
- data/diffy.gemspec +2 -2
- data/lib/diffy/diff.rb +2 -2
- data/lib/diffy/html_formatter.rb +2 -2
- data/spec/diffy_spec.rb +4 -0
- metadata +6 -6
data/CHANGELOG
CHANGED
data/CONTRIBUTORS
CHANGED
data/README.md
CHANGED
@@ -119,6 +119,13 @@ option when initializing:
|
|
119
119
|
|
120
120
|
And even deals a bit with the formatting!
|
121
121
|
|
122
|
+
### Empty Diff Behavior
|
123
|
+
|
124
|
+
By default diffy will return the full text of its first input if there are no
|
125
|
+
differences with the second input. Sometimes it's useful to return the actual
|
126
|
+
diff, the empty string, in this case. To enable this behavior, simply use the
|
127
|
+
`:allow_empty_diff => true` option when initializing.
|
128
|
+
|
122
129
|
### Plus and Minus symbols in HTML output
|
123
130
|
|
124
131
|
By default Diffy doesn't include the `+`, `-`, and ` ` at the beginning of line for
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.7
|
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 = "2.0.
|
8
|
+
s.version = "2.0.7"
|
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 = "2012-
|
12
|
+
s.date = "2012-05-31"
|
13
13
|
s.description = "Convenient diffing in ruby"
|
14
14
|
s.email = "sgrock@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/diffy/diff.rb
CHANGED
@@ -46,7 +46,7 @@ module Diffy
|
|
46
46
|
end
|
47
47
|
diff_opts = options[:diff].is_a?(Array) ? options[:diff] : [options[:diff]]
|
48
48
|
diff = Open3.popen3(diff_bin, *(diff_opts + paths)) { |i, o, e| o.read }
|
49
|
-
if diff =~ /\A\s*\Z/
|
49
|
+
if diff =~ /\A\s*\Z/ && !options[:allow_empty_diff]
|
50
50
|
diff = case options[:source]
|
51
51
|
when 'strings' then string1
|
52
52
|
when 'files' then File.read(string1)
|
@@ -91,7 +91,7 @@ module Diffy
|
|
91
91
|
def tempfile(string)
|
92
92
|
t = Tempfile.new('diffy')
|
93
93
|
t.print(string)
|
94
|
-
t.
|
94
|
+
t.close
|
95
95
|
t.path
|
96
96
|
end
|
97
97
|
|
data/lib/diffy/html_formatter.rb
CHANGED
@@ -33,9 +33,9 @@ module Diffy
|
|
33
33
|
# remove +/- or wrap in html
|
34
34
|
def clean_line(line)
|
35
35
|
if @options[:include_plus_and_minus_in_html]
|
36
|
-
line.
|
36
|
+
line.sub(/^(.)/, '<span class="symbol">\1</span>')
|
37
37
|
else
|
38
|
-
line.
|
38
|
+
line.sub(/^./, '')
|
39
39
|
end.chomp
|
40
40
|
end
|
41
41
|
|
data/spec/diffy_spec.rb
CHANGED
@@ -36,6 +36,10 @@ describe Diffy::Diff do
|
|
36
36
|
bang
|
37
37
|
DIFF
|
38
38
|
end
|
39
|
+
|
40
|
+
it "should not show everything if the :allow_empty_diff option is set" do
|
41
|
+
Diffy::Diff.new(@path1, @path2, :source => 'files', :allow_empty_diff => true).to_s.should == ''
|
42
|
+
end
|
39
43
|
end
|
40
44
|
describe "with lines that start with backslashes" do
|
41
45
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70218594623100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70218594623100
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70218594622520 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.9.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70218594622520
|
36
36
|
description: Convenient diffing in ruby
|
37
37
|
email: sgrock@gmail.com
|
38
38
|
executables: []
|