geoblacklight 4.5.0 → 4.6.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/app/controllers/download_controller.rb +5 -0
  4. data/app/helpers/arcgis_helper.rb +3 -0
  5. data/app/helpers/blacklight_helper.rb +4 -0
  6. data/app/helpers/carto_helper.rb +5 -0
  7. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +7 -1
  8. data/app/helpers/geoblacklight_helper.rb +74 -21
  9. data/app/models/concerns/geoblacklight/solr_document/carto.rb +7 -0
  10. data/app/models/concerns/geoblacklight/solr_document/citation.rb +7 -0
  11. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -1
  12. data/app/models/concerns/geoblacklight/solr_document.rb +30 -2
  13. data/app/presenters/geoblacklight/document_presenter.rb +8 -0
  14. data/app/views/catalog/_arcgis.html.erb +1 -1
  15. data/app/views/catalog/_carto.html.erb +1 -1
  16. data/app/views/catalog/_downloads_collapse.html.erb +3 -0
  17. data/app/views/catalog/_index_split_default.html.erb +1 -1
  18. data/app/views/catalog/_show_default_attribute_table.html.erb +1 -1
  19. data/app/views/catalog/_show_default_viewer_container.html.erb +3 -3
  20. data/app/views/catalog/_show_downloads.html.erb +3 -0
  21. data/app/views/catalog/_show_sidebar.html.erb +1 -1
  22. data/app/views/catalog/_show_sidebar_static_map.html.erb +3 -0
  23. data/app/views/catalog/_web_services.html.erb +1 -1
  24. data/geoblacklight.gemspec +2 -2
  25. data/lib/geoblacklight/deprecated_configuration.rb +519 -0
  26. data/lib/geoblacklight/download/hgl_download.rb +5 -0
  27. data/lib/geoblacklight/engine.rb +14 -0
  28. data/lib/geoblacklight/geometry.rb +7 -0
  29. data/lib/geoblacklight/item_viewer.rb +8 -1
  30. data/lib/geoblacklight/references.rb +15 -0
  31. data/lib/geoblacklight/version.rb +1 -1
  32. data/lib/geoblacklight/view_helper_override.rb +12 -1
  33. data/lib/geoblacklight.rb +17 -0
  34. data/lib/tasks/geoblacklight.rake +17 -0
  35. data/package.json +3 -2
  36. data/spec/lib/geoblacklight/deprecated_configuration_spec.rb +597 -0
  37. data/spec/lib/geoblacklight/geometry_spec.rb +15 -0
  38. data/spec/lib/geoblacklight/references_spec.rb +24 -0
  39. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +16 -0
  40. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +48 -0
  41. data/spec/spec_helper.rb +14 -11
  42. metadata +7 -5
@@ -227,4 +227,28 @@ describe Geoblacklight::References do
227
227
  expect(direct_download_only.downloads_by_format).to be_nil
228
228
  end
229
229
  end
