colibri 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/Manifest +1 -1
- data/Rakefile +1 -1
- data/colibri.gemspec +3 -3
- data/lib/colibri.rb +1 -1
- data/lib/{diff_helper.rb → colibri_helper.rb} +2 -2
- data/lib/output/simple_correction_diff.rb +2 -2
- data/lib/output/simple_html_diff.rb +3 -2
- data/lib/output/string_simple_correction_diff.rb +1 -1
- data/lib/output/vc_diff.rb +8 -7
- metadata +7 -7
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/Manifest
CHANGED
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'rake'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
|
-
Echoe.new('colibri', '0.0.
|
6
|
+
Echoe.new('colibri', '0.0.3') do |p|
|
7
7
|
p.description = "Display a diff of two files (long strings...) as html"
|
8
8
|
p.url = "https://github.com/IgorDobryn/colibri"
|
9
9
|
p.author = "Igor Dobryn"
|
data/colibri.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "colibri"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Igor Dobryn"]
|
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.date = "2011-08-31"
|
11
11
|
s.description = "Display a diff of two files (long strings...) as html"
|
12
12
|
s.email = "IgorDobryn@gmail.com"
|
13
|
-
s.extra_rdoc_files = ["README", "lib/colibri.rb", "lib/
|
14
|
-
s.files = ["MIT-LICENSE", "Manifest", "README", "Rakefile", "init.rb", "lib/colibri.rb", "lib/
|
13
|
+
s.extra_rdoc_files = ["README", "lib/colibri.rb", "lib/colibri_helper.rb", "lib/output/simple_correction_diff.rb", "lib/output/simple_html_diff.rb", "lib/output/string_simple_correction_diff.rb", "lib/output/vc_diff.rb"]
|
14
|
+
s.files = ["MIT-LICENSE", "Manifest", "README", "Rakefile", "init.rb", "lib/colibri.rb", "lib/colibri_helper.rb", "lib/output/simple_correction_diff.rb", "lib/output/simple_html_diff.rb", "lib/output/string_simple_correction_diff.rb", "lib/output/vc_diff.rb", "sample.css", "colibri.gemspec"]
|
15
15
|
s.homepage = "https://github.com/IgorDobryn/colibri"
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Colibri", "--main", "README"]
|
17
17
|
s.require_paths = ["lib"]
|
data/lib/colibri.rb
CHANGED
@@ -6,7 +6,7 @@ require 'output/vc_diff'
|
|
6
6
|
class Colibri
|
7
7
|
# add html_escape to class level ;)
|
8
8
|
extend ERB::Util
|
9
|
-
def self.diff(old, new, output =
|
9
|
+
def self.diff(old, new, output = SimpleHtmlDiff)
|
10
10
|
# html_escape code for display and split strings into lines array
|
11
11
|
a = html_escape(old).split(/\015?\012/)
|
12
12
|
b = html_escape(new).split(/\015?\012/)
|
@@ -7,13 +7,13 @@ module ColibriHelper
|
|
7
7
|
|
8
8
|
# generates a simple correction diff with "inline-diffs"
|
9
9
|
def correction_diff(old, new)
|
10
|
-
Colibri.diff(old, new,
|
10
|
+
Colibri.diff(old, new, SimpleCorrectionDiff)
|
11
11
|
end
|
12
12
|
|
13
13
|
# generates a simple vc similar diff, where only the changes + some preceding
|
14
14
|
# lines are shown
|
15
15
|
def vc_diff(old,new)
|
16
|
-
Colibri.diff(old,new,
|
16
|
+
Colibri.diff(old,new, VcDiff)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class SimpleCorrectionDiff #:nodoc:
|
2
2
|
include ERB::Util
|
3
3
|
|
4
4
|
attr_accessor :content
|
@@ -8,7 +8,7 @@ class Output::SimpleCorrectionDiff #:nodoc:
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def change(event)
|
11
|
-
out =
|
11
|
+
out = StringSimpleCorrectionDiff.new
|
12
12
|
Diff::LCS.traverse_sequences(event.old_element, event.new_element, out)
|
13
13
|
@content << %Q|<span class="change">#{out.content}#{out.closing}</span><br/></span><br/>\n|
|
14
14
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class SimpleHtmlDiff #:nodoc:
|
2
2
|
attr_accessor :content
|
3
3
|
attr_accessor :old_line
|
4
4
|
attr_accessor :new_line
|
@@ -8,7 +8,7 @@ class Output::SimpleHtmlDiff #:nodoc:
|
|
8
8
|
@old_line = 1
|
9
9
|
@new_line = 1
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def change(event)
|
13
13
|
@content << %Q|<tr><td>#{old_line}. </td><td><pre class="only_a">#{event.old_element}</pre></td><td><pre class="only_b">#{event.new_element}</pre></td><td>#{new_line}. </td></tr>\n|
|
14
14
|
@old_line += 1
|
@@ -34,3 +34,4 @@ class Output::SimpleHtmlDiff #:nodoc:
|
|
34
34
|
@new_line += 1
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
data/lib/output/vc_diff.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class VcDiff #:nodoc:
|
2
2
|
attr_accessor :content
|
3
3
|
attr_accessor :old_line
|
4
4
|
attr_accessor :new_line
|
@@ -11,11 +11,11 @@ class Output::VcDiff #:nodoc:
|
|
11
11
|
@old_line = 1
|
12
12
|
@new_line = 1
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def change(event)
|
16
16
|
add_last_lines unless @last == :change
|
17
17
|
@content << %Q|<tr><td>#{old_line}. </td><td><pre class="only_a">#{event.old_element}</pre></td><td><pre class="only_b">#{event.new_element}</pre></td><td>#{new_line}. </td></tr>\n|
|
18
|
-
|
18
|
+
|
19
19
|
@last = :change
|
20
20
|
@old_line += 1
|
21
21
|
@new_line += 1
|
@@ -33,7 +33,7 @@ class Output::VcDiff #:nodoc:
|
|
33
33
|
add_last_lines unless @last == :discard_a
|
34
34
|
@content << %Q|<tr><td>#{old_line}. </td><td><pre class="only_a">#{event.old_element}</pre></td><td></td><td></td></tr>\n|
|
35
35
|
|
36
|
-
@last = :discard_a
|
36
|
+
@last = :discard_a
|
37
37
|
@old_line += 1
|
38
38
|
end
|
39
39
|
|
@@ -41,11 +41,11 @@ class Output::VcDiff #:nodoc:
|
|
41
41
|
def discard_b(event)
|
42
42
|
add_last_lines unless @last == :discard_b
|
43
43
|
@content << %Q|<tr><td></td><td></td><td><pre class="only_b">#{event.new_element}</pre></td><td>#{new_line}. </td></tr>\n|
|
44
|
-
|
44
|
+
|
45
45
|
@last = :discard_b
|
46
46
|
@new_line += 1
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def add_last_lines(n = 3)
|
50
50
|
@content << %Q|<tr><td colspan="4">Next Change: </td></tr>\n|
|
51
51
|
start = @last_lines.length - n
|
@@ -55,5 +55,6 @@ class Output::VcDiff #:nodoc:
|
|
55
55
|
end
|
56
56
|
@last_lines = []
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
end
|
60
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colibri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -54,7 +54,7 @@ date: 2011-08-31 00:00:00.000000000Z
|
|
54
54
|
dependencies:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: diff-lcs
|
57
|
-
requirement: &
|
57
|
+
requirement: &70461610 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
@@ -62,10 +62,10 @@ dependencies:
|
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
|
-
version_requirements: *
|
65
|
+
version_requirements: *70461610
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: erubis
|
68
|
-
requirement: &
|
68
|
+
requirement: &70461190 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
71
71
|
- - ! '>='
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
version: '0'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
|
-
version_requirements: *
|
76
|
+
version_requirements: *70461190
|
77
77
|
description: Display a diff of two files (long strings...) as html
|
78
78
|
email: IgorDobryn@gmail.com
|
79
79
|
executables: []
|
@@ -81,7 +81,7 @@ extensions: []
|
|
81
81
|
extra_rdoc_files:
|
82
82
|
- README
|
83
83
|
- lib/colibri.rb
|
84
|
-
- lib/
|
84
|
+
- lib/colibri_helper.rb
|
85
85
|
- lib/output/simple_correction_diff.rb
|
86
86
|
- lib/output/simple_html_diff.rb
|
87
87
|
- lib/output/string_simple_correction_diff.rb
|
@@ -93,7 +93,7 @@ files:
|
|
93
93
|
- Rakefile
|
94
94
|
- init.rb
|
95
95
|
- lib/colibri.rb
|
96
|
-
- lib/
|
96
|
+
- lib/colibri_helper.rb
|
97
97
|
- lib/output/simple_correction_diff.rb
|
98
98
|
- lib/output/simple_html_diff.rb
|
99
99
|
- lib/output/string_simple_correction_diff.rb
|
metadata.gz.sig
CHANGED
Binary file
|