cartographer 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/cartographer.rb +9 -2
- data/test/test_cartographer.rb +12 -0
- metadata +2 -2
data/History.txt
CHANGED
data/lib/cartographer.rb
CHANGED
@@ -24,7 +24,7 @@ require 'nokogiri'
|
|
24
24
|
# See Cartographer and Cartographer::URL RDoc for more information.
|
25
25
|
#
|
26
26
|
class Cartographer
|
27
|
-
VERSION = '1.1.
|
27
|
+
VERSION = '1.1.1'
|
28
28
|
|
29
29
|
##
|
30
30
|
# List of Cartographer::URL objects
|
@@ -91,7 +91,7 @@ class Cartographer
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
uri.path = new_path
|
94
|
+
uri.path = Cartographer.escape_path(new_path)
|
95
95
|
add URL.new(:location => uri, :lastmod => stat.mtime, :changefreq => @default_changefreq)
|
96
96
|
end
|
97
97
|
end
|
@@ -132,6 +132,13 @@ class Cartographer
|
|
132
132
|
urls.uniq!
|
133
133
|
end
|
134
134
|
|
135
|
+
private
|
136
|
+
|
137
|
+
def self.escape_path(path)
|
138
|
+
require 'cgi'
|
139
|
+
path.split(%r!/!, -1).map { |x| CGI.escape(x) }.join("/")
|
140
|
+
end
|
141
|
+
|
135
142
|
##
|
136
143
|
# Cartographer::URL is a structure to enforce the sitemap format.
|
137
144
|
#
|
data/test/test_cartographer.rb
CHANGED
@@ -57,6 +57,18 @@ class TestCartographer < MiniTest::Unit::TestCase
|
|
57
57
|
)
|
58
58
|
|
59
59
|
FileUtils.rm_r("test/prune_me")
|
60
|
+
|
61
|
+
FileUtils.touch('test/with spaces')
|
62
|
+
|
63
|
+
sm = Cartographer.new("http://example.org")
|
64
|
+
sm.add_tree(File.expand_path("test"))
|
65
|
+
|
66
|
+
assert_includes(
|
67
|
+
sm.urls.map(&:location),
|
68
|
+
URI.parse("http://example.org/with+spaces")
|
69
|
+
)
|
70
|
+
|
71
|
+
FileUtils.rm('test/with spaces')
|
60
72
|
end
|
61
73
|
|
62
74
|
def test_to_xml
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cartographer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Erik Hollensbe
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-03-
|
14
|
+
date: 2011-03-29 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|