Skip to content

Commit

Permalink
Merge 557d186 into 8788cc9
Browse files Browse the repository at this point in the history
  • Loading branch information
ebenenglish committed May 27, 2020
2 parents 8788cc9 + 557d186 commit 2c3f692
Show file tree
Hide file tree
Showing 64 changed files with 16,755 additions and 2,061 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -19,3 +19,5 @@ spec/internal
jetty
.DS_Store
.idea/
.rakeTasks
.internal_test_app
99 changes: 99 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,99 @@
require: rubocop-rspec

AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.3
Exclude:
- "lib/generators/blacklight_maps/templates/**/*"
- "blacklight-maps.gemspec"

# engine_cart block includes conditional, not duplication
Bundler/DuplicatedGem:
Exclude:
- 'Gemfile'

# engine_cart block is following default Rails order
Bundler/OrderedGems:
Exclude:
- 'Gemfile'

Layout/IndentationConsistency:
EnforcedStyle: normal

Metrics/AbcSize:
Max: 20
Exclude:
- 'lib/blacklight/maps/maps_search_builder.rb'

Metrics/BlockLength:
Exclude:
- "spec/**/*"

Metrics/ClassLength:
Exclude:
- 'lib/blacklight/maps/export.rb'

Metrics/LineLength:
Max: 200
Exclude:
- 'lib/blacklight/maps/engine.rb'
- 'spec/**/*'

Metrics/MethodLength:
Max: 15

Naming/HeredocDelimiterNaming:
Enabled: false

Naming/PredicateName:
NamePrefixBlacklist:
- is_

Rails:
Enabled: true

Rails/OutputSafety:
Enabled: false

RSpec/AnyInstance:
Exclude:
- 'spec/system/initial_view_spec.rb'

RSpec/BeforeAfterAll:
Enabled: false

RSpec/DescribeClass:
Exclude:
- 'spec/system/*'

RSpec/FilePath:
Exclude:
- 'spec/lib/blacklight/maps/*'

RSpec/MessageSpies:
EnforcedStyle: receive

RSpec/MultipleExpectations:
Max: 4

RSpec/NestedGroups:
Max: 5

RSpec/PredicateMatcher:
Exclude:
- 'spec/lib/blacklight/maps/render_constraints_override_spec.rb'

# https://github.com/rubocop-hq/rubocop/issues/6439
Style/AccessModifierDeclarations:
Enabled: false

Style/BracesAroundHashParameters:
Exclude:
- 'spec/lib/blacklight/maps/export_spec.rb'

Style/Documentation:
Enabled: false

Style/SignalException:
Exclude:
- 'spec/**/*'
37 changes: 21 additions & 16 deletions .travis.yml
@@ -1,25 +1,30 @@
notifications:
email: false
language: ruby
sudo: false
rvm:
- 2.6.0
dist: bionic

matrix:
include:
env: "RAILS_VERSION=4.2.11"
addons:
chrome: stable

before_install:
- gem install bundler
- google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 http://localhost &

env:
- "RAILS_VERSION=4.2.6"

notifications:
irc: "irc.freenode.org#blacklight"
email:
- blacklight-commits@googlegroups.com

global_env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'

matrix:
include:
- rvm: 2.7.0
env: "RAILS_VERSION=6.0.2.2"
- rvm: 2.6.5
env: "RAILS_VERSION=6.0.2.2"
- rvm: 2.6.5
env: "RAILS_VERSION=5.2.4.2"
- rvm: 2.5.7
env: "RAILS_VERSION=5.2.4.2 BLACKLIGHT_API_TEST=true ENGINE_CART_RAILS_OPTIONS=\"--api --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-test\""
- rvm: 2.4.9
env: "RAILS_VERSION=5.2.4.2"
fast_finish: true

jdk: openjdk11
47 changes: 40 additions & 7 deletions Gemfile
@@ -1,15 +1,48 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in blacklight-maps.gemspec
gemspec

group :test do
gem 'simplecov', require: false
group :development, :test do
gem 'coveralls', require: false
end

file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
if File.exists?(file)
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(file)
gem 'engine_cart'
# BEGIN ENGINE_CART BLOCK
# engine_cart: 1.2.0
# engine_cart stanza: 0.10.0
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
if File.exist?(file)
begin
eval_gemfile file
rescue Bundler::GemfileError => e
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
Bundler.ui.warn e.message
end
else
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"

if ENV['RAILS_VERSION']
if ENV['RAILS_VERSION'] == 'edge'
gem 'rails', github: 'rails/rails'
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
else
gem 'rails', ENV['RAILS_VERSION']
end
end

