commit rubygem-diffy for openSUSE:Factory
Hello community, here is the log from the commit of package rubygem-diffy for openSUSE:Factory checked in at 2015-12-24 12:16:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-diffy (Old) and /work/SRC/openSUSE:Factory/.rubygem-diffy.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-diffy" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-diffy/rubygem-diffy.changes 2015-10-20 00:04:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-diffy.new/rubygem-diffy.changes 2015-12-24 12:16:45.000000000 +0100 @@ -1,0 +2,9 @@ +Fri Dec 18 05:34:23 UTC 2015 - coolo@suse.com + +- updated to version 3.1.0 + see installed CHANGELOG + + == 3.1.0 == + Side by side diffs. Thanks Runar Skaare Tveiten! + +------------------------------------------------------------------- Old: ---- diffy-3.0.7.gem New: ---- diffy-3.1.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-diffy.spec ++++++ --- /var/tmp/diff_new_pack.9mVN6b/_old 2015-12-24 12:16:46.000000000 +0100 +++ /var/tmp/diff_new_pack.9mVN6b/_new 2015-12-24 12:16:46.000000000 +0100 @@ -24,14 +24,14 @@ # Name: rubygem-diffy -Version: 3.0.7 +Version: 3.1.0 Release: 0 %define mod_name diffy %define mod_full_name %{mod_name}-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 5 -BuildRequires: %{ruby} BuildRequires: %{rubygem gem2rpm} +BuildRequires: %{ruby} +BuildRequires: ruby-macros >= 5 Url: http://github.com/samg/diffy Source: http://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml ++++++ diffy-3.0.7.gem -> diffy-3.1.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG new/CHANGELOG --- old/CHANGELOG 2014-10-12 18:55:44.000000000 +0200 +++ new/CHANGELOG 2015-12-17 07:58:46.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2014-10-12 18:55:44.000000000 +0200 +++ new/README.md 2015-12-17 07:58:46.000000000 +0100 @@ -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 @@ -126,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 +<div class="diff"> + <ul> + <li class="del"><del>Hello how are you</del></li> + <li class="unchanged"><span>I'm fine</span></li> + <li class="del"><del>That's <strong>great</strong></del></li> + </ul> +</div> +``` + +``` +>> puts Diffy::SplitDiff.new(string1, string2, :format => :html).right +<div class="diff"> + <ul> + <li class="ins"><ins>Hello how are you<strong>?</strong></ins></li> + <li class="unchanged"><span>I'm fine</span></li> + <li class="ins"><ins>That's <strong>swell</strong></ins></li> + </ul> +</div> +``` + + Other Diff Options ------------------ Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/diffy/css.rb new/lib/diffy/css.rb --- old/lib/diffy/css.rb 2014-10-12 18:55:44.000000000 +0200 +++ new/lib/diffy/css.rb 2015-12-17 07:58:46.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/diffy/split_diff.rb new/lib/diffy/split_diff.rb --- old/lib/diffy/split_diff.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/diffy/split_diff.rb 2015-12-17 07:58:46.000000000 +0100 @@ -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+<li class="ins"><ins>(.*)</ins></li>}, '') + 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+<li class="del"><del>(.*)</del></li>}, '') + when :text + @diff.gsub(/^-(.*)\n/, '') + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/diffy/version.rb new/lib/diffy/version.rb --- old/lib/diffy/version.rb 2014-10-12 18:55:44.000000000 +0200 +++ new/lib/diffy/version.rb 2015-12-17 07:58:46.000000000 +0100 @@ -1,3 +1,3 @@ module Diffy - VERSION = '3.0.7' + VERSION = '3.1.0' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/diffy.rb new/lib/diffy.rb --- old/lib/diffy.rb 2014-10-12 18:55:44.000000000 +0200 +++ new/lib/diffy.rb 2015-12-17 07:58:46.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2014-10-12 18:55:44.000000000 +0200 +++ new/metadata 2015-12-17 07:58:46.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: diffy version: !ruby/object:Gem::Version - version: 3.0.7 + version: 3.1.0 platform: ruby authors: - Sam Goldstein autorequire: bindir: bin cert_chain: [] -date: 2014-10-12 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/diffy_spec.rb new/spec/diffy_spec.rb --- old/spec/diffy_spec.rb 2014-10-12 18:55:44.000000000 +0200 +++ new/spec/diffy_spec.rb 2015-12-17 07:58:46.000000000 +0100 @@ -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 +<div class="diff"> + <ul> + <li class="unchanged"><span>lorem</span></li> + <li class="del"><del>ipsum<strong></strong></del></li> + <li class="del"><del><strong></strong>dolor</del></li> + <li class="unchanged"><span>sit amet</span></li> + </ul> +</div> + 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 +<div class="diff"> + <ul> + <li class="unchanged"><span>lorem</span></li> + <li class="ins"><ins>ipsumdolor</ins></li> + <li class="unchanged"><span>sit amet</span></li> + </ul> +</div> + HTML + end + end +end + describe 'Diffy::CSS' do it "should be some css" do expect(Diffy::CSS).to include 'diff{overflow:auto;}'
participants (1)
-
root@hilbert.suse.de