blacklight-sitemap 0.0.2 → 0.0.3
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/README.rdoc +12 -6
- data/VERSION +1 -1
- data/generators/blacklight_sitemap/blacklight_sitemap_generator.rb +3 -0
- data/lib/blacklight-sitemap.rb +5 -2
- data/spec/blacklight-sitemap_spec.rb +11 -0
- metadata +4 -4
data/README.rdoc
CHANGED
|
@@ -4,26 +4,32 @@ Rake task for creating a sitemap from a Blacklight Solr index.
|
|
|
4
4
|
|
|
5
5
|
== Installation
|
|
6
6
|
|
|
7
|
-
In config/environment.rb add:
|
|
7
|
+
* In config/environment.rb add:
|
|
8
8
|
config.gem 'blacklight-sitemap'
|
|
9
9
|
|
|
10
|
-
Install the gem:
|
|
10
|
+
* Install the gem:
|
|
11
11
|
rake gems:install
|
|
12
12
|
or
|
|
13
13
|
gem install blacklight-sitemap
|
|
14
14
|
|
|
15
|
-
Run the generator:
|
|
15
|
+
* Run the generator:
|
|
16
16
|
script/generate blacklight_sitemap
|
|
17
17
|
|
|
18
|
-
Open your Rakefile and edit the BlacklightSitemapTask to your liking using the
|
|
18
|
+
* Open your Rakefile and edit the BlacklightSitemapTask to your liking using the
|
|
19
19
|
provided documentation.
|
|
20
20
|
|
|
21
|
-
Run the rake task:
|
|
21
|
+
* Run the rake task:
|
|
22
22
|
rake blacklight:sitemap
|
|
23
23
|
|
|
24
|
-
Remove
|
|
24
|
+
* Remove created sitemap files:
|
|
25
25
|
rake blacklight:sitemap:clobber
|
|
26
26
|
|
|
27
|
+
== Upgrading
|
|
28
|
+
|
|
29
|
+
* Either remove your current blacklight-sitemap from your Rakefile or comment it out.
|
|
30
|
+
* Install the latest gem. You may need to update the version in your cofig/environment.rb
|
|
31
|
+
* Run the generator again.
|
|
32
|
+
|
|
27
33
|
|
|
28
34
|
== TODO
|
|
29
35
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.3
|
|
@@ -33,6 +33,9 @@ Rake::BlacklightSitemapTask.new do |sm|
|
|
|
33
33
|
|
|
34
34
|
# Solr field used to retrieve from a document the value for the priority element for a url
|
|
35
35
|
# sm.priority_field = nil
|
|
36
|
+
|
|
37
|
+
# Solr query sort parameter
|
|
38
|
+
# sm.sort = '_docid_ asc'
|
|
36
39
|
end
|
|
37
40
|
EOF
|
|
38
41
|
rakefile = File.read('Rakefile')
|
data/lib/blacklight-sitemap.rb
CHANGED
|
@@ -29,15 +29,18 @@ module Rake
|
|
|
29
29
|
# Solr field to use to provide a priority for this resource
|
|
30
30
|
attr_accessor :priority_field
|
|
31
31
|
|
|
32
|
+
# Solr sort option
|
|
33
|
+
attr_accessor :sort
|
|
32
34
|
|
|
33
35
|
def initialize
|
|
34
|
-
@url = 'http://localhost:3000'
|
|
36
|
+
@url = 'http://localhost:3000/catalog'
|
|
35
37
|
@base_filename = 'blacklight'
|
|
36
38
|
@gzip = false
|
|
37
39
|
@changefreq = nil
|
|
38
40
|
@max = 50000 #default value for max number of locs per sitemap file
|
|
39
41
|
@lastmod_field = 'timestamp'
|
|
40
42
|
@priority_field = nil
|
|
43
|
+
@sort = '_docid_ asc'
|
|
41
44
|
yield self if block_given?
|
|
42
45
|
define
|
|
43
46
|
end
|
|
@@ -60,7 +63,7 @@ module Rake
|
|
|
60
63
|
batches = (number_of_resources / @max.to_f).ceil
|
|
61
64
|
puts 'Total sitemap to create: ' + batches.to_s
|
|
62
65
|
master_sitemap = ''
|
|
63
|
-
|
|
66
|
+
base_solr_parameters.merge!(:sort => @sort) if @sort
|
|
64
67
|
batches.times do |batch_number|
|
|
65
68
|
current_page = batch_number + 1
|
|
66
69
|
start = batch_number * @max
|
|
@@ -84,6 +84,17 @@ describe "BlacklightSitemap" do
|
|
|
84
84
|
task.priority_field.should eq('priority')
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
it 'should have a default value for sorting the Solr query' do
|
|
88
|
+
@default_task.sort.should eq('_docid_ asc')
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'should be able to set a new value for sort' do
|
|
92
|
+
task = Rake::BlacklightSitemapTask.new do |sm|
|
|
93
|
+
sm.sort = 'timestamp asc'
|
|
94
|
+
end
|
|
95
|
+
task.sort.should eq('timestamp asc')
|
|
96
|
+
end
|
|
97
|
+
|
|
87
98
|
it 'should create the sitemap clobber task' do
|
|
88
99
|
Rake::BlacklightSitemapTask.new
|
|
89
100
|
Rake::Task['blacklight:sitemap:clobber'].should be_a_kind_of Rake::Task
|
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: 25
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.0.3
|
|
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: 2010-12-
|
|
18
|
+
date: 2010-12-04 00:00:00 -05:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|