xml-sitemap 1.3.2 → 1.3.3

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b467c55eb24039a8652c3a189cf487bf04d99dc3
4
+ data.tar.gz: 971eb8094137094e68c3a0d152f49d40ff9f48f3
5
+ SHA512:
6
+ metadata.gz: c44a0304eb5bed9861639d5e57c8efbff456d674e87ff2bcc92e0243b60f8e87f893b7d2e2ffe9617a33183abcbabd446641b0454e7baf2bd5c896ac733ac226
7
+ data.tar.gz: 6fc0c7f1c1954934a914aa6a02e3525e13d84b7b4c73cfd6ae6eb7c0a5e569bd971af3da4139a375d7d851cefbaba9485792690d31acfc65878d635b05345b11
@@ -20,12 +20,12 @@ module XmlSitemap
20
20
  #
21
21
  # map - XmlSitemap::Map instance
22
22
  #
23
- def add(map)
23
+ def add(map, use_offsets=true)
24
24
  raise ArgumentError, 'XmlSitemap::Map object required!' unless map.kind_of?(XmlSitemap::Map)
25
25
  raise ArgumentError, 'Map is empty!' if map.empty?
26
26
 
27
27
  @maps << {
28
- :loc => map.index_url(@offsets[map.group], @secure),
28
+ :loc => use_offsets ? map.index_url(@offsets[map.group], @secure) : map.plain_index_url(@secure),
29
29
  :lastmod => map.created_at.utc.iso8601
30
30
  }
31
31
  @offsets[map.group] += 1
@@ -87,6 +87,10 @@ module XmlSitemap
87
87
  "#{secure ? 'https' : 'http'}://#{@domain}/#{@group}-#{offset}.xml"
88
88
  end
89
89
 
90
+ def plain_index_url(secure)
91
+ "#{secure ? 'https' : 'http'}://#{@domain}/#{@group}.xml"
92
+ end
93
+
90
94
  # Render XML
91
95
  #
92
96
  # method - Pick a render engine (:builder, :nokogiri, :string).
@@ -1,6 +1,6 @@
1
1
  module XmlSitemap
2
2
  unless defined?(::XmlSitemap::VERSION)
3
- VERSION = '1.3.2'
3
+ VERSION = "1.3.3"
4
4
  end
5
5
 
6
6
  def self.version
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <sitemapindex xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
+ <sitemap>
4
+ <loc>http://one.foobar.com/sitemap.xml</loc>
5
+ <lastmod>2011-06-01T00:00:01Z</lastmod>
6
+ </sitemap>
7
+ <sitemap>
8
+ <loc>http://two.foobar.com/sitemap.xml</loc>
9
+ <lastmod>2011-06-01T00:00:01Z</lastmod>
10
+ </sitemap>
11
+ </sitemapindex>
@@ -45,6 +45,18 @@ describe XmlSitemap::Index do
45
45
 
46
46
  index.render.split("\n")[2..-1].join("\n").should == fixture('sample_index_secure.xml').split("\n")[2..-1].join("\n")
47
47
  end
48
+
49
+ it 'renders a proper index for multiple subdomains' do
50
+ m1 = XmlSitemap::Map.new('one.foobar.com', :time => base_time) { |m| m.add('about') }
51
+ m2 = XmlSitemap::Map.new('two.foobar.com', :time => base_time) { |m| m.add('about') }
52
+
53
+ index = XmlSitemap::Index.new do |i|
54
+ i.add(m1, false)
55
+ i.add(m2, false)
56
+ end
57
+
58
+ index.render.split("\n")[2..-1].join("\n").should == fixture('sample_many_subdomains_index.xml').split("\n")[2..-1].join("\n")
59
+ end
48
60
  end
49
61
 
50
62
  describe '#render_to' do
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
5
- prerelease:
4
+ version: 1.3.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dan Sosedoff
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-21 00:00:00.000000000 Z
11
+ date: 2013-11-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: simplecov
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: nokogiri
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,17 +69,15 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: builder
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '2.0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '2.0'
94
83
  description: Provides a wrapper to generate XML sitemaps and sitemap indexes.
@@ -119,6 +108,7 @@ files:
119
108
  - spec/fixtures/group_index.xml
120
109
  - spec/fixtures/sample_index.xml
121
110
  - spec/fixtures/sample_index_secure.xml
111
+ - spec/fixtures/sample_many_subdomains_index.xml
122
112
  - spec/fixtures/saved_map.xml
123
113
  - spec/fixtures/simple_map.xml
124
114
  - spec/index_spec.rb
@@ -129,27 +119,26 @@ files:
129
119
  - xml-sitemap.gemspec
130
120
  homepage: http://github.com/sosedoff/xml-sitemap
131
121
  licenses: []
122
+ metadata: {}
132
123
  post_install_message:
133
124
  rdoc_options: []
134
125
  require_paths:
135
126
  - lib
136
127
  required_ruby_version: !ruby/object:Gem::Requirement
137
- none: false
138
128
  requirements:
139
- - - ! '>='
129
+ - - '>='
140
130
  - !ruby/object:Gem::Version
141
131
  version: '0'
142
132
  required_rubygems_version: !ruby/object:Gem::Requirement
143
- none: false
144
133
  requirements:
145
- - - ! '>='
134
+ - - '>='
146
135
  - !ruby/object:Gem::Version
147
136
  version: '0'
148
137
  requirements: []
149
138
  rubyforge_project:
150
- rubygems_version: 1.8.25
139
+ rubygems_version: 2.0.5
151
140
  signing_key:
152
- specification_version: 3
141
+ specification_version: 4
153
142
  summary: Simple XML sitemap generator for Ruby/Rails applications.
154
143
  test_files:
155
144
  - spec/fixtures/empty_index.xml
@@ -159,6 +148,7 @@ test_files:
159
148
  - spec/fixtures/group_index.xml
160
149
  - spec/fixtures/sample_index.xml
161
150
  - spec/fixtures/sample_index_secure.xml
151
+ - spec/fixtures/sample_many_subdomains_index.xml
162
152
  - spec/fixtures/saved_map.xml
163
153
  - spec/fixtures/simple_map.xml
164
154
  - spec/index_spec.rb