diffy 2.0.10 → 2.1.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.
- data/CHANGELOG +3 -0
- data/CONTRIBUTORS +1 -0
- data/README.md +43 -5
- data/Rakefile +5 -1
- data/VERSION +1 -1
- data/diffy.gemspec +3 -2
- data/lib/diffy.rb +0 -1
- data/lib/diffy/diff.rb +7 -2
- data/spec/diffy_spec.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/CONTRIBUTORS
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Diffy - Easy Diffing With Ruby
|
1
|
+
Diffy - Easy Diffing With Ruby [![Build Status](https://secure.travis-ci.org/samg/diffy.png)](http://travis-ci.org/samg/diffy)
|
2
2
|
============================
|
3
3
|
|
4
4
|
Need diffs in your ruby app? Diffy has you covered. It provides a convenient
|
@@ -21,11 +21,41 @@ A default format can be set like so:
|
|
21
21
|
|
22
22
|
Diffy::Diff.default_format = :html
|
23
23
|
|
24
|
+
Installation
|
25
|
+
------------
|
26
|
+
|
27
|
+
###on Unix
|
28
|
+
|
29
|
+
gem install diffy
|
30
|
+
|
31
|
+
###on Windows:
|
32
|
+
|
33
|
+
1. ensure that you have a working `which` and `diff` on your machine and on
|
34
|
+
your search path.
|
35
|
+
|
36
|
+
There are two options:
|
37
|
+
|
38
|
+
1. install unxutils <http://sourceforge.net/projects/unxutils>
|
39
|
+
|
40
|
+
note that these tools contain diff 2.7 which has a different handling
|
41
|
+
of whitespace in the diff results. This makes diffy spec tests
|
42
|
+
yielding one fail on windows.
|
43
|
+
|
44
|
+
2. install these two individually from the gnuwin32 project
|
45
|
+
<http://gnuwin32.sourceforge.net/>
|
46
|
+
|
47
|
+
note that this delivers diff 2.8 which makes diffy spec pass
|
48
|
+
even on windows.
|
49
|
+
|
50
|
+
|
51
|
+
2. install the gem by
|
52
|
+
|
53
|
+
gem install diffy
|
54
|
+
|
55
|
+
|
24
56
|
Getting Started
|
25
57
|
---------------
|
26
58
|
|
27
|
-
sudo gem install diffy
|
28
|
-
|
29
59
|
Here's an example of using Diffy to diff two strings
|
30
60
|
|
31
61
|
$ irb
|
@@ -121,8 +151,8 @@ And even deals a bit with the formatting!
|
|
121
151
|
|
122
152
|
### Empty Diff Behavior
|
123
153
|
|
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
|
154
|
+
By default diffy will return the full text of its first input if there are no
|
155
|
+
differences with the second input. Sometimes it's useful to return the actual
|
126
156
|
diff, the empty string, in this case. To enable this behavior, simply use the
|
127
157
|
`:allow_empty_diff => true` option when initializing.
|
128
158
|
|
@@ -203,6 +233,14 @@ If you want to use Diffy and Ruby 1.8.6 then:
|
|
203
233
|
|
204
234
|
$ gem install diffy -v1.1.0
|
205
235
|
|
236
|
+
Testing
|
237
|
+
------------
|
238
|
+
|
239
|
+
Diffy includes a full set of rspec tests. When contributing please include
|
240
|
+
tests for your changes.
|
241
|
+
|
242
|
+
[![Build Status](https://secure.travis-ci.org/samg/diffy.png)](http://travis-ci.org/samg/diffy)
|
243
|
+
|
206
244
|
---------------------------------------------------------------------
|
207
245
|
|
208
246
|
Report bugs or request features at http://github.com/samg/diffy/issues
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0
|
1
|
+
2.1.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 = "2.0
|
8
|
+
s.version = "2.1.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 = "2012-
|
12
|
+
s.date = "2012-11-06"
|
13
13
|
s.description = "Convenient diffing in ruby"
|
14
14
|
s.email = "sgrock@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".rspec",
|
21
|
+
".travis.yml",
|
21
22
|
"CHANGELOG",
|
22
23
|
"CONTRIBUTORS",
|
23
24
|
"Gemfile",
|
data/lib/diffy.rb
CHANGED
data/lib/diffy/diff.rb
CHANGED
@@ -45,7 +45,8 @@ module Diffy
|
|
45
45
|
[string1, string2]
|
46
46
|
end
|
47
47
|
diff_opts = options[:diff].is_a?(Array) ? options[:diff] : [options[:diff]]
|
48
|
-
|
48
|
+
cmd = "#{diff_bin} #{diff_opts.join(' ')} #{paths.join(' ')}"
|
49
|
+
diff = `#{cmd}`
|
49
50
|
diff.force_encoding('ASCII-8BIT') if diff.respond_to?(:valid_encoding?) && !diff.valid_encoding?
|
50
51
|
if diff =~ /\A\s*\Z/ && !options[:allow_empty_diff]
|
51
52
|
diff = case options[:source]
|
@@ -116,7 +117,11 @@ module Diffy
|
|
116
117
|
private
|
117
118
|
|
118
119
|
def diff_bin
|
119
|
-
@@bin ||=
|
120
|
+
@@bin ||=""
|
121
|
+
|
122
|
+
@@bin = `which diff.exe`.chomp if @@bin.empty?
|
123
|
+
@@bin = `which diff`.chomp if @@bin.empty?
|
124
|
+
|
120
125
|
if @@bin.empty?
|
121
126
|
raise "Can't find a diff executable in PATH #{ENV['PATH']}"
|
122
127
|
end
|
data/spec/diffy_spec.rb
CHANGED
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.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|