geoblacklight 1.0.3 → 1.1.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.solr_wrapper +6 -0
  4. data/.travis.yml +18 -4
  5. data/README.md +2 -4
  6. data/Rakefile +58 -35
  7. data/app/assets/javascripts/geoblacklight/geoblacklight.js +1 -1
  8. data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +5 -1
  9. data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +6 -0
  10. data/app/helpers/carto_helper.rb +36 -0
  11. data/app/helpers/geoblacklight_helper.rb +10 -9
  12. data/app/models/concerns/geoblacklight/solr_document.rb +1 -1
  13. data/app/models/concerns/geoblacklight/solr_document/carto.rb +28 -0
  14. data/app/views/catalog/_exports.html.erb +3 -3
  15. data/config/initializers/rails_config.rb +1 -1
  16. data/config/locales/geoblacklight.en.yml +1 -0
  17. data/geoblacklight.gemspec +9 -8
  18. data/lib/generators/geoblacklight/install_generator.rb +8 -14
  19. data/lib/generators/geoblacklight/templates/settings.yml +2 -2
  20. data/lib/geoblacklight/engine.rb +2 -1
  21. data/lib/geoblacklight/version.rb +1 -1
  22. data/lib/geoblacklight/view_helper_override.rb +1 -0
  23. data/lib/geoblacklight/wms_layer.rb +1 -1
  24. data/lib/tasks/geoblacklight.rake +19 -1
  25. data/schema/geoblacklight-schema.json +21 -23
  26. data/schema/geoblacklight-schema.md +10 -8
  27. data/solr/conf/_rest_managed.json +3 -0
  28. data/solr/conf/admin-extra.html +31 -0
  29. data/solr/conf/elevate.xml +36 -0
  30. data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  31. data/{schema/solr → solr}/conf/protwords.txt +0 -0
  32. data/{schema/solr → solr}/conf/schema.xml +2 -4
  33. data/solr/conf/scripts.conf +24 -0
  34. data/{schema/solr → solr}/conf/solrconfig.xml +17 -6
  35. data/solr/conf/spellings.txt +2 -0
  36. data/solr/conf/stopwords.txt +58 -0
  37. data/solr/conf/stopwords_en.txt +58 -0
  38. data/{schema/solr → solr}/conf/synonyms.txt +31 -29
  39. data/solr/conf/xslt/example.xsl +132 -0
  40. data/solr/conf/xslt/example_atom.xsl +67 -0
  41. data/solr/conf/xslt/example_rss.xsl +66 -0
  42. data/solr/conf/xslt/luke.xsl +337 -0
  43. data/spec/controllers/catalog_controller_spec.rb +1 -1
  44. data/spec/controllers/download_controller_spec.rb +14 -8
  45. data/spec/features/configurable_basemap_spec.rb +0 -1
  46. data/spec/features/exports_spec.rb +4 -4
  47. data/spec/fixtures/solr_documents/esri-image-map-layer.json +2 -2
  48. data/spec/helpers/carto_helper_spec.rb +11 -0
  49. data/spec/helpers/geoblacklight_helpers_spec.rb +0 -8
  50. data/spec/models/concerns/geoblacklight/solr_document/{carto_db_spec.rb → carto_spec.rb} +6 -6
  51. data/spec/spec_helper.rb +8 -1
  52. data/spec/support/backport_test_helpers.rb +45 -0
  53. data/spec/test_app_templates/solr_documents +1 -0
  54. data/template.rb +1 -1
  55. metadata +88 -52
  56. data/app/models/concerns/geoblacklight/solr_document/carto_db.rb +0 -15
  57. data/config/jetty.yml +0 -6
  58. data/lib/generators/geoblacklight/templates/config/jetty.yml +0 -10
  59. data/lib/tasks/configure_solr.rake +0 -14
  60. data/schema/solr/conf/stopwords_en.txt +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48c9e2e90c4bfabbb4748eb794be90c69a5781cb
4
- data.tar.gz: 6df94d214fb1e14663bc20397d8618ba11443736
3
+ metadata.gz: b2b4e8cdd2abd133e663a53e4ffd289a4a3a985c
4
+ data.tar.gz: 5d78163437e30eb35a0ef6fa0a88ed8d8fe77a7c
5
5
  SHA512:
6
- metadata.gz: dd18bfc6823fba943918ff5814b4240f9b8d6d7da4e8c1b57a0ecb50a00c4ce8b26b4c2420a74b2f14efbba8a1a1450092c86a8527c940648026012873507476
7
- data.tar.gz: de73cdc4fe06a93e1f93ef87b7b4e70a043196c8521e19db2b8ecade2e98e28e6748068bf31e51693bbaa30c95d5631a2af2c0f2124f7553e330a17efd65ccf6
6
+ metadata.gz: 3516a9bcb20e42d49bad3ce0c4661a30a8b954da619f01372f36fe7e3ce8eb8b99bea0288a99fe2a13ddea48dad4cfa4cf5a42478589966e68b9f73fe093cc89
7
+ data.tar.gz: adf65bf73c7c7f56cfdca331beba85c47e71115e032177be4b8c7fe8858d468532778ecbe370f67095ed8aa573734f557c1eec7ebf2a53c65c67442a94176599
data/.gitignore CHANGED
@@ -16,4 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  jetty
19
- .internal_test_app
19
+ .internal_test_app
@@ -0,0 +1,6 @@
1
+ # Place any default configuration for solr_wrapper here
2
+ # port: 8983
3
+ collection:
4
+ dir: solr/conf/
5
+ name: blacklight-core
6
+
@@ -1,12 +1,26 @@
1
- cache: bundler
2
1
  language: ruby
3
2
  sudo: false
3
+
4
4
  notifications:
5
5
  email: false
6
6
 
7
7
  rvm:
8
- - 2.1
8
+ - 2.3.1
9
+
10
+ matrix:
11
+ include:
12
+ - rvm: 2.3.1
13
+ env: "RAILS_VERSION=4.2.6"
14
+ - rvm: 2.2.5
15
+ env: "RAILS_VERSION=5.0.0"
16
+
17
+ before_install:
18
+ - gem install bundler
9
19
 
10
20
  env:
11
- global:
12
- - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
21
+ - "RAILS_VERSION=5.0.0"
22
+
23
+ global_env:
24
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
25
+
26
+ jdk: oraclejdk8
data/README.md CHANGED
@@ -17,13 +17,11 @@ Creating a new GeoBlacklight application from the template
17
17
  $ rails new app-name -m https://raw.githubusercontent.com/geoblacklight/geoblacklight/master/template.rb
18
18
  ```
19
19
 
20
- To install Solr (with Jetty)
20
+ To launch app:
21
21
 
22
22
  ```
23
23
  $ cd app-name
24
- $ rake jetty:download
25
- $ rake jetty:unzip
26
- $ rake geoblacklight:configure_solr
24
+ $ rake geoblacklight:server
27
25
  ```
28
26
 
29
27
  Or install with [Docker](https://github.com/geoblacklight/geoblacklight-docker)
data/Rakefile CHANGED
@@ -1,22 +1,18 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ require 'rails'
1
4
  begin
2
- require 'bundler/gem_tasks'
3
5
  require 'bundler/setup'
4
6
  rescue LoadError
5
7
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
8
  end
7
9
 
8
- BLACKLIGHT_JETTY_VERSION = '4.10.3'.freeze
9
- ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v#{BLACKLIGHT_JETTY_VERSION}.zip".freeze
10
- APP_ROOT = File.dirname(__FILE__)
11
-
12
- require 'rspec/core/rake_task'
10
+ require 'solr_wrapper'
13
11
  require 'engine_cart/rake_task'
14
- require 'jettywrapper'
12
+ require 'rspec/core/rake_task'
15
13
  require 'rubocop/rake_task'
16
14
 
17
- Dir.glob('lib/tasks/configure_solr.rake').each { |r| load r }
18
-
19
- task default: :ci
15
+ EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
20
16
 
21
17
  desc 'Run style checker'
22
18
  RuboCop::RakeTask.new(:rubocop) do |task|
@@ -29,38 +25,65 @@ task spec: :rubocop do
29
25
  RSpec::Core::RakeTask.new(:spec)
30
26
  end
31
27
 
32
- desc 'Load fixtures'
33
- task fixtures: ['engine_cart:generate'] do
34
- EngineCart.within_test_app do
35
- system 'rake geoblacklight:solr:seed RAILS_ENV=test'
36
- system 'rake geoblacklight:downloads:mkdir'
37
- end
38
- end
39
-
40
28
  desc 'Run Teaspoon JavaScript tests'
41
29
  task :teaspoon do
42
30
  system('teaspoon --require=.internal_test_app/spec/teaspoon_env.rb')
43
31
  end
44
32
 
45
- desc 'Execute Continuous Integration build'
46
- task :ci do
47
- if Rails.env.test?
48
- Rake::Task['engine_cart:generate'].invoke
49
- Rake::Task['jetty:clean'].invoke
50
- Rake::Task['geoblacklight:configure_solr'].invoke
51
- ENV['environment'] = 'test'
52
- jetty_params = Jettywrapper.load_config
53
- jetty_params[:startup_wait] = 60
33
+ desc 'Run test suite'
34
+ task ci: ['geoblacklight:generate'] do
35
+ SolrWrapper.wrap do |solr|
36
+ solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('.', File.dirname(__FILE__)), 'solr', 'conf')) do
37
+ within_test_app do
38
+ system 'RAILS_ENV=test rake geoblacklight:index:seed'
39
+ end
40
+ Rake::Task['geoblacklight:coverage'].invoke
41
+ end
42
+ end
43
+ # Run JavaScript tests
44
+ Rake::Task['teaspoon'].invoke
45
+ end
46
+
47
+ namespace :geoblacklight do
48
+ desc 'Run tests with coverage'
49
+ task :coverage do
50
+ ENV['COVERAGE'] = 'true'
51
+ Rake::Task['spec'].invoke
52
+ end
53
+
54
+ desc 'Create the test rails app'
55
+ task generate: ['engine_cart:generate'] do
56
+ end
57
+
58
+ namespace :internal do
59
+ task seed: ['engine_cart:generate'] do
60
+ within_test_app do
61
+ system 'bundle exec rake geoblacklight:index:seed'
62
+ system 'bundle exec rake geoblacklight:downloads:mkdir'
63
+ end
64
+ end
65
+ end
54
66
 
55
- Jettywrapper.wrap(jetty_params) do
56
- Rake::Task['fixtures'].invoke
67
+ desc 'Run Solr and GeoBlacklight for interactive development'
68
+ task :server, [:rails_server_args] do |_t, args|
69
+ if File.exist? EngineCart.destination
70
+ within_test_app do
71
+ system 'bundle update'
72
+ end
73
+ else
74
+ Rake::Task['engine_cart:generate'].invoke
75
+ end
57
76
 
58
- # run the tests
59
- Rake::Task['spec'].invoke
77
+ SolrWrapper.wrap(port: '8983') do |solr|
78
+ solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('.', File.dirname(__FILE__)), 'solr', 'conf')) do
79
+ Rake::Task['geoblacklight:internal:seed'].invoke
80
+
81
+ within_test_app do
82
+ system "bundle exec rails s #{args[:rails_server_args]}"
83
+ end
84
+ end
60
85
  end
61
- # Run JavaScript tests
62
- Rake::Task['teaspoon'].invoke
63
- else
64
- system('rake ci RAILS_ENV=test')
65
86
  end
66
87
  end
88
+
89
+ task default: [:ci]
@@ -20,7 +20,7 @@
20
20
 
21
21
  var GeoBlacklight = L.Class.extend({
22
22
  statics: {
23
- __version__: '1.0.3',
23
+ __version__: '1.1.0',
24
24
 
25
25
  debounce: function(fn, delay) {
26
26
  var timeout = null;
@@ -42,7 +42,11 @@
42
42
  @extend .fa, .fa-file-text-o;
43
43
  }
44
44
 
45
- .geoblacklight-cartodb {
45
+ .geoblacklight-carto {
46
46
  @extend .fa, .fa-map-marker;
47
47
  }
48
48
 
49
+ // DEPRECATED: Will be removed in GeoBlacklight v2.0
50
+ .geoblacklight-cartodb {
51
+ @extend .geoblacklight-cartodb;
52
+ }
@@ -33,6 +33,12 @@
33
33
  width: 1.4em;
34
34
  }
35
35
 
36
+ .geoblacklight-carto {
37
+ text-align: center;
38
+ width: 1.4em;
39
+ }
40
+
41
+ // DEPRECATED: Will be removed in GeoBlacklight v2.0
36
42
  .geoblacklight-cartodb {
37
43
  text-align: center;
38
44
  width: 1.4em;
@@ -0,0 +1,36 @@
1
+ module CartoHelper
2
+ ##
3
+ # Creates a Carto OneClick link link, using the configuration link
4
+ # @param [String] file_link
5
+ # @return [String]
6
+ def carto_link(file_link)
7
+ params = URI.encode_www_form(
8
+ file: file_link,
9
+ provider: carto_provider,
10
+ logo: Settings.APPLICATION_LOGO_URL
11
+ )
12
+ carto_oneclick_host + '?' + params
13
+ end
14
+
15
+ ##
16
+ # Removes blank space from provider to accomodate Carto OneClick
17
+ #
18
+ def carto_provider
19
+ application_name.delete(' ')
20
+ end
21
+
22
+ private
23
+
24
+ ##
25
+ # Method used to access setting and provide deprecation warnings to migrate
26
+ def carto_oneclick_host
27
+ if Settings.CARTODB_ONECLICK_LINK.present?
28
+ Deprecation.warn(
29
+ GeoblacklightHelper,
30
+ 'Settings.CARTODB_ONECLICK_LINK is deprecated and will be removed in ' \
31
+ 'Geoblacklight 2.0.0, use Settings.CARTO_ONECLICK_LINK instead'
32
+ )
33
+ end
34
+ Settings.CARTO_ONECLICK_LINK || Settings.CARTODB_ONECLICK_LINK
35
+ end
36
+ end
@@ -1,4 +1,7 @@
1
1
  module GeoblacklightHelper
2
+ extend Deprecation
3
+ self.deprecation_horizon = 'Geoblacklight 2.0.0'
4
+
2
5
  def sms_helper
3
6
  content_tag(:i, '', class: 'fa fa-mobile fa-fw') + ' ' + t('blacklight.tools.sms')
4
7
  end
@@ -103,23 +106,21 @@ module GeoblacklightHelper
103
106
 
104
107
  ##
105
108
  # Removes blank space from provider to accomodate CartoDB OneClick
106
- #
109
+ # @deprecated Use {#carto_provider} instead.
107
110
  def cartodb_provider
108
- application_name.delete(' ')
111
+ carto_provider
109
112
  end
113
+ deprecation_deprecate cartodb_provider: 'use GeoblacklightHelper#carto_provider instead'
110
114
 
111
115
  ##
112
- # Creates a CartoDB OneClick link link, using the configuration link
116
+ # Creates a Carto OneClick link link, using the configuration link
113
117
  # @param [String] file_link
114
118
  # @return [String]
119
+ # @deprecated Use {#carto_link} instead.
115
120
  def cartodb_link(file_link)
116
- params = URI.encode_www_form(
117
- file: file_link,
118
- provider: cartodb_provider,
119
- logo: Settings.APPLICATION_LOGO_URL
120
- )
121
- Settings.CARTODB_ONECLICK_LINK + '?' + params
121
+ carto_link(file_link)
122
122
  end
123
+ deprecation_deprecate carto_link: 'use GeoblacklightHelper#carto_link instead'
123
124
 
124
125
  ##
125
126
  # Renders the partials for a Geoblacklight::Reference in the web services
@@ -4,7 +4,7 @@ module Geoblacklight
4
4
  extend Blacklight::Solr::Document
5
5
 
6
6
  include Geoblacklight::SolrDocument::Finder
7
- include Geoblacklight::SolrDocument::CartoDb
7
+ include Geoblacklight::SolrDocument::Carto
8
8
  include Geoblacklight::SolrDocument::Inspection
9
9
 
10
10
  delegate :download_types, to: :references
@@ -0,0 +1,28 @@
1
+ module Geoblacklight
2
+ module SolrDocument
3
+ ##
4
+ # Module for providing external Carto download references for a document
5
+ module Carto
6
+ extend Deprecation
7
+ self.deprecation_horizon = 'Geoblacklight 2.0.0'
8
+ ##
9
+ # Returns a url to a file that should be used with CartoDB integration
10
+ # @return [String]
11
+ # @deprecated Use {#carto_reference} instead
12
+ def cartodb_reference
13
+ carto_reference
14
+ end
15
+ deprecation_deprecate(
16
+ cartodb_reference: 'use Geoblacklight::SolrDocument::Carto#carto_reference instead'
17
+ )
18
+
19
+ ##
20
+ # Returns a url to a file that should be used with CartoDB integration
21
+ # @return [String]
22
+ def carto_reference
23
+ return unless public? && download_types.try(:[], :geojson).present?
24
+ Geoblacklight::GeojsonDownload.new(self).url_with_params
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,6 +1,6 @@
1
1
  <% document ||= @document %>
2
- <% if document.cartodb_reference.present? %>
3
- <%= link_to(cartodb_link(document.cartodb_reference), target: '_blank') do %>
4
- <span class='geoblacklight geoblacklight-cartodb'></span>Open in CartoDB
2
+ <% if document.carto_reference.present? %>
3
+ <%= link_to(carto_link(document.carto_reference), target: '_blank') do %>
4
+ <span class='geoblacklight geoblacklight-carto'></span><%= t('geoblacklight.tools.open_carto') %>
5
5
  <% end %>
6
6
  <% end %>
@@ -1,3 +1,3 @@
1
- RailsConfig.setup do |config|
1
+ Config.setup do |config|
2
2
  config.const_name = 'Settings'
3
3
  end
@@ -13,6 +13,7 @@ en:
13
13
  map_heading: 'Find by location'
14
14
  tools:
15
15
  login_to_view: 'Login to view and download'
16
+ open_carto: 'Open in Carto'
16
17
  formats:
17
18
  arcgrid: 'ArcGRID'
18
19
  geojson: 'GeoJSON'
@@ -18,21 +18,22 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
+ spec.add_dependency 'rails', '>= 4.2.0', '< 6'
21
22
  spec.add_dependency 'blacklight', '~> 6.3'
22
23
  spec.add_dependency 'leaflet-rails', '~> 0.7.3'
23
24
  spec.add_dependency 'font-awesome-rails'
24
- spec.add_dependency 'rails_config', '~> 0.4.2'
25
+ spec.add_dependency 'config'
25
26
  spec.add_dependency 'faraday'
26
27
  spec.add_dependency 'coderay'
27
28
  spec.add_dependency 'geoblacklight-icons', '>= 0.2'
29
+ spec.add_dependency 'deprecation'
28
30
 
29
- spec.add_development_dependency 'bundler', '~> 1.5'
30
- spec.add_development_dependency 'rake', '~> 11.0.1'
31
- spec.add_development_dependency 'rspec-rails', '~> 3.4.2'
32
- spec.add_development_dependency 'jettywrapper', '>= 2.0'
31
+ spec.add_development_dependency 'solr_wrapper'
32
+ spec.add_development_dependency 'rails-controller-testing'
33
+ spec.add_development_dependency 'rspec-rails', '~> 3.1'
33
34
  spec.add_development_dependency 'engine_cart', '~> 0.10'
34
- spec.add_development_dependency 'capybara', '~> 2.3.0'
35
- spec.add_development_dependency 'poltergeist', '~> 1.5'
35
+ spec.add_development_dependency 'capybara', '>= 2.5.0'
36
+ spec.add_development_dependency 'poltergeist'
36
37
  spec.add_development_dependency 'factory_girl_rails'
37
- spec.add_development_dependency 'database_cleaner'
38
+ spec.add_development_dependency 'database_cleaner', '~> 1.3'
38
39
  end
@@ -4,13 +4,12 @@ module Geoblacklight
4
4
  class Install < Rails::Generators::Base
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
 
7
- class_option :jettywrapper,
8
- type: :boolean,
9
- default: false,
10
- desc: 'Use jettywrapper to download and control Jetty'
11
-
12
7
  desc 'Install Geoblacklight'
13
8
 
9
+ def add_solr_wrapper
10
+ generate 'blacklight:solr5'
11
+ end
12
+
14
13
  def mount_geoblacklight_engine
15
14
  route "mount Geoblacklight::Engine => 'geoblacklight'"
16
15
  end
@@ -36,15 +35,6 @@ module Geoblacklight
36
35
  EOF
37
36
  end
38
37
 
39
- def install_jettywrapper
40
- return unless options[:jettywrapper]
41
- copy_file 'config/jetty.yml'
42
-
43
- append_to_file 'Rakefile',
44
- "\nZIP_URL = \"https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.3.zip\"\n" \
45
- "require 'jettywrapper'\n"
46
- end
47
-
48
38
  def assets
49
39
  copy_file 'geoblacklight.scss', 'app/assets/stylesheets/geoblacklight.scss'
50
40
  copy_file 'geoblacklight.js', 'app/assets/javascripts/geoblacklight.js'
@@ -62,6 +52,10 @@ module Geoblacklight
62
52
  copy_file 'settings.yml', 'config/settings.yml'
63
53
  end
64
54
 
55
+ def solr_config
56
+ directory '../../../../solr', 'solr'
57
+ end
58
+
65
59
  def include_geoblacklight_solrdocument
66
60
  inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do
67
61
  "\n include Geoblacklight::SolrDocument"