Skip to content

Commit

Permalink
Disable geo_monitor until it gains GeoBlacklight v4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
thatbudakguy committed Jun 28, 2024
1 parent e4041b9 commit 7c466b6
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ gem 'newrelic_rpm'
gem 'twitter-typeahead-rails'
gem 'blacklight_range_limit', '~> 7.0'
gem 'redis', '~> 5.0'
gem 'geo_monitor', '~> 0.7', github: 'geoblacklight/geo_monitor'
# Not compatible with GeoBlacklight 4.x
# https://github.com/geoblacklight/geo_monitor/issues/12
# gem 'geo_monitor', '~> 0.7', github: 'geoblacklight/geo_monitor'
gem 'geo_combine', '>= 0.9' # For OpenGeoMetadata indexing
gem 'sidekiq', '~> 7.0'
gem 'whenever', require: false
Expand Down
9 changes: 0 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
GIT
remote: https://github.com/geoblacklight/geo_monitor.git
revision: 28d61996677292730a9285f5686e4f5a193c8fae
specs:
geo_monitor (0.8.0)
faraday
rails (>= 6.1, < 7.2)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -581,7 +573,6 @@ DEPENDENCIES
factory_bot_rails (~> 6.2.0)
faraday (~> 2.0)
geo_combine (>= 0.9)
geo_monitor (~> 0.7)!
geoblacklight (~> 4.3)
honeybadger
http
Expand Down
30 changes: 15 additions & 15 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'blacklight/catalog'
require 'legacy_id_map'

# rubocop:disable Metrics/ClassLength
class CatalogController < ApplicationController
include BlacklightRangeLimit::ControllerOverride
include Blacklight::Catalog
Expand Down Expand Up @@ -100,19 +99,21 @@ class CatalogController < ApplicationController
config.add_facet_field Settings.FIELDS.INDEX_YEAR, label: 'Year', limit: 10
config.add_facet_field Settings.FIELDS.ACCESS_RIGHTS, label: 'Access', limit: 8,
item_component: Geoblacklight::IconFacetItemComponent
config.add_facet_field 'availability',
label: 'Availability',
query: {
available: {
label: 'Available',
fq: "(layer_availability_score_f:[#{Settings.GEOMONITOR_TOLERANCE} TO 1])"
},
unavailable: {
label: 'Unavailable',
fq: "layer_availability_score_f:[0 TO #{Settings.GEOMONITOR_TOLERANCE}]"
}
},
item_component: Geoblacklight::IconFacetItemComponent
# Disabled until GeoMonitor is updated for v4.x compatibility
# https://github.com/geoblacklight/geo_monitor/issues/12
# config.add_facet_field 'availability',
# label: 'Availability',
# query: {
# available: {
# label: 'Available',
# fq: "(layer_availability_score_f:[#{Settings.GEOMONITOR_TOLERANCE} TO 1])"
# },
# unavailable: {
# label: 'Unavailable',
# fq: "layer_availability_score_f:[0 TO #{Settings.GEOMONITOR_TOLERANCE}]"
# }
# },
# item_component: Geoblacklight::IconFacetItemComponent
config.add_facet_field Settings.FIELDS.RESOURCE_CLASS, label: 'Resource Class', limit: 8
config.add_facet_field Settings.FIELDS.RESOURCE_TYPE, label: 'Resource Type', limit: 8
config.add_facet_field Settings.FIELDS.FORMAT, label: 'Format', limit: 8
Expand Down Expand Up @@ -354,4 +355,3 @@ def redirect_from_legacy_id
end
end
end
# rubocop:enable Metrics/ClassLength
1 change: 1 addition & 0 deletions app/jobs/check_layer_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class CheckLayerJob < ApplicationJob

