geoblacklight 4.0.0.pre.rc2 → 4.0.0.pre.rc3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e016f04146c4adb059ab8e46fc9ab057bc6f3fbaddc93db8bc08f1cbd4f9109
4
- data.tar.gz: 32ce106b04443cbcf338542e6cf249fac74fd1d3631ec07f8bd91f71cef65b5d
3
+ metadata.gz: c79db293440e20eec134b810891862224cc2ffd664c0e0b1899235bd6c577d52
4
+ data.tar.gz: 20fd4af3b5cb75b5902370b464da4d50f0afdb081d143e566275fd6ec7f6ece6
5
5
  SHA512:
6
- metadata.gz: 434df1f2da05c35bc5aa86c3209810f6cc6cba302153a42e005aea9997ea59e1049deba575d720da8b8324c16d2cc14774507a591fba76bb043b94e39c7ad0c4
7
- data.tar.gz: 4150a0c44452e67547212301a17ee1ace802784034845b7832f5cbcb82f686c9dbab68f93d6b61dcef54f5405fc7ab35312d4b100055f00a276f14efa2db7cc1
6
+ metadata.gz: 814e2426bdd9024a0d68b4750f2a9b02ac45e8bdf52f8a0c1d54004ae1f3140bce2b93223982ebfc19e960561c6afaaef939f8c7909d91949f15cb1151d34a33
7
+ data.tar.gz: 72113af4255d38766e2916ddeac83796daaf3f8079e6eeac631603e9768fb38fc213a12460b0151a0bf9943da33fa4bee9e4b902f0b43e58b299aa1dc19b2d10
@@ -33,6 +33,11 @@ jobs:
33
33
  rails_version: 6.1
34
34
  bundler_version: 2.1.1
35
35
  faraday_version: '~> 1.0'
36
+ - ruby_version: '3.0'
37
+ rails_version: '7.0.2.2'
38
+ bundler_version: 2.1.1
39
+ faraday_version: '>= 2'
40
+
36
41
  name: test ruby ${{ matrix.ruby_version }} / rails ${{ matrix.rails_version }} / faraday ${{ matrix.faraday_version }}
37
42
  steps:
38
43
  - uses: actions/checkout@v2
data/.rubocop.yml CHANGED
@@ -70,6 +70,11 @@ RSpec/AnyInstance:
70
70
  - 'spec/models/concerns/geoblacklight/solr_document/finder_spec.rb'
71
71
  - 'spec/features/download_layer_spec.rb'
72
72
 
