blacklight-sitemap 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
diff-lcs (1.1.
|
4
|
+
diff-lcs (1.1.2)
|
5
5
|
git (1.2.5)
|
6
|
-
jeweler (1.5.
|
6
|
+
jeweler (1.5.1)
|
7
7
|
bundler (~> 1.0.0)
|
8
8
|
git (>= 1.2.5)
|
9
9
|
rake
|
10
|
-
nokogiri (1.
|
11
|
-
rake (0.
|
12
|
-
rcov (0.9.
|
10
|
+
nokogiri (1.4.4)
|
11
|
+
rake (0.8.7)
|
12
|
+
rcov (0.9.9)
|
13
13
|
rspec (2.1.0)
|
14
14
|
rspec-core (~> 2.1.0)
|
15
15
|
rspec-expectations (~> 2.1.0)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/blacklight-sitemap.rb
CHANGED
@@ -11,8 +11,11 @@ end
|
|
11
11
|
|
12
12
|
module Rake
|
13
13
|
class BlacklightSitemapTask
|
14
|
-
# base url used for
|
15
|
-
attr_accessor :
|
14
|
+
# base url used for locations of resources
|
15
|
+
attr_accessor :resource_url
|
16
|
+
|
17
|
+
# base url used for public directory where sitemaps will be placed
|
18
|
+
attr_accessor :public_url
|
16
19
|
|
17
20
|
# base filename to use for sitemap in case these will be moved to a location
|
18
21
|
# that hosts other sitemaps so these sitemaps do not overwrite others
|
@@ -42,7 +45,9 @@ module Rake
|
|
42
45
|
attr_accessor :qt
|
43
46
|
|
44
47
|
def initialize
|
45
|
-
@
|
48
|
+
@resource_url = 'http://localhost:3000/catalog'
|
49
|
+
@public_url = 'http://localhost:3000'
|
50
|
+
|
46
51
|
@base_filename = 'blacklight'
|
47
52
|
@gzip = false
|
48
53
|
@changefreq = nil
|
@@ -94,7 +99,7 @@ module Rake
|
|
94
99
|
response['docs'].each do |doc|
|
95
100
|
xml.url do
|
96
101
|
# FIXME through config
|
97
|
-
xml.loc File.join(@
|
102
|
+
xml.loc File.join(@resource_url.to_s, doc['id'])
|
98
103
|
if @lastmod_field and doc[@lastmod_field]
|
99
104
|
xml.lastmod doc[@lastmod_field].to_s
|
100
105
|
if batch_lastmods[batch_number].blank? or batch_lastmods[batch_number] < doc[@lastmod_field]
|
@@ -123,7 +128,7 @@ module Rake
|
|
123
128
|
sitemap_index_builder = Nokogiri::XML::Builder.new do |xml|
|
124
129
|
xml.sitemapindex 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
|
125
130
|
batches.times do |batch|
|
126
|
-
sitemap_filename = File.join(@
|
131
|
+
sitemap_filename = File.join(@public_url.to_s, @base_filename + '-sitemap' + batch.to_s + '.xml')
|
127
132
|
sitemap_filename << '.gz' if @gzip
|
128
133
|
xml.sitemap{
|
129
134
|
xml.loc sitemap_filename
|
@@ -2,8 +2,13 @@ require 'blacklight-sitemap'
|
|
2
2
|
Rake::BlacklightSitemapTask.new do |sm|
|
3
3
|
# below are configuration options with their default values shown.
|
4
4
|
|
5
|
-
# FIXME: you'll definitely want to change the
|
6
|
-
#
|
5
|
+
# FIXME: you'll definitely want to change the resource_url value
|
6
|
+
# base url for resources
|
7
|
+
# sm.resource_url = 'http://localhost:3000/catalog'
|
8
|
+
|
9
|
+
# FIXME: you'll definitely want to change the public_url value
|
10
|
+
# base url for public directory of application where sitemaps will be placed
|
11
|
+
# sm.public_url = 'http://localhost:3000'
|
7
12
|
|
8
13
|
# base filename given to generated sitemap files
|
9
14
|
# sm.base_filename = 'blacklight'
|
@@ -15,11 +15,18 @@ describe "BlacklightSitemap" do
|
|
15
15
|
Rake::Task['blacklight:sitemap:create'].should be_a_kind_of Rake::Task
|
16
16
|
end
|
17
17
|
|
18
|
-
it "should be able to have the url attribute" do
|
18
|
+
it "should be able to have the resource url attribute" do
|
19
19
|
task = Rake::BlacklightSitemapTask.new do |sm|
|
20
|
-
sm.
|
20
|
+
sm.resource_url = 'http://example.com/catalog'
|
21
21
|
end
|
22
|
-
task.
|
22
|
+
task.resource_url.should eq('http://example.com/catalog')
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should have the public URL for storing the sitemaps" do
|
26
|
+
task = Rake::BlacklightSitemapTask.new do |sm|
|
27
|
+
sm.public_url = 'http://example.com'
|
28
|
+
end
|
29
|
+
task.public_url.should eq('http://example.com')
|
23
30
|
end
|
24
31
|
|
25
32
|
it 'should have a base_filename attribute' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-sitemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason Ronallo
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-26 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|