sitemap_generator 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,6 +3,7 @@ require 'rake/rdoctask'
3
3
  require 'rubygems'
4
4
  gem 'rspec', '1.3.0'
5
5
  require 'spec/rake/spectask'
6
+ gem 'nokogiri'
6
7
 
7
8
  begin
8
9
  require 'jeweler'
@@ -16,6 +17,7 @@ begin
16
17
  gem.files = FileList["[A-Z]*", "{bin,lib,rails,templates,tasks}/**/*"]
17
18
  gem.test_files = []
18
19
  gem.add_development_dependency "rspec"
20
+ gem.add_development_dependency "nokogiri"
19
21
  end
20
22
  Jeweler::GemcutterTasks.new
21
23
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -24,7 +24,17 @@ module SitemapGenerator
24
24
  self.link_count = 0
25
25
 
26
26
  @xml_content = '' # XML urlset content
27
- @xml_wrapper_start = %q[<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">]
27
+ @xml_wrapper_start = <<-HTML
28
+ <?xml version="1.0" encoding="UTF-8"?>
29
+ <urlset
30
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
31
+ xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
32
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
33
+ http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
34
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
35
+ >
36
+ HTML
37
+ @xml_wrapper_start.gsub!(/\s+/, ' ').gsub!(/ *> */, '>')
28
38
  @xml_wrapper_end = %q[</urlset>]
29
39
  self.filesize = @xml_wrapper_start.bytesize + @xml_wrapper_end.bytesize
30
40
  end
@@ -5,15 +5,24 @@ module SitemapGenerator
5
5
  def initialize(*args)
6
6
  super(*args)
7
7
 
8
- @ml_content = '' # XML urlset content
9
- @xml_wrapper_start = %q[<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">]
8
+ @xml_content = '' # XML urlset content
9
+ @xml_wrapper_start = <<-HTML
10
+ <?xml version="1.0" encoding="UTF-8"?>
11
+ <sitemapindex
12
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
13
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
14
+ http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"
15
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
16
+ >
17
+ HTML
18
+ @xml_wrapper_start.gsub!(/\s+/, ' ').gsub!(/ *> */, '>')
10
19
  @xml_wrapper_end = %q[</sitemapindex>]
11
20
  self.filesize = @xml_wrapper_start.bytesize + @xml_wrapper_end.bytesize
12
21
  end
13
22
 
14
23
  # Return XML as a String
15
24
  def build_xml(builder, link)
16
- builder.url do
25
+ builder.sitemap do
17
26
  builder.loc link[:loc]
18
27
  builder.lastmod w3c_date(link[:lastmod]) if link[:lastmod]
19
28
  end
@@ -18,6 +18,8 @@ module SitemapGenerator
18
18
  def create
19
19
  require 'sitemap_generator/interpreter'
20
20
 
21
+ self.public_path = File.join(::Rails.root, 'public/') if self.public_path.nil?
22
+
21
23
  start_time = Time.now
22
24
  SitemapGenerator::Interpreter.run
23
25
  finalize!
@@ -35,7 +37,6 @@ module SitemapGenerator
35
37
  # <tt>default_host</tt> hostname including protocol to use in all sitemap links
36
38
  # e.g. http://en.google.ca
37
39
  def initialize(public_path = nil, sitemaps_path = nil, default_host = nil)
38
- public_path = File.join(::Rails.root, 'public/') if public_path.nil?
39
40
  self.default_host = default_host
40
41
  self.public_path = public_path
41
42
  self.sitemaps_path = sitemaps_path
@@ -6,6 +6,8 @@ require 'sitemap_generator/templates'
6
6
  require 'sitemap_generator/utilities'
7
7
  require 'sitemap_generator/railtie' if SitemapGenerator::Utilities.rails3?
8
8
 
9
+ require 'active_support/core_ext/numeric'
10
+
9
11
  module SitemapGenerator
10
12
  silence_warnings do
11
13
  VERSION = File.read(File.dirname(__FILE__) + "/../VERSION").strip
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adam Salter
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-21 00:00:00 -07:00
18
+ date: 2010-05-22 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -30,6 +30,18 @@ dependencies:
30
30
  version: "0"
31
31
  type: :development
32
32
  version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: nokogiri
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ type: :development
44
+ version_requirements: *id002
33
45
  description: A Rails 3-compatible gem/plugin to generate enterprise-class Sitemaps using a familiar Rails Routes-like DSL. Sitemaps are readable by all search engines and adhere to the Sitemap protocol specification. Automatically pings search engines to notify them of new sitemaps (including Google, Yahoo and Bing). Provides rake tasks to easily manage your sitemaps. Supports image sitemaps and handles millions of links.
34
46
  email: kjvarga@gmail.com
35
47
  executables: []