geoblacklight_sidecar_images 0.6.2 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +51 -3
- data/Rakefile +2 -5
- data/app/services/geoblacklight_sidecar_images/image_service.rb +1 -5
- data/geoblacklight_sidecar_images.gemspec +2 -1
- data/lib/geoblacklight_sidecar_images/version.rb +1 -1
- data/lib/tasks/geoblacklight_sidecar_images_tasks.rake +1 -1
- data/spec/services/image_service_spec.rb +1 -2
- metadata +21 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ae3e9ab51f23610aac2e673df45127839969fd50605b78754d5e7ce6a5f7301
|
4
|
+
data.tar.gz: ec8d5992aa11cec13dc91cb307207186def7113f0079ebf8cca95ec13c1eb410
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 017b1d571f0589de1e0e28188fa1c2536bf3889fde482293bd7e2f0c3c04fd86facea0ba7b5c2c2eafff863361b17ba58919bfd6f0d063ea8fb94c0ea91f133d
|
7
|
+
data.tar.gz: 570c963adb6102ab3d8576c78e07b809053713d0fa8685c3e81ea0cddf7db48d1859bd35228bc493fa36a5c4c19887c018bb6616260f08c58ee07519fc558922
|
data/README.md
CHANGED
@@ -7,6 +7,12 @@
|
|
7
7
|
|
8
8
|
Store local copies of remote imagery in GeoBlacklight.
|
9
9
|
|
10
|
+
* [Requirements](#requirements)
|
11
|
+
* [Installation](#installation)
|
12
|
+
* [Rake Tasks](#rake-tasks)
|
13
|
+
* [View Customization](#view-customization)
|
14
|
+
* [Development](#development)
|
15
|
+
|
10
16
|
## Description
|
11
17
|
This GeoBlacklight plugin captures remote images from geographic web services and saves them locally. It borrows the concept of a [SolrDocumentSidecar](https://github.com/projectblacklight/spotlight/blob/master/app/models/spotlight/solr_document_sidecar.rb) from [Spotlight](https://github.com/projectblacklight/spotlight), to have an ActiveRecord-based "sidecar" to match each non-AR SolrDocument. This allows us to use [ActiveStorage](https://github.com/rails/rails/tree/master/activestorage) to attach images to our solr documents.
|
12
18
|
|
@@ -19,7 +25,7 @@ This GeoBlacklight plugin captures remote images from geographic web services an
|
|
19
25
|
* [GeoBlacklight](https://github.com/geoblacklight/geoblacklight)
|
20
26
|
* [ImageMagick](https://github.com/ImageMagick/ImageMagick)
|
21
27
|
|
22
|
-
|
28
|
+
### Suggested
|
23
29
|
|
24
30
|
* Background Job Processor
|
25
31
|
|
@@ -47,6 +53,23 @@ Run the database migration.
|
|
47
53
|
$ bin/rails db:migrate
|
48
54
|
```
|
49
55
|
|
56
|
+
Complete any necessary [Active Storage setup](https://edgeguides.rubyonrails.org/active_storage_overview.html#setup) steps, for example:
|
57
|
+
|
58
|
+
1. Add a config/storage.yml file
|
59
|
+
|
60
|
+
```
|
61
|
+
local:
|
62
|
+
service: Disk
|
63
|
+
root: <%= Rails.root.join("storage") %>
|
64
|
+
```
|
65
|
+
|
66
|
+
2. Add config/environments declarations, development.rb for example:
|
67
|
+
|
68
|
+
```
|
69
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
70
|
+
config.active_storage.service = :local
|
71
|
+
```
|
72
|
+
|
50
73
|
### New GeoBlacklight Instance
|
51
74
|
|
52
75
|
Create a new GeoBlacklight instance with the GBLSI code
|
@@ -182,7 +205,9 @@ Then you can edit your GeoBlacklight settings.yml file to point at that solr fie
|
|
182
205
|
|
183
206
|
## View customization
|
184
207
|
|
185
|
-
|
208
|
+
Use basic Active Storage patterns to display imagery in your application.
|
209
|
+
|
210
|
+
### Example Methods
|
186
211
|
|
187
212
|
```ruby
|
188
213
|
# Is there an image?
|
@@ -196,7 +221,30 @@ document.sidecar.image.variable?
|
|
196
221
|
|
197
222
|
```
|
198
223
|
|
199
|
-
|
224
|
+
### Search results
|
225
|
+
|
226
|
+
This GBL plugin includes a custom [catalog/_index_split_default.html.erb file](https://github.com/geoblacklight/geoblacklight_sidecar_images/blob/develop/lib/generators/geoblacklight_sidecar_images/templates/views/catalog/_index_split_default.html.erb). Look there for examples on calling the image method.
|
227
|
+
|
228
|
+
### Show pages
|
229
|
+
|
230
|
+
Example for adding a thumbnail to the show page sidebar.
|
231
|
+
|
232
|
+
*catalog/_show_sidebar.html.erb*
|
233
|
+
|
234
|
+
```ruby
|
235
|
+
# Add to end of file
|
236
|
+
<% if @document.sidecar.image.attached? %>
|
237
|
+
<% if @document.sidecar.image.variable? %>
|
238
|
+
<div class="card">
|
239
|
+
<div class="card-header">Thumbnail</div>
|
240
|
+
<div class="card-body">
|
241
|
+
<%= image_tag @document.sidecar.image.variant(resize: "200"), {class: 'mr-3'} %>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
<% end %>
|
245
|
+
<% end %>
|
246
|
+
|
247
|
+
```
|
200
248
|
|
201
249
|
## Development
|
202
250
|
|
data/Rakefile
CHANGED
@@ -16,17 +16,14 @@ RSpec::Core::RakeTask.new(:spec)
|
|
16
16
|
require 'rubocop/rake_task'
|
17
17
|
RuboCop::RakeTask.new(:rubocop)
|
18
18
|
|
19
|
+
require 'solr_wrapper/rake_task'
|
19
20
|
require 'engine_cart/rake_task'
|
20
21
|
require 'geoblacklight_sidecar_images/version'
|
21
22
|
|
22
23
|
task ci: ['engine_cart:generate'] do
|
23
24
|
ENV['environment'] = 'test'
|
24
|
-
|
25
|
-
SolrWrapper.wrap(port: '8983') do |solr|
|
25
|
+
SolrWrapper.wrap do |solr|
|
26
26
|
solr.with_collection(name: 'blacklight-core', dir: File.join(__dir__, 'solr', 'conf')) do
|
27
|
-
# Fixtures here
|
28
|
-
# Rake::Task['spotlight:fixtures'].invoke
|
29
|
-
|
30
27
|
# run the tests
|
31
28
|
Rake::Task['spec'].invoke
|
32
29
|
end
|
@@ -53,7 +53,6 @@ module GeoblacklightSidecarImages
|
|
53
53
|
def image_tempfile(document_id)
|
54
54
|
@metadata['viewer_protocol'] = @document.viewer_protocol
|
55
55
|
@metadata['image_url'] = image_url
|
56
|
-
@metadata['service_url'] = service_url
|
57
56
|
@metadata['gblsi_thumbnail_uri'] = gblsi_thumbnail_uri
|
58
57
|
|
59
58
|
return nil unless image_data && @metadata['placeheld'] == false
|
@@ -180,11 +179,8 @@ module GeoblacklightSidecarImages
|
|
180
179
|
# from the viewer protocol, and if it's loaded, the image_url
|
181
180
|
# method is called.
|
182
181
|
def service_url
|
183
|
-
|
184
182
|
# Follow image_url instead
|
185
|
-
if gblsi_thumbnail_uri
|
186
|
-
return nil
|
187
|
-
end
|
183
|
+
return nil if gblsi_thumbnail_uri
|
188
184
|
|
189
185
|
@service_url ||=
|
190
186
|
begin
|
@@ -34,5 +34,6 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_development_dependency 'rubocop', '~> 0.60.0'
|
35
35
|
s.add_development_dependency 'rubocop-rspec', '~> 1.30.0'
|
36
36
|
s.add_development_dependency 'selenium-webdriver'
|
37
|
-
s.add_development_dependency 'solr_wrapper'
|
37
|
+
s.add_development_dependency 'solr_wrapper', '~> 2.2'
|
38
|
+
s.add_development_dependency 'sprockets', '< 4'
|
38
39
|
end
|
@@ -20,7 +20,7 @@ namespace :gblsci do
|
|
20
20
|
namespace :images do
|
21
21
|
desc 'Harvest image for specific document'
|
22
22
|
task :harvest_doc_id, [:doc_id] => [:environment] do |_t, args|
|
23
|
-
StoreImageJob.perform_later(args[:doc_id])
|
23
|
+
GeoblacklightSidecarImages::StoreImageJob.perform_later(args[:doc_id])
|
24
24
|
end
|
25
25
|
|
26
26
|
desc 'Harvest all images'
|
@@ -35,8 +35,7 @@ describe GeoblacklightSidecarImages::ImageService do
|
|
35
35
|
expect(wms_imgsvc.send(:image_url)).to include 'wms'
|
36
36
|
end
|
37
37
|
|
38
|
-
it 'returns
|
39
|
-
expect(map_imgsvc.send(:image_url)).to include 'illinois'
|
38
|
+
it 'returns no service_url when settings thumbnail field' do
|
40
39
|
expect(map_imgsvc.send(:service_url)).to be_falsey
|
41
40
|
end
|
42
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoblacklight_sidecar_images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Larson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: geoblacklight
|
@@ -231,16 +231,30 @@ dependencies:
|
|
231
231
|
name: solr_wrapper
|
232
232
|
requirement: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: '
|
236
|
+
version: '2.2'
|
237
237
|
type: :development
|
238
238
|
prerelease: false
|
239
239
|
version_requirements: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
|
-
- - "
|
241
|
+
- - "~>"
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: '
|
243
|
+
version: '2.2'
|
244
|
+
- !ruby/object:Gem::Dependency
|
245
|
+
name: sprockets
|
246
|
+
requirement: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "<"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '4'
|
251
|
+
type: :development
|
252
|
+
prerelease: false
|
253
|
+
version_requirements: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - "<"
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '4'
|
244
258
|
description:
|
245
259
|
email:
|
246
260
|
- ewlarson@umn.edu
|
@@ -379,8 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
379
393
|
- !ruby/object:Gem::Version
|
380
394
|
version: '0'
|
381
395
|
requirements: []
|
382
|
-
|
383
|
-
rubygems_version: 2.7.6
|
396
|
+
rubygems_version: 3.1.2
|
384
397
|
signing_key:
|
385
398
|
specification_version: 4
|
386
399
|
summary: Store local copies of remote imagery in GeoBlacklight
|