geoblacklight 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2b4e8cdd2abd133e663a53e4ffd289a4a3a985c
4
- data.tar.gz: 5d78163437e30eb35a0ef6fa0a88ed8d8fe77a7c
3
+ metadata.gz: 3fbbd1cee6968a57c66c02b5feeecc88c1db0b40
4
+ data.tar.gz: 449649509ad18a912fcaa748a1b77fbe5e0fa1e8
5
5
  SHA512:
6
- metadata.gz: 3516a9bcb20e42d49bad3ce0c4661a30a8b954da619f01372f36fe7e3ce8eb8b99bea0288a99fe2a13ddea48dad4cfa4cf5a42478589966e68b9f73fe093cc89
7
- data.tar.gz: adf65bf73c7c7f56cfdca331beba85c47e71115e032177be4b8c7fe8858d468532778ecbe370f67095ed8aa573734f557c1eec7ebf2a53c65c67442a94176599
6
+ metadata.gz: 02e426d0152ffa9e06c4d2a55e2ac300ed40f6419ed068095b19d6acc0d8051963ed44d53722497598612a9a5fb11e540ac5ced525da7c0ff5f81f40a0753cb5
7
+ data.tar.gz: 434bc34f80ecd636a5e88ee72f8201b1660a80359c0f8a95ed38411347c8c3fe90296531a6be92bbb0a154a3f04a8daebcd6f5a8a9433a00146a45671df554cf
data/.travis.yml CHANGED
@@ -15,6 +15,7 @@ matrix:
15
15
  env: "RAILS_VERSION=5.0.0"
16
16
 
17
17
  before_install:
18
+ - gem update --system
18
19
  - gem install bundler
19
20
 
20
21
  env:
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
- system "bundle exec rails s #{args[:rails_server_args]}"
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
@@ -20,7 +20,7 @@
20
20
 
21
21
  var GeoBlacklight = L.Class.extend({
22
22
  statics: {
23
- __version__: '1.1.0',
23
+ __version__: '1.1.2',
24
24
 
25
25
  debounce: function(fn, delay) {
26
26
  var timeout = null;
@@ -1,9 +1,15 @@
1
1
  class WmsController < ApplicationController
2
2
  def handle
3
- response = Geoblacklight::WmsLayer.new(params).feature_info
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
@@ -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'
@@ -1,3 +1,3 @@
1
1
  module Geoblacklight
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
@@ -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
- system "bundle exec rails s #{args[:rails_server_args]}"
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
- it 'returns only URL parameter' do
14
- expect(wms_layer.url).to eq 'http://www.example.com/'
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
- it 'returns all params except URL plus default params' do
20
- expect(wms_layer.search_params.length).to eq 8
21
- expect(wms_layer.search_params).not_to include 'URL' => 'http://www.example.com'
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
@@ -1,6 +1,5 @@
1
- gem 'blacklight'
2
- gem 'geoblacklight'
3
- gem 'jettywrapper'
1
+ gem 'blacklight', '>= 6.3'
2
+ gem 'geoblacklight', '>= 1.1.2'
4
3
 
5
4
  run 'bundle install'
6
5
 
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.0
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-05 00:00:00.000000000 Z
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: '0'
523
+ version: 2.5.2
524
524
  requirements: []
525
525
  rubyforge_project:
526
- rubygems_version: 2.5.1
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