230
+ describe "#format with a document that is not a SolrDocument" do
231
+ let(:plain_document) do
232
+ Class.new do
233
+ def initialize(attributes)
234
+ @attributes = attributes
235
+ end
236
+
237
+ def [](key)
238
+ @attributes[key]
239
+ end
240
+ end
241
+ end
242
+
243
+ it "warns that GeoBlacklight 5 calls #file_format on the document" do
244
+ document = plain_document.new(
245
+ Settings.FIELDS.FORMAT => "Shapefile",
246
+ Settings.FIELDS.REFERENCES => "{}"
247
+ )
248
+
249
+ expect(Geoblacklight.deprecation).to receive(:warn).with(/does not respond to #file_format/)
250
+
251
+ expect(described_class.new(document).format).to eq "Shapefile"
252
+ end
253
+ end
230
254
  end
@@ -11,5 +11,21 @@ describe Geoblacklight::SolrDocument::Citation do
11
11
  expect(document.geoblacklight_citation("http://example.com"))
12
12
  .to eq "United States. National Oceanic and Atmospheric Administration. Circuit Rider Productions. (2002). 10 Meter Contours: Russian River Basin, California. [Shapefile]. Circuit Rider Productions. Retrieved from http://example.com"
13
13
  end
14
+
15
+ describe "with more than one publisher" do
16
+ let(:document) { SolrDocument.new(fixture.merge(Settings.FIELDS.PUBLISHER => ["First", "Second"])) }
17
+
18
+ it "warns that GeoBlacklight 5 keeps only the first publisher" do
19
+ expect(Geoblacklight.deprecation).to receive(:warn).with(/will lose its other publishers/)
20
+ document.geoblacklight_citation("http://example.com")
21
+ end
22
+ end
23
+
24
+ describe "with a single publisher" do
25
+ it "does not warn" do
26
+ expect(Geoblacklight.deprecation).not_to receive(:warn)
27
+ document.geoblacklight_citation("http://example.com")
28
+ end
29
+ end
14
30
  end
15
31
  end
@@ -64,6 +64,54 @@ describe Geoblacklight::SolrDocument do
64
64
  end
65
65
  end
66
66
  end
67
+ describe "deprecations for GeoBlacklight 5 behavior changes" do
68
+ describe "#restricted?" do
69
+ describe "with rights data that is present but blank" do
70
+ let(:document_attributes) { {rights_field => ""} }
71
+ it "warns that GeoBlacklight 5 stops treating the document as restricted" do
72
+ expect(Geoblacklight.deprecation).to receive(:warn).with(
73
+ /#restricted\? returns true for a document whose .* is present but blank/
74
+ )
75
+ expect(document.restricted?).to be true
76
+ end
77
+ end
78
+
79
+ describe "without rights data at all" do
80
+ let(:document_attributes) { {} }
81
+ it "does not warn" do
82
+ expect(Geoblacklight.deprecation).not_to receive(:warn)
83
+ expect(document.restricted?).to be true
84
+ end
85
+ end
86
+ end
87
+
88
+ describe "#geom_field and #wxs_identifier" do
89
+ describe "when the Solr field is missing" do
90
+ let(:document_attributes) { {} }
91
+ it "warns that GeoBlacklight 5 returns nil rather than an empty string" do
92
+ expect(Geoblacklight.deprecation).to receive(:warn).with(/#geom_field returns "" for a document/)
93
+ expect(document.geom_field).to eq ""
94
+ end
95
+
96
+ it "warns for wxs_identifier too" do
97
+ expect(Geoblacklight.deprecation).to receive(:warn).with(/#wxs_identifier returns "" for a document/)
98
+ expect(document.wxs_identifier).to eq ""
99
+ end
100
+ end
101
+
102
+ describe "when the Solr field is present" do
103
+ let(:document_attributes) do
104
+ {Settings.FIELDS.GEOMETRY => "ENVELOPE(-1,1,1,-1)", Settings.FIELDS.WXS_IDENTIFIER => "cite:foo"}
105
+ end
106
+ it "does not warn" do
107
+ expect(Geoblacklight.deprecation).not_to receive(:warn)
108
+ expect(document.geom_field).to eq "ENVELOPE(-1,1,1,-1)"
109
+ expect(document.wxs_identifier).to eq "cite:foo"
110
+ end
111
+ end
112
+ end
113
+ end
114
+
67
115
  describe "#downloadable?" do
68
116
  describe "available direct download" do
69
117
  let(:document_attributes) do
data/spec/spec_helper.rb CHANGED
@@ -30,25 +30,28 @@ require "rails-controller-testing" if Rails::VERSION::MAJOR >= 5
30
30
  require "rspec/rails"
31
31
  require "capybara/rspec"
32
32
  require "selenium-webdriver"
33
- require "webdrivers"
34
33
 
35
34
  # Setup webmock for specific tests
36
35
  require "webmock/rspec"
37
36
  WebMock.allow_net_connect!(net_http_connect_on_start: true)
38
37
 
39
- Capybara.register_driver(:selenium) do |app|
40
- browser_options = ::Selenium::WebDriver::Chrome::Options.new(args: %w[headless disable-gpu disable-setuid-sandbox window-size=7680,4320])
38
+ Capybara.register_driver :chrome_headless do |app|
39
+ # Set up Chrome options
40
+ options = Selenium::WebDriver::Chrome::Options.new
41
+ options.add_argument("--headless")
42
+ options.add_argument("--disable-gpu")
43
+ options.add_argument("--no-sandbox")
44
+ options.add_argument("--window-size=1280,1024")
41
45
 
42
- http_client = Selenium::WebDriver::Remote::Http::Default.new
43
- http_client.read_timeout = 120
44
- http_client.open_timeout = 120
45
- Capybara::Selenium::Driver.new(app,
46
- browser: :chrome,
47
- options: browser_options,
48
- http_client: http_client)
46
+ # Allow longer TCP reads to prevent timeout in the case of loading fixture
47
+ # eee6150b-ce2f-4837-9d17-ce72a0c1c26f, as part of relations_spec.rb
48
+ client = Selenium::WebDriver::Remote::Http::Default.new
49
+ client.read_timeout = 120 # seconds
50
+
51
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: options, http_client: client)
49
52
  end
50
53
 
51
- Capybara.javascript_driver = :selenium
54
+ Capybara.javascript_driver = :chrome_headless
52
55
  Capybara.default_max_wait_time = 120
53
56
 
54
57
  require "geoblacklight"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -10,7 +10,7 @@ authors:
10
10
  - Jack Reed
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-07-25 00:00:00.000000000 Z
13
+ date: 2026-09-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '7'
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '8.1'
24
+ version: '8.2'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +31,7 @@ dependencies:
31
31
  version: '7'
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '8.1'
34
+ version: '8.2'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: blacklight
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -263,7 +263,7 @@ dependencies:
263
263
  - !ruby/object:Gem::Version
264
264
  version: 2.5.0
265
265
  - !ruby/object:Gem::Dependency
266
- name: webdrivers
266
+ name: selenium-webdriver
267
267
  requirement: !ruby/object:Gem::Requirement
268
268
  requirements:
269
269
  - - ">="
@@ -640,6 +640,7 @@ files:
640
640
  - lib/geoblacklight.rb
641
641
  - lib/geoblacklight/bounding_box.rb
642
642
  - lib/geoblacklight/constants.rb
643
+ - lib/geoblacklight/deprecated_configuration.rb
643
644
  - lib/geoblacklight/download.rb
644
645
  - lib/geoblacklight/download/geojson_download.rb
645
646
  - lib/geoblacklight/download/geotiff_download.rb
@@ -828,6 +829,7 @@ files:
828
829
  - spec/javascripts/metadata_download_button_spec.js
829
830
  - spec/javascripts/util_spec.js
830
831
  - spec/lib/geoblacklight/bounding_box_spec.rb
832
+ - spec/lib/geoblacklight/deprecated_configuration_spec.rb
831
833
  - spec/lib/geoblacklight/document_presenter_spec.rb
832
834
  - spec/lib/geoblacklight/download/geojson_download_spec.rb
833
835
  - spec/lib/geoblacklight/download/geotiff_download_spec.rb