geoblacklight 4.5.1 → 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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/download_controller.rb +5 -0
  3. data/app/helpers/arcgis_helper.rb +3 -0
  4. data/app/helpers/blacklight_helper.rb +4 -0
  5. data/app/helpers/carto_helper.rb +5 -0
  6. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +7 -1
  7. data/app/helpers/geoblacklight_helper.rb +74 -21
  8. data/app/models/concerns/geoblacklight/solr_document/carto.rb +7 -0
  9. data/app/models/concerns/geoblacklight/solr_document/citation.rb +7 -0
  10. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -1
  11. data/app/models/concerns/geoblacklight/solr_document.rb +30 -2
  12. data/app/presenters/geoblacklight/document_presenter.rb +8 -0
  13. data/app/views/catalog/_arcgis.html.erb +1 -1
  14. data/app/views/catalog/_carto.html.erb +1 -1
  15. data/app/views/catalog/_downloads_collapse.html.erb +3 -0
  16. data/app/views/catalog/_index_split_default.html.erb +1 -1
  17. data/app/views/catalog/_show_default_attribute_table.html.erb +1 -1
  18. data/app/views/catalog/_show_default_viewer_container.html.erb +3 -3
  19. data/app/views/catalog/_show_downloads.html.erb +3 -0
  20. data/app/views/catalog/_show_sidebar.html.erb +1 -1
  21. data/app/views/catalog/_show_sidebar_static_map.html.erb +3 -0
  22. data/app/views/catalog/_web_services.html.erb +1 -1
  23. data/lib/geoblacklight/deprecated_configuration.rb +519 -0
  24. data/lib/geoblacklight/download/hgl_download.rb +5 -0
  25. data/lib/geoblacklight/engine.rb +14 -0
  26. data/lib/geoblacklight/geometry.rb +7 -0
  27. data/lib/geoblacklight/item_viewer.rb +8 -1
  28. data/lib/geoblacklight/references.rb +15 -0
  29. data/lib/geoblacklight/version.rb +1 -1
  30. data/lib/geoblacklight/view_helper_override.rb +12 -1
  31. data/lib/geoblacklight.rb +17 -0
  32. data/lib/tasks/geoblacklight.rake +17 -0
  33. data/package.json +3 -2
  34. data/spec/lib/geoblacklight/deprecated_configuration_spec.rb +597 -0
  35. data/spec/lib/geoblacklight/geometry_spec.rb +15 -0
  36. data/spec/lib/geoblacklight/references_spec.rb +24 -0
  37. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +16 -0
  38. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +48 -0
  39. metadata +5 -6
@@ -57,4 +57,19 @@ describe Geoblacklight::Geometry do
57
57
  end
58
58
  end
59
59
  end
60
+ describe "#bounding_box for a document with no geometry" do
61
+ it "warns that GeoBlacklight 5 raises instead of falling back to the whole world" do
62
+ expect(Geoblacklight.deprecation).to receive(:warn).with(
63
+ /#bounding_box falls back to the whole world extent/
64
+ )
65
+
66
+ expect(described_class.new("").bounding_box).to be_a String
67
+ end
68
+
69
+ it "does not warn for a document that has geometry" do
70
+ expect(Geoblacklight.deprecation).not_to receive(:warn)
71
+
72
+ described_class.new("ENVELOPE(-1,1,1,-1)").bounding_box
73
+ end
74
+ end
60
75
  end
@@ -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
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.1
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
8
8
  - Darren Hardy
9
9
  - Eliot Jordan
10
10
  - Jack Reed
11
- autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2026-06-08 00:00:00.000000000 Z
13
+ date: 2026-09-01 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rails
@@ -641,6 +640,7 @@ files:
641
640
  - lib/geoblacklight.rb
642
641
  - lib/geoblacklight/bounding_box.rb
643
642
  - lib/geoblacklight/constants.rb
643
+ - lib/geoblacklight/deprecated_configuration.rb
644
644
  - lib/geoblacklight/download.rb
645
645
  - lib/geoblacklight/download/geojson_download.rb
646
646
  - lib/geoblacklight/download/geotiff_download.rb
@@ -829,6 +829,7 @@ files:
829
829
  - spec/javascripts/metadata_download_button_spec.js
830
830
  - spec/javascripts/util_spec.js
831
831
  - spec/lib/geoblacklight/bounding_box_spec.rb
832
+ - spec/lib/geoblacklight/deprecated_configuration_spec.rb
832
833
  - spec/lib/geoblacklight/document_presenter_spec.rb
833
834
  - spec/lib/geoblacklight/download/geojson_download_spec.rb
834
835
  - spec/lib/geoblacklight/download/geotiff_download_spec.rb
@@ -899,7 +900,6 @@ homepage: http://github.com/geoblacklight/geoblacklight
899
900
  licenses:
900
901
  - Apache 2.0
901
902
  metadata: {}
902
- post_install_message:
903
903
  rdoc_options: []
904
904
  require_paths:
905
905
  - lib
@@ -914,8 +914,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
914
914
  - !ruby/object:Gem::Version
915
915
  version: 2.5.2
916
916
  requirements: []
917
- rubygems_version: 3.5.11
918
- signing_key:
917
+ rubygems_version: 3.6.2
919
918
  specification_version: 4
920
919
  summary: A discovery platform for geospatial holdings
921
920
  test_files: []