geoblacklight 4.0.0 → 4.1.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +23 -8
- data/.gitignore +3 -0
- data/.standard.yml +1 -0
- data/Gemfile +13 -11
- data/README.md +1 -1
- data/Rakefile +42 -50
- data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +26 -0
- data/app/assets/images/blacklight/arizona.svg +4 -0
- data/app/assets/images/blacklight/circle-info-solid.svg +1 -0
- data/app/assets/images/blacklight/fire-solid.svg +1 -0
- data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
- data/app/assets/images/blacklight/nebraska.svg +4 -0
- data/app/assets/images/blacklight/rutgers.svg +5 -0
- data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
- data/app/assets/javascripts/geoblacklight/basemaps.js +1 -1
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
- data/app/components/geoblacklight/display_note_component.html.erb +1 -0
- data/app/components/geoblacklight/display_note_component.rb +47 -0
- data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
- data/app/controllers/download_controller.rb +36 -37
- data/app/controllers/relation_controller.rb +1 -0
- data/app/controllers/wms_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +2 -1
- data/app/helpers/blacklight_helper.rb +2 -1
- data/app/helpers/carto_helper.rb +3 -2
- data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
- data/app/helpers/geoblacklight_helper.rb +47 -36
- data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
- data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
- data/app/presenters/geoblacklight/document_presenter.rb +3 -2
- data/app/views/catalog/_citation.html.erb +35 -10
- data/app/views/catalog/_show_default_display_note.html.erb +7 -0
- data/app/views/catalog/_show_sidebar.html.erb +1 -0
- data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
- data/app/views/relation/index.json.jbuilder +1 -1
- data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
- data/config/initializers/rails_config.rb +5 -1
- data/config/locales/geoblacklight.en.yml +18 -10
- data/geoblacklight.gemspec +36 -40
- data/lib/generators/geoblacklight/assets_generator.rb +15 -15
- data/lib/generators/geoblacklight/install_generator.rb +24 -23
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
- data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +2 -2
- data/lib/generators/geoblacklight/templates/settings.yml +76 -24
- data/lib/geoblacklight/bounding_box.rb +1 -0
- data/lib/geoblacklight/constants.rb +26 -25
- data/lib/geoblacklight/download/geojson_download.rb +10 -9
- data/lib/geoblacklight/download/geotiff_download.rb +6 -5
- data/lib/geoblacklight/download/hgl_download.rb +4 -3
- data/lib/geoblacklight/download/kmz_download.rb +11 -10
- data/lib/geoblacklight/download/shapefile_download.rb +10 -9
- data/lib/geoblacklight/download.rb +12 -11
- data/lib/geoblacklight/engine.rb +10 -9
- data/lib/geoblacklight/exceptions.rb +3 -0
- data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +14 -11
- data/lib/geoblacklight/geometry.rb +6 -5
- data/lib/geoblacklight/item_viewer.rb +4 -3
- data/lib/geoblacklight/metadata/base.rb +4 -3
- data/lib/geoblacklight/metadata/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata/html.rb +5 -4
- data/lib/geoblacklight/metadata/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata_transformer.rb +6 -2
- data/lib/geoblacklight/reference.rb +3 -2
- data/lib/geoblacklight/references.rb +12 -7
- data/lib/geoblacklight/relation/ancestors.rb +4 -3
- data/lib/geoblacklight/relation/descendants.rb +4 -3
- data/lib/geoblacklight/relation/relation_response.rb +3 -2
- data/lib/geoblacklight/routes/downloadable.rb +3 -2
- data/lib/geoblacklight/routes/exportable.rb +4 -3
- data/lib/geoblacklight/routes/wms.rb +2 -1
- data/lib/geoblacklight/routes.rb +4 -3
- data/lib/geoblacklight/version.rb +2 -1
- data/lib/geoblacklight/view_helper_override.rb +3 -2
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
- data/lib/geoblacklight/wms_layer.rb +4 -3
- data/lib/geoblacklight.rb +32 -31
- data/lib/tasks/geoblacklight.rake +45 -44
- data/schema/geoblacklight-schema-aardvark.json +6 -0
- data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
- data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
- data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
- data/spec/config/initializers/rails_config_spec.rb +10 -9
- data/spec/controllers/catalog_controller_spec.rb +27 -26
- data/spec/controllers/download_controller_spec.rb +50 -49
- data/spec/controllers/relation_controller_spec.rb +5 -4
- data/spec/controllers/wms_controller_spec.rb +10 -9
- data/spec/factories/user.rb +3 -2
- data/spec/features/bookmarks_spec.rb +7 -6
- data/spec/features/citations_spec.rb +12 -0
- data/spec/features/configurable_basemap_spec.rb +12 -11
- data/spec/features/data_dictionary_download_spec.rb +11 -10
- data/spec/features/download_layer_spec.rb +64 -63
- data/spec/features/empty_search_spec.rb +6 -5
- data/spec/features/esri_viewer_spec.rb +33 -32
- data/spec/features/exports_spec.rb +18 -17
- data/spec/features/full_screen_controll_spec.rb +8 -8
- data/spec/features/help_text_spec.rb +6 -5
- data/spec/features/home_page_spec.rb +30 -29
- data/spec/features/iiif_viewer_spec.rb +6 -5
- data/spec/features/index_map_spec.rb +17 -16
- data/spec/features/layer_inspection_spec.rb +8 -7
- data/spec/features/layer_opacity_spec.rb +15 -14
- data/spec/features/layer_preview_spec.rb +11 -10
- data/spec/features/layer_with_no_references_spec.rb +5 -4
- data/spec/features/linkified_attribute_table_spec.rb +8 -7
- data/spec/features/metadata_panel_spec.rb +32 -31
- data/spec/features/missing_metadata_spec.rb +18 -17
- data/spec/features/multiple_downloads_spec.rb +11 -10
- data/spec/features/oembed_spec.rb +6 -5
- data/spec/features/relations_spec.rb +51 -26
- data/spec/features/saved_searches_spec.rb +7 -6
- data/spec/features/search_bar_spec.rb +9 -8
- data/spec/features/search_results_complex_geometry_spec.rb +12 -11
- data/spec/features/search_results_icons_spec.rb +10 -9
- data/spec/features/search_results_map_spec.rb +21 -20
- data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
- data/spec/features/search_spec.rb +19 -18
- data/spec/features/show_page_download_spec.rb +15 -14
- data/spec/features/show_page_metadata_spec.rb +9 -8
- data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
- data/spec/features/sms_spec.rb +12 -11
- data/spec/features/split_view.html.erb_spec.rb +56 -55
- data/spec/features/suppressed_records_spec.rb +10 -9
- data/spec/features/tilejson_spec.rb +12 -9
- data/spec/features/tms_spec.rb +6 -5
- data/spec/features/web_services_modal_spec.rb +39 -38
- data/spec/features/wmts_spec.rb +20 -17
- data/spec/features/xyz_spec.rb +6 -5
- data/spec/fixtures/manifests/tilejson.json +1 -1
- data/spec/fixtures/manifests/wmts-single.xml +5 -5
- data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
- data/spec/fixtures/solr_documents/actual-point1.json +1 -1
- data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
- data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
- data/spec/fixtures/solr_documents/display-note.json +52 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
- data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
- data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
- data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
- data/spec/fixtures/solr_documents/index_map_point.json +1 -1
- data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
- data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
- data/spec/fixtures/solr_documents/restricted-line.json +1 -1
- data/spec/fixtures/solr_documents/tilejson.json +3 -3
- data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
- data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
- data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
- data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
- data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
- data/spec/fixtures/solr_documents/wmts-single-layer.json +7 -7
- data/spec/fixtures/solr_documents/xyz.json +3 -3
- data/spec/helpers/arcgis_helper_spec.rb +8 -7
- data/spec/helpers/carto_helper_spec.rb +6 -5
- data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
- data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
- data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
- data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download_spec.rb +61 -60
- data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
- data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
- data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
- data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
- data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
- data/spec/lib/geoblacklight/reference_spec.rb +28 -27
- data/spec/lib/geoblacklight/references_spec.rb +89 -76
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
- data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
- data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
- data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
- data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
- data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
- data/spec/routing/catalog_routing_spec.rb +4 -3
- data/spec/spec_helper.rb +35 -38
- data/spec/support/backport_test_helpers.rb +6 -5
- data/spec/support/features/session_helpers.rb +8 -7
- data/spec/support/features.rb +2 -1
- data/spec/support/fixtures.rb +2 -1
- data/spec/tasks/geoblacklight_spec.rb +10 -9
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
- data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
- data/template.rb +9 -8
- metadata +40 -216
- data/.gitmodules +0 -0
- data/.rubocop.yml +0 -111
- data/.rubocop_todo.yml +0 -437
- data/config/initializers/new_gbl_settings_defaults_3_4.yml +0 -6
- /data/app/assets/images/blacklight/{berkeley.svg → university-of-california-berkeley.svg} +0 -0
@@ -1,39 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require
|
2
|
+
|
3
|
+
require "rails/generators"
|
4
|
+
require "generators/geoblacklight/install_generator"
|
4
5
|
|
5
6
|
namespace :geoblacklight do
|
6
|
-
desc
|
7
|
+
desc "Run Solr and GeoBlacklight for interactive development"
|
7
8
|
task :server, [:rails_server_args] do |_t, args|
|
8
|
-
require
|
9
|
-
SolrWrapper.wrap(port:
|
10
|
-
solr.with_collection(name:
|
9
|
+
require "solr_wrapper"
|
10
|
+
SolrWrapper.wrap(port: "8983") do |solr|
|
11
|
+
solr.with_collection(name: "blacklight-core", dir: File.join(File.expand_path("../../", File.dirname(__FILE__)), "solr", "conf")) do
|
11
12
|
puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
|
12
13
|
puts "\n^C to stop"
|
13
|
-
puts
|
14
|
+
puts " "
|
14
15
|
begin
|
15
|
-
Rake::Task[
|
16
|
+
Rake::Task["geoblacklight:solr:seed"].invoke
|
16
17
|
system "bundle exec rails s #{args[:rails_server_args]}"
|
17
18
|
rescue Interrupt
|
18
|
-
puts
|
19
|
+
puts "Shutting down..."
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
desc
|
25
|
+
desc "Run Solr and GeoBlacklight for interactive development with Webpack enabled"
|
25
26
|
task :webpack do |_t|
|
26
|
-
require
|
27
|
-
SolrWrapper.wrap(port:
|
28
|
-
solr.with_collection(name:
|
27
|
+
require "solr_wrapper"
|
28
|
+
SolrWrapper.wrap(port: "8983") do |solr|
|
29
|
+
solr.with_collection(name: "blacklight-core", dir: File.join(File.expand_path("../../", File.dirname(__FILE__)), "solr", "conf")) do
|
29
30
|
puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
|
30
31
|
puts "\n^C to stop"
|
31
|
-
puts
|
32
|
+
puts " "
|
32
33
|
begin
|
33
|
-
Rake::Task[
|
34
|
-
system
|
34
|
+
Rake::Task["geoblacklight:solr:seed"].invoke
|
35
|
+
system "foreman start"
|
35
36
|
rescue Interrupt
|
36
|
-
puts
|
37
|
+
puts "Shutting down..."
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -42,41 +43,41 @@ namespace :geoblacklight do
|
|
42
43
|
# Local fixtures: bundle exec rake "geoblacklight:index:seed"
|
43
44
|
# Remote fixtures: bundle exec rake "geoblacklight:index:seed[:remote]"
|
44
45
|
namespace :index do
|
45
|
-
desc
|
46
|
+
desc "Index GBL test fixture metadata into Solr"
|
46
47
|
task :seed, [:remote] => :environment do |t, args|
|
47
48
|
docs = []
|
48
49
|
|
49
50
|
if args.remote
|
50
|
-
puts
|
51
|
-
JSON.
|
52
|
-
URI.
|
51
|
+
puts "Indexing - Remote test fixtures"
|
52
|
+
JSON.parse(
|
53
|
+
URI.parse("https://api.github.com/repos/geoblacklight/geoblacklight/contents/spec/fixtures/solr_documents").open.read
|
53
54
|
).each do |fixture|
|
54
|
-
if fixture[
|
55
|
-
docs << JSON.
|
55
|
+
if fixture["name"].include?(".json")
|
56
|
+
docs << JSON.parse(URI.parse(fixture["download_url"]).open.read)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
else
|
59
|
-
puts
|
60
|
-
docs = Dir[
|
60
|
+
puts "Indexing - Local test fixtures"
|
61
|
+
docs = Dir["spec/fixtures/solr_documents/*.json"].map { |f| JSON.parse File.read(f) }.flatten
|
61
62
|
end
|
62
63
|
|
63
64
|
Blacklight.default_index.connection.add docs
|
64
65
|
Blacklight.default_index.connection.commit
|
65
66
|
end
|
66
67
|
|
67
|
-
desc
|
68
|
-
task :
|
69
|
-
docs = JSON.parse(File.read(Rails.root.join(
|
68
|
+
desc "Ingests a GeoHydra transformed.json"
|
69
|
+
task ingest_all: :environment do
|
70
|
+
docs = JSON.parse(File.read(Rails.root.join("tmp", "transformed.json")))
|
70
71
|
docs.each do |doc|
|
71
72
|
Blacklight.default_index.connection.add doc
|
72
73
|
Blacklight.default_index.connection.commit
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
desc
|
77
|
+
desc "Ingests a directory of geoblacklight.json files"
|
77
78
|
task :ingest, [:directory] => :environment do |_t, args|
|
78
|
-
args.with_defaults(directory:
|
79
|
-
Dir.glob(File.join(args[:directory],
|
79
|
+
args.with_defaults(directory: "data")
|
80
|
+
Dir.glob(File.join(args[:directory], "**", "geoblacklight.json")).each do |fn|
|
80
81
|
puts "Ingesting #{fn}"
|
81
82
|
begin
|
82
83
|
Blacklight.default_index.connection.add(JSON.parse(File.read(fn)))
|
@@ -84,47 +85,47 @@ namespace :geoblacklight do
|
|
84
85
|
puts "Failed to ingest #{fn}: #{e.inspect}"
|
85
86
|
end
|
86
87
|
end
|
87
|
-
puts
|
88
|
+
puts "Committing changes to Solr"
|
88
89
|
Blacklight.default_index.connection.commit
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
92
93
|
namespace :downloads do
|
93
|
-
desc
|
94
|
+
desc "Delete all cached downloads"
|
94
95
|
task delete: :environment do
|
95
|
-
FileUtils.rm_rf Dir.glob(Rails.root.join(
|
96
|
+
FileUtils.rm_rf Dir.glob(Rails.root.join("tmp", "cache", "downloads", "*"))
|
96
97
|
end
|
97
|
-
desc
|
98
|
+
desc "Create download directory"
|
98
99
|
task mkdir: :environment do
|
99
|
-
FileUtils.mkdir_p(Rails.root.join(
|
100
|
+
FileUtils.mkdir_p(Rails.root.join("tmp", "cache", "downloads"), verbose: true)
|
100
101
|
end
|
101
|
-
desc
|
102
|
+
desc "Precaches a download"
|
102
103
|
task :precache, [:doc_id, :download_type, :timeout] => [:environment] do |_t, args|
|
103
104
|
unless args[:doc_id] && args[:download_type] && args[:timeout]
|
104
|
-
fail
|
105
|
+
fail "Please supply required arguments [document_id, download_type and timeout]"
|
105
106
|
end
|
106
107
|
document = Geoblacklight::SolrDocument.find(args[:doc_id])
|
107
108
|
fail Blacklight::Exceptions::RecordNotFound if document[:id] != args[:doc_id]
|
108
109
|
download = "Geoblacklight::#{args[:download_type].capitalize}Download"
|
109
|
-
|
110
|
+
.constantize.new(document, timeout: args[:timeout].to_i)
|
110
111
|
download.get
|
111
112
|
Rails.logger.info "Successfully downloaded #{download.file_name}"
|
112
113
|
Rails.logger.info Geoblacklight::ShapefileDownload.file_path.to_s
|
113
114
|
rescue Geoblacklight::Exceptions::ExternalDownloadFailed => error
|
114
|
-
Rails.logger.error error.message +
|
115
|
+
Rails.logger.error error.message + " " + error.url
|
115
116
|
rescue NameError
|
116
117
|
Rails.logger.error "Could not find that download type \"#{args[:download_type]}\""
|
117
118
|
end
|
118
119
|
end
|
119
120
|
|
120
121
|
namespace :solr do
|
121
|
-
desc
|
122
|
-
task :
|
123
|
-
Rake::Task[
|
122
|
+
desc "Put sample data into solr"
|
123
|
+
task seed: :environment do
|
124
|
+
Rake::Task["geoblacklight:index:seed"].invoke
|
124
125
|
end
|
125
126
|
end
|
126
127
|
|
127
|
-
desc
|
128
|
+
desc "Stdout output asset paths"
|
128
129
|
task application_asset_paths: [:environment] do
|
129
130
|
puts Rails.application.config.assets.paths
|
130
131
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe Geoblacklight::DisplayNoteComponent, type: :component do
|
6
|
+
subject(:rendered) do
|
7
|
+
render_inline_to_capybara_node(described_class.new(**kwargs))
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "prefixed" do
|
11
|
+
let(:kwargs) { {display_note: "Warning: Full force applied."} }
|
12
|
+
it "prefixed, includes display note and icon" do
|
13
|
+
expect(rendered).to have_selector("div.gbl-display-note.alert.alert-warning")
|
14
|
+
expect(rendered).to have_selector("span.blacklight-icons > svg")
|
15
|
+
expect(rendered).to have_text("Warning: Full force applied.")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "non-prefixed" do
|
20
|
+
let(:kwargs) { {display_note: "Simple note."} }
|
21
|
+
it "non-prefixed, includes only default display note" do
|
22
|
+
expect(rendered).to have_selector("div.gbl-display-note.alert.alert-secondary")
|
23
|
+
expect(rendered).to_not have_selector("span.blacklight-icons > svg")
|
24
|
+
expect(rendered).to have_text("Simple note.")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
RSpec.describe Geoblacklight::HomepageFeatureFacetComponent, type: :component do
|
5
6
|
subject(:rendered) do
|
@@ -7,7 +8,7 @@ RSpec.describe Geoblacklight::HomepageFeatureFacetComponent, type: :component do
|
|
7
8
|
end
|
8
9
|
|
9
10
|
# Build a search
|
10
|
-
let(:context) { {
|
11
|
+
let(:context) { {whatever: :value} }
|
11
12
|
let(:service) { Blacklight::SearchService.new(config: blacklight_config, user_params: user_params, **context) }
|
12
13
|
let(:repository) { Blacklight::Solr::Repository.new(blacklight_config) }
|
13
14
|
let(:user_params) { {} }
|
@@ -15,25 +16,25 @@ RSpec.describe Geoblacklight::HomepageFeatureFacetComponent, type: :component do
|
|
15
16
|
let(:copy_of_catalog_config) { ::CatalogController.blacklight_config.deep_copy }
|
16
17
|
let(:blacklight_solr) { RSolr.connect(Blacklight.connection_config.except(:adapter)) }
|
17
18
|
|
18
|
-
describe
|
19
|
+
describe "homepage" do
|
19
20
|
before do
|
20
21
|
(@response, @document_list) = service.search_results
|
21
22
|
end
|
22
23
|
|
23
24
|
let(:kargs) do
|
24
25
|
{
|
25
|
-
icon:
|
26
|
-
label:
|
26
|
+
icon: "home",
|
27
|
+
label: "geoblacklight.home.institution",
|
27
28
|
facet_field: Settings.FIELDS.PROVIDER,
|
28
29
|
response: @response
|
29
30
|
}
|
30
31
|
end
|
31
32
|
|
32
|
-
it
|
33
|
-
expect(rendered).to have_selector(
|
34
|
-
expect(rendered).to have_selector(
|
35
|
-
expect(rendered).to have_selector(
|
36
|
-
expect(rendered).to have_selector(
|
33
|
+
it "includes facet links" do
|
34
|
+
expect(rendered).to have_selector("div.category-block")
|
35
|
+
expect(rendered).to have_selector("div.category-icon")
|
36
|
+
expect(rendered).to have_selector("a.home-facet-link")
|
37
|
+
expect(rendered).to have_selector("a.more_facets_link")
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
RSpec.describe Geoblacklight::IconFacetItemComponent, type: :component do
|
5
6
|
subject(:rendered) do
|
6
7
|
render_inline_to_capybara_node(described_class.new(suppress_link: true, **kwargs))
|
7
8
|
end
|
8
9
|
|
9
|
-
let(:kwargs) { {
|
10
|
-
let(:facet_item) { instance_double(Blacklight::FacetItemPresenter, label:
|
11
|
-
let(:facet_config) { Blacklight::Configuration::FacetField.new(field:
|
10
|
+
let(:kwargs) { {facet_item: facet_item} }
|
11
|
+
let(:facet_item) { instance_double(Blacklight::FacetItemPresenter, label: "Stanford", value: "stanford", hits: 5, href: nil, selected?: false, facet_config: facet_config) }
|
12
|
+
let(:facet_config) { Blacklight::Configuration::FacetField.new(field: "provider_facet", label: "Provider") }
|
12
13
|
|
13
|
-
it
|
14
|
-
expect(rendered).to have_selector(
|
15
|
-
expect(rendered).to have_selector(
|
14
|
+
it "prepends the icon to the facet item label" do
|
15
|
+
expect(rendered).to have_selector("span.facet-label", text: "Stanford")
|
16
|
+
expect(rendered).to have_selector("span.facet-label svg title", text: "Stanford University")
|
16
17
|
end
|
17
18
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe "Config" do
|
6
|
+
it "Loads new v4.1 Settings defaults" do
|
7
|
+
expect(Settings).to respond_to("RELATIONSHIPS_SHOWN")
|
8
|
+
expect(Settings.FIELDS.DISPLAY_NOTE).to be_present
|
9
|
+
expect(Settings.DISPLAY_NOTES_SHOWN).to respond_to(:danger)
|
10
|
+
expect(Settings.SIDEBAR_STATIC_MAP).to include("iiif")
|
11
|
+
|
7
12
|
[:field, :query_type, :icon, :label].each do |method|
|
8
|
-
expect(Settings.RELATIONSHIPS_SHOWN.
|
13
|
+
expect(Settings.RELATIONSHIPS_SHOWN.MEMBER_OF_ANCESTORS).to respond_to(method)
|
9
14
|
end
|
10
15
|
end
|
11
|
-
|
12
|
-
it 'Loads new v3.4 Settings.FIELDS defaults' do
|
13
|
-
expect(Settings.HOMEPAGE_MAP_GEOM).to be_nil
|
14
|
-
end
|
15
16
|
end
|
@@ -1,61 +1,62 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe CatalogController, type: :controller do
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
get :web_services, params: {
|
6
|
+
describe "#web_services" do
|
7
|
+
it "returns a document based off an id" do
|
8
|
+
get :web_services, params: {id: "mit-f6rqs4ucovjk2"}
|
8
9
|
expect(response).to have_http_status :ok
|
9
10
|
expect(assigns(:documents)).not_to be_nil
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
describe
|
14
|
-
it
|
14
|
+
describe ".default_solr_params" do
|
15
|
+
it "sets the number of rows returned by Solr to 10 and does not filter the results" do
|
15
16
|
get :index
|
16
17
|
expect(response).to have_http_status :ok
|
17
18
|
expect(assigns(:response).docs).not_to be_empty
|
18
19
|
expect(assigns(:response).docs.length).to eq 10
|
19
20
|
end
|
20
21
|
|
21
|
-
it
|
22
|
+
it "sets the starting document index to 0" do
|
22
23
|
get :index
|
23
24
|
expect(response).to have_http_status :ok
|
24
25
|
expect(assigns(:response).docs).not_to be_empty
|
25
|
-
expect(assigns(:response).docs.first.id).to eq
|
26
|
+
expect(assigns(:response).docs.first.id).to eq "stanford-cg357zz0321"
|
26
27
|
end
|
27
28
|
|
28
|
-
context
|
29
|
+
context "with altered default parameters" do
|
29
30
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
30
31
|
|
31
32
|
before do
|
32
33
|
allow(controller).to receive_messages blacklight_config: blacklight_config
|
33
34
|
end
|
34
35
|
|
35
|
-
it
|
36
|
-
blacklight_config.default_solr_params = {
|
36
|
+
it "sets the starting document index" do
|
37
|
+
blacklight_config.default_solr_params = {:start => 2, "q.alt" => "*:*"}
|
37
38
|
get :index
|
38
39
|
expect(response).to have_http_status :ok
|
39
40
|
expect(assigns(:response).docs).not_to be_empty
|
40
|
-
expect(assigns(:response).docs.first.id).to eq
|
41
|
+
expect(assigns(:response).docs.first.id).to eq "mit-001145244"
|
41
42
|
end
|
42
43
|
|
43
|
-
it
|
44
|
-
blacklight_config.default_solr_params = {
|
44
|
+
it "filters using a default DisMax query when no query is provided by the client" do
|
45
|
+
blacklight_config.default_solr_params = {:start => 10, "q.alt" => "{!dismax}id:nyu"}
|
45
46
|
get :index
|
46
47
|
expect(response).to have_http_status :ok
|
47
48
|
expect(assigns(:response).docs).to be_empty
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
51
|
-
context
|
52
|
+
context "with altered per page parameters" do
|
52
53
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
53
54
|
|
54
55
|
before do
|
55
56
|
allow(controller).to receive_messages blacklight_config: blacklight_config
|
56
57
|
end
|
57
58
|
|
58
|
-
it
|
59
|
+
it "alters the number of documents returned from Solr" do
|
59
60
|
blacklight_config.default_per_page = 20
|
60
61
|
get :index
|
61
62
|
expect(response).to have_http_status :ok
|
@@ -65,19 +66,19 @@ describe CatalogController, type: :controller do
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
describe
|
69
|
-
it
|
70
|
-
get :raw, params: {
|
69
|
+
describe "#raw" do
|
70
|
+
it "returns a JSON representation of a Solr Document" do
|
71
|
+
get :raw, params: {id: "tufts-cambridgegrid100-04"}
|
71
72
|
expect(response).to have_http_status :ok
|
72
73
|
expect(response.body).not_to be_empty
|
73
74
|
response_values = JSON.parse(response.body)
|
74
|
-
expect(response_values).to include
|
75
|
-
expect(response_values).to include Settings.FIELDS.TITLE =>
|
76
|
-
expect(response_values).to include Settings.FIELDS.IDENTIFIER => [
|
77
|
-
expect(response_values).to include Settings.FIELDS.ACCESS_RIGHTS =>
|
78
|
-
expect(response_values).to include Settings.FIELDS.PROVIDER =>
|
79
|
-
expect(response_values).to include Settings.FIELDS.ID =>
|
80
|
-
expect(response_values).to include Settings.FIELDS.GEOMETRY =>
|
75
|
+
expect(response_values).to include "gbl_mdVersion_s" => "Aardvark"
|
76
|
+
expect(response_values).to include Settings.FIELDS.TITLE => "100 Foot Grid Cambridge MA 2004"
|
77
|
+
expect(response_values).to include Settings.FIELDS.IDENTIFIER => ["urn:geodata.tufts.edu:Tufts.CambridgeGrid100_04"]
|
78
|
+
expect(response_values).to include Settings.FIELDS.ACCESS_RIGHTS => "Public"
|
79
|
+
expect(response_values).to include Settings.FIELDS.PROVIDER => "Tufts"
|
80
|
+
expect(response_values).to include Settings.FIELDS.ID => "tufts-cambridgegrid100-04"
|
81
|
+
expect(response_values).to include Settings.FIELDS.GEOMETRY => "ENVELOPE(-71.163984,-71.052581,42.408316,42.34757)"
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
@@ -1,120 +1,121 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe DownloadController, type: :controller do
|
5
|
-
describe
|
6
|
-
describe
|
7
|
-
it
|
8
|
-
get :file, params: {
|
6
|
+
describe "#file" do
|
7
|
+
describe "restricted file" do
|
8
|
+
it "redirects to login for authentication" do
|
9
|
+
get :file, params: {id: "stanford-cg357zz0321-shapefile", format: "zip"}
|
9
10
|
expect(response).to have_http_status :unauthorized
|
10
11
|
end
|
11
12
|
end
|
12
|
-
describe
|
13
|
-
it
|
13
|
+
describe "public file" do
|
14
|
+
it "initiates download" do
|
14
15
|
allow(controller).to receive(:render) # Needed for testing with Rails 4
|
15
16
|
expect(controller).to receive(:send_file)
|
16
|
-
get :file, params: {
|
17
|
+
get :file, params: {id: "mit-f6rqs4ucovjk2-shapefile", format: "zip"}
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
20
|
-
describe
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
get :show, params: {
|
21
|
+
describe "#show" do
|
22
|
+
describe "restricted file" do
|
23
|
+
it "redirects to login for authentication" do
|
24
|
+
get :show, params: {id: "stanford-cg357zz0321", format: "json"}
|
24
25
|
expect(response).to have_http_status :unauthorized
|
25
26
|
end
|
26
27
|
end
|
27
|
-
describe
|
28
|
+
describe "public file" do
|
28
29
|
let(:shapefile_download) { instance_double(Geoblacklight::ShapefileDownload) }
|
29
30
|
|
30
31
|
before do
|
31
32
|
allow(Geoblacklight::ShapefileDownload).to receive(:new).and_return(shapefile_download)
|
32
33
|
end
|
33
34
|
|
34
|
-
it
|
35
|
-
allow(shapefile_download).to receive(:get).and_return(
|
36
|
-
get :show, params: {
|
35
|
+
it "initiates download creation" do
|
36
|
+
allow(shapefile_download).to receive(:get).and_return("success")
|
37
|
+
get :show, params: {id: "mit-f6rqs4ucovjk2", type: "shapefile"}
|
37
38
|
expect(response).to have_http_status :ok
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
|
-
context
|
42
|
-
let(:id) {
|
43
|
-
let(:type) {
|
42
|
+
context "when requesting GeoJSON files" do
|
43
|
+
let(:id) { "tufts-cambridgegrid100-04" }
|
44
|
+
let(:type) { "geojson" }
|
44
45
|
let(:geojson_download) { instance_double(Geoblacklight::GeojsonDownload) }
|
45
46
|
|
46
47
|
before do
|
47
|
-
allow(geojson_download).to receive(:get).and_return(
|
48
|
+
allow(geojson_download).to receive(:get).and_return("file.json")
|
48
49
|
allow(Geoblacklight::GeojsonDownload).to receive(:new).and_return(geojson_download)
|
49
50
|
end
|
50
51
|
|
51
|
-
it
|
52
|
+
it "downloads the files and notifies the user" do
|
52
53
|
expect(Geoblacklight::GeojsonDownload).to receive(:new)
|
53
|
-
get :show, params: {
|
54
|
+
get :show, params: {id: id, type: type}
|
54
55
|
|
55
|
-
expect(response.body).to include
|
56
|
-
expect(response.body).to include
|
56
|
+
expect(response.body).to include "success"
|
57
|
+
expect(response.body).to include "Your file file.json is ready for download"
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
context
|
61
|
-
let(:id) {
|
62
|
-
let(:type) {
|
61
|
+
context "when requesting GeoTIFF files" do
|
62
|
+
let(:id) { "tufts-cambridgegrid100-04" }
|
63
|
+
let(:type) { "geotiff" }
|
63
64
|
let(:geotiff_download) { instance_double(Geoblacklight::GeotiffDownload) }
|
64
65
|
|
65
66
|
before do
|
66
|
-
allow(geotiff_download).to receive(:get).and_return(
|
67
|
+
allow(geotiff_download).to receive(:get).and_return("file.tiff")
|
67
68
|
allow(Geoblacklight::GeotiffDownload).to receive(:new).and_return(geotiff_download)
|
68
69
|
end
|
69
70
|
|
70
|
-
it
|
71
|
+
it "downloads the files and notifies the user" do
|
71
72
|
expect(Geoblacklight::GeotiffDownload).to receive(:new)
|
72
|
-
get :show, params: {
|
73
|
+
get :show, params: {id: id, type: type}
|
73
74
|
|
74
|
-
expect(response.body).to include
|
75
|
-
expect(response.body).to include
|
75
|
+
expect(response.body).to include "success"
|
76
|
+
expect(response.body).to include "Your file file.tiff is ready for download"
|
76
77
|
end
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
|
-
describe
|
81
|
+
describe "#hgl" do
|
81
82
|
let(:hgl_download) { instance_double(Geoblacklight::HglDownload) }
|
82
83
|
|
83
|
-
it
|
84
|
-
allow(hgl_download).to receive(:get).and_return(
|
84
|
+
it "requests file" do
|
85
|
+
allow(hgl_download).to receive(:get).and_return("success")
|
85
86
|
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
86
87
|
|
87
|
-
get :hgl, params: {
|
88
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3", email: "foo@example.com"}
|
88
89
|
expect(response).to have_http_status :ok
|
89
90
|
end
|
90
91
|
|
91
|
-
it
|
92
|
+
it "renders form" do
|
92
93
|
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
93
94
|
|
94
|
-
get :hgl, params: {
|
95
|
-
expect(response).to render_template(
|
95
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3"}
|
96
|
+
expect(response).to render_template("hgl")
|
96
97
|
end
|
97
98
|
|
98
|
-
context
|
99
|
+
context "when an error occurs while downloading a file" do
|
99
100
|
let(:exception) { Geoblacklight::Exceptions::ExternalDownloadFailed.new(url: nil) }
|
100
101
|
|
101
|
-
it
|
102
|
+
it "uses the default error message when the exception does not have a URL" do
|
102
103
|
allow(Geoblacklight::HglDownload).to receive(:new).and_raise(exception)
|
103
104
|
|
104
|
-
get :hgl, params: {
|
105
|
-
expect(response.body).to include(
|
106
|
-
expect(response.body).to include(
|
105
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3", email: "foo@example.com"}
|
106
|
+
expect(response.body).to include("danger")
|
107
|
+
expect(response.body).to include("Sorry, the requested file could not be downloaded")
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
110
|
-
context
|
111
|
-
it
|
111
|
+
context "when downloading the requested file fails" do
|
112
|
+
it "flashes the error message" do
|
112
113
|
allow(hgl_download).to receive(:get).and_return(nil)
|
113
114
|
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
114
115
|
|
115
|
-
get :hgl, params: {
|
116
|
-
expect(response.body).to include(
|
117
|
-
expect(response.body).to include(
|
116
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3", email: "foo@example.com"}
|
117
|
+
expect(response.body).to include("danger")
|
118
|
+
expect(response.body).to include("Sorry, the requested file could not be downloaded")
|
118
119
|
end
|
119
120
|
end
|
120
121
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe RelationController, type: :controller do
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
get :index, params: {
|
6
|
+
describe "#index" do
|
7
|
+
it "returns a listing of related documents for a record" do
|
8
|
+
get :index, params: {id: "nyu_2451_34502"}
|
8
9
|
expect(response).to have_http_status :ok
|
9
10
|
expect(assigns(:relations)).not_to be_nil
|
10
11
|
end
|