diffy 3.0.1 → 3.0.2
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 +4 -4
- data/.gitignore +5 -0
- data/.travis.yml +3 -0
- data/CONTRIBUTORS +1 -0
- data/Gemfile +7 -3
- data/README.md +10 -10
- data/Rakefile +0 -34
- data/diffy.gemspec +19 -56
- data/lib/diffy/diff.rb +1 -1
- data/lib/diffy/html_formatter.rb +1 -1
- data/lib/diffy/version.rb +3 -0
- data/spec/diffy_spec.rb +32 -2
- metadata +27 -27
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b046b2d411fcf289de53a9f8fde302d1d7ab5a5
|
4
|
+
data.tar.gz: d0b6638a247807c18afefef9f8cb9414581b1fc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8266ca734ad349afd9728e12b3d34ac226e6c993bd79bba16481018ec5d03836c9edb8d9f4bc93a845adbfd52c56bab8118259304d57ed37e70399472f5493cf
|
7
|
+
data.tar.gz: 0d3cf9397e5fba6d42fb9f60514a537a1003210695a5dd5eefd5ad15b69f55aa06f027ac5a83400badbf20dd2a8d4b24b92667178a472d4f907999831a5d9ab6
|
data/.travis.yml
CHANGED
data/CONTRIBUTORS
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,7 @@ It provides several built in format options which can be passed to
|
|
14
14
|
|
15
15
|
* `:text` - Plain text output
|
16
16
|
* `:color` - ANSI colorized text suitable for use in a terminal
|
17
|
-
* `:html` - HTML output. Since version 2.0 this format does inline highlighting of the changes between
|
17
|
+
* `:html` - HTML output. Since version 2.0 this format does inline highlighting of the character changes between lines.
|
18
18
|
* `:html_simple` - HTML output without inline highlighting. This may be useful in situations where high performance is required or simpler output is desired.
|
19
19
|
|
20
20
|
A default format can be set like so:
|
@@ -38,14 +38,14 @@ Installation
|
|
38
38
|
1. install unxutils <http://sourceforge.net/projects/unxutils>
|
39
39
|
|
40
40
|
note that these tools contain diff 2.7 which has a different handling
|
41
|
-
of whitespace in the diff results. This makes
|
42
|
-
yielding one fail on
|
41
|
+
of whitespace in the diff results. This makes Diffy spec tests
|
42
|
+
yielding one fail on Windows.
|
43
43
|
|
44
44
|
2. install these two individually from the gnuwin32 project
|
45
45
|
<http://gnuwin32.sourceforge.net/>
|
46
46
|
|
47
|
-
note that this delivers diff 2.8 which makes
|
48
|
-
even on
|
47
|
+
note that this delivers diff 2.8 which makes Diffy spec pass
|
48
|
+
even on Windows.
|
49
49
|
|
50
50
|
|
51
51
|
2. install the gem by
|
@@ -133,7 +133,7 @@ You can diff files instead of strings by using the `:source` option.
|
|
133
133
|
|
134
134
|
### Full Diff Output
|
135
135
|
|
136
|
-
By default
|
136
|
+
By default Diffy removes the superfluous diff output. This is because its
|
137
137
|
default is to show the complete diff'ed file (`diff -U 10000` is the default).
|
138
138
|
|
139
139
|
Diffy does support full output, just use the `:include_diff_info => true`
|
@@ -151,7 +151,7 @@ And even deals a bit with the formatting!
|
|
151
151
|
|
152
152
|
### Empty Diff Behavior
|
153
153
|
|
154
|
-
By default
|
154
|
+
By default Diffy will return empty string if there are no
|
155
155
|
differences in inputs. In previous versions the full text of its first input
|
156
156
|
was returned in this case. To restore this behaviour simply use the
|
157
157
|
`:allow_empty_diff => false` option when initializing.
|
@@ -203,7 +203,7 @@ Default Diff Options
|
|
203
203
|
|
204
204
|
You can set the default options for new `Diffy::Diff`s using the
|
205
205
|
`Diffy::Diff.default_options` and `Diffy::Diff.default_options=` methods.
|
206
|
-
Options passed to Diffy::Diff.new will be merged into the default options.
|
206
|
+
Options passed to `Diffy::Diff.new` will be merged into the default options.
|
207
207
|
|
208
208
|
>> Diffy::Diff.default_options
|
209
209
|
=> {:diff=>"-U 10000", :source=>"strings", :include_diff_info=>false, :include_plus_and_minus_in_html=>false}
|
@@ -215,7 +215,7 @@ Custom Formats
|
|
215
215
|
--------------
|
216
216
|
|
217
217
|
Diffy tries to make generating your own custom formatted output easy.
|
218
|
-
`Diffy::Diff` provides an
|
218
|
+
`Diffy::Diff` provides an enumerable interface which lets you iterate over
|
219
219
|
lines in the diff.
|
220
220
|
|
221
221
|
>> Diffy::Diff.new("foo\nbar\n", "foo\nbar\nbaz\n").each do |line|
|
@@ -239,7 +239,7 @@ Use `#map`, `#inject`, or any of Enumerable's methods. Go crazy.
|
|
239
239
|
Ruby Version Compatibility
|
240
240
|
-------------------------
|
241
241
|
|
242
|
-
Support for Ruby 1.8.6 was dropped
|
242
|
+
Support for Ruby 1.8.6 was dropped beginning at version 2.0 in order to support
|
243
243
|
the chainable enumerators available in 1.8.7 and 1.9.
|
244
244
|
|
245
245
|
If you want to use Diffy and Ruby 1.8.6 then:
|
data/Rakefile
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
begin
|
2
|
-
require 'rdoc/task'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
end
|
6
|
-
require 'rubygems/package_task'
|
7
1
|
require 'rspec/core/rake_task'
|
8
2
|
|
9
3
|
task :default => :spec
|
@@ -12,31 +6,3 @@ desc "Run all specs in spec directory"
|
|
12
6
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
13
7
|
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
14
8
|
end
|
15
|
-
|
16
|
-
Rake::RDocTask.new do |rd|
|
17
|
-
rd.main = "README"
|
18
|
-
rd.rdoc_dir = 'doc'
|
19
|
-
rd.rdoc_files.include("README", "**/*.rb")
|
20
|
-
end
|
21
|
-
|
22
|
-
begin
|
23
|
-
require 'jeweler'
|
24
|
-
Jeweler::Tasks.new do |s|
|
25
|
-
s.name = %q{diffy}
|
26
|
-
|
27
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
28
|
-
s.authors = ["Sam Goldstein"]
|
29
|
-
s.description = %q{Convenient diffing in ruby}
|
30
|
-
s.email = %q{sgrock@gmail.com}
|
31
|
-
s.has_rdoc = true
|
32
|
-
s.homepage = "http://github.com/samg/diffy/tree/master"
|
33
|
-
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
34
|
-
s.require_paths = ["lib"]
|
35
|
-
s.summary = %q{A convenient way to diff string in ruby}
|
36
|
-
s.license = 'MIT'
|
37
|
-
|
38
|
-
end
|
39
|
-
rescue LoadError
|
40
|
-
puts "Jeweler not available."
|
41
|
-
end
|
42
|
-
|
data/diffy.gemspec
CHANGED
@@ -1,60 +1,23 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'diffy/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "diffy"
|
8
|
+
spec.version = Diffy::VERSION
|
9
|
+
spec.authors = ["Sam Goldstein"]
|
10
|
+
spec.email = ["sgrock@gmail.org"]
|
11
|
+
spec.description = "Convenient diffing in ruby"
|
12
|
+
spec.summary = "A convenient way to diff string in ruby"
|
13
|
+
spec.homepage = "http://github.com/samg/diffy"
|
14
|
+
spec.license = "MIT"
|
9
15
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
s.email = "sgrock@gmail.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".rspec",
|
21
|
-
".travis.yml",
|
22
|
-
"CHANGELOG",
|
23
|
-
"CONTRIBUTORS",
|
24
|
-
"Gemfile",
|
25
|
-
"LICENSE",
|
26
|
-
"README.md",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"diffy.gemspec",
|
30
|
-
"lib/diffy.rb",
|
31
|
-
"lib/diffy/css.rb",
|
32
|
-
"lib/diffy/diff.rb",
|
33
|
-
"lib/diffy/format.rb",
|
34
|
-
"lib/diffy/html_formatter.rb",
|
35
|
-
"spec/demo_app.rb",
|
36
|
-
"spec/diffy_spec.rb"
|
37
|
-
]
|
38
|
-
s.homepage = "http://github.com/samg/diffy/tree/master"
|
39
|
-
s.licenses = ["MIT"]
|
40
|
-
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
41
|
-
s.require_paths = ["lib"]
|
42
|
-
s.rubygems_version = "2.0.2"
|
43
|
-
s.summary = "A convenient way to diff string in ruby"
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
44
20
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.0"])
|
50
|
-
s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<rspec>, ["~> 2.0"])
|
53
|
-
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
54
|
-
end
|
55
|
-
else
|
56
|
-
s.add_dependency(%q<rspec>, ["~> 2.0"])
|
57
|
-
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
58
|
-
end
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_development_dependency "rspec", '~> 2.0'
|
59
23
|
end
|
60
|
-
|
data/lib/diffy/diff.rb
CHANGED
@@ -49,7 +49,7 @@ module Diffy
|
|
49
49
|
|
50
50
|
if WINDOWS
|
51
51
|
# don't use open3 on windows
|
52
|
-
cmd = "\"#{diff_bin}\" #{diff_options.join(' ')} #{paths.join(' ')}"
|
52
|
+
cmd = "\"#{diff_bin}\" #{diff_options.join(' ')} #{paths.map{|s| "\"#{s}\""}.join(' ')}"
|
53
53
|
diff = `#{cmd}`
|
54
54
|
else
|
55
55
|
diff = Open3.popen3(diff_bin, *(diff_options + paths)) { |i, o, e| o.read }
|
data/lib/diffy/html_formatter.rb
CHANGED
data/spec/diffy_spec.rb
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'diffy')
|
|
4
4
|
describe Diffy::Diff do
|
5
5
|
|
6
6
|
describe "diffing two files" do
|
7
|
-
def tempfile(string)
|
8
|
-
t = Tempfile.new(
|
7
|
+
def tempfile(string, fn = 'diffy-spec')
|
8
|
+
t = Tempfile.new(fn)
|
9
9
|
# ensure tempfiles aren't unlinked when GC runs by maintaining a
|
10
10
|
# reference to them.
|
11
11
|
@tempfiles ||=[]
|
@@ -27,6 +27,36 @@ describe Diffy::Diff do
|
|
27
27
|
DIFF
|
28
28
|
end
|
29
29
|
|
30
|
+
it "should accept file paths with spaces as arguments" do
|
31
|
+
string1 = "foo\nbar\nbang\n"
|
32
|
+
string2 = "foo\nbang\n"
|
33
|
+
path1, path2 = tempfile(string1, 'path with spaces'), tempfile(string2, 'path with spaces')
|
34
|
+
Diffy::Diff.new(path1, path2, :source => 'files').to_s.should == <<-DIFF
|
35
|
+
foo
|
36
|
+
-bar
|
37
|
+
bang
|
38
|
+
DIFF
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should accept file paths with spaces as arguments on windows" do
|
42
|
+
begin
|
43
|
+
|
44
|
+
orig_verbose, $VERBOSE = $VERBOSE, nil #silence redefine constant warnings
|
45
|
+
orig_windows, Diffy::WINDOWS = Diffy::WINDOWS, true
|
46
|
+
string1 = "foo\nbar\nbang\n"
|
47
|
+
string2 = "foo\nbang\n"
|
48
|
+
path1, path2 = tempfile(string1, 'path with spaces'), tempfile(string2, 'path with spaces')
|
49
|
+
Diffy::Diff.new(path1, path2, :source => 'files').to_s.should == <<-DIFF
|
50
|
+
foo
|
51
|
+
-bar
|
52
|
+
bang
|
53
|
+
DIFF
|
54
|
+
ensure
|
55
|
+
Diffy::WINDOWS, $VERBOSE = orig_windows, orig_verbose
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
30
60
|
describe "with no line different" do
|
31
61
|
before do
|
32
62
|
string1 = "foo\nbar\nbang\n"
|
metadata
CHANGED
@@ -1,92 +1,92 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Goldstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
40
|
+
version: '2.0'
|
41
41
|
description: Convenient diffing in ruby
|
42
|
-
email:
|
42
|
+
email:
|
43
|
+
- sgrock@gmail.org
|
43
44
|
executables: []
|
44
45
|
extensions: []
|
45
|
-
extra_rdoc_files:
|
46
|
-
- LICENSE
|
47
|
-
- README.md
|
46
|
+
extra_rdoc_files: []
|
48
47
|
files:
|
49
|
-
- .
|
50
|
-
- .
|
48
|
+
- ".gitignore"
|
49
|
+
- ".rspec"
|
50
|
+
- ".travis.yml"
|
51
51
|
- CHANGELOG
|
52
52
|
- CONTRIBUTORS
|
53
53
|
- Gemfile
|
54
54
|
- LICENSE
|
55
55
|
- README.md
|
56
56
|
- Rakefile
|
57
|
-
- VERSION
|
58
57
|
- diffy.gemspec
|
59
58
|
- lib/diffy.rb
|
60
59
|
- lib/diffy/css.rb
|
61
60
|
- lib/diffy/diff.rb
|
62
61
|
- lib/diffy/format.rb
|
63
62
|
- lib/diffy/html_formatter.rb
|
63
|
+
- lib/diffy/version.rb
|
64
64
|
- spec/demo_app.rb
|
65
65
|
- spec/diffy_spec.rb
|
66
|
-
homepage: http://github.com/samg/diffy
|
66
|
+
homepage: http://github.com/samg/diffy
|
67
67
|
licenses:
|
68
68
|
- MIT
|
69
69
|
metadata: {}
|
70
70
|
post_install_message:
|
71
|
-
rdoc_options:
|
72
|
-
- --inline-source
|
73
|
-
- --charset=UTF-8
|
71
|
+
rdoc_options: []
|
74
72
|
require_paths:
|
75
73
|
- lib
|
76
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
77
75
|
requirements:
|
78
|
-
- -
|
76
|
+
- - ">="
|
79
77
|
- !ruby/object:Gem::Version
|
80
78
|
version: '0'
|
81
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
80
|
requirements:
|
83
|
-
- -
|
81
|
+
- - ">="
|
84
82
|
- !ruby/object:Gem::Version
|
85
83
|
version: '0'
|
86
84
|
requirements: []
|
87
85
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.0
|
86
|
+
rubygems_version: 2.2.0
|
89
87
|
signing_key:
|
90
88
|
specification_version: 4
|
91
89
|
summary: A convenient way to diff string in ruby
|
92
|
-
test_files:
|
90
|
+
test_files:
|
91
|
+
- spec/demo_app.rb
|
92
|
+
- spec/diffy_spec.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.0.1
|