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 CHANGED
@@ -1,3 +1,8 @@
1
+ == 2.0.7 ==
2
+ Added :allow_empty_diff option
3
+
4
+ == Oops, need to backfill changelog ==
5
+
1
6
  == 1.0.1 ==
2
7
  * Compatibility with ruby 1.8.6 and 1.9
3
8
 
@@ -1,3 +1,4 @@
1
1
  * Sam Goldstein
2
2
  * joelash
3
3
  * chaffeqa
4
+ * Lincoln Ritter
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.6
1
+ 2.0.7
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "diffy"
8
- s.version = "2.0.6"
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-03-04"
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 = [
@@ -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.flush
94
+ t.close
95
95
  t.path
96
96
  end
97
97
 
@@ -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.gsub(/^(.)/, '<span class="symbol">\1</span>')
36
+ line.sub(/^(.)/, '<span class="symbol">\1</span>')
37
37
  else
38
- line.gsub(/^./, '')
38
+ line.sub(/^./, '')
39
39
  end.chomp
40
40
  end
41
41
 
@@ -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.6
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-03-04 00:00:00.000000000 Z
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: &70147571059540 !ruby/object:Gem::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: *70147571059540
24
+ version_requirements: *70218594623100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70147571058940 !ruby/object:Gem::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: *70147571058940
35
+ version_requirements: *70218594622520
36
36
  description: Convenient diffing in ruby
37
37
  email: sgrock@gmail.com
38
38
  executables: []