blacklight-sitemap 1.1.0 → 2.0.0

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 CHANGED
@@ -8,8 +8,7 @@ gem 'nokogiri'
8
8
  # Add dependencies to develop your gem here.
9
9
  # Include everything needed to run rake, tests, features, etc.
10
10
  group :development do
11
- gem "rspec", "~> 2.1.0"
12
- gem "bundler", "~> 1.0.0"
13
- gem "jeweler", "~> 1.5.1"
11
+ gem "rspec", "~> 2.13.0"
12
+ gem "jeweler", "~> 1.8.4"
14
13
  gem "rcov", ">= 0"
15
14
  end
@@ -1,30 +1,33 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.1.2)
4
+ diff-lcs (1.2.1)
5
5
  git (1.2.5)
6
- jeweler (1.5.1)
7
- bundler (~> 1.0.0)
6
+ jeweler (1.8.4)
7
+ bundler (~> 1.0)
8
8
  git (>= 1.2.5)
9
9
  rake
10
+ rdoc
11
+ json (1.7.7)
10
12
  nokogiri (1.4.4)
11
- rake (0.8.7)
13
+ rake (10.0.3)
12
14
  rcov (0.9.9)
13
- rspec (2.1.0)
14
- rspec-core (~> 2.1.0)
15
- rspec-expectations (~> 2.1.0)
16
- rspec-mocks (~> 2.1.0)
17
- rspec-core (2.1.0)
18
- rspec-expectations (2.1.0)
19
- diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.1.0)
15
+ rdoc (4.0.0)
16
+ json (~> 1.4)
17
+ rspec (2.13.0)
18
+ rspec-core (~> 2.13.0)
19
+ rspec-expectations (~> 2.13.0)
20
+ rspec-mocks (~> 2.13.0)
21
+ rspec-core (2.13.0)
22
+ rspec-expectations (2.13.0)
23
+ diff-lcs (>= 1.1.3, < 2.0)
24
+ rspec-mocks (2.13.0)
21
25
 
22
26
  PLATFORMS
23
27
  ruby
24
28
 
25
29
  DEPENDENCIES
26
- bundler (~> 1.0.0)
27
- jeweler (~> 1.5.1)
30
+ jeweler (~> 1.8.4)
28
31
  nokogiri
29
32
  rcov
30
- rspec (~> 2.1.0)
33
+ rspec (~> 2.13.0)
@@ -4,11 +4,10 @@ Rake task for creating a sitemap from a Blacklight Solr index.
4
4
 
5
5
  == Installation
6
6
 
7
- * This version only works with Rails 3/Blacklight 3. For Blacklight versions 2.x, try v0.0.5
8
- of this gem.
7
+ * This version only works with Rails 3.2/Blacklight 4. Some changes to how Blacklight is configured and how it communicates with Solr mean that it will currently only work with Blacklight 4 using the standard CatalogController.
9
8
 
10
9
  * In Gemfile
11
- gem 'blacklight-sitemap', '~> 1.0.0'
10
+ gem 'blacklight-sitemap', '~> 2.0.0'
12
11
 
13
12
  * Install the gem:
14
13
  bundle install
data/Rakefile CHANGED
@@ -40,8 +40,8 @@ end
40
40
 
41
41
  task :default => :spec
42
42
 
43
- require 'rake/rdoctask'
44
- Rake::RDocTask.new do |rdoc|
43
+ require 'rdoc/task'
44
+ RDoc::Task.new do |rdoc|
45
45
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
46
 
47
47
  rdoc.rdoc_dir = 'rdoc'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 2.0.0
@@ -74,10 +74,13 @@ module Rake
74
74
  #collect warnings here rather than raise an error
75
75
  warnings = []
76
76
 
77
+ blacklight_config = CatalogController.blacklight_config
78
+
77
79
  puts 'Creating a sitemap...'
78
80
  fl = ['id', @lastmod_field, @priority_field].compact.join(',')
79
81
  base_solr_parameters = {:qt => @qt, :fq => 'id:[* TO *]', :fl => fl}
80
- number_of_resources = Blacklight.solr.find(base_solr_parameters.merge(:rows => 1))['response']['numFound']
82
+ response = Blacklight.solr.get(blacklight_config.solr_path, :params => base_solr_parameters.merge(:rows => 1))
83
+ number_of_resources = response['response']['numFound']
81
84
  puts 'Number of resources: ' + number_of_resources.to_s
82
85
  batches = (number_of_resources / @max.to_f).ceil
83
86
  puts 'Total sitemap to create: ' + batches.to_s
@@ -93,7 +96,7 @@ module Rake
93
96
  current_page = batch_number + 1
94
97
  start = batch_number * @max
95
98
  puts 'Processing batch # ' + current_page.to_s
96
- response = Blacklight.solr.find(base_solr_parameters.merge(:rows => @max, :start => start))['response']
99
+ response = Blacklight.solr.get(blacklight_config.solr_path, :params => base_solr_parameters.merge(:rows => @max, :start => start))['response']
97
100
  sitemap_builder = Nokogiri::XML::Builder.new do |xml|
98
101
  xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
99
102
  response['docs'].each do |doc|
metadata CHANGED
@@ -1,109 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: blacklight-sitemap
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 1
9
- - 0
10
- version: 1.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jason Ronallo
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-09-26 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- type: :runtime
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
32
15
  name: nokogiri
33
- version_requirements: *id001
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
34
23
  prerelease: false
35
- - !ruby/object:Gem::Dependency
36
- type: :development
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
38
25
  none: false
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 11
43
- segments:
44
- - 2
45
- - 1
46
- - 0
47
- version: 2.1.0
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
48
31
  name: rspec
49
- version_requirements: *id002
50
- prerelease: false
51
- - !ruby/object:Gem::Dependency
52
- type: :development
53
- requirement: &id003 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
54
33
  none: false
55
- requirements:
34
+ requirements:
56
35
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 23
59
- segments:
60
- - 1
61
- - 0
62
- - 0
63
- version: 1.0.0
64
- name: bundler
65
- version_requirements: *id003
66
- prerelease: false
67
- - !ruby/object:Gem::Dependency
36
+ - !ruby/object:Gem::Version
37
+ version: 2.13.0
68
38
  type: :development
69
- requirement: &id004 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
70
41
  none: false
71
- requirements:
42
+ requirements:
72
43
  - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 1
75
- segments:
76
- - 1
77
- - 5
78
- - 1
79
- version: 1.5.1
44
+ - !ruby/object:Gem::Version
45
+ version: 2.13.0
46
+ - !ruby/object:Gem::Dependency
80
47
  name: jeweler
81
- version_requirements: *id004
82
- prerelease: false
83
- - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.4
84
54
  type: :development
85
- requirement: &id005 !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
86
57
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 3
91
- segments:
92
- - 0
93
- version: "0"
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.4
62
+ - !ruby/object:Gem::Dependency
94
63
  name: rcov
95
- version_requirements: *id005
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
96
71
  prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
97
78
  description: Blacklight sitemap rake task.
98
79
  email: jronallo@gmail.com
99
80
  executables: []
100
-
101
81
  extensions: []
102
-
103
- extra_rdoc_files:
82
+ extra_rdoc_files:
104
83
  - LICENSE.txt
105
84
  - README.rdoc
106
- files:
85
+ files:
107
86
  - Gemfile
108
87
  - Gemfile.lock
109
88
  - LICENSE.txt
@@ -113,42 +92,32 @@ files:
113
92
  - lib/blacklight-sitemap.rb
114
93
  - lib/rails/generators/blacklight/sitemap/sitemap_generator.rb
115
94
  - lib/rails/generators/blacklight/sitemap/templates/default_rake_task.rb
116
- - spec/blacklight-sitemap_spec.rb
117
- - spec/spec_helper.rb
118
- has_rdoc: true
119
95
  homepage: http://github.com/jronallo/blacklight-sitemap
120
- licenses:
96
+ licenses:
121
97
  - MIT
122
98
  post_install_message:
123
99
  rdoc_options: []
124
-
125
- require_paths:
100
+ require_paths:
126
101
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
102
+ required_ruby_version: !ruby/object:Gem::Requirement
128
103
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ segments:
134
109
  - 0
135
- version: "0"
136
- required_rubygems_version: !ruby/object:Gem::Requirement
110
+ hash: 1405675366613807619
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
112
  none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
145
117
  requirements: []
146
-
147
118
  rubyforge_project:
148
- rubygems_version: 1.6.2
119
+ rubygems_version: 1.8.24
149
120
  signing_key:
150
121
  specification_version: 3
151
122
  summary: Blacklight sitemap rake task.
152
- test_files:
153
- - spec/blacklight-sitemap_spec.rb
154
- - spec/spec_helper.rb
123
+ test_files: []
@@ -1,118 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "BlacklightSitemap" do
4
- before(:all) do
5
- @default_task = Rake::BlacklightSitemapTask.new
6
- end
7
-
8
- it 'should create a default task which clobbers then creates' do
9
- Rake::BlacklightSitemapTask.new
10
- Rake::Task['blacklight:sitemap'].should be_a_kind_of Rake::Task
11
- end
12
-
13
- it "should create the sitemap creation task" do
14
- Rake::BlacklightSitemapTask.new
15
- Rake::Task['blacklight:sitemap:create'].should be_a_kind_of Rake::Task
16
- end
17
-
18
- it "should be able to have the resource url attribute" do
19
- task = Rake::BlacklightSitemapTask.new do |sm|
20
- sm.resource_url = 'http://example.com/catalog'
21
- end
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')
30
- end
31
-
32
- it 'should have a base_filename attribute' do
33
- @default_task.base_filename.should eq('blacklight')
34
- end
35
-
36
- it 'should allow for changing the base_filename attribute' do
37
- task = Rake::BlacklightSitemapTask.new do |sm|
38
- sm.base_filename = 'bl'
39
- end
40
- task.base_filename.should eq('bl')
41
- end
42
-
43
- it 'should store a value for whether to gzip or not' do
44
- task = Rake::BlacklightSitemapTask.new do |sm|
45
- sm.gzip = true
46
- end
47
- task.gzip.should be_true
48
- end
49
-
50
- it 'should have a default nil value for changefreq' do
51
- @default_task.changefreq.should be_nil
52
- end
53
-
54
- it 'should allow for changing the changefreq value' do
55
- task = Rake::BlacklightSitemapTask.new do |sm|
56
- sm.changefreq = 'never'
57
- end
58
- task.changefreq.should eq('never')
59
- end
60
-
61
- it 'should set the ceiling to 50,000 as a default' do
62
- @default_task.max.should == 50000
63
- end
64
-
65
- it 'should allow the ceiling to be set to a different value' do
66
- task = Rake::BlacklightSitemapTask.new do |sm|
67
- sm.max = 50
68
- end
69
- task.max.should == 50
70
- end
71
-
72
- it 'should have a default value for the lastmod_field' do
73
- @default_task.lastmod_field.should eq('timestamp')
74
- end
75
-
76
- it 'should allow a new value for lastmod_field' do
77
- task = Rake::BlacklightSitemapTask.new do |sm|
78
- sm.lastmod_field = 'date_created'
79
- end
80
- task.lastmod_field.should eq('date_created')
81
- end
82
-
83
- it 'should have a default value for the priority_field' do
84
- @default_task.priority_field.should be_nil
85
- end
86
-
87
- it 'should allow a new value for priority_field' do
88
- task = Rake::BlacklightSitemapTask.new do |sm|
89
- sm.priority_field = 'priority'
90
- end
91
- task.priority_field.should eq('priority')
92
- end
93
-
94
- it 'should have a default value for sorting the Solr query' do
95
- @default_task.sort.should eq('_docid_ asc')
96
- end
97
-
98
- it 'should be able to set a new value for sort' do
99
- task = Rake::BlacklightSitemapTask.new do |sm|
100
- sm.sort = 'timestamp asc'
101
- end
102
- task.sort.should eq('timestamp asc')
103
- end
104
-
105
- it 'should be able to set a new value for qt' do
106
- task = Rake::BlacklightSitemapTask.new do |sm|
107
- sm.qt = 'bozart'
108
- end
109
- task.qt.should eq('bozart')
110
- end
111
-
112
- it 'should create the sitemap clobber task' do
113
- Rake::BlacklightSitemapTask.new
114
- Rake::Task['blacklight:sitemap:clobber'].should be_a_kind_of Rake::Task
115
- end
116
-
117
- end
118
-
@@ -1,12 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'blacklight-sitemap'
5
-
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
-
10
- RSpec.configure do |config|
11
-
12
- end