geoblacklight 1.1.0 → 1.1.2
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/.travis.yml +1 -0
- data/Rakefile +9 -2
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +1 -1
- data/app/controllers/wms_controller.rb +7 -1
- data/geoblacklight.gemspec +1 -0
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/tasks/geoblacklight.rake +9 -1
- data/spec/controllers/wms_controller_spec.rb +34 -0
- data/spec/lib/geoblacklight/wms_layer_spec.rb +41 -6
- data/template.rb +2 -3
- metadata +6 -6
- data/spec/test_app_templates/solr_documents +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fbbd1cee6968a57c66c02b5feeecc88c1db0b40
|
4
|
+
data.tar.gz: 449649509ad18a912fcaa748a1b77fbe5e0fa1e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02e426d0152ffa9e06c4d2a55e2ac300ed40f6419ed068095b19d6acc0d8051963ed44d53722497598612a9a5fb11e540ac5ced525da7c0ff5f81f40a0753cb5
|
7
|
+
data.tar.gz: 434bc34f80ecd636a5e88ee72f8201b1660a80359c0f8a95ed38411347c8c3fe90296531a6be92bbb0a154a3f04a8daebcd6f5a8a9433a00146a45671df554cf
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'rubygems'
|
3
2
|
require 'rails'
|
4
3
|
begin
|
5
4
|
require 'bundler/setup'
|
5
|
+
require 'bundler/gem_tasks'
|
6
6
|
rescue LoadError
|
7
7
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
8
8
|
end
|
@@ -79,7 +79,14 @@ namespace :geoblacklight do
|
|
79
79
|
Rake::Task['geoblacklight:internal:seed'].invoke
|
80
80
|
|
81
81
|
within_test_app do
|
82
|
-
|
82
|
+
puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
|
83
|
+
puts "\n^C to stop"
|
84
|
+
puts ' '
|
85
|
+
begin
|
86
|
+
system "bundle exec rails s #{args[:rails_server_args]}"
|
87
|
+
rescue Interrupt
|
88
|
+
puts 'Shutting down...'
|
89
|
+
end
|
83
90
|
end
|
84
91
|
end
|
85
92
|
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
class WmsController < ApplicationController
|
2
2
|
def handle
|
3
|
-
response = Geoblacklight::WmsLayer.new(
|
3
|
+
response = Geoblacklight::WmsLayer.new(wms_params).feature_info
|
4
4
|
|
5
5
|
respond_to do |format|
|
6
6
|
format.json { render json: response }
|
7
7
|
end
|
8
8
|
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def wms_params
|
13
|
+
params.permit('URL', 'LAYERS', 'BBOX', 'WIDTH', 'HEIGHT', 'QUERY_LAYERS', 'X', 'Y')
|
14
|
+
end
|
9
15
|
end
|
data/geoblacklight.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
|
+
spec.required_rubygems_version = '>= 2.5.2'
|
20
21
|
|
21
22
|
spec.add_dependency 'rails', '>= 4.2.0', '< 6'
|
22
23
|
spec.add_dependency 'blacklight', '~> 6.3'
|
@@ -7,7 +7,15 @@ namespace :geoblacklight do
|
|
7
7
|
task :server, [:rails_server_args] do |_t, args|
|
8
8
|
SolrWrapper.wrap(port: '8983') do |solr|
|
9
9
|
solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('../../', File.dirname(__FILE__)), 'solr', 'conf')) do
|
10
|
-
|
10
|
+
puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
|
11
|
+
puts "\n^C to stop"
|
12
|
+
puts ' '
|
13
|
+
begin
|
14
|
+
Rake::Task['geoblacklight:solr:seed'].invoke
|
15
|
+
system "bundle exec rails s #{args[:rails_server_args]}"
|
16
|
+
rescue Interrupt
|
17
|
+
puts 'Shutting down...'
|
18
|
+
end
|
11
19
|
end
|
12
20
|
end
|
13
21
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Geoblacklight::WmsController, type: :controller do
|
4
|
+
let(:wms_layer) { instance_double('Geoblacklight::WmsLayer') }
|
5
|
+
let(:feature_info) { { values: ['fid', 'layer:example'] } }
|
6
|
+
let(:params) do
|
7
|
+
{ format: 'json', 'URL' => 'http://www.example.com/', 'LAYERS' => 'layer:example',
|
8
|
+
'BBOX' => '-74, 40, -68, 43', 'WIDTH' => '500', 'HEIGHT' => '400',
|
9
|
+
'QUERY_LAYERS' => 'layer:example', 'X' => '277', 'Y' => '195' }
|
10
|
+
end
|
11
|
+
|
12
|
+
before do
|
13
|
+
allow(Geoblacklight::WmsLayer).to receive(:new).and_return(wms_layer)
|
14
|
+
allow(wms_layer).to receive(:feature_info).and_return(feature_info)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#handle' do
|
18
|
+
it 'returns feature info as json' do
|
19
|
+
get :handle, params: params
|
20
|
+
expect(response.body).to eq(feature_info.to_json)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#wms_params' do
|
25
|
+
let(:wms_params) { controller.instance_eval { wms_params } }
|
26
|
+
|
27
|
+
it 'returns only permitted params' do
|
28
|
+
get :handle, params: params
|
29
|
+
expect(wms_params.to_h).not_to eq(params)
|
30
|
+
params.delete(:format)
|
31
|
+
expect(wms_params.to_h).to eq(params)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,28 +1,63 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Geoblacklight::WmsLayer do
|
4
|
-
let(:params) { { 'URL' => 'http://www.example.com/', 'X' => '277' } }
|
5
4
|
let(:wms_layer) { described_class.new(params) }
|
5
|
+
let(:rails_4_params) { { 'URL' => 'http://www.example.com/', 'X' => '277' } }
|
6
|
+
let(:rails_5_params) { instance_double('ActionController::Parameters') }
|
7
|
+
|
8
|
+
before do
|
9
|
+
allow(rails_5_params).to receive(:to_h).and_return('URL' => 'http://www.example.com/', 'X' => '277')
|
10
|
+
end
|
11
|
+
|
6
12
|
describe '#initialize' do
|
13
|
+
let(:params) { rails_4_params }
|
14
|
+
|
7
15
|
it 'initializes as a WmsLayer object' do
|
8
16
|
expect(wms_layer).to be_an described_class
|
9
17
|
end
|
10
18
|
end
|
11
19
|
|
12
20
|
describe '#url' do
|
13
|
-
|
14
|
-
|
21
|
+
context 'when running on rails 4' do
|
22
|
+
let(:params) { rails_4_params }
|
23
|
+
|
24
|
+
it 'returns the correct URL parameter' do
|
25
|
+
expect(wms_layer.url).to eq('http://www.example.com/')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when running on rails 5' do
|
30
|
+
let(:params) { rails_5_params }
|
31
|
+
|
32
|
+
it 'returns the correct URL parameter' do
|
33
|
+
expect(wms_layer.url).to eq('http://www.example.com/')
|
34
|
+
end
|
15
35
|
end
|
16
36
|
end
|
17
37
|
|
18
38
|
describe '#search_params' do
|
19
|
-
|
20
|
-
|
21
|
-
|
39
|
+
context 'when running on rails 4' do
|
40
|
+
let(:params) { rails_4_params }
|
41
|
+
|
42
|
+
it 'returns all params except URL plus default params' do
|
43
|
+
expect(wms_layer.search_params.length).to eq 8
|
44
|
+
expect(wms_layer.search_params).not_to include 'URL' => 'http://www.example.com/'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when running on rails 5' do
|
49
|
+
let(:params) { rails_5_params }
|
50
|
+
|
51
|
+
it 'returns all params except URL plus default params' do
|
52
|
+
expect(wms_layer.search_params.length).to eq 8
|
53
|
+
expect(wms_layer.search_params).not_to include 'URL' => 'http://www.example.com/'
|
54
|
+
end
|
22
55
|
end
|
23
56
|
end
|
24
57
|
|
25
58
|
describe '#request_response' do
|
59
|
+
let(:params) { rails_4_params }
|
60
|
+
|
26
61
|
it 'returns a Faraday object' do
|
27
62
|
faraday = double('faraday')
|
28
63
|
allow(faraday).to receive(:get)
|
data/template.rb
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.2
|
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: 2016-08-
|
14
|
+
date: 2016-08-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -425,6 +425,7 @@ files:
|
|
425
425
|
- solr/conf/xslt/luke.xsl
|
426
426
|
- spec/controllers/catalog_controller_spec.rb
|
427
427
|
- spec/controllers/download_controller_spec.rb
|
428
|
+
- spec/controllers/wms_controller_spec.rb
|
428
429
|
- spec/factories/user.rb
|
429
430
|
- spec/features/bookmarks_spec.rb
|
430
431
|
- spec/features/configurable_basemap_spec.rb
|
@@ -494,7 +495,6 @@ files:
|
|
494
495
|
- spec/support/features/session_helpers.rb
|
495
496
|
- spec/teaspoon_env.rb
|
496
497
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
497
|
-
- spec/test_app_templates/solr_documents
|
498
498
|
- spec/views/catalog/_document_split.html.erb_spec.rb
|
499
499
|
- spec/views/catalog/_downloads.html.erb_spec.rb
|
500
500
|
- spec/views/catalog/_index_split.html.erb_spec.rb
|
@@ -520,16 +520,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
520
520
|
requirements:
|
521
521
|
- - ">="
|
522
522
|
- !ruby/object:Gem::Version
|
523
|
-
version:
|
523
|
+
version: 2.5.2
|
524
524
|
requirements: []
|
525
525
|
rubyforge_project:
|
526
|
-
rubygems_version: 2.
|
526
|
+
rubygems_version: 2.4.8
|
527
527
|
signing_key:
|
528
528
|
specification_version: 4
|
529
529
|
summary: A discovery platform for geospatial holdings
|
530
530
|
test_files:
|
531
531
|
- spec/controllers/catalog_controller_spec.rb
|
532
532
|
- spec/controllers/download_controller_spec.rb
|
533
|
+
- spec/controllers/wms_controller_spec.rb
|
533
534
|
- spec/factories/user.rb
|
534
535
|
- spec/features/bookmarks_spec.rb
|
535
536
|
- spec/features/configurable_basemap_spec.rb
|
@@ -599,7 +600,6 @@ test_files:
|
|
599
600
|
- spec/support/features/session_helpers.rb
|
600
601
|
- spec/teaspoon_env.rb
|
601
602
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
602
|
-
- spec/test_app_templates/solr_documents
|
603
603
|
- spec/views/catalog/_document_split.html.erb_spec.rb
|
604
604
|
- spec/views/catalog/_downloads.html.erb_spec.rb
|
605
605
|
- spec/views/catalog/_index_split.html.erb_spec.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
../fixtures/solr_documents
|