##
# @param [GeoMonitor::Layer] layer
# TODO: migrate this to the geo_monitor gem itself?
def perform(layer)
# See if in Solr first, if not, deactivate and exit
num_found = Blacklight.default_index.connection.get(
Expand Down
3 changes: 2 additions & 1 deletion app/models/solr_document.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class SolrDocument
include Blacklight::Solr::Document
include Geoblacklight::SolrDocument
include GeomonitorConcern
# include GeomonitorConcern
# https://github.com/geoblacklight/geo_monitor/issues/12
include RightsMetadataConcern
include WmsRewriteConcern

Expand Down
8 changes: 5 additions & 3 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ class Application < Rails::Application
require 'rights_metadata'
# Inject our StatusExtension concern to add behavior
# (index updates) to the GeoMonitor::Status class
config.to_prepare do
GeoMonitor::Status.include StatusExtension
end
# Disabled until v4.x compatibility is resolved
# https://github.com/geoblacklight/geo_monitor/issues/12
# config.to_prepare do
# GeoMonitor::Status.include StatusExtension
# end
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Expand Down
20 changes: 11 additions & 9 deletions config/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@

set :output, 'log/cron.log'

every 1.day, at: '9:34pm', roles: %i[whenevs] do
rake 'earthworks:geomonitor:update'
end
# Disable GeoMonitor jobs until v4.x compatibility is resolved
# https://github.com/geoblacklight/geo_monitor/issues/12
# every 1.day, at: '9:34pm', roles: %i[whenevs] do
# rake 'earthworks:geomonitor:update'
# end

every 1.day, at: ['1:13 am', '7:42 am', '1:13 pm', '7:42 pm'], roles: %i[whenevs] do
rake 'earthworks:geomonitor:check_stanford'
end
# every 1.day, at: ['1:13 am', '7:42 am', '1:13 pm', '7:42 pm'], roles: %i[whenevs] do
# rake 'earthworks:geomonitor:check_stanford'
# end

every 2.days, at: ['2:21 am'], roles: %i[whenevs] do
rake 'earthworks:geomonitor:check_public'
end
# every 2.days, at: ['2:21 am'], roles: %i[whenevs] do
# rake 'earthworks:geomonitor:check_public'
# end

every '0 3 * * *', roles: %i[app] do # daily at 3 am
rake 'earthworks:clear_rack_attack_cache'
Expand Down
7 changes: 4 additions & 3 deletions spec/factories/layer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FactoryBot.define do
factory :layer, class: 'GeoMonitor::Layer'
end
# https://github.com/geoblacklight/geo_monitor/issues/12
# FactoryBot.define do
# factory :layer, class: 'GeoMonitor::Layer'
# end
2 changes: 1 addition & 1 deletion spec/features/unavailable_layer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

describe 'Unavailable layer' do
describe 'Unavailable layer', skip: 'needs GBLv4 compatibility' do
it 'hides and shows appropriate messages for geomonitored unavailable' do
visit solr_document_path 'harvard-ntadcd106'
within '.unavailable-warning' do
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/check_layer_job_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe CheckLayerJob do
RSpec.describe CheckLayerJob, skip: 'needs GBLv4 compatibility' do
context 'when in Solr index' do
let(:layer) { create(:layer, slug: 'tufts-cambridgegrid100-04', checktype: 'WMS') }

Expand Down
8 changes: 4 additions & 4 deletions spec/models/concerns/geomonitor_concern_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

describe GeomonitorConcern do
RSpec.describe GeomonitorConcern, skip: 'needs GBLv4 compatibility' do
let(:document) { SolrDocument.new(document_attributes) }

describe 'available?' do
Expand All @@ -13,7 +13,7 @@
end

it 'calls super logic' do
expect(document.available?).to be_truthy
expect(document.available?).to be true
end
end

Expand All @@ -27,7 +27,7 @@
end

it 'is not avilable' do
expect(document.available?).to be_falsey
expect(document.available?).to be false
end
end
end
Expand All @@ -36,7 +36,7 @@
let(:document_attributes) { {} }

it 'no score present' do
expect(document.score_meets_threshold?).to be_truthy
expect(document.score_meets_threshold?).to be true
end
end
end

0 comments on commit 7c466b6

Please sign in to comment.