case ENV['RAILS_VERSION']
when /^5.[12]/, /^6.0/
gem 'sass-rails', '~> 5.0'
when /^4.2/
gem 'responders', '~> 2.0'
gem 'sass-rails', '>= 5.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'json', '~> 1.8'
when /^4.[01]/
gem 'sass-rails', '< 5.0'
end
end
# END ENGINE_CART BLOCK
18 changes: 9 additions & 9 deletions README.md
Expand Up @@ -53,11 +53,11 @@ Blacklight-Maps requires that your Solr index include at least one (but preferab

```
# coordinates: lon lat or lat,lon
# bounding box: minX minY maxX maxY
coordinates_field:
# bounding box: ENVELOPE(minX, maxX, maxY, minY)
coordinates_srpt:
- 78.96288 20.593684
- 20.593684,78.96288
- 68.162386 6.7535159 97.395555 35.5044752
- ENVELOPE(68.162386, 97.395555, 35.5044752, 6.7535159)
```

2. An indexed, stored string field containing a properly-formatted [GeoJSON](http://geojson.org) feature object for a point or bounding box that includes the coordinates and (preferably) location name. This field can be multivalued.
Expand All @@ -74,7 +74,7 @@ Blacklight-Maps requires that your Solr index include at least one (but preferab
3. An indexed, stored text or string field containing location names. This field can be multivalued.

```
placename_field: India
subject_geo_ssim: India
```

##### Why so complicated?
Expand All @@ -88,10 +88,10 @@ Blacklight-Maps can be used with either field type (#1 or #2), however to take a
**Important:** If you are NOT using the geojson field (#2), you should create a `copyField` in your Solr schema.xml to copy the coordinates from the `location_rpt` field to a string field that is stored, indexed, and multivalued to allow for proper faceting of the coordinate values in the catalog#map and catalog#index views.

```
<!-- Solr4 location_rpt field for coordinates, shapes, etc. -->
<dynamicField name="geospatial" type="location_rpt" indexed="true" stored="true" multiValued="true" />
<!-- Solr location_rpt field for coordinates, shapes, etc. -->
<dynamicField name="*_srpt" type="location_rpt" indexed="true" stored="true" multiValued="true" />
<!-- copy geospatial to string field for faceting -->
<copyField source="geospatial" dest="geospatial_facet" />
<copyField source="coordinates_srpt" dest="coordinates_ssim" />
```

Support for additional field types may be added in the future.
Expand All @@ -112,9 +112,9 @@ Blacklight-Maps expects you to provide these configuration options:
+ `placename_field` = the name of the Solr field containing the location names
+ `coordinates_field` = the name of the Solr `location_rpt` type field containing geospatial coordinate data

In addition, you must add the geospatial facet field to the list of facet fields:
In addition, you must add the geospatial facet field to the list of facet fields in `app/controllers/catalog_controller.rb`, for example:
```ruby
config.add_facet_field 'geojson_field', :limit => -2, :label => 'Coordinates', :show => false
config.add_facet_field 'geojson_ssim', :limit => -2, :label => 'Coordinates', :show => false
```

#### Optional
Expand Down
67 changes: 35 additions & 32 deletions Rakefile
@@ -1,43 +1,46 @@
require "bundler/gem_tasks"
# frozen_string_literal: true

ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.6.0.zip"
APP_ROOT = File.dirname(__FILE__)

require 'rspec/core/rake_task'
require 'engine_cart/rake_task'
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'jettywrapper'
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'BlacklightMaps'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end

task default: :ci
Bundler::GemHelper.install_tasks

RSpec::Core::RakeTask.new(:spec)
Rake::Task.define_task(:environment)

desc "Load fixtures"
task :fixtures => ['engine_cart:generate'] do
EngineCart.within_test_app do
system "rake blacklight_maps:solr:seed RAILS_ENV=test"
end
end
load 'lib/railties/blacklight_maps.rake'

desc "Execute Continuous Integration build"
task :ci => ['engine_cart:generate', 'jetty:clean', 'blacklight_maps:configure_jetty'] do

require 'jettywrapper'
jetty_params = Jettywrapper.load_config('test')
task default: :ci

error = Jettywrapper.wrap(jetty_params) do
Rake::Task['fixtures'].invoke
Rake::Task['spec'].invoke
end
raise "test failures: #{error}" if error
end
require 'engine_cart/rake_task'

require 'solr_wrapper'

namespace :blacklight_maps do
desc "Copies the default SOLR config for the bundled Testing Server"
task :configure_jetty do
FileList['solr_conf/conf/*'].each do |f|
cp("#{f}", 'jetty/solr/blacklight-core/conf/', :verbose => true)
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new

require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)

desc 'Run test suite'
task ci: [:rubocop, 'engine_cart:generate'] do
SolrWrapper.wrap do |solr|
solr.with_collection do
within_test_app do
system 'RAILS_ENV=test rake blacklight_maps:index:seed'
end
Rake::Task['spec'].invoke
end
end
end
end
1 change: 1 addition & 0 deletions app/assets/images/blacklight/gallery.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/blacklight/maps.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/images/blacklight/masonry.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/images/blacklight/slideshow.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions app/assets/javascripts/blacklight-maps.js
@@ -1,7 +1,4 @@
// for Blacklight.onLoad:
//= require blacklight/core

//= require leaflet
//= require leaflet.markercluster

//= require_tree .
//= require_tree .

0 comments on commit 2c3f692

Please sign in to comment.