73
+ RSpec/Capybara/SpecificMatcher:
74
+ Exclude:
75
+ - spec/components/geoblacklight/*
76
+ - spec/features/*
77
+
73
78
  RSpec/DescribeClass:
74
79
  Exclude:
75
80
  - spec/tasks/*
@@ -85,6 +90,7 @@ RSpec/VerifiedDoubles:
85
90
  Exclude:
86
91
  - 'spec/lib/geoblacklight/download/hgl_download_spec.rb'
87
92
  - 'spec/lib/geoblacklight/document_presenter_spec.rb'
93
+ - 'spec/lib/geoblacklight/references_spec.rb'
88
94
 
89
95
  # TODO: Investigate use of OpenStruct in specs
90
96
  Style/OpenStructUse:
data/.solr_wrapper CHANGED
@@ -1,4 +1,4 @@
1
- url: https://archive.apache.org/dist/lucene/solr/8.11.1/solr-8.11.1.zip
1
+ url: https://archive.apache.org/dist/lucene/solr/8.11.2/solr-8.11.2.tgz
2
2
  validate: false
3
3
  instance_dir: tmp/solr
4
4
  download_dir: tmp/solr
@@ -11,6 +11,6 @@ class WmsController < ApplicationController
11
11
  private
12
12
 
13
13
  def wms_params
14
- params.permit('URL', 'LAYERS', 'BBOX', 'WIDTH', 'HEIGHT', 'QUERY_LAYERS', 'X', 'Y')
14
+ params.permit(Settings.GBL_PARAMS)
15
15
  end
16
16
  end
@@ -20,6 +20,7 @@ en:
20
20
  export_shapefile_link: 'Shapefile'
21
21
  export_kmz_link: 'KMZ'
22
22
  export_geojson_link: 'GeoJSON'
23
+ export_geotiff_link: 'GeoTIFF'
23
24
  home:
24
25
  headline: 'Explore and discover...'
25
26
  search_heading: 'Find the maps and data you need'
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
  spec.required_rubygems_version = '>= 2.5.2'
21
21
 
22
- spec.add_dependency 'rails', '>= 6.1', '< 7'
22
+ spec.add_dependency 'rails', '>= 6.1', '< 7.1'
23
23
  spec.add_dependency 'blacklight', '~> 7.12'
24
24
  spec.add_dependency 'config'
25
25
  spec.add_dependency 'faraday', '>= 1.0'
@@ -17,7 +17,7 @@ module Geoblacklight
17
17
  def add_javascript
18
18
  copy_file 'assets/geoblacklight.js', 'app/assets/javascripts/geoblacklight.js'
19
19
 
20
- if Rails.version.to_i == 6
20
+ if Rails.version.to_i >= 6
21
21
  append_to_file 'app/assets/javascripts/application.js',
22
22
  "\n// Required by GeoBlacklight\n//= require geoblacklight"
23
23
  end
@@ -7,6 +7,23 @@ module Geoblacklight
7
7
 
8
8
  desc 'Install Geoblacklight'
9
9
 
10
+ def allow_geoblacklight_params
11
+ gbl_params = <<-"PARAMS"
12
+ before_action :allow_geoblacklight_params
13
+
14
+ def allow_geoblacklight_params
15
+ # Blacklight::Parameters will pass these to params.permit
16
+ blacklight_config.search_state_fields.append(Settings.GBL_PARAMS)
17
+ end
18
+ PARAMS
19
+
20
+ inject_into_file 'app/controllers/application_controller.rb', gbl_params, before: /^end/
21
+ end
22
+
23
+ def raise_unpermitted_params
24
+ inject_into_file 'config/environments/test.rb', "config.action_controller.action_on_unpermitted_parameters = :raise\n", before: /^end/
25
+ end
26
+
10
27
  def mount_geoblacklight_engine
11
28
  inject_into_file 'config/routes.rb', "mount Geoblacklight::Engine => 'geoblacklight'\n", before: /^end/
12
29
  end
@@ -22,6 +22,25 @@ OVERLAP_RATIO_BOOST: '2'
22
22
  HOMEPAGE_MAP_GEOM: null
23
23
  # HOMEPAGE_MAP_GEOM: '{"type":"Polygon","coordinates":[[[-73.58,42.93],[-73.58,41.20],[-69.90,41.20],[-69.90,42.93]]]}'
24
24
 
25
+ # Non-search-field GeoBlacklight application permitted params
26
+ GBL_PARAMS:
27
+ - :bbox
28
+ - :email
29
+ - :file
30
+ - :format
31
+ - :id
32
+ - :logo
33
+ - :provider
34
+ - :type
35
+ - :BBOX
36
+ - :HEIGHT
37
+ - :LAYERS
38
+ - :QUERY_LAYERS
39
+ - :URL
40
+ - :WIDTH
41
+ - :X
42
+ - :Y
43
+
25
44
  # Solr field mappings
26
45
  FIELDS:
27
46
  :ACCESS_RIGHTS: 'dct_accessRights_s'
@@ -48,7 +48,7 @@ module Geoblacklight
48
48
  File.rename("#{file_path_and_name}.tmp", file_path_and_name)
49
49
  file_name
50
50
  rescue Geoblacklight::Exceptions::WrongDownloadFormat => error
51
- Geoblacklight.logger.error "#{error} expected #{@options[:content_type]} "\
51
+ Geoblacklight.logger.error "#{error} expected #{@options[:content_type]} " \
52
52
  "received #{download.headers['content-type']}"
53
53
  File.delete("#{file_path_and_name}.tmp")
54
54
  raise Geoblacklight::Exceptions::ExternalDownloadFailed, message: 'Wrong download type'
@@ -13,8 +13,10 @@ module Geoblacklight
13
13
  # GeoblacklightHelper is needed by all helpers, so we inject it
14
14
  # into action view base here.
15
15
  initializer 'geoblacklight.helpers' do
16
- ActionView::Base.send :include, GeoblacklightHelper
17
- ActionView::Base.send :include, CartoHelper
16
+ config.after_initialize do
17
+ ActionView::Base.send :include, GeoblacklightHelper
18
+ ActionView::Base.send :include, CartoHelper
19
+ end
18
20
  end
19
21
 
20
22
  config.to_prepare do
@@ -31,7 +31,7 @@ module Geoblacklight
31
31
  def cleaned_metadata
32
32
  transformed_doc = Nokogiri::XML(@metadata.to_html)
33
33
  if transformed_doc.xpath('//body').children.empty?
34
- fail TransformError,\
34
+ fail TransformError, \
35
35
  'Failed to extract the <body> child elements from the transformed metadata'
36
36
  end
37
37
  transformed_doc.xpath('//body').children
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Geoblacklight
3
- VERSION = '4.0.0-rc2'
3
+ VERSION = '4.0.0-rc3'
4
4
  end
@@ -5,7 +5,7 @@ describe CatalogController, type: :controller do
5
5
  describe '#web_services' do
6
6
  it 'returns a document based off an id' do
7
7
  get :web_services, params: { id: 'mit-f6rqs4ucovjk2' }
8
- expect(response.status).to eq 200
8
+ expect(response).to have_http_status :ok
9
9
  expect(assigns(:documents)).not_to be_nil
10
10
  end
11
11
  end
@@ -13,14 +13,14 @@ describe CatalogController, type: :controller do
13
13
  describe '.default_solr_params' do
14
14
  it 'sets the number of rows returned by Solr to 10 and does not filter the results' do
15
15
  get :index
16
- expect(response.status).to eq 200
16
+ expect(response).to have_http_status :ok
17
17
  expect(assigns(:response).docs).not_to be_empty
18
18
  expect(assigns(:response).docs.length).to eq 10
19
19
  end
20
20
 
21
21
  it 'sets the starting document index to 0' do
22
22
  get :index
23
- expect(response.status).to eq 200
23
+ expect(response).to have_http_status :ok
24
24
  expect(assigns(:response).docs).not_to be_empty
25
25
  expect(assigns(:response).docs.first.id).to eq 'stanford-cg357zz0321'
26
26
  end
@@ -35,7 +35,7 @@ describe CatalogController, type: :controller do
35
35
  it 'sets the starting document index' do
36
36
  blacklight_config.default_solr_params = { start: 2, 'q.alt' => '*:*' }
37
37
  get :index
38
- expect(response.status).to eq 200
38
+ expect(response).to have_http_status :ok
39
39
  expect(assigns(:response).docs).not_to be_empty
40
40
  expect(assigns(:response).docs.first.id).to eq 'mit-001145244'
41
41
  end
@@ -43,7 +43,7 @@ describe CatalogController, type: :controller do
43
43
  it 'filters using a default DisMax query when no query is provided by the client' do
44
44
  blacklight_config.default_solr_params = { start: 10, 'q.alt' => '{!dismax}id:nyu' }
45
45
  get :index
46
- expect(response.status).to eq 200
46
+ expect(response).to have_http_status :ok
47
47
  expect(assigns(:response).docs).to be_empty
48
48
  end
49
49
  end
@@ -58,7 +58,7 @@ describe CatalogController, type: :controller do
58
58
  it 'alters the number of documents returned from Solr' do
59
59
  blacklight_config.default_per_page = 20
60
60
  get :index
61
- expect(response.status).to eq 200
61
+ expect(response).to have_http_status :ok
62
62
  expect(assigns(:response).docs).not_to be_empty
63
63
  expect(assigns(:response).docs.length).to eq 20
64
64
  end
@@ -68,7 +68,7 @@ describe CatalogController, type: :controller do
68
68
  describe '#raw' do
69
69
  it 'returns a JSON representation of a Solr Document' do
70
70
  get :raw, params: { id: 'tufts-cambridgegrid100-04' }
71
- expect(response.status).to eq 200
71
+ expect(response).to have_http_status :ok
72
72
  expect(response.body).not_to be_empty
73
73
  response_values = JSON.parse(response.body)
74
74
  expect(response_values).to include 'gbl_mdVersion_s' => 'Aardvark'
@@ -6,7 +6,7 @@ describe DownloadController, type: :controller do
6
6
  describe 'restricted file' do
7
7
  it 'redirects to login for authentication' do
8
8
  get :file, params: { id: 'stanford-cg357zz0321-shapefile', format: 'zip' }
9
- expect(response.status).to eq 401
9
+ expect(response).to have_http_status :unauthorized
10
10
  end
11
11
  end
12
12
  describe 'public file' do
@@ -21,7 +21,7 @@ describe DownloadController, type: :controller do
21
21
  describe 'restricted file' do
22
22
  it 'redirects to login for authentication' do
23
23
  get :show, params: { id: 'stanford-cg357zz0321', format: 'json' }
24
- expect(response.status).to eq 401
24
+ expect(response).to have_http_status :unauthorized
25
25
  end
26
26
  end
27
27
  describe 'public file' do
@@ -34,7 +34,7 @@ describe DownloadController, type: :controller do
34
34
  it 'initiates download creation' do
35
35
  allow(shapefile_download).to receive(:get).and_return('success')
36
36
  get :show, params: { id: 'mit-f6rqs4ucovjk2', type: 'shapefile' }
37
- expect(response.status).to eq 200
37
+ expect(response).to have_http_status :ok
38
38
  end
39
39
  end
40
40
 
@@ -85,7 +85,7 @@ describe DownloadController, type: :controller do
85
85
  allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
86
86
 
87
87
  get :hgl, params: { id: 'harvard-g7064-s2-1834-k3', email: 'foo@example.com' }
88
- expect(response.status).to eq 200
88
+ expect(response).to have_http_status :ok
89
89
  end
90
90
 
91
91
  it 'renders form' do
@@ -5,7 +5,7 @@ describe RelationController, type: :controller do
5
5
  describe '#index' do
6
6
  it 'returns a listing of related documents for a record' do
7
7
  get :index, params: { id: 'nyu_2451_34502' }
8
- expect(response.status).to eq 200
8
+ expect(response).to have_http_status :ok
9
9
  expect(assigns(:relations)).not_to be_nil
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ describe WmsController, type: :controller do
5
5
  let(:wms_layer) { instance_double(Geoblacklight::WmsLayer) }
6
6
  let(:feature_info) { { values: ['fid', 'layer:example'] } }
7
7
  let(:params) do
8
- { format: 'json', 'URL' => 'http://www.example.com/', 'LAYERS' => 'layer:example',
8
+ { 'format' => 'json', 'URL' => 'http://www.example.com/', 'LAYERS' => 'layer:example',
9
9
  'BBOX' => '-74, 40, -68, 43', 'WIDTH' => '500', 'HEIGHT' => '400',
10
10
  'QUERY_LAYERS' => 'layer:example', 'X' => '277', 'Y' => '195' }
11
11
  end
@@ -27,8 +27,6 @@ describe WmsController, type: :controller do
27
27
 
28
28
  it 'returns only permitted params' do
29
29
  get :handle, params: params
30
- expect(wms_params.to_h).not_to eq(params)
31
- params.delete(:format)
32
30
  expect(wms_params.to_h).to eq(params)
33
31
  end
34
32
  end
@@ -139,8 +139,8 @@ describe GeoblacklightHelper, type: :helper do
139
139
  context 'as a String' do
140
140
  let(:document_attributes) do
141
141
  {
142
- value: 'This is a really long string that should get truncated when it gets rendered'\
143
- 'in the index view to give a brief description of the contents of a particular document'\
142
+ value: 'This is a really long string that should get truncated when it gets rendered' \
143
+ 'in the index view to give a brief description of the contents of a particular document' \
144
144
  'indexed into Solr'
145
145
  }
146
146
  end
@@ -154,8 +154,8 @@ describe GeoblacklightHelper, type: :helper do
154
154
  context 'as an Array' do
155
155
  let(:document_attributes) do
156
156
  {
157
- value: ['This is a really long string that should get truncated when it gets rendered'\
158
- 'in the index view to give a brief description of the contents of a particular document'\
157
+ value: ['This is a really long string that should get truncated when it gets rendered' \
158
+ 'in the index view to give a brief description of the contents of a particular document' \
159
159
  'indexed into Solr']
160
160
  }
161
161
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'spec_helper'
3
3
 
4
- describe 'catalog/_results_pagination.html.erb', type: :view do
4
+ describe 'catalog/_results_pagination', type: :view do
5
5
  it 'will have a #pagination wrapping div' do
6
6
  allow(view).to receive_messages(show_pagination?: false)
7
7
  render
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'spec_helper'
3
3
 
4
- describe 'catalog/_show_downloads.html.erb', type: :view do
4
+ describe 'catalog/_show_downloads', type: :view do
5
5
  context 'document is downloadable' do
6
6
  let(:document) { instance_double(SolrDocument) }
7
7
  before do
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.0.0.pre.rc2
4
+ version: 4.0.0.pre.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2022-06-08 00:00:00.000000000 Z
14
+ date: 2022-07-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '6.1'
23
23
  - - "<"
24
24
  - !ruby/object:Gem::Version
25
- version: '7'
25
+ version: '7.1'
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '6.1'
33
33
  - - "<"
34
34
  - !ruby/object:Gem::Version
35
- version: '7'
35
+ version: '7.1'
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: blacklight
38
38
  requirement: !ruby/object:Gem::Requirement