dirb 1.0.1 → 1.1.0
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.
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/dirb.gemspec +7 -6
- data/lib/dirb.rb +4 -3
- data/spec/dirb_spec.rb +6 -0
- metadata +17 -5
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/dirb.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dirb}
|
8
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
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{2010-
|
12
|
+
s.date = %q{2010-10-15}
|
13
13
|
s.description = %q{Convenient diffing in ruby}
|
14
14
|
s.email = %q{sgrock@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.homepage = %q{http://github.com/samg/dirb/tree/master}
|
31
31
|
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
32
32
|
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.3.
|
33
|
+
s.rubygems_version = %q{1.3.7}
|
34
34
|
s.summary = %q{A convenient way to diff string in ruby}
|
35
35
|
s.test_files = [
|
36
36
|
"spec/dirb_spec.rb"
|
@@ -40,9 +40,10 @@ Gem::Specification.new do |s|
|
|
40
40
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
41
|
s.specification_version = 3
|
42
42
|
|
43
|
-
if Gem::Version.new(Gem::
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
44
|
else
|
45
45
|
end
|
46
46
|
else
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
data/lib/dirb.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'tempfile'
|
3
3
|
require 'open3'
|
4
|
+
require 'erb'
|
4
5
|
module Dirb
|
5
6
|
class Diff
|
6
7
|
class << self
|
@@ -81,11 +82,11 @@ module Dirb
|
|
81
82
|
lines = map do |line|
|
82
83
|
case line
|
83
84
|
when /^\+/
|
84
|
-
' <li class="ins"><ins>' + line.gsub(/^./, '').chomp + '</ins></li>'
|
85
|
+
' <li class="ins"><ins>' + ERB::Util.h(line.gsub(/^./, '').chomp) + '</ins></li>'
|
85
86
|
when /^-/
|
86
|
-
' <li class="del"><del>' + line.gsub(/^./, '').chomp + '</del></li>'
|
87
|
+
' <li class="del"><del>' + ERB::Util.h(line.gsub(/^./, '').chomp) + '</del></li>'
|
87
88
|
when /^ /
|
88
|
-
' <li class="unchanged"><span>' + line.gsub(/^./, '').chomp + '</span></li>'
|
89
|
+
' <li class="unchanged"><span>' + ERB::Util.h(line.gsub(/^./, '').chomp) + '</span></li>'
|
89
90
|
end
|
90
91
|
end
|
91
92
|
%'<div class="diff">\n <ul>\n#{lines.join("\n")}\n </ul>\n</div>\n'
|
data/spec/dirb_spec.rb
CHANGED
@@ -136,6 +136,12 @@ baz
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
+
it "should escape diffed html in html output" do
|
140
|
+
diff = Dirb::Diff.new("<script>alert('bar')</script>", "<script>alert('foo')</script>").to_s(:html)
|
141
|
+
diff.should include('<script>')
|
142
|
+
diff.should_not include('<script>')
|
143
|
+
end
|
144
|
+
|
139
145
|
it "should be easy to generate custom format" do
|
140
146
|
Dirb::Diff.new("foo\nbar\n", "foo\nbar\nbaz\n").map do |line|
|
141
147
|
case line
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dirb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Sam Goldstein
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-10-15 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -43,21 +49,27 @@ rdoc_options:
|
|
43
49
|
require_paths:
|
44
50
|
- lib
|
45
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
46
53
|
requirements:
|
47
54
|
- - ">="
|
48
55
|
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
49
59
|
version: "0"
|
50
|
-
version:
|
51
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
52
62
|
requirements:
|
53
63
|
- - ">="
|
54
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
66
|
+
segments:
|
67
|
+
- 0
|
55
68
|
version: "0"
|
56
|
-
version:
|
57
69
|
requirements: []
|
58
70
|
|
59
71
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.3.
|
72
|
+
rubygems_version: 1.3.7
|
61
73
|
signing_key:
|
62
74
|
specification_version: 3
|
63
75
|
summary: A convenient way to diff string in ruby
|