sitemap_generator 5.2.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGES.md +250 -0
  3. data/README.md +156 -125
  4. data/VERSION +1 -1
  5. data/lib/capistrano/tasks/sitemap_generator.cap +21 -23
  6. data/lib/sitemap_generator.rb +1 -2
  7. data/lib/sitemap_generator/adapters/s3_adapter.rb +5 -0
  8. data/lib/sitemap_generator/application.rb +1 -1
  9. data/lib/sitemap_generator/builder/sitemap_file.rb +7 -3
  10. data/lib/sitemap_generator/builder/sitemap_url.rb +1 -10
  11. data/lib/sitemap_generator/link_set.rb +16 -10
  12. data/lib/sitemap_generator/{sitemap_namer.rb → simple_namer.rb} +1 -1
  13. data/lib/sitemap_generator/sitemap_location.rb +13 -1
  14. data/lib/sitemap_generator/tasks.rb +2 -2
  15. metadata +51 -123
  16. data/Gemfile +0 -13
  17. data/Gemfile.lock +0 -38
  18. data/Rakefile +0 -43
  19. data/spec/blueprint.rb +0 -15
  20. data/spec/files/sitemap.create.rb +0 -12
  21. data/spec/files/sitemap.groups.rb +0 -49
  22. data/spec/sitemap_generator/adapters/s3_adapter_spec.rb +0 -23
  23. data/spec/sitemap_generator/alternate_sitemap_spec.rb +0 -100
  24. data/spec/sitemap_generator/application_spec.rb +0 -69
  25. data/spec/sitemap_generator/builder/sitemap_file_spec.rb +0 -110
  26. data/spec/sitemap_generator/builder/sitemap_index_file_spec.rb +0 -124
  27. data/spec/sitemap_generator/builder/sitemap_index_url_spec.rb +0 -28
  28. data/spec/sitemap_generator/builder/sitemap_url_spec.rb +0 -192
  29. data/spec/sitemap_generator/core_ext/bigdecimal_spec.rb +0 -20
  30. data/spec/sitemap_generator/core_ext/numeric_spec.rb +0 -43
  31. data/spec/sitemap_generator/file_adaptor_spec.rb +0 -20
  32. data/spec/sitemap_generator/geo_sitemap_spec.rb +0 -30
  33. data/spec/sitemap_generator/helpers/number_helper_spec.rb +0 -196
  34. data/spec/sitemap_generator/interpreter_spec.rb +0 -90
  35. data/spec/sitemap_generator/link_set_spec.rb +0 -864
  36. data/spec/sitemap_generator/mobile_sitemap_spec.rb +0 -27
  37. data/spec/sitemap_generator/news_sitemap_spec.rb +0 -42
  38. data/spec/sitemap_generator/pagemap_sitemap_spec.rb +0 -57
  39. data/spec/sitemap_generator/sitemap_generator_spec.rb +0 -591
  40. data/spec/sitemap_generator/sitemap_groups_spec.rb +0 -144
  41. data/spec/sitemap_generator/sitemap_location_spec.rb +0 -210
  42. data/spec/sitemap_generator/sitemap_namer_spec.rb +0 -96
  43. data/spec/sitemap_generator/templates_spec.rb +0 -24
  44. data/spec/sitemap_generator/utilities/existence_spec.rb +0 -26
  45. data/spec/sitemap_generator/utilities/hash_spec.rb +0 -57
  46. data/spec/sitemap_generator/utilities/rounding_spec.rb +0 -31
  47. data/spec/sitemap_generator/utilities_spec.rb +0 -101
  48. data/spec/sitemap_generator/video_sitemap_spec.rb +0 -117
  49. data/spec/spec_helper.rb +0 -24
  50. data/spec/support/file_macros.rb +0 -39
  51. data/spec/support/schemas/siteindex.xsd +0 -73
  52. data/spec/support/schemas/sitemap-geo.xsd +0 -41
  53. data/spec/support/schemas/sitemap-mobile.xsd +0 -32
  54. data/spec/support/schemas/sitemap-news.xsd +0 -159
  55. data/spec/support/schemas/sitemap-pagemap.xsd +0 -97
  56. data/spec/support/schemas/sitemap-video.xsd +0 -643
  57. data/spec/support/schemas/sitemap.xsd +0 -115
  58. data/spec/support/xml_macros.rb +0 -67
@@ -1,115 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3
- targetNamespace="http://www.sitemaps.org/schemas/sitemap/0.9"
4
- xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
5
- elementFormDefault="qualified">
6
- <xsd:annotation>
7
- <xsd:documentation>
8
- XML Schema for Sitemap files.
9
- Last Modifed 2008-03-26
10
- </xsd:documentation>
11
- </xsd:annotation>
12
-
13
- <xsd:element name="urlset">
14
- <xsd:annotation>
15
- <xsd:documentation>
16
- Container for a set of up to 50,000 document elements.
17
- This is the root element of the XML file.
18
- </xsd:documentation>
19
- </xsd:annotation>
20
- <xsd:complexType>
21
- <xsd:sequence>
22
- <xsd:element name="url" type="tUrl" maxOccurs="unbounded"/>
23
- </xsd:sequence>
24
- </xsd:complexType>
25
- </xsd:element>
26
-
27
- <xsd:complexType name="tUrl">
28
- <xsd:annotation>
29
- <xsd:documentation>
30
- Container for the data needed to describe a document to crawl.
31
- </xsd:documentation>
32
- </xsd:annotation>
33
- <xsd:sequence>
34
- <xsd:element name="loc" type="tLoc"/>
35
- <xsd:element name="lastmod" type="tLastmod" minOccurs="0"/>
36
- <xsd:element name="changefreq" type="tChangeFreq" minOccurs="0"/>
37
- <xsd:element name="priority" type="tPriority" minOccurs="0"/>
38
- <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="strict"/>
39
- </xsd:sequence>
40
- </xsd:complexType>
41
-
42
- <xsd:simpleType name="tLoc">
43
- <xsd:annotation>
44
- <xsd:documentation>
45
- REQUIRED: The location URI of a document.
46
- The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
47
- </xsd:documentation>
48
- </xsd:annotation>
49
- <xsd:restriction base="xsd:anyURI">
50
- <xsd:minLength value="12"/>
51
- <xsd:maxLength value="2048"/>
52
- </xsd:restriction>
53
- </xsd:simpleType>
54
-
55
- <xsd:simpleType name="tLastmod">
56
- <xsd:annotation>
57
- <xsd:documentation>
58
- OPTIONAL: The date the document was last modified. The date must conform
59
- to the W3C DATETIME format (http://www.w3.org/TR/NOTE-datetime).
60
- Example: 2005-05-10
61
- Lastmod may also contain a timestamp.
62
- Example: 2005-05-10T17:33:30+08:00
63
- </xsd:documentation>
64
- </xsd:annotation>
65
- <xsd:union>
66
- <xsd:simpleType>
67
- <xsd:restriction base="xsd:date"/>
68
- </xsd:simpleType>
69
- <xsd:simpleType>
70
- <xsd:restriction base="xsd:dateTime"/>
71
- </xsd:simpleType>
72
- </xsd:union>
73
- </xsd:simpleType>
74
-
75
- <xsd:simpleType name="tChangeFreq">
76
- <xsd:annotation>
77
- <xsd:documentation>
78
- OPTIONAL: Indicates how frequently the content at a particular URL is
79
- likely to change. The value "always" should be used to describe
80
- documents that change each time they are accessed. The value "never"
81
- should be used to describe archived URLs. Please note that web
82
- crawlers may not necessarily crawl pages marked "always" more often.
83
- Consider this element as a friendly suggestion and not a command.
84
- </xsd:documentation>
85
- </xsd:annotation>
86
- <xsd:restriction base="xsd:string">
87
- <xsd:enumeration value="always"/>
88
- <xsd:enumeration value="hourly"/>
89
- <xsd:enumeration value="daily"/>
90
- <xsd:enumeration value="weekly"/>
91
- <xsd:enumeration value="monthly"/>
92
- <xsd:enumeration value="yearly"/>
93
- <xsd:enumeration value="never"/>
94
- </xsd:restriction>
95
- </xsd:simpleType>
96
-
97
- <xsd:simpleType name="tPriority">
98
- <xsd:annotation>
99
- <xsd:documentation>
100
- OPTIONAL: The priority of a particular URL relative to other pages
101
- on the same site. The value for this element is a number between
102
- 0.0 and 1.0 where 0.0 identifies the lowest priority page(s).
103
- The default priority of a page is 0.5. Priority is used to select
104
- between pages on your site. Setting a priority of 1.0 for all URLs
105
- will not help you, as the relative priority of pages on your site
106
- is what will be considered.
107
- </xsd:documentation>
108
- </xsd:annotation>
109
- <xsd:restriction base="xsd:decimal">
110
- <xsd:minInclusive value="0.0"/>
111
- <xsd:maxInclusive value="1.0"/>
112
- </xsd:restriction>
113
- </xsd:simpleType>
114
-
115
- </xsd:schema>
@@ -1,67 +0,0 @@
1
- require 'nokogiri'
2
-
3
- module XmlMacros
4
-
5
- def gzipped_xml_file_should_validate_against_schema(xml_gz_filename, schema_name)
6
- Zlib::GzipReader.open(xml_gz_filename) do |xml_file|
7
- xml_data_should_validate_against_schema(xml_file.read, schema_name)
8
- end
9
- end
10
-
11
- # Validate XML against a local schema file.
12
- #
13
- # `schema_name` gives the name of the schema file to validate against. The schema
14
- # file is looked for in `spec/support/schemas/<schema_name>.xsd`.
15
- def xml_data_should_validate_against_schema(xml, schema_name)
16
- xml = xml.is_a?(String) ? xml : xml.to_s
17
- doc = Nokogiri::XML(xml)
18
- schema_file = File.join(File.dirname(__FILE__), 'schemas', "#{schema_name}.xsd")
19
- schema = Nokogiri::XML::Schema File.read(schema_file)
20
- schema.validate(doc).should == []
21
- end
22
-
23
- # Validate a fragment of XML against a schema. Builds a document with a root
24
- # node for you so the fragment can be validated.
25
- #
26
- # Unfortunately Nokogiri doesn't support validating
27
- # documents with multiple namespaces. So we have to extract the element
28
- # and create a new document from it. If the xmlns isn't set on the element
29
- # we get an error like:
30
- #
31
- # Element 'video': No matching global declaration available for the validation root.
32
- #
33
- # <tt>xml</tt> The XML fragment
34
- # <tt>schema_name</tt> the name of the schema file to validate against. The schema
35
- # file is looked for in `spec/support/schemas/<schema_name>.xsd`.
36
- # <tt>xmlns</tt> A hash with only one key which gives the XML namespace and associated
37
- # URI. Sometimes one needs to specify a prefix to the namespace, in which case this would
38
- # look like: 'xmlns:video' => 'http://www.google.com/schemas/sitemap-video/1.1'
39
- #
40
- # Example:
41
- # xml_fragment_should_validate_against_schema('<video/>', 'sitemap-video', 'xmlns:video' => 'http://www.google.com/schemas/sitemap-video/1.1')
42
- #
43
- # This validates the given XML using the spec/support/schemas/sitemap-video.xsd`
44
- # schema. The XML namespace `xmlns:video='http://www.google.com/schemas/sitemap-video/1.1'` is automatically
45
- # added to the root element for you.
46
- def xml_fragment_should_validate_against_schema(xml, schema_name, xmlns={})
47
- xml = xml.is_a?(String) ? xml : xml.to_s
48
- doc = Nokogiri::XML(xml)
49
- doc.root.send(:[]=, *xmlns.first)
50
- xml_data_should_validate_against_schema(doc, schema_name)
51
- end
52
-
53
- def gzipped_xml_file_should_have_minimal_whitespace(xml_gz_filename)
54
- Zlib::GzipReader.open(xml_gz_filename) do |xml_file|
55
- xml_data_should_have_minimal_whitespace xml_file.read
56
- end
57
- end
58
-
59
- def xml_data_should_have_minimal_whitespace(xml_data)
60
- xml_data.should_not match /^\s/
61
- xml_data.should_not match /\s$/
62
- xml_data.should_not match /\s\s+/
63
- xml_data.should_not match /\s[<>]/
64
- xml_data.should_not match /[<>]\s/
65
- end
66
-
67
- end