diffy 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of diffy might be problematic. Click here for more details.
- data/Gemfile +4 -0
 - data/Rakefile +1 -2
 - data/VERSION +1 -1
 - data/diffy.gemspec +20 -21
 - data/lib/diffy/html_formatter.rb +2 -4
 - data/spec/diffy_spec.rb +16 -1
 - metadata +25 -11
 - data/.gitignore +0 -2
 
    
        data/Gemfile
    ADDED
    
    
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -23,7 +23,6 @@ begin 
     | 
|
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       25 
25 
     | 
    
         
             
                s.authors = ["Sam Goldstein"]
         
     | 
| 
       26 
     | 
    
         
            -
                s.date = %q{2010-06-28}
         
     | 
| 
       27 
26 
     | 
    
         
             
                s.description = %q{Convenient diffing in ruby}
         
     | 
| 
       28 
27 
     | 
    
         
             
                s.email = %q{sgrock@gmail.com}
         
     | 
| 
       29 
28 
     | 
    
         
             
                s.has_rdoc = true
         
     | 
| 
         @@ -34,6 +33,6 @@ begin 
     | 
|
| 
       34 
33 
     | 
    
         | 
| 
       35 
34 
     | 
    
         
             
              end
         
     | 
| 
       36 
35 
     | 
    
         
             
            rescue LoadError
         
     | 
| 
       37 
     | 
    
         
            -
              puts "Jeweler not available. 
     | 
| 
      
 36 
     | 
    
         
            +
              puts "Jeweler not available."
         
     | 
| 
       38 
37 
     | 
    
         
             
            end
         
     | 
| 
       39 
38 
     | 
    
         | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            2.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            2.0.2
         
     | 
    
        data/diffy.gemspec
    CHANGED
    
    | 
         @@ -1,52 +1,51 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Generated by jeweler
         
     | 
| 
       2 
2 
     | 
    
         
             
            # DO NOT EDIT THIS FILE DIRECTLY
         
     | 
| 
       3 
     | 
    
         
            -
            # Instead, edit Jeweler::Tasks in Rakefile, and run  
     | 
| 
      
 3 
     | 
    
         
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         
     | 
| 
       4 
4 
     | 
    
         
             
            # -*- encoding: utf-8 -*-
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{diffy}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "2.0. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "2.0.2"
         
     | 
| 
       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 = %q{ 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2011-06-20}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{Convenient diffing in ruby}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = %q{sgrock@gmail.com}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
       16 
16 
     | 
    
         
             
                "LICENSE",
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                "README.md"
         
     | 
| 
       18 
18 
     | 
    
         
             
              ]
         
     | 
| 
       19 
19 
     | 
    
         
             
              s.files = [
         
     | 
| 
       20 
     | 
    
         
            -
                " 
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
                "CHANGELOG",
         
     | 
| 
      
 21 
     | 
    
         
            +
                "Gemfile",
         
     | 
| 
      
 22 
     | 
    
         
            +
                "LICENSE",
         
     | 
| 
      
 23 
     | 
    
         
            +
                "README.md",
         
     | 
| 
      
 24 
     | 
    
         
            +
                "Rakefile",
         
     | 
| 
      
 25 
     | 
    
         
            +
                "VERSION",
         
     | 
| 
      
 26 
     | 
    
         
            +
                "diffy.gemspec",
         
     | 
| 
      
 27 
     | 
    
         
            +
                "lib/diffy.rb",
         
     | 
| 
      
 28 
     | 
    
         
            +
                "lib/diffy/diff.rb",
         
     | 
| 
      
 29 
     | 
    
         
            +
                "lib/diffy/format.rb",
         
     | 
| 
      
 30 
     | 
    
         
            +
                "lib/diffy/html_formatter.rb",
         
     | 
| 
      
 31 
     | 
    
         
            +
                "spec/diffy_spec.rb"
         
     | 
| 
       32 
32 
     | 
    
         
             
              ]
         
     | 
| 
       33 
33 
     | 
    
         
             
              s.homepage = %q{http://github.com/samg/diffy/tree/master}
         
     | 
| 
       34 
34 
     | 
    
         
             
              s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
         
     | 
| 
       35 
35 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
       36 
     | 
    
         
            -
              s.rubygems_version = %q{1.3 
     | 
| 
      
 36 
     | 
    
         
            +
              s.rubygems_version = %q{1.5.3}
         
     | 
| 
       37 
37 
     | 
    
         
             
              s.summary = %q{A convenient way to diff string in ruby}
         
     | 
| 
       38 
     | 
    
         
            -
              s.test_files = [
         
     | 
| 
       39 
     | 
    
         
            -
                "spec/diffy_spec.rb"
         
     | 
| 
       40 
     | 
    
         
            -
              ]
         
     | 
| 
       41 
38 
     | 
    
         | 
| 
       42 
39 
     | 
    
         
             
              if s.respond_to? :specification_version then
         
     | 
| 
       43 
     | 
    
         
            -
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         
     | 
| 
       44 
40 
     | 
    
         
             
                s.specification_version = 3
         
     | 
| 
       45 
41 
     | 
    
         | 
| 
       46 
42 
     | 
    
         
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         
     | 
| 
      
 43 
     | 
    
         
            +
                  s.add_development_dependency(%q<rspec>, ["~> 2.0"])
         
     | 
| 
       47 
44 
     | 
    
         
             
                else
         
     | 
| 
      
 45 
     | 
    
         
            +
                  s.add_dependency(%q<rspec>, ["~> 2.0"])
         
     | 
| 
       48 
46 
     | 
    
         
             
                end
         
     | 
| 
       49 
47 
     | 
    
         
             
              else
         
     | 
| 
      
 48 
     | 
    
         
            +
                s.add_dependency(%q<rspec>, ["~> 2.0"])
         
     | 
| 
       50 
49 
     | 
    
         
             
              end
         
     | 
| 
       51 
50 
     | 
    
         
             
            end
         
     | 
| 
       52 
51 
     | 
    
         | 
    
        data/lib/diffy/html_formatter.rb
    CHANGED
    
    | 
         @@ -41,8 +41,6 @@ module Diffy 
     | 
|
| 
       41 
41 
     | 
    
         
             
                    if not chunk2
         
     | 
| 
       42 
42 
     | 
    
         
             
                      next ERB::Util.h(chunk1)
         
     | 
| 
       43 
43 
     | 
    
         
             
                    end
         
     | 
| 
       44 
     | 
    
         
            -
                    chunk1 = ERB::Util.h(chunk1)
         
     | 
| 
       45 
     | 
    
         
            -
                    chunk2 = ERB::Util.h(chunk2)
         
     | 
| 
       46 
44 
     | 
    
         | 
| 
       47 
45 
     | 
    
         
             
                    dir1 = chunk1.each_char.first
         
     | 
| 
       48 
46 
     | 
    
         
             
                    dir2 = chunk2.each_char.first
         
     | 
| 
         @@ -57,7 +55,7 @@ module Diffy 
     | 
|
| 
       57 
55 
     | 
    
         
             
                      processed << (index + 1)
         
     | 
| 
       58 
56 
     | 
    
         
             
                      [hi1, hi2]
         
     | 
| 
       59 
57 
     | 
    
         
             
                    else
         
     | 
| 
       60 
     | 
    
         
            -
                      chunk1
         
     | 
| 
      
 58 
     | 
    
         
            +
                      ERB::Util.h(chunk1)
         
     | 
| 
       61 
59 
     | 
    
         
             
                    end
         
     | 
| 
       62 
60 
     | 
    
         
             
                  end.flatten
         
     | 
| 
       63 
61 
     | 
    
         
             
                  lines.map{|line| line.each_line.map(&:chomp).to_a if line }.flatten.compact.
         
     | 
| 
         @@ -66,7 +64,7 @@ module Diffy 
     | 
|
| 
       66 
64 
     | 
    
         | 
| 
       67 
65 
     | 
    
         
             
                def split_characters(chunk)
         
     | 
| 
       68 
66 
     | 
    
         
             
                  chunk.gsub(/^./, '').each_line.map do |line|
         
     | 
| 
       69 
     | 
    
         
            -
                    line.chomp.split('') + ['\n']
         
     | 
| 
      
 67 
     | 
    
         
            +
                    (line.chomp.split('') + ['\n']).map{|chr| ERB::Util.h(chr) }
         
     | 
| 
       70 
68 
     | 
    
         
             
                  end.flatten.join("\n") + "\n"
         
     | 
| 
       71 
69 
     | 
    
         
             
                end
         
     | 
| 
       72 
70 
     | 
    
         | 
    
        data/spec/diffy_spec.rb
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require ' 
     | 
| 
      
 1 
     | 
    
         
            +
            require 'rspec'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'diffy'))
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            describe Diffy::Diff do
         
     | 
| 
         @@ -245,6 +245,21 @@ baz 
     | 
|
| 
       245 
245 
     | 
    
         
             
                    @diff.to_s(:html).should ==  html
         
     | 
| 
       246 
246 
     | 
    
         
             
                  end
         
     | 
| 
       247 
247 
     | 
    
         | 
| 
      
 248 
     | 
    
         
            +
                  it "should not double escape html in wierd edge cases" do
         
     | 
| 
      
 249 
     | 
    
         
            +
                    @string1 = "preface = (! title .)+ title &{YYACCEPT}\n"
         
     | 
| 
      
 250 
     | 
    
         
            +
                    @string2 = "preface = << (! title .)+ title >> &{YYACCEPT}\n"
         
     | 
| 
      
 251 
     | 
    
         
            +
                    @diff = Diffy::Diff.new @string1, @string2
         
     | 
| 
      
 252 
     | 
    
         
            +
                    html = <<-HTML
         
     | 
| 
      
 253 
     | 
    
         
            +
            <div class="diff">
         
     | 
| 
      
 254 
     | 
    
         
            +
              <ul>
         
     | 
| 
      
 255 
     | 
    
         
            +
                <li class="del"><del>preface = (! title .)+ title &{YYACCEPT}</del></li>
         
     | 
| 
      
 256 
     | 
    
         
            +
                <li class="ins"><ins>preface = <strong><< </strong>(! title .)+ title <strong>>> </strong>&{YYACCEPT}</ins></li>
         
     | 
| 
      
 257 
     | 
    
         
            +
              </ul>
         
     | 
| 
      
 258 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 259 
     | 
    
         
            +
                    HTML
         
     | 
| 
      
 260 
     | 
    
         
            +
                    @diff.to_s(:html).should ==  html
         
     | 
| 
      
 261 
     | 
    
         
            +
                  end
         
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
       248 
263 
     | 
    
         
             
                  it "should highlight the changes within the line with windows style line breaks" do
         
     | 
| 
       249 
264 
     | 
    
         
             
                    @string1 = "hahaha\r\ntime flies like an arrow\r\nfoo bar\r\nbang baz\n"
         
     | 
| 
       250 
265 
     | 
    
         
             
                    @string2 = "hahaha\r\nfruit flies like a banana\r\nbang baz\n"
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: diffy
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
       5 
     | 
    
         
            -
              prerelease:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 11
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 2
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 2
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 2.0.2
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Sam Goldstein
         
     | 
| 
         @@ -15,10 +15,24 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date:  
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2011-06-20 00:00:00 -07:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
     | 
    
         
            -
            dependencies:  
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 21 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 22 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 23 
     | 
    
         
            +
              version_requirements: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 24 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 25 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 26 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 27 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 28 
     | 
    
         
            +
                    hash: 3
         
     | 
| 
      
 29 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 30 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 31 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 32 
     | 
    
         
            +
                    version: "2.0"
         
     | 
| 
      
 33 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              requirement: *id001
         
     | 
| 
       22 
36 
     | 
    
         
             
            description: Convenient diffing in ruby
         
     | 
| 
       23 
37 
     | 
    
         
             
            email: sgrock@gmail.com
         
     | 
| 
       24 
38 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -29,8 +43,8 @@ extra_rdoc_files: 
     | 
|
| 
       29 
43 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       30 
44 
     | 
    
         
             
            - README.md
         
     | 
| 
       31 
45 
     | 
    
         
             
            files: 
         
     | 
| 
       32 
     | 
    
         
            -
            - .gitignore
         
     | 
| 
       33 
46 
     | 
    
         
             
            - CHANGELOG
         
     | 
| 
      
 47 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
       34 
48 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       35 
49 
     | 
    
         
             
            - README.md
         
     | 
| 
       36 
50 
     | 
    
         
             
            - Rakefile
         
     | 
| 
         @@ -72,9 +86,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       72 
86 
     | 
    
         
             
            requirements: []
         
     | 
| 
       73 
87 
     | 
    
         | 
| 
       74 
88 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       75 
     | 
    
         
            -
            rubygems_version: 1.3 
     | 
| 
      
 89 
     | 
    
         
            +
            rubygems_version: 1.5.3
         
     | 
| 
       76 
90 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       77 
91 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       78 
92 
     | 
    
         
             
            summary: A convenient way to diff string in ruby
         
     | 
| 
       79 
     | 
    
         
            -
            test_files: 
         
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
      
 93 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
    
        data/.gitignore
    DELETED