sitemap_checker 0.1.2 → 0.1.3
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/lib/sitemap_checker/sitemap.rb +2 -12
- data/lib/sitemap_checker/version.rb +1 -1
- data/spec/sitemap_checker_spec.rb +0 -6
- metadata +2 -2
@@ -27,13 +27,7 @@ module SitemapChecker
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def is_siteindex?(xml)
|
30
|
-
|
31
|
-
ixsd.valid?(xml)
|
32
|
-
end
|
33
|
-
|
34
|
-
def is_sitemap?(xml)
|
35
|
-
mxsd = Nokogiri::XML::Schema(open('http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'))
|
36
|
-
mxsd.valid?(xml)
|
30
|
+
xml.xpath('//xmlns:sitemap').size > 0
|
37
31
|
end
|
38
32
|
|
39
33
|
def process_siteindex(xml)
|
@@ -47,11 +41,7 @@ module SitemapChecker
|
|
47
41
|
end
|
48
42
|
|
49
43
|
def process_sitemap(xml)
|
50
|
-
|
51
|
-
return get_locs(xml)
|
52
|
-
else raise 'Invalid Schema'
|
53
|
-
return false
|
54
|
-
end
|
44
|
+
return get_locs(xml)
|
55
45
|
end
|
56
46
|
|
57
47
|
def get_locs(xml)
|
@@ -12,8 +12,6 @@ describe SitemapChecker do
|
|
12
12
|
stub_request(:any, "http://www.github.com/sitemap.xml.gz").to_return(:status => 200, :body => File.read(@dir + 'fixtures/sitemap.xml.gz'))
|
13
13
|
stub_request(:any, "http://www.github.com/siteindex.xml").to_return(:status => 200, :body => File.read(@dir + 'fixtures/siteindex.xml'))
|
14
14
|
stub_request(:any, "http://www.github.com/siteindex.xml.gz").to_return(:status => 200, :body => File.read(@dir + 'fixtures/siteindex.xml.gz'))
|
15
|
-
stub_request(:get, "http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd").to_return(:status => 200, :body => File.read(@dir + 'fixtures/sitemap.xsd'), :headers => {})
|
16
|
-
stub_request(:get, "http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd").to_return(:status => 200, :body => File.read(@dir + 'fixtures/siteindex.xsd'), :headers => {})
|
17
15
|
end
|
18
16
|
|
19
17
|
it "Sitemap accepts xml siteindexes" do
|
@@ -38,10 +36,6 @@ describe SitemapChecker do
|
|
38
36
|
@gz_sitemap.locs.size.should eq(2)
|
39
37
|
end
|
40
38
|
|
41
|
-
it "Sitemap errors if input doc does not match sitemap schema" do
|
42
|
-
lambda {SitemapChecker::Sitemap.new('http://www.github.com')}.should raise_error(RuntimeError, 'Invalid Schema')
|
43
|
-
end
|
44
|
-
|
45
39
|
it "Sitemap locs are Path objects" do
|
46
40
|
@xml_sitemap = SitemapChecker::Sitemap.new('http://www.github.com/sitemap.xml')
|
47
41
|
@xml_sitemap.locs.first.class.should eq(SitemapChecker::Path)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitemap_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|