sitemap_generator 2.1.3 → 2.1.4

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- sitemap_generator (2.1.3)
4
+ sitemap_generator (2.1.4)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -26,6 +26,7 @@ Does your website use SitemapGenerator to generate Sitemaps? Where would you be
26
26
  Changelog
27
27
  -------
28
28
 
29
+ - v2.1.4: Allow special characters in URLs (don't use URI.join to construct URLs)
29
30
  - v2.1.3: Fix calling create with both `filename` and `sitemaps_namer` options
30
31
  - v2.1.2: Support multiple videos per url using the new `videos` option to `add()`.
31
32
  - v2.1.1: Support calling `create()` multiple times in a sitemap config. Support host names with path segments so you can use a `default_host` like `'http://mysite.com/subdirectory/'`. Turn off `include_index` when the `sitemaps_host` differs from `default_host`. Add docs about how to upload to remote hosts.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.1.4
@@ -32,17 +32,21 @@ module SitemapGenerator
32
32
 
33
33
  SitemapGenerator::Utilities.assert_valid_keys(options, :priority, :changefreq, :lastmod, :host, :images, :video, :geo, :news, :videos)
34
34
  options.reverse_merge!(:priority => 0.5, :changefreq => 'weekly', :lastmod => Time.now, :images => [], :news => {}, :videos => [])
35
+ if options[:host].blank?
36
+ raise "Cannot generate a url without a host"
37
+ end
35
38
  if video = options.delete(:video)
36
39
  options[:videos] = video.is_a?(Array) ? options[:videos].concat(video) : options[:videos] << video
37
40
  end
38
- raise "Cannot generate a url without a host" unless options[:host].present?
41
+
42
+ path = path.to_s.sub(/^\//, '')
43
+ loc = path.empty? ? options[:host] : (options[:host].to_s.sub(/\/$/, '') + '/' + path)
39
44
  self.merge!(
40
- :path => path,
41
45
  :priority => options[:priority],
42
46
  :changefreq => options[:changefreq],
43
47
  :lastmod => options[:lastmod],
44
48
  :host => options[:host],
45
- :loc => URI.join(options[:host], path.to_s.sub(/^\//, '')).to_s, # support host with subdirectory
49
+ :loc => loc,
46
50
  :images => prepare_images(options[:images], options[:host]),
47
51
  :news => prepare_news(options[:news]),
48
52
  :videos => options[:videos],
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitemap_generator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 3
10
- version: 2.1.3
9
+ - 4
10
+ version: 2.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karl Varga
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-09-23 00:00:00 -07:00
19
+ date: 2011-10-18 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency