sitemap_generator 1.4.0 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -3
- data/Gemfile.lock +6 -6
- data/README.md +2 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/lib/sitemap_generator.rb +17 -9
- data/lib/sitemap_generator/application.rb +22 -0
- data/lib/sitemap_generator/builder/sitemap_file.rb +62 -55
- data/lib/sitemap_generator/builder/sitemap_index_file.rb +28 -12
- data/lib/sitemap_generator/builder/sitemap_index_url.rb +3 -3
- data/lib/sitemap_generator/builder/sitemap_url.rb +6 -6
- data/lib/sitemap_generator/interpreter.rb +3 -3
- data/lib/sitemap_generator/link_set.rb +133 -79
- data/lib/sitemap_generator/sitemap_location.rb +71 -0
- data/lib/sitemap_generator/sitemap_namer.rb +30 -0
- data/lib/sitemap_generator/utilities.rb +12 -13
- metadata +33 -30
data/Gemfile
CHANGED
@@ -5,12 +5,12 @@ gem 'sitemap_generator', :path => './'
|
|
5
5
|
gem 'rails', '2.3.8'
|
6
6
|
gem 'mocha', '0.9.10'
|
7
7
|
gem 'rake', '0.8.7'
|
8
|
-
gem 'rspec', '1.3.
|
8
|
+
gem 'rspec', '1.3.1', :require => 'spec'
|
9
9
|
gem 'rspec-rails', '~>1.3.2', :require => 'spec/rails'
|
10
10
|
|
11
11
|
# Simplify these dependencies
|
12
12
|
gem 'git', '1.2.5'
|
13
|
-
gem 'jeweler', '1.4.0'
|
13
|
+
gem 'jeweler', '=1.4.0'
|
14
14
|
gem 'github', '0.4.5'
|
15
15
|
gem 'gemcutter', '0.6.1'
|
16
16
|
|
@@ -21,4 +21,4 @@ gem 'sqlite3-ruby', '1.3.1', :require => 'sqlite3'
|
|
21
21
|
group :test do
|
22
22
|
gem 'ruby-debug', '0.10.3'
|
23
23
|
gem 'ruby-debug-base', '0.10.3'
|
24
|
-
end
|
24
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ./
|
3
3
|
specs:
|
4
|
-
sitemap_generator (1.
|
4
|
+
sitemap_generator (1.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
activeresource (2.3.8)
|
17
17
|
activesupport (= 2.3.8)
|
18
18
|
activesupport (2.3.8)
|
19
|
-
columnize (0.3.
|
19
|
+
columnize (0.3.1)
|
20
20
|
gemcutter (0.6.1)
|
21
21
|
git (1.2.5)
|
22
22
|
github (0.4.5)
|
@@ -29,12 +29,12 @@ GEM
|
|
29
29
|
git (>= 1.2.5)
|
30
30
|
rubyforge (>= 2.0.0)
|
31
31
|
json (1.5.1)
|
32
|
-
json_pure (1.
|
32
|
+
json_pure (1.4.6)
|
33
33
|
linecache (0.43)
|
34
34
|
mocha (0.9.10)
|
35
35
|
rake
|
36
36
|
nokogiri (1.4.4)
|
37
|
-
rack (1.1.
|
37
|
+
rack (1.1.2)
|
38
38
|
rails (2.3.8)
|
39
39
|
actionmailer (= 2.3.8)
|
40
40
|
actionpack (= 2.3.8)
|
@@ -43,7 +43,7 @@ GEM
|
|
43
43
|
activesupport (= 2.3.8)
|
44
44
|
rake (>= 0.8.3)
|
45
45
|
rake (0.8.7)
|
46
|
-
rspec (1.3.
|
46
|
+
rspec (1.3.1)
|
47
47
|
rspec-rails (1.3.2)
|
48
48
|
rack (>= 1.0.0)
|
49
49
|
rspec (>= 1.3.0)
|
@@ -71,7 +71,7 @@ DEPENDENCIES
|
|
71
71
|
nokogiri (= 1.4.4)
|
72
72
|
rails (= 2.3.8)
|
73
73
|
rake (= 0.8.7)
|
74
|
-
rspec (= 1.3.
|
74
|
+
rspec (= 1.3.1)
|
75
75
|
rspec-rails (~> 1.3.2)
|
76
76
|
ruby-debug (= 0.10.3)
|
77
77
|
ruby-debug-base (= 0.10.3)
|
data/README.md
CHANGED
@@ -18,7 +18,8 @@ Features
|
|
18
18
|
Changelog
|
19
19
|
-------
|
20
20
|
|
21
|
-
- v1.
|
21
|
+
- v1.5.0: Major refactoring & testing in preparation for new API & features
|
22
|
+
- v1.4.0: [Geo sitemap][geo_tags] support, multiple sitemap support via CONFIG_FILE rake option
|
22
23
|
- v1.3.0: Support setting the sitemaps path
|
23
24
|
- v1.2.0: Verified working with Rails 3 stable release
|
24
25
|
- v1.1.0: [Video sitemap][sitemap_video] support
|
data/Rakefile
CHANGED
@@ -98,7 +98,6 @@ Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
98
98
|
spec.libs << 'lib' << 'spec'
|
99
99
|
spec.spec_files = FileList['spec/sitemap_generator/**/*_spec.rb']
|
100
100
|
end
|
101
|
-
task :spec => :check_dependencies
|
102
101
|
|
103
102
|
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
104
103
|
spec.libs << 'lib' << 'spec'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5.2
|
data/lib/sitemap_generator.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require 'sitemap_generator/builder'
|
2
|
+
require 'sitemap_generator/sitemap_namer'
|
2
3
|
require 'sitemap_generator/link_set'
|
3
4
|
require 'sitemap_generator/templates'
|
4
5
|
require 'sitemap_generator/utilities'
|
5
|
-
require 'sitemap_generator/
|
6
|
-
|
6
|
+
require 'sitemap_generator/application'
|
7
|
+
require 'sitemap_generator/sitemap_location'
|
7
8
|
require 'active_support/core_ext/numeric'
|
8
9
|
|
9
10
|
module SitemapGenerator
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
SitemapError = Class.new(StandardError)
|
12
|
+
SitemapFullError = Class.new(SitemapError)
|
13
|
+
SitemapFinalizedError = Class.new(SitemapError)
|
14
|
+
|
14
15
|
silence_warnings do
|
15
16
|
VERSION = File.read(File.dirname(__FILE__) + "/../VERSION").strip
|
16
17
|
MAX_SITEMAP_FILES = 50_000 # max sitemap links per index file
|
@@ -18,14 +19,21 @@ module SitemapGenerator
|
|
18
19
|
MAX_SITEMAP_IMAGES = 1_000 # max images per url
|
19
20
|
MAX_SITEMAP_FILESIZE = 10.megabytes # bytes
|
20
21
|
|
21
|
-
|
22
|
+
# Lazy-initialize the LinkSet instance
|
23
|
+
Sitemap = (Class.new do
|
24
|
+
def method_missing(*args, &block)
|
25
|
+
(@link_set ||= LinkSet.new).send(*args, &block)
|
26
|
+
end
|
27
|
+
end).new
|
22
28
|
end
|
23
29
|
|
24
30
|
class << self
|
25
|
-
attr_accessor :root, :templates
|
31
|
+
attr_accessor :root, :app, :templates
|
26
32
|
end
|
27
33
|
|
28
34
|
self.root = File.expand_path(File.join(File.dirname(__FILE__), '../'))
|
29
35
|
self.templates = SitemapGenerator::Templates.new(self.root)
|
36
|
+
self.app = SitemapGenerator::Application.new
|
37
|
+
end
|
30
38
|
|
31
|
-
|
39
|
+
require 'sitemap_generator/railtie' if SitemapGenerator.app.rails3?
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module SitemapGenerator
|
4
|
+
class Application
|
5
|
+
def rails?
|
6
|
+
defined?(Rails)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Returns a boolean indicating whether this environment is Rails 3
|
10
|
+
#
|
11
|
+
# @return [Boolean]
|
12
|
+
def rails3?
|
13
|
+
rails? && Rails.version.to_f >= 3
|
14
|
+
rescue
|
15
|
+
false # Rails.version defined in 2.1.0
|
16
|
+
end
|
17
|
+
|
18
|
+
def root
|
19
|
+
Pathname.new(rails? && Rails.root || Dir.getwd)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -7,31 +7,30 @@ module SitemapGenerator
|
|
7
7
|
#
|
8
8
|
# General Usage:
|
9
9
|
#
|
10
|
-
# sitemap = SitemapFile.new(
|
10
|
+
# sitemap = SitemapFile.new(:location => SitemapLocation.new(...))
|
11
11
|
# sitemap.add('/', { ... }) <- add a link to the sitemap
|
12
|
-
# sitemap.finalize! <-
|
13
|
-
# and freezes the object to protect it from further modification
|
12
|
+
# sitemap.finalize! <- write the sitemap file and freeze the object to protect it from further modification
|
14
13
|
#
|
15
14
|
class SitemapFile
|
16
15
|
include ActionView::Helpers::NumberHelper
|
17
16
|
include ActionView::Helpers::TextHelper # Rails 2.2.2 fails with missing 'pluralize' otherwise
|
18
|
-
|
17
|
+
attr_reader :link_count, :filesize, :filename, :location
|
19
18
|
|
20
|
-
#
|
21
|
-
# Usually your Rails <tt>public/</tt> directory.
|
19
|
+
# Options:
|
22
20
|
#
|
23
|
-
# <tt>
|
24
|
-
# file relative to <tt>public_path</tt>
|
21
|
+
# <tt>location</tt> a SitemapGenerator::SitemapLocation instance
|
25
22
|
#
|
26
|
-
# <tt>
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@
|
23
|
+
# <tt>filename</tt> a symbol giving the base of the sitemap fileaname. Default: :sitemap
|
24
|
+
#
|
25
|
+
# <tt>namer</tt> (optional) if provided is used to get the next sitemap filename, overriding :filename
|
26
|
+
def initialize(opts={})
|
27
|
+
SitemapGenerator::Utilities.assert_valid_keys(opts, [:location, :filename, :namer])
|
28
|
+
|
29
|
+
@location = opts.delete(:location) || SitemapGenerator::SitemapLocation.new
|
30
|
+
@namer = opts.delete(:namer) || new_namer(opts.delete(:filename))
|
31
|
+
@filename = @location[:filename] = @namer.next
|
32
|
+
@link_count = 0
|
33
|
+
@xml_content = '' # XML urlset content
|
35
34
|
@xml_wrapper_start = <<-HTML
|
36
35
|
<?xml version="1.0" encoding="UTF-8"?>
|
37
36
|
<urlset
|
@@ -46,61 +45,49 @@ module SitemapGenerator
|
|
46
45
|
HTML
|
47
46
|
@xml_wrapper_start.gsub!(/\s+/, ' ').gsub!(/ *> */, '>').strip!
|
48
47
|
@xml_wrapper_end = %q[</urlset>]
|
49
|
-
|
48
|
+
@filesize = bytesize(@xml_wrapper_start) + bytesize(@xml_wrapper_end)
|
50
49
|
end
|
51
50
|
|
52
51
|
def lastmod
|
53
|
-
File.mtime(
|
52
|
+
File.mtime(path) rescue nil
|
54
53
|
end
|
55
54
|
|
56
55
|
def empty?
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
def full_url
|
61
|
-
URI.join(self.hostname, self.sitemap_path).to_s
|
62
|
-
end
|
63
|
-
|
64
|
-
def full_path
|
65
|
-
@full_path ||= File.join(self.public_path, self.sitemap_path)
|
56
|
+
@link_count == 0
|
66
57
|
end
|
67
58
|
|
68
59
|
# Return a boolean indicating whether the sitemap file can fit another link
|
69
|
-
# of <tt>bytes</tt> bytes in size.
|
60
|
+
# of <tt>bytes</tt> bytes in size. You can also pass a string and the
|
61
|
+
# bytesize will be calculated for you.
|
70
62
|
def file_can_fit?(bytes)
|
71
|
-
|
63
|
+
bytes = bytes.is_a?(String) ? bytesize(bytes) : bytes
|
64
|
+
(@filesize + bytes) < SitemapGenerator::MAX_SITEMAP_FILESIZE && @link_count < SitemapGenerator::MAX_SITEMAP_LINKS
|
72
65
|
end
|
73
66
|
|
74
67
|
# Add a link to the sitemap file.
|
75
68
|
#
|
76
69
|
# If a link cannot be added, for example if the file is too large or the link
|
77
|
-
# limit has been reached, a SitemapGenerator::SitemapFullError exception is raised
|
70
|
+
# limit has been reached, a SitemapGenerator::SitemapFullError exception is raised
|
71
|
+
# and the sitemap is finalized.
|
78
72
|
#
|
79
73
|
# If the Sitemap has already been finalized a SitemapGenerator::SitemapFinalizedError
|
80
74
|
# exception is raised.
|
81
75
|
#
|
76
|
+
# Return the new link count.
|
77
|
+
#
|
82
78
|
# Call with:
|
83
79
|
# sitemap_url - a SitemapUrl instance
|
84
80
|
# sitemap, options - a Sitemap instance and options hash
|
85
81
|
# path, options - a path for the URL and options hash
|
86
82
|
def add(link, options={})
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
SitemapGenerator::Builder::SitemapUrl.new(link, options).to_xml
|
91
|
-
end
|
83
|
+
raise SitemapGenerator::SitemapFinalizedError if finalized?
|
84
|
+
xml = (link.is_a?(SitemapUrl) ? link : SitemapUrl.new(link, options)).to_xml
|
85
|
+
raise SitemapGenerator::SitemapFullError if !file_can_fit?(xml)
|
92
86
|
|
93
|
-
|
94
|
-
raise SitemapGenerator::SitemapFinalizedError
|
95
|
-
elsif !file_can_fit?(bytesize(xml))
|
96
|
-
raise SitemapGenerator::SitemapFullError
|
97
|
-
end
|
98
|
-
|
99
|
-
# Add the XML
|
87
|
+
# Add the XML to the sitemap
|
100
88
|
@xml_content << xml
|
101
|
-
|
102
|
-
|
103
|
-
true
|
89
|
+
@filesize += bytesize(xml)
|
90
|
+
@link_count += 1
|
104
91
|
end
|
105
92
|
|
106
93
|
# Write out the Sitemap file and freeze this object.
|
@@ -111,17 +98,18 @@ module SitemapGenerator
|
|
111
98
|
# A SitemapGenerator::SitemapFinalizedError exception is raised if the Sitemap
|
112
99
|
# has already been finalized
|
113
100
|
def finalize!
|
114
|
-
raise SitemapGenerator::SitemapFinalizedError if
|
101
|
+
raise SitemapGenerator::SitemapFinalizedError if finalized?
|
115
102
|
|
116
103
|
# Ensure that the directory exists
|
117
|
-
dir =
|
104
|
+
dir = @location.directory
|
105
|
+
path = @location.path
|
118
106
|
if !File.exists?(dir)
|
119
107
|
FileUtils.mkdir_p(dir)
|
120
108
|
elsif !File.directory?(dir)
|
121
109
|
raise SitemapError.new("#{dir} should be a directory!")
|
122
110
|
end
|
123
111
|
|
124
|
-
open(
|
112
|
+
open(path, 'wb') do |file|
|
125
113
|
gz = Zlib::GzipWriter.new(file)
|
126
114
|
gz.write @xml_wrapper_start
|
127
115
|
gz.write @xml_content
|
@@ -129,22 +117,41 @@ module SitemapGenerator
|
|
129
117
|
gz.close
|
130
118
|
end
|
131
119
|
@xml_content = @xml_wrapper_start = @xml_wrapper_end = ''
|
132
|
-
|
120
|
+
freeze
|
133
121
|
end
|
134
122
|
|
135
123
|
def finalized?
|
136
|
-
|
124
|
+
frozen?
|
125
|
+
end
|
126
|
+
|
127
|
+
# Return a new instance of the sitemap file with the same options, and the next name in the sequence.
|
128
|
+
def next
|
129
|
+
self.class.new(:location => @location.dup, :namer => @namer)
|
137
130
|
end
|
138
131
|
|
139
132
|
# Return a summary string
|
140
|
-
def summary
|
141
|
-
uncompressed_size = number_to_human_size(filesize) rescue "#{filesize / 8} KB"
|
142
|
-
compressed_size = number_to_human_size(
|
143
|
-
"+ #{'%-21s' %
|
133
|
+
def summary(opts={})
|
134
|
+
uncompressed_size = number_to_human_size(@filesize) rescue "#{@filesize / 8} KB"
|
135
|
+
compressed_size = number_to_human_size(@location.filesize) rescue "#{@location.filesize / 8} KB"
|
136
|
+
"+ #{'%-21s' % @location.path_in_public} #{'%13s' % @link_count} links / #{'%10s' % uncompressed_size} / #{'%10s' % compressed_size} gzipped"
|
137
|
+
end
|
138
|
+
|
139
|
+
# Create a new namer given a filename base and set the filename of this sitemap from it.
|
140
|
+
# It is a bit confusing because the setter takes a filename base whereas the getter
|
141
|
+
# returns a full filename including extension.
|
142
|
+
def filename=(base)
|
143
|
+
@namer = new_namer(base)
|
144
|
+
@filename = @location[:filename] = @namer.next
|
144
145
|
end
|
145
146
|
|
146
147
|
protected
|
147
148
|
|
149
|
+
# Return a new namer given a filename base and set the filename of this sitemap from it.
|
150
|
+
# Default filename base is 'sitemap'.
|
151
|
+
def new_namer(base=nil)
|
152
|
+
SitemapGenerator::SitemapNamer.new(base ||= :sitemap)
|
153
|
+
end
|
154
|
+
|
148
155
|
# Return the bytesize length of the string. Ruby 1.8.6 compatible.
|
149
156
|
def bytesize(string)
|
150
157
|
string.respond_to?(:bytesize) ? string.bytesize : string.length
|
@@ -3,10 +3,16 @@ module SitemapGenerator
|
|
3
3
|
class SitemapIndexFile < SitemapFile
|
4
4
|
attr_accessor :sitemaps
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
|
6
|
+
def initialize(opts={})
|
7
|
+
@options = [:location, :filename]
|
8
|
+
SitemapGenerator::Utilities.assert_valid_keys(opts, @options)
|
8
9
|
|
9
|
-
|
10
|
+
@location = opts.delete(:location) || SitemapGenerator::SitemapLocation.new
|
11
|
+
@filename = "#{opts.fetch(:filename, :sitemap_index)}.xml.gz"
|
12
|
+
@location[:filename] = @filename
|
13
|
+
|
14
|
+
@link_count = 0
|
15
|
+
@sitemaps_link_count = 0
|
10
16
|
@xml_content = '' # XML urlset content
|
11
17
|
@xml_wrapper_start = <<-HTML
|
12
18
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -19,28 +25,38 @@ module SitemapGenerator
|
|
19
25
|
HTML
|
20
26
|
@xml_wrapper_start.gsub!(/\s+/, ' ').gsub!(/ *> */, '>').strip!
|
21
27
|
@xml_wrapper_end = %q[</sitemapindex>]
|
22
|
-
|
28
|
+
@filesize = bytesize(@xml_wrapper_start) + bytesize(@xml_wrapper_end)
|
23
29
|
end
|
24
30
|
|
25
31
|
# Finalize sitemaps as they are added to the index
|
26
32
|
def add(link, options={})
|
27
|
-
if link.is_a?(SitemapFile)
|
28
|
-
|
29
|
-
|
33
|
+
if file = link.is_a?(SitemapFile) && link
|
34
|
+
@sitemaps_link_count += file.link_count
|
35
|
+
file.finalize!
|
30
36
|
end
|
31
37
|
super(SitemapGenerator::Builder::SitemapIndexUrl.new(link, options))
|
32
38
|
end
|
33
39
|
|
34
40
|
# Return the total number of links in all sitemaps reference by this index file
|
35
41
|
def total_link_count
|
36
|
-
|
42
|
+
@sitemaps_link_count
|
43
|
+
end
|
44
|
+
|
45
|
+
# Set a new filename on the instance. Should not include any extensions e.g. :sitemap_index
|
46
|
+
def filename=(filename)
|
47
|
+
@filename = @location[:filename] = "#{filename}_index.xml.gz"
|
37
48
|
end
|
38
49
|
|
39
50
|
# Return a summary string
|
40
|
-
def summary
|
41
|
-
uncompressed_size = number_to_human_size(filesize) rescue "#{filesize / 8} KB"
|
42
|
-
compressed_size = number_to_human_size(
|
43
|
-
"+ #{'%-21s' %
|
51
|
+
def summary(opts={})
|
52
|
+
uncompressed_size = number_to_human_size(@filesize) rescue "#{@filesize / 8} KB"
|
53
|
+
compressed_size = number_to_human_size(@location.filesize) rescue "#{@location.filesize / 8} KB"
|
54
|
+
"+ #{'%-21s' % @location.path_in_public} #{'%10s' % @link_count} sitemaps / #{'%10s' % uncompressed_size} / #{'%10s' % compressed_size} gzipped"
|
55
|
+
end
|
56
|
+
|
57
|
+
def stats_summary(opts={})
|
58
|
+
str = "Sitemap stats: #{number_with_delimiter(@sitemaps_link_count)} links / #{@link_count} sitemaps"
|
59
|
+
str += " / %dm%02ds" % opts[:time_taken].divmod(60) if opts[:time_taken]
|
44
60
|
end
|
45
61
|
end
|
46
62
|
end
|
@@ -5,9 +5,9 @@ module SitemapGenerator
|
|
5
5
|
class SitemapIndexUrl < SitemapUrl
|
6
6
|
|
7
7
|
def initialize(path, options={})
|
8
|
-
if path.is_a?(SitemapGenerator::Builder::SitemapIndexFile)
|
9
|
-
options.reverse_merge!(:host =>
|
10
|
-
path =
|
8
|
+
if index = path.is_a?(SitemapGenerator::Builder::SitemapIndexFile) && path
|
9
|
+
options.reverse_merge!(:host => index.location.host, :lastmod => Time.now, :changefreq => 'always', :priority => 1.0)
|
10
|
+
path = index.location.path_in_public
|
11
11
|
super(path, options)
|
12
12
|
else
|
13
13
|
super
|
@@ -9,13 +9,13 @@ module SitemapGenerator
|
|
9
9
|
# sitemap - a Sitemap instance, or
|
10
10
|
# path, options - a path for the URL and options hash
|
11
11
|
def initialize(path, options={})
|
12
|
-
if path.is_a?(SitemapGenerator::Builder::SitemapFile)
|
13
|
-
options.reverse_merge!(:host =>
|
14
|
-
path =
|
12
|
+
if sitemap = path.is_a?(SitemapGenerator::Builder::SitemapFile) && path
|
13
|
+
options.reverse_merge!(:host => sitemap.location.host, :lastmod => sitemap.lastmod)
|
14
|
+
path = sitemap.location.path_in_public
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
options.reverse_merge!(:priority => 0.5, :changefreq => 'weekly', :lastmod => Time.now, :
|
17
|
+
SitemapGenerator::Utilities.assert_valid_keys(options, :priority, :changefreq, :lastmod, :host, :images, :video, :geo)
|
18
|
+
options.reverse_merge!(:priority => 0.5, :changefreq => 'weekly', :lastmod => Time.now, :images => [])
|
19
19
|
self.merge!(
|
20
20
|
:path => path,
|
21
21
|
:priority => options[:priority],
|
@@ -94,7 +94,7 @@ module SitemapGenerator
|
|
94
94
|
def prepare_images(images, host)
|
95
95
|
images.delete_if { |key,value| key[:loc] == nil }
|
96
96
|
images.each do |r|
|
97
|
-
|
97
|
+
SitemapGenerator::Utilities.assert_valid_keys(r, :loc, :caption, :geo_location, :title, :license)
|
98
98
|
r[:loc] = URI.join(host, r[:loc]).to_s
|
99
99
|
end
|
100
100
|
images[0..(SitemapGenerator::MAX_SITEMAP_IMAGES-1)]
|
@@ -6,9 +6,9 @@ module SitemapGenerator
|
|
6
6
|
# Rails URL helpers.
|
7
7
|
class Interpreter
|
8
8
|
|
9
|
-
if SitemapGenerator
|
9
|
+
if SitemapGenerator.app.rails3?
|
10
10
|
include ::Rails.application.routes.url_helpers
|
11
|
-
|
11
|
+
elsif SitemapGenerator.app.rails?
|
12
12
|
require 'action_controller'
|
13
13
|
include ActionController::UrlWriter
|
14
14
|
end
|
@@ -23,7 +23,7 @@ module SitemapGenerator
|
|
23
23
|
if block_given?
|
24
24
|
instance_eval(&block)
|
25
25
|
else
|
26
|
-
sitemap_config_file ||=
|
26
|
+
sitemap_config_file ||= SitemapGenerator.app.root + 'config/sitemap.rb'
|
27
27
|
eval(File.read(sitemap_config_file), nil, sitemap_config_file.to_s)
|
28
28
|
end
|
29
29
|
end
|
@@ -1,15 +1,12 @@
|
|
1
1
|
require 'builder'
|
2
|
-
require 'action_view'
|
3
2
|
|
4
3
|
# A LinkSet provisions a bunch of links to sitemap files. It also writes the index file
|
5
4
|
# which lists all the sitemap files written.
|
6
5
|
module SitemapGenerator
|
7
6
|
class LinkSet
|
8
|
-
include ActionView::Helpers::NumberHelper # for number_with_delimiter
|
9
7
|
|
10
|
-
attr_reader :default_host, :public_path, :sitemaps_path, :filename
|
11
|
-
attr_accessor :
|
12
|
-
attr_accessor :verbose, :yahoo_app_id
|
8
|
+
attr_reader :default_host, :public_path, :sitemaps_path, :filename, :sitemap, :location
|
9
|
+
attr_accessor :verbose, :yahoo_app_id, :include_root, :include_index
|
13
10
|
|
14
11
|
# Evaluate the sitemap config file and write all sitemaps.
|
15
12
|
#
|
@@ -21,85 +18,102 @@ module SitemapGenerator
|
|
21
18
|
def create(config_file = 'config/sitemap.rb', &block)
|
22
19
|
require 'sitemap_generator/interpreter'
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
self.sitemap_index = SitemapGenerator::Builder::SitemapIndexFile.new(@public_path, sitemap_index_path)
|
27
|
-
self.sitemap = SitemapGenerator::Builder::SitemapFile.new(@public_path, new_sitemap_path)
|
28
|
-
end
|
21
|
+
# Clear out the current objects. New objects will be lazy-initialized.
|
22
|
+
@sitemap_index = @sitemap = nil
|
29
23
|
|
24
|
+
start_time = Time.now
|
30
25
|
SitemapGenerator::Interpreter.new(self, config_file, &block)
|
31
|
-
|
32
|
-
|
33
|
-
puts self.sitemap.summary if verbose
|
34
|
-
end
|
35
|
-
self.sitemap_index.finalize!
|
26
|
+
finalize_sitemap
|
27
|
+
finalize_sitemap_index
|
36
28
|
end_time = Time.now
|
37
29
|
|
38
|
-
if verbose
|
39
|
-
puts self.sitemap_index.summary
|
40
|
-
puts "\nSitemap stats: #{number_with_delimiter(self.sitemap_index.total_link_count)} links / #{self.sitemap_index.sitemaps.size} sitemaps / " +
|
41
|
-
("%dm%02ds" % (end_time - start_time).divmod(60))
|
42
|
-
end
|
30
|
+
puts sitemap_index.stats_summary(:time_taken => end_time - start_time) if verbose
|
43
31
|
end
|
44
32
|
|
45
33
|
# Constructor
|
46
34
|
#
|
47
|
-
#
|
35
|
+
# Call with a hash of options. Options:
|
36
|
+
#
|
37
|
+
# <tt>public_path</tt> full path to the directory to write sitemaps in.
|
48
38
|
# Defaults to your Rails <tt>public/</tt> directory.
|
49
39
|
#
|
50
|
-
# <tt>sitemaps_path</tt>
|
40
|
+
# <tt>sitemaps_path</tt> path fragment within public to write sitemaps
|
51
41
|
# to e.g. 'en/'. Sitemaps are written to <tt>public_path</tt> + <tt>sitemaps_path</tt>
|
52
42
|
#
|
53
|
-
# <tt>default_host</tt>
|
43
|
+
# <tt>default_host</tt> host including protocol to use in all sitemap links
|
54
44
|
# e.g. http://en.google.ca
|
55
45
|
#
|
56
|
-
# <tt>filename</tt>
|
57
|
-
#
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
46
|
+
# <tt>filename</tt> symbol giving the base name for files (default <tt>:sitemap</tt>).
|
47
|
+
# The sitemap names are generated like "#{@filename}1.xml.gzip", "#{@filename}2.xml.gzip"
|
48
|
+
# and the index name is like "#{@filename}_index.xml.gzip".
|
49
|
+
#
|
50
|
+
# <tt>include_root</tt> whether to include the root url i.e. '/' in each group of sitemaps.
|
51
|
+
# Default is false.
|
52
|
+
#
|
53
|
+
# <tt>include_index</tt> whether to include the sitemap index URL in each group of sitemaps.
|
54
|
+
# Default is false.
|
55
|
+
def initialize(*args)
|
56
|
+
|
57
|
+
# Extract options
|
58
|
+
options = if (!args.first.nil? && !args.first.is_a?(Hash)) || args.size > 1
|
59
|
+
warn "Deprecated. Please call with an options hash instead."
|
60
|
+
[:public_path, :sitemaps_path, :default_host, :filename].each_with_index.inject({}) do |hash, arg|
|
61
|
+
hash[arg[0]] = args[arg[1]]
|
62
|
+
hash
|
63
|
+
end
|
64
|
+
else
|
65
|
+
args.first || {}
|
66
66
|
end
|
67
67
|
|
68
|
-
#
|
69
|
-
|
70
|
-
|
68
|
+
# Option defaults
|
69
|
+
options.reverse_merge!({
|
70
|
+
:include_root => true,
|
71
|
+
:include_index => true,
|
72
|
+
:filename => :sitemap,
|
73
|
+
:public_path => SitemapGenerator.app.root + 'public/',
|
74
|
+
:sitemaps_path => nil
|
75
|
+
})
|
76
|
+
options.each_pair { |k, v| instance_variable_set("@#{k}".to_sym, v) }
|
77
|
+
|
78
|
+
|
79
|
+
# Create a location object to store all the location options
|
80
|
+
@location = SitemapGenerator::SitemapLocation.new(
|
81
|
+
:sitemaps_path => @sitemaps_path,
|
82
|
+
:public_path => @public_path,
|
83
|
+
:host => @default_host
|
84
|
+
)
|
71
85
|
end
|
72
86
|
|
73
87
|
# Entry point for users.
|
74
88
|
#
|
75
89
|
# Called within the user's eval'ed sitemap config file. Add links to sitemap files
|
76
|
-
# passing a block.
|
90
|
+
# passing a block. This instance is passed in as an argument. You can call
|
91
|
+
# `add` on it to add links.
|
77
92
|
#
|
78
|
-
#
|
93
|
+
# Example:
|
94
|
+
# add_links do |sitemap|
|
95
|
+
# sitemap.add '/'
|
96
|
+
# end
|
79
97
|
def add_links
|
80
|
-
|
81
|
-
|
82
|
-
# Set default host on the sitemap objects and seed the sitemap with the default links
|
83
|
-
self.sitemap.hostname = self.sitemap_index.hostname = default_host
|
84
|
-
self.sitemap.add('/', :lastmod => Time.now, :changefreq => 'always', :priority => 1.0)
|
85
|
-
self.sitemap.add(self.sitemap_index, :lastmod => Time.now, :changefreq => 'always', :priority => 1.0)
|
86
|
-
|
98
|
+
sitemap.add('/', :lastmod => Time.now, :changefreq => 'always', :priority => 1.0, :host => @location.host) if include_root
|
99
|
+
sitemap.add(sitemap_index, :lastmod => Time.now, :changefreq => 'always', :priority => 1.0) if include_index
|
87
100
|
yield self
|
88
101
|
end
|
89
102
|
|
90
103
|
# Add a link to a Sitemap. If a new Sitemap is required, one will be created for
|
91
104
|
# you.
|
105
|
+
#
|
106
|
+
# link - string link e.g. '/merchant', '/article/1' or whatever.
|
107
|
+
# options - see README.
|
108
|
+
# host - host for the link, defaults to your <tt>default_host</tt>.
|
92
109
|
def add(link, options={})
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
self.sitemap = SitemapGenerator::Builder::SitemapFile.new(public_path, new_sitemap_path, default_host)
|
101
|
-
retry
|
102
|
-
end
|
110
|
+
sitemap.add(link, options.reverse_merge!(:host => @location.host))
|
111
|
+
rescue SitemapGenerator::SitemapFullError
|
112
|
+
finalize_sitemap
|
113
|
+
retry
|
114
|
+
rescue SitemapGenerator::SitemapFinalizedError
|
115
|
+
@sitemap = sitemap.next
|
116
|
+
retry
|
103
117
|
end
|
104
118
|
|
105
119
|
# Ping search engines.
|
@@ -108,7 +122,7 @@ module SitemapGenerator
|
|
108
122
|
def ping_search_engines
|
109
123
|
require 'open-uri'
|
110
124
|
|
111
|
-
sitemap_index_url = CGI.escape(
|
125
|
+
sitemap_index_url = CGI.escape(sitemap_index.location.url)
|
112
126
|
search_engines = {
|
113
127
|
:google => "http://www.google.com/webmasters/sitemaps/ping?sitemap=#{sitemap_index_url}",
|
114
128
|
:yahoo => "http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=#{sitemap_index_url}&appid=#{yahoo_app_id}",
|
@@ -140,49 +154,89 @@ module SitemapGenerator
|
|
140
154
|
end
|
141
155
|
end
|
142
156
|
|
157
|
+
# Return a count of the total number of links in all sitemaps
|
143
158
|
def link_count
|
144
|
-
|
159
|
+
sitemap_index.total_link_count
|
145
160
|
end
|
146
161
|
|
162
|
+
# Set the host name, including protocol, that will be used by default on each
|
163
|
+
# of your sitemap links. You can pass a different host in your options to `add`
|
164
|
+
# if you need to change it on a per-link basis.
|
147
165
|
def default_host=(value)
|
148
|
-
|
149
|
-
self.sitemap_index.hostname = value unless self.sitemap_index.finalized?
|
150
|
-
self.sitemap.hostname = value unless self.sitemap.finalized?
|
166
|
+
update_location_info(:host, value)
|
151
167
|
end
|
152
168
|
|
169
|
+
# Set the public_path. This path gives the location of your public directory.
|
170
|
+
# The default is the public/ directory in your Rails root. Or if Rails is not
|
171
|
+
# found, it defaults to public/ in the current directory (of the process).
|
172
|
+
#
|
173
|
+
# Example: 'tmp/' if you don't want to generate in public for some reason.
|
174
|
+
#
|
175
|
+
# Set to nil to use the current directory.
|
153
176
|
def public_path=(value)
|
154
|
-
|
155
|
-
self.sitemap_index.public_path = value unless self.sitemap_index.finalized?
|
156
|
-
self.sitemap.public_path = value unless self.sitemap.finalized?
|
177
|
+
update_location_info(:public_path, value)
|
157
178
|
end
|
158
179
|
|
180
|
+
# Set the sitemaps_path. This path gives the location to write sitemaps to
|
181
|
+
# relative to your public_path.
|
182
|
+
# Example: 'sitemaps/' to generate your sitemaps in 'public/sitemaps/'.
|
159
183
|
def sitemaps_path=(value)
|
160
|
-
|
161
|
-
self.sitemap_index.sitemap_path = sitemap_index_path unless self.sitemap_index.finalized?
|
162
|
-
self.sitemap.sitemap_path = new_sitemap_path unless self.sitemap.finalized?
|
184
|
+
update_location_info(:sitemaps_path, value)
|
163
185
|
end
|
164
186
|
|
187
|
+
# Set the filename base to use when generating sitemaps and sitemap indexes.
|
165
188
|
def filename=(value)
|
166
189
|
@filename = value
|
167
|
-
|
168
|
-
|
190
|
+
update_sitemap_info(:filename, value)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Lazy-initialize a sitemap instance when it's accessed
|
194
|
+
def sitemap
|
195
|
+
@sitemap ||= SitemapGenerator::Builder::SitemapFile.new(
|
196
|
+
:location => @location.dup,
|
197
|
+
:filename => @filename
|
198
|
+
)
|
199
|
+
end
|
200
|
+
|
201
|
+
# Lazy-initialize a sitemap index instance when it's accessed
|
202
|
+
def sitemap_index
|
203
|
+
@sitemap_index ||= SitemapGenerator::Builder::SitemapIndexFile.new(
|
204
|
+
:location => @location.dup,
|
205
|
+
:filename => "#{@filename}_index"
|
206
|
+
)
|
169
207
|
end
|
170
208
|
|
171
209
|
protected
|
172
210
|
|
173
|
-
#
|
174
|
-
#
|
175
|
-
|
176
|
-
|
177
|
-
|
211
|
+
# Finalize a sitemap by including it in the index and outputting a summary line.
|
212
|
+
# Do nothing if it has already been finalized.
|
213
|
+
def finalize_sitemap
|
214
|
+
return if sitemap.finalized?
|
215
|
+
sitemap_index.add(sitemap)
|
216
|
+
puts sitemap.summary if verbose
|
178
217
|
end
|
179
218
|
|
180
|
-
#
|
181
|
-
#
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
219
|
+
# Finalize a sitemap index and output a summary line. Do nothing if it has already
|
220
|
+
# been finalized.
|
221
|
+
def finalize_sitemap_index
|
222
|
+
return if sitemap_index.finalized?
|
223
|
+
sitemap_index.finalize!
|
224
|
+
puts sitemap_index.summary if verbose
|
225
|
+
end
|
226
|
+
|
227
|
+
# Update the given attribute on the current sitemap index and sitemap files. But
|
228
|
+
# don't create the index or sitemap files yet if they are not already created.
|
229
|
+
def update_sitemap_info(attribute, value)
|
230
|
+
sitemap_index.send("#{attribute}=", value) if @sitemap_index && !@sitemap_index.finalized?
|
231
|
+
sitemap.send("#{attribute}=", value) if @sitemap && !@sitemap.finalized?
|
232
|
+
end
|
233
|
+
|
234
|
+
# Update the given attribute on the current sitemap index and sitemap file location objects.
|
235
|
+
# But don't create the index or sitemap files yet if they are not already created.
|
236
|
+
def update_location_info(attribute, value)
|
237
|
+
@location.merge!(attribute => value)
|
238
|
+
sitemap_index.location.merge!(attribute => value) if @sitemap_index && !@sitemap_index.finalized?
|
239
|
+
sitemap.location.merge!(attribute => value) if @sitemap && !@sitemap.finalized?
|
186
240
|
end
|
187
241
|
end
|
188
242
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module SitemapGenerator
|
2
|
+
class SitemapLocation < Hash
|
3
|
+
|
4
|
+
[:filename, :host].each do |method|
|
5
|
+
define_method(method) do
|
6
|
+
raise SitemapGenerator::SitemapError, "No value set for #{method}" unless self[method]
|
7
|
+
self[method]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
[:public_path, :sitemaps_path].each do |method|
|
12
|
+
define_method(method) do
|
13
|
+
Pathname.new(self[method].nil? ? '' : self[method])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# The filename is not required at initialization but must be set when calling
|
18
|
+
# methods that depend on it like <tt>path</tt>.
|
19
|
+
#
|
20
|
+
# All options are optional. Supported options are:
|
21
|
+
# public_path - path to the "public" directory, or the directory you want to
|
22
|
+
# write sitemaps in. Default is a directory <tt>public/</tt>
|
23
|
+
# in the current working directory, or relative to the Rails root
|
24
|
+
# directory if running under Rails.
|
25
|
+
# sitemaps_path - gives the path relative to the <tt>public_path</tt> in which to
|
26
|
+
# write sitemaps e.g. <tt>sitemaps/</tt>.
|
27
|
+
# host - host name for URLs. The full URL to the file is then constructed from
|
28
|
+
# the <tt>host</tt>, <tt>sitemaps_path</tt> and <tt>filename</tt>
|
29
|
+
# filename - name of the file
|
30
|
+
def initialize(opts={})
|
31
|
+
SitemapGenerator::Utilities.assert_valid_keys(opts, [:public_path, :sitemaps_path, :host, :filename])
|
32
|
+
opts.reverse_merge!(
|
33
|
+
:sitemaps_path => nil,
|
34
|
+
:public_path => SitemapGenerator.app.root + 'public/',
|
35
|
+
:host => nil,
|
36
|
+
:filename => nil
|
37
|
+
)
|
38
|
+
self.merge!(opts)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Return a new Location instance with the given options merged in
|
42
|
+
def with(opts={})
|
43
|
+
self.merge(opts)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Full path to the directory of the file.
|
47
|
+
def directory
|
48
|
+
(public_path + sitemaps_path).to_s
|
49
|
+
end
|
50
|
+
|
51
|
+
# Full path of the file including the filename.
|
52
|
+
def path
|
53
|
+
(public_path + sitemaps_path + filename).to_s
|
54
|
+
end
|
55
|
+
|
56
|
+
# Relative path of the file (including the filename) relative to <tt>public_path</tt>
|
57
|
+
def path_in_public
|
58
|
+
(sitemaps_path + filename).to_s
|
59
|
+
end
|
60
|
+
|
61
|
+
# Full URL of the file.
|
62
|
+
def url
|
63
|
+
URI.join(host, sitemaps_path.to_s, filename.to_s).to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
# Return the size of the file at <tt>path</tt>
|
67
|
+
def filesize
|
68
|
+
File.size?(path)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module SitemapGenerator
|
2
|
+
# A poor excuse for an enumerator, but it will have to do.
|
3
|
+
# Return an object with a method `next` that generates sitemaps with the given name
|
4
|
+
# and an index appended.
|
5
|
+
#
|
6
|
+
# For example:
|
7
|
+
# SitemapNamer.new(:sitemap) generates 'sitemap1.xml.gz', 'sitemap2.xml.gz' etc
|
8
|
+
class SitemapNamer
|
9
|
+
# Params:
|
10
|
+
# name - string or symbol name that is the base of the generated filename
|
11
|
+
#
|
12
|
+
# Options include:
|
13
|
+
# :extension - Default: '.xml.gz'. File extension to append.
|
14
|
+
# :start - Default: 1. Index at which to start counting.
|
15
|
+
def initialize(name, options={});
|
16
|
+
@options = options.reverse_merge(
|
17
|
+
:extension => '.xml.gz',
|
18
|
+
:start => 1
|
19
|
+
)
|
20
|
+
@name = name
|
21
|
+
@count = @options[:start]
|
22
|
+
end
|
23
|
+
|
24
|
+
def next
|
25
|
+
"#{@name}#{@count}#{@options[:extension]}"
|
26
|
+
ensure
|
27
|
+
@count += 1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -4,35 +4,34 @@ module SitemapGenerator
|
|
4
4
|
|
5
5
|
# Copy templates/sitemap.rb to config if not there yet.
|
6
6
|
def install_sitemap_rb(verbose=false)
|
7
|
-
if File.exist?(
|
7
|
+
if File.exist?(SitemapGenerator.app.root + 'config/sitemap.rb')
|
8
8
|
puts "already exists: config/sitemap.rb, file not copied" if verbose
|
9
9
|
else
|
10
10
|
FileUtils.cp(
|
11
11
|
SitemapGenerator.templates.template_path(:sitemap_sample),
|
12
|
-
|
12
|
+
SitemapGenerator.app.root + 'config/sitemap.rb')
|
13
13
|
puts "created: config/sitemap.rb" if verbose
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
# Remove config/sitemap.rb if exists.
|
18
18
|
def uninstall_sitemap_rb
|
19
|
-
if File.exist?(
|
20
|
-
File.rm(
|
19
|
+
if File.exist?(SitemapGenerator.app.root + 'config/sitemap.rb')
|
20
|
+
File.rm(SitemapGenerator.app.root + 'config/sitemap.rb')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
# Clean sitemap files in output directory.
|
25
25
|
def clean_files
|
26
|
-
FileUtils.rm(Dir[
|
26
|
+
FileUtils.rm(Dir[SitemapGenerator.app.root + 'public/sitemap*.xml.gz'])
|
27
27
|
end
|
28
28
|
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
false # Rails.version defined in 2.1.0
|
29
|
+
# Validate all keys in a hash match *valid keys, raising ArgumentError on a
|
30
|
+
# mismatch. Note that keys are NOT treated indifferently, meaning if you use
|
31
|
+
# strings for keys but assert symbols as keys, this will fail.
|
32
|
+
def assert_valid_keys(hash, *valid_keys)
|
33
|
+
unknown_keys = hash.keys - [valid_keys].flatten
|
34
|
+
raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
|
36
35
|
end
|
37
36
|
end
|
38
|
-
end
|
37
|
+
end
|
metadata
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
name: sitemap_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
hash: 7
|
5
|
-
prerelease:
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 2
|
10
|
+
version: 1.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Karl Varga
|
@@ -16,14 +16,12 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-31 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
|
-
prerelease: false
|
24
23
|
type: :development
|
25
|
-
|
26
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
25
|
none: false
|
28
26
|
requirements:
|
29
27
|
- - ">="
|
@@ -32,12 +30,12 @@ dependencies:
|
|
32
30
|
segments:
|
33
31
|
- 0
|
34
32
|
version: "0"
|
35
|
-
|
36
|
-
|
33
|
+
name: rspec
|
34
|
+
version_requirements: *id001
|
37
35
|
prerelease: false
|
36
|
+
- !ruby/object:Gem::Dependency
|
38
37
|
type: :development
|
39
|
-
|
40
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
40
|
requirements:
|
43
41
|
- - ">="
|
@@ -46,12 +44,12 @@ dependencies:
|
|
46
44
|
segments:
|
47
45
|
- 0
|
48
46
|
version: "0"
|
49
|
-
|
50
|
-
|
47
|
+
name: nokogiri
|
48
|
+
version_requirements: *id002
|
51
49
|
prerelease: false
|
50
|
+
- !ruby/object:Gem::Dependency
|
52
51
|
type: :development
|
53
|
-
|
54
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
53
|
none: false
|
56
54
|
requirements:
|
57
55
|
- - ">="
|
@@ -60,12 +58,12 @@ dependencies:
|
|
60
58
|
segments:
|
61
59
|
- 0
|
62
60
|
version: "0"
|
63
|
-
|
64
|
-
|
61
|
+
name: sqlite3-ruby
|
62
|
+
version_requirements: *id003
|
65
63
|
prerelease: false
|
64
|
+
- !ruby/object:Gem::Dependency
|
66
65
|
type: :development
|
67
|
-
|
68
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
67
|
none: false
|
70
68
|
requirements:
|
71
69
|
- - ">="
|
@@ -74,12 +72,12 @@ dependencies:
|
|
74
72
|
segments:
|
75
73
|
- 0
|
76
74
|
version: "0"
|
77
|
-
|
78
|
-
|
75
|
+
name: jeweler
|
76
|
+
version_requirements: *id004
|
79
77
|
prerelease: false
|
78
|
+
- !ruby/object:Gem::Dependency
|
80
79
|
type: :development
|
81
|
-
|
82
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
83
81
|
none: false
|
84
82
|
requirements:
|
85
83
|
- - ">="
|
@@ -88,12 +86,12 @@ dependencies:
|
|
88
86
|
segments:
|
89
87
|
- 0
|
90
88
|
version: "0"
|
91
|
-
|
92
|
-
|
89
|
+
name: github
|
90
|
+
version_requirements: *id005
|
93
91
|
prerelease: false
|
92
|
+
- !ruby/object:Gem::Dependency
|
94
93
|
type: :development
|
95
|
-
|
96
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
95
|
none: false
|
98
96
|
requirements:
|
99
97
|
- - ">="
|
@@ -102,7 +100,9 @@ dependencies:
|
|
102
100
|
segments:
|
103
101
|
- 0
|
104
102
|
version: "0"
|
105
|
-
|
103
|
+
name: git
|
104
|
+
version_requirements: *id006
|
105
|
+
prerelease: false
|
106
106
|
description: SitemapGenerator is a Rails gem that makes it easy to generate enterprise-class Sitemaps readable by all search engines. Generated Sitemaps adhere to the Sitemap protocol specification. When you generate new Sitemaps, SitemapGenerator can automatically ping the major search engines (including Google, Yahoo and Bing) to notify them. SitemapGenerator includes rake tasks to easily manage your sitemaps.
|
107
107
|
email: kjvarga@gmail.com
|
108
108
|
executables: []
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- Rakefile
|
122
122
|
- VERSION
|
123
123
|
- lib/sitemap_generator.rb
|
124
|
+
- lib/sitemap_generator/application.rb
|
124
125
|
- lib/sitemap_generator/builder.rb
|
125
126
|
- lib/sitemap_generator/builder/sitemap_file.rb
|
126
127
|
- lib/sitemap_generator/builder/sitemap_index_file.rb
|
@@ -129,6 +130,8 @@ files:
|
|
129
130
|
- lib/sitemap_generator/interpreter.rb
|
130
131
|
- lib/sitemap_generator/link_set.rb
|
131
132
|
- lib/sitemap_generator/railtie.rb
|
133
|
+
- lib/sitemap_generator/sitemap_location.rb
|
134
|
+
- lib/sitemap_generator/sitemap_namer.rb
|
132
135
|
- lib/sitemap_generator/tasks.rb
|
133
136
|
- lib/sitemap_generator/templates.rb
|
134
137
|
- lib/sitemap_generator/utilities.rb
|
@@ -166,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
169
|
requirements: []
|
167
170
|
|
168
171
|
rubyforge_project:
|
169
|
-
rubygems_version: 1.
|
172
|
+
rubygems_version: 1.6.2
|
170
173
|
signing_key:
|
171
174
|
specification_version: 3
|
172
175
|
summary: Easily generate enterprise class Sitemaps for your Rails site using a familiar Rails Routes-like DSL
|