blacklight-sitemap 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/blacklight-sitemap.rb +13 -1
  3. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -55,6 +55,10 @@ module Rake
55
55
  desc 'create a sitemap for blacklight'
56
56
  task :create => :environment do
57
57
  start_time = Time.now
58
+
59
+ #collect warnings here rather than raise an error
60
+ warnings = []
61
+
58
62
  puts 'Creating a sitemap...'
59
63
  fl = ['id', @lastmod_field, @priority_field].compact.join(',')
60
64
  base_solr_parameters = {:qt => 'standard', :q => 'id:[* TO *]', :fl => fl}
@@ -97,6 +101,9 @@ module Rake
97
101
  File.open(sitemap_filename, 'w') do |fh|
98
102
  fh.puts sitemap_builder.to_xml
99
103
  end
104
+ if File.size(sitemap_filename) > 10485760
105
+ warnings << 'WARNING Sitemap is over 10MB limit: ' + sitemap_filename
106
+ end
100
107
  if @gzip
101
108
  `gzip #{sitemap_filename}`
102
109
  end
@@ -119,14 +126,19 @@ module Rake
119
126
  end
120
127
  end
121
128
  end #sitemap_index_builder
122
- File.open(File.join(RAILS_ROOT, 'public', @base_filename + '-sitemap.xml'), 'w') do |fh|
129
+ index_sitemap_filename = File.join(RAILS_ROOT, 'public', @base_filename + '-sitemap.xml')
130
+ File.open(index_sitemap_filename, 'w') do |fh|
123
131
  fh.puts sitemap_index_builder.to_xml
124
132
  end
133
+ if File.size(index_sitemap_filename) > 10485760
134
+ warnings << 'WARNING Index sitemap is over 10MB limit: ' + index_sitemap_filename
135
+ end
125
136
  puts 'Done.'
126
137
  end_time = Time.now
127
138
  puts 'Create start time: ' + start_time.to_s
128
139
  puts 'Create end time: ' + end_time.to_s
129
140
  puts 'Execution time in seconds: ' + (end_time - start_time).to_s
141
+ puts warnings.join("\n")
130
142
  end # task :sitemap
131
143
 
132
144
  desc 'clobber sitemap files'
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
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-04 00:00:00 -05:00
18
+ date: 2010-12-05 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency