diff -Nru ruby-diffy-3.0.6/CHANGELOG ruby-diffy-3.1.0/CHANGELOG --- ruby-diffy-3.0.6/CHANGELOG 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/CHANGELOG 2017-06-19 04:10:14.000000000 +0000 @@ -1,3 +1,6 @@ +== 3.1.0 == +Side by side diffs. Thanks Runar Skaare Tveiten! + == 3.0.5 == Improve performance when generating html output (with inline highlighting) on long lines. Thanks Jason Barnabe! diff -Nru ruby-diffy-3.0.6/CONTRIBUTORS ruby-diffy-3.1.0/CONTRIBUTORS --- ruby-diffy-3.0.6/CONTRIBUTORS 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/CONTRIBUTORS 2017-06-19 04:10:14.000000000 +0000 @@ -9,3 +9,4 @@ * printercu * Bryan Ricker * JasonBarnabe +* Skye Shaw diff -Nru ruby-diffy-3.0.6/debian/changelog ruby-diffy-3.1.0/debian/changelog --- ruby-diffy-3.0.6/debian/changelog 2014-09-15 13:13:42.000000000 +0000 +++ ruby-diffy-3.1.0/debian/changelog 2017-06-19 04:23:52.000000000 +0000 @@ -1,3 +1,16 @@ +ruby-diffy (3.1.0-1) unstable; urgency=medium + + * Team upload + [ Cédric Boutillier ] + * uncomment inclusion of the README + + [ Abhijith PA ] + * New upstream release. + * Bump Standards-Version to 4.0.0 + * New patch 01-fix_library_path.patch + + -- Abhijith PA Mon, 19 Jun 2017 09:53:52 +0530 + ruby-diffy (3.0.6-1) unstable; urgency=medium * Initial release (Closes: #760276) diff -Nru ruby-diffy-3.0.6/debian/compat ruby-diffy-3.1.0/debian/compat --- ruby-diffy-3.0.6/debian/compat 2014-09-10 21:19:13.000000000 +0000 +++ ruby-diffy-3.1.0/debian/compat 2017-06-19 04:23:52.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru ruby-diffy-3.0.6/debian/control ruby-diffy-3.1.0/debian/control --- ruby-diffy-3.0.6/debian/control 2014-09-15 13:01:02.000000000 +0000 +++ ruby-diffy-3.1.0/debian/control 2017-06-19 04:23:52.000000000 +0000 @@ -3,10 +3,12 @@ Priority: optional Maintainer: Debian Ruby Extras Maintainers Uploaders: Cédric Boutillier -Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.9.0~), ruby-rspec -Standards-Version: 3.9.5 -Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-diffy.git -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-diffy.git;a=summary +Build-Depends: debhelper (>= 9~), + gem2deb, + ruby-rspec +Standards-Version: 4.0.0 +Vcs-Git: https://anonscm.debian.org/git/pkg-ruby-extras/ruby-diffy.git +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ruby-extras/ruby-diffy.git Homepage: http://github.com/samg/diffy Testsuite: autopkgtest XS-Ruby-Versions: all @@ -14,7 +16,9 @@ Package: ruby-diffy Architecture: all XB-Ruby-Versions: ${ruby:Versions} -Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter +Depends: ruby | ruby-interpreter, + ${misc:Depends}, + ${shlibs:Depends} Description: convenient way to diff strings in Ruby Diffy is a Ruby library providing a convenient way to generate a diff from two strings or files. diff -Nru ruby-diffy-3.0.6/debian/patches/01-fix_library_path.patch ruby-diffy-3.1.0/debian/patches/01-fix_library_path.patch --- ruby-diffy-3.0.6/debian/patches/01-fix_library_path.patch 1970-01-01 00:00:00.000000000 +0000 +++ ruby-diffy-3.1.0/debian/patches/01-fix_library_path.patch 2017-06-19 04:23:52.000000000 +0000 @@ -0,0 +1,14 @@ +Description: Fix the library path of diffy +Author: Abhijith PA +Forwarded: not-needed +Last-Update: 2017-07-25 + +--- ruby-diffy-3.1.0.orig/spec/diffy_spec.rb ++++ ruby-diffy-3.1.0/spec/diffy_spec.rb +@@ -1,5 +1,5 @@ + require 'rspec' +-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'diffy')) ++require 'diffy' + + describe Diffy::Diff do + diff -Nru ruby-diffy-3.0.6/debian/patches/series ruby-diffy-3.1.0/debian/patches/series --- ruby-diffy-3.0.6/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ ruby-diffy-3.1.0/debian/patches/series 2017-06-19 04:23:52.000000000 +0000 @@ -0,0 +1 @@ +01-fix_library_path.patch diff -Nru ruby-diffy-3.0.6/debian/ruby-diffy.docs ruby-diffy-3.1.0/debian/ruby-diffy.docs --- ruby-diffy-3.0.6/debian/ruby-diffy.docs 2014-09-10 21:19:13.000000000 +0000 +++ ruby-diffy-3.1.0/debian/ruby-diffy.docs 2017-06-19 04:23:52.000000000 +0000 @@ -1,2 +1 @@ -# FIXME: READMEs found -# README.md +README.md diff -Nru ruby-diffy-3.0.6/lib/diffy/css.rb ruby-diffy-3.1.0/lib/diffy/css.rb --- ruby-diffy-3.0.6/lib/diffy/css.rb 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/lib/diffy/css.rb 2017-06-19 04:10:14.000000000 +0000 @@ -14,4 +14,21 @@ .diff li.diff-comment { display: none; } .diff li.diff-block-info { background: none repeat scroll 0 0 gray; } STYLE + + CSS_COLORBLIND_1 = <<-STYLE +.diff{overflow:auto;} +.diff ul{background:#fff;overflow:auto;font-size:13px;list-style:none;margin:0;padding:0;display:table;width:100%;} +.diff del, .diff ins{display:block;text-decoration:none;} +.diff li{padding:0; display:table-row;margin: 0;height:1em;} +.diff li.ins{background:#ddf; color:#008} +.diff li.del{background:#fee; color:#b00} +.diff li:hover{background:#ffc} +/* try 'whitespace:pre;' if you don't want lines to wrap */ +.diff del, .diff ins, .diff span{white-space:pre-wrap;font-family:courier;} +.diff del strong{font-weight:normal;background:#fcc;} +.diff ins strong{font-weight:normal;background:#99f;} +.diff li.diff-comment { display: none; } +.diff li.diff-block-info { background: none repeat scroll 0 0 gray; } + STYLE + end diff -Nru ruby-diffy-3.0.6/lib/diffy/diff.rb ruby-diffy-3.1.0/lib/diffy/diff.rb --- ruby-diffy-3.0.6/lib/diffy/diff.rb 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/lib/diffy/diff.rb 2017-06-19 04:10:14.000000000 +0000 @@ -51,7 +51,7 @@ if WINDOWS # don't use open3 on windows - cmd = "\"#{diff_bin}\" #{diff_options.join(' ')} #{paths.map{|s| "\"#{s}\""}.join(' ')}" + cmd = sprintf '"%s" %s %s', diff_bin, diff_options.join(' '), paths.map { |s| %("#{s}") }.join(' ') diff = `#{cmd}` else diff = Open3.popen3(diff_bin, *(diff_options + paths)) { |i, o, e| o.read } @@ -142,15 +142,20 @@ def diff_bin return @@bin if @@bin - @@bin ||= "" - if WINDOWS - @@bin = `which diff.exe`.chomp if @@bin.empty? + if @@bin = ENV['DIFFY_DIFF'] + # system() trick from Minitest + raise "Can't execute diff program '#@@bin'" unless system(@@bin, __FILE__, __FILE__) + return @@bin end - @@bin = `which diff`.chomp if @@bin.empty? - if @@bin.empty? + diffs = ['diff', 'ldiff'] + diffs.first << '.exe' if WINDOWS # ldiff does not have exe extension + @@bin = diffs.find { |name| system(name, __FILE__, __FILE__) } + + if @@bin.nil? raise "Can't find a diff executable in PATH #{ENV['PATH']}" end + @@bin end diff -Nru ruby-diffy-3.0.6/lib/diffy/split_diff.rb ruby-diffy-3.1.0/lib/diffy/split_diff.rb --- ruby-diffy-3.0.6/lib/diffy/split_diff.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-diffy-3.1.0/lib/diffy/split_diff.rb 2017-06-19 04:10:14.000000000 +0000 @@ -0,0 +1,49 @@ +module Diffy + class SplitDiff + def initialize(left, right, options = {}) + @format = options[:format] || Diffy::Diff.default_format + + formats = Format.instance_methods(false).map { |x| x.to_s } + unless formats.include?(@format.to_s) + fail ArgumentError, "Format #{format.inspect} is not a valid format" + end + + @diff = Diffy::Diff.new(left, right, options).to_s(@format) + @left_diff, @right_diff = split + end + + %w(left right).each do |direction| + define_method direction do + instance_variable_get("@#{direction}_diff") + end + end + + private + + def split + [split_left, split_right] + end + + def split_left + case @format + when :color + @diff.gsub(/\033\[32m\+(.*)\033\[0m\n/, '') + when :html, :html_simple + @diff.gsub(%r{\s+
  • (.*)
  • }, '') + when :text + @diff.gsub(/^\+(.*)\n/, '') + end + end + + def split_right + case @format + when :color + @diff.gsub(/\033\[31m\-(.*)\033\[0m\n/, '') + when :html, :html_simple + @diff.gsub(%r{\s+
  • (.*)
  • }, '') + when :text + @diff.gsub(/^-(.*)\n/, '') + end + end + end +end diff -Nru ruby-diffy-3.0.6/lib/diffy/version.rb ruby-diffy-3.1.0/lib/diffy/version.rb --- ruby-diffy-3.0.6/lib/diffy/version.rb 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/lib/diffy/version.rb 2017-06-19 04:10:14.000000000 +0000 @@ -1,3 +1,3 @@ module Diffy - VERSION = '3.0.6' + VERSION = '3.1.0' end diff -Nru ruby-diffy-3.0.6/lib/diffy.rb ruby-diffy-3.1.0/lib/diffy.rb --- ruby-diffy-3.0.6/lib/diffy.rb 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/lib/diffy.rb 2017-06-19 04:10:14.000000000 +0000 @@ -9,4 +9,5 @@ require File.join(File.dirname(__FILE__), 'diffy', 'format') require File.join(File.dirname(__FILE__), 'diffy', 'html_formatter') require File.join(File.dirname(__FILE__), 'diffy', 'diff') +require File.join(File.dirname(__FILE__), 'diffy', 'split_diff') require File.join(File.dirname(__FILE__), 'diffy', 'css') diff -Nru ruby-diffy-3.0.6/metadata.yml ruby-diffy-3.1.0/metadata.yml --- ruby-diffy-3.0.6/metadata.yml 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/metadata.yml 2017-06-19 04:10:14.000000000 +0000 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: diffy version: !ruby/object:Gem::Version - version: 3.0.6 + version: 3.1.0 platform: ruby authors: - Sam Goldstein autorequire: bindir: bin cert_chain: [] -date: 2014-07-25 00:00:00.000000000 Z +date: 2015-12-17 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake @@ -60,6 +60,7 @@ - lib/diffy/diff.rb - lib/diffy/format.rb - lib/diffy/html_formatter.rb +- lib/diffy/split_diff.rb - lib/diffy/version.rb - spec/demo_app.rb - spec/diffy_spec.rb @@ -83,7 +84,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.2.2 +rubygems_version: 2.4.5.1 signing_key: specification_version: 4 summary: A convenient way to diff string in ruby diff -Nru ruby-diffy-3.0.6/README.md ruby-diffy-3.1.0/README.md --- ruby-diffy-3.0.6/README.md 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/README.md 2017-06-19 04:10:14.000000000 +0000 @@ -1,4 +1,4 @@ -Diffy - Easy Diffing With Ruby [![Build Status](https://secure.travis-ci.org/samg/diffy.png)](http://travis-ci.org/samg/diffy) +Diffy - Easy Diffing With Ruby [![Build Status](https://travis-ci.org/samg/diffy.svg?branch=master)](https://travis-ci.org/samg/diffy) ============================ Need diffs in your ruby app? Diffy has you covered. It provides a convenient @@ -30,25 +30,29 @@ ###on Windows: -1. ensure that you have a working `which` and `diff` on your machine and on - your search path. +1. Ensure that you have a working `diff` on your machine and in your search path. - There are two options: + There are several options: - 1. install unxutils + 1. Install [Diff::LCS](https://github.com/halostatue/diff-lcs), which includes `ldiff`. [RSpec](https://www.relishapp.com/rspec/docs/gettingstarted) + depends on Diff::LCS so you may already have it installed. + + 1. If you're using [RubyInstaller](http://rubyinstaller.org), install the [devkit](http://rubyinstaller.org/add-ons/devkit). + + 1. Install unxutils note that these tools contain diff 2.7 which has a different handling of whitespace in the diff results. This makes Diffy spec tests yielding one fail on Windows. - 2. install these two individually from the gnuwin32 project + 1. Install these two individually from the gnuwin32 project note that this delivers diff 2.8 which makes Diffy spec pass even on Windows. -2. install the gem by +2. Install the gem by gem install diffy @@ -122,6 +126,81 @@ .diff li.diff-comment { display: none; } .diff li.diff-block-info { background: none repeat scroll 0 0 gray; } + +There's also a colorblind-safe version of the pallete provided in `Diffy::CSS_COLORBLIND_1`. + + +Side-by-side comparisons +------------------------ + +Side-by-side comparisons, or split views as called by some, are supported by +using the `Diffy::SplitDiff` class. This class takes a diff returned from +`Diffy::Diff` and splits it in two parts (or two sides): left and right. The +left side represents deletions while the right side represents insertions. + +The class is used as follows: + +``` +Diffy::SplitDiff.new(string1, string2, options = {}) +``` + +The optional options hash is passed along to the main `Diff::Diff` class, so +all default options such as full diff output are supported. The output format +may be changed by passing the format with the options hash (see below), and all +default formats are supported. + +Unlinke `Diffy::Diff`, `Diffy::SplitDiff` does not use `#to_s` to output +the resulting diff. Instead, two self-explanatory methods are used to output +the diff; `#left` and `#right`. Using the earlier example, this is what they +look like in action: + +``` +>> puts Diffy::SplitDiff.new(string1, string2).left +-Hello how are you + I'm fine +-That's great +``` + +``` +>> puts Diffy::SplitDiff.new(string1, string2).right ++Hello how are you? + I'm fine ++That's swell +``` + +### Changing the split view output format + +The output format may be changed by passing the format with the options hash: + +``` +Diffy::SplitDiff.new(string1, string2, :format => :html) +``` + +This will result in the following: + +``` +>> puts Diffy::SplitDiff.new(string1, string2, :format => :html).left +
    +
      +
    • Hello how are you
    • +
    • I'm fine
    • +
    • That's great
    • +
    +
    +``` + +``` +>> puts Diffy::SplitDiff.new(string1, string2, :format => :html).right +
    +
      +
    • Hello how are you?
    • +
    • I'm fine
    • +
    • That's swell
    • +
    +
    +``` + + Other Diff Options ------------------ diff -Nru ruby-diffy-3.0.6/spec/diffy_spec.rb ruby-diffy-3.1.0/spec/diffy_spec.rb --- ruby-diffy-3.0.6/spec/diffy_spec.rb 2014-09-02 12:41:34.000000000 +0000 +++ ruby-diffy-3.1.0/spec/diffy_spec.rb 2017-06-19 04:10:14.000000000 +0000 @@ -588,6 +588,73 @@ end end +describe Diffy::SplitDiff do + before do + ::Diffy::Diff.default_options.merge!(:diff => '-U 10000') + end + + it "should fail with invalid format" do + expected_fail = expect do + Diffy::SplitDiff.new("lorem\n", "ipsum\n", :format => :fail) + end + expected_fail.to raise_error(ArgumentError) + end + + describe "#left" do + it "should only highlight deletions" do + string1 = "lorem\nipsum\ndolor\nsit amet\n" + string2 = "lorem\nipsumdolor\nsit amet\n" + expect(Diffy::SplitDiff.new(string1, string2).left).to eq <<-TEXT + lorem +-ipsum +-dolor + sit amet + TEXT + end + + it "should also format left diff as html" do + string1 = "lorem\nipsum\ndolor\nsit amet\n" + string2 = "lorem\nipsumdolor\nsit amet\n" + expect(Diffy::SplitDiff.new(string1, string2, :format => :html).left).to eq <<-HTML +
    +
      +
    • lorem
    • +
    • ipsum
    • +
    • dolor
    • +
    • sit amet
    • +
    +
    + HTML + end + end + + describe "#right" do + it "should only highlight insertions" do + string1 = "lorem\nipsum\ndolor\nsit amet\n" + string2 = "lorem\nipsumdolor\nsit amet\n" + expect(Diffy::SplitDiff.new(string1, string2).right).to eq <<-TEXT + lorem ++ipsumdolor + sit amet + TEXT + end + + it "should also format right diff as html" do + string1 = "lorem\nipsum\ndolor\nsit amet\n" + string2 = "lorem\nipsumdolor\nsit amet\n" + expect(Diffy::SplitDiff.new(string1, string2, :format => :html).right).to eq <<-HTML +
    +
      +
    • lorem
    • +
    • ipsumdolor
    • +
    • sit amet
    • +
    +
    + HTML + end + end +end + describe 'Diffy::CSS' do it "should be some css" do expect(Diffy::CSS).to include 'diff{overflow:auto;}'