Skip to content

Commit

Permalink
Merge 12f1da9 into 90c3def
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Jul 7, 2020
2 parents 90c3def + 12f1da9 commit 7b44b2f
Show file tree
Hide file tree
Showing 16 changed files with 358 additions and 179 deletions.
45 changes: 23 additions & 22 deletions .rubocop_todo.yml
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-06-23 23:19:48 UTC using RuboCop version 0.86.0.
# on 2020-07-07 16:20:55 UTC using RuboCop version 0.86.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -22,6 +22,12 @@ Layout/CaseIndentation:
Exclude:
- 'lib/robots/dor_repo/gis_assembly/generate_content_metadata.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLineAfterGuardClause:
Exclude:
- 'lib/robots/dor_repo/gis_delivery/load_geoserver.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Expand Down Expand Up @@ -111,10 +117,10 @@ Lint/UselessAssignment:
- 'lib/robots/dor_repo/gis_delivery/load_vector.rb'
- 'lib/robots/dor_repo/gis_discovery/export_opengeometadata.rb'

# Offense count: 39
# Offense count: 40
# Configuration parameters: IgnoredMethods.
Metrics/AbcSize:
Max: 96
Max: 90

# Offense count: 6
# Configuration parameters: CountComments, ExcludedMethods.
Expand All @@ -130,29 +136,29 @@ Metrics/BlockNesting:
# Offense count: 5
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 196
Max: 245

# Offense count: 17
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 25

# Offense count: 42
# Offense count: 43
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 107
Max: 135

# Offense count: 3
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 7

# Offense count: 16
# Offense count: 15
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 24

# Offense count: 22
# Offense count: 20
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
Naming/MethodParameterName:
Expand All @@ -164,7 +170,6 @@ Naming/MethodParameterName:
- 'lib/robots/dor_repo/gis_assembly/generate_content_metadata.rb'
- 'lib/robots/dor_repo/gis_assembly/generate_geo_metadata.rb'
- 'lib/robots/dor_repo/gis_assembly/generate_mods.rb'
- 'lib/robots/dor_repo/gis_delivery/load_geoserver.rb'
- 'lib/robots/dor_repo/gis_discovery/generate_geoblacklight.rb'

# Offense count: 43
Expand All @@ -191,10 +196,11 @@ RSpec/ExampleWording:
Exclude:
- 'spec/unit/gazetteer_spec.rb'

# Offense count: 1
# Offense count: 2
# Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
RSpec/FilePath:
Exclude:
- 'spec/robots/dor_repo/gis_delivery/finish_gis_delievery_workflow_spec.rb'
- 'spec/unit/gazetteer_spec.rb'

# Offense count: 4
Expand Down Expand Up @@ -231,13 +237,6 @@ RSpec/VerifiedDoubles:
Exclude:
- 'spec/robots/dor_repo/gis_assembly/load_geo_metadata_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
Security/YAMLLoad:
Exclude:
- 'lib/robots/dor_repo/gis_delivery/finish_gis_delivery_workflow.rb'
- 'lib/robots/dor_repo/gis_delivery/load_geoserver.rb'

# Offense count: 5
# Configuration parameters: AllowedChars.
Style/AsciiComments:
Expand Down Expand Up @@ -282,7 +281,7 @@ Style/Encoding:
- 'spec/robots/dor_repo/gis_assembly/generate_mods_spec.rb'
- 'spec/unit/gazetteer_spec.rb'

# Offense count: 9
# Offense count: 8
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
Expand Down Expand Up @@ -370,7 +369,7 @@ Style/NumericLiteralPrefix:
Style/NumericLiterals:
MinDigits: 8

# Offense count: 18
# Offense count: 19
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Expand All @@ -380,6 +379,7 @@ Style/NumericPredicate:
- 'lib/gis_robot_suite.rb'
- 'lib/robots/dor_repo/gis_assembly/extract_boundingbox.rb'
- 'lib/robots/dor_repo/gis_assembly/generate_mods.rb'
- 'lib/robots/dor_repo/gis_delivery/load_geoserver.rb'
- 'lib/robots/dor_repo/gis_discovery/generate_geoblacklight.rb'

# Offense count: 12
Expand Down Expand Up @@ -418,14 +418,14 @@ Style/RescueStandardError:
- 'lib/robots/dor_repo/gis_delivery/load_geoserver.rb'
- 'lib/robots/dor_repo/gis_discovery/export_opengeometadata.rb'

# Offense count: 103
# Offense count: 102
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: only_raise, only_fail, semantic
Style/SignalException:
Enabled: false

# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: MinSize.
# SupportedStyles: percent, brackets
Expand Down Expand Up @@ -459,9 +459,10 @@ Style/UnlessElse:
- 'lib/robots/dor_repo/gis_assembly/normalize_data.rb'
- 'lib/robots/dor_repo/gis_delivery/load_raster.rb'

# Offense count: 3
# Offense count: 4
# Cop supports --auto-correct.
Style/ZeroLengthPredicate:
Exclude:
- 'lib/robots/dor_repo/gis_assembly/generate_mods.rb'
- 'lib/robots/dor_repo/gis_delivery/load_geoserver.rb'
- 'lib/robots/dor_repo/gis_discovery/generate_geoblacklight.rb'
3 changes: 1 addition & 2 deletions Gemfile
Expand Up @@ -12,17 +12,16 @@ gem 'fastimage', '~> 1.7'
gem 'ffi-geos', '~> 1.0', require: false # XXX: where is this used?
# iso-639 0.3.0 isn't compatible with ruby 2.5. This declaration can be dropped when we upgrade to ruby 2.6
# see https://github.com/alphabetum/iso-639/issues/12
gem 'geoserver-publish', '>= 0.4.0'
gem 'iso-639', '~> 0.2.10'
gem 'lyber-core', '~> 6.1'
gem 'pry', '~> 0.10' # for console
gem 'rake', '~> 13.0'
gem 'rgeoserver', '~> 0.10'
gem 'rsolr'
gem 'slop', '~> 3.6' # for bin/run_robot
gem 'honeybadger'
gem 'geo_combine'
gem 'net-http-persistent', '~> 3.0'
gem 'activemodel', '~> 5.1', '< 5.2' # due to https://github.com/sul-dlss/gis-robot-suite/issues/174
gem 'resque'
gem 'resque-pool'
gem 'scanf'
Expand Down
21 changes: 3 additions & 18 deletions Gemfile.lock
Expand Up @@ -70,7 +70,6 @@ GEM
config (2.2.1)
deep_merge (~> 1.2, >= 1.2.1)
dry-validation (~> 1.0, >= 1.0.0)
confstruct (0.2.7)
connection_pool (2.2.3)
coveralls (0.8.23)
json (>= 1.8, < 3)
Expand All @@ -82,7 +81,6 @@ GEM
safe_yaml (~> 1.0.0)
crass (1.0.6)
daemons (1.3.1)
dbf (3.1.3)
deep_merge (1.2.1)
deprecation (0.99.0)
activesupport
Expand Down Expand Up @@ -190,6 +188,8 @@ GEM
rsolr
sanitize
thor
geoserver-publish (0.4.0)
faraday
haml (5.1.2)
temple (>= 0.8.0)
tilt
Expand Down Expand Up @@ -307,19 +307,6 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.4)
rgeo (0.5.3)
rgeo-shapefile (0.4.2)
dbf (~> 3.0)
rgeo (~> 0.3)
rgeoserver (0.10.1)
activemodel
activesupport
confstruct (~> 0.2.7)
nokogiri
rest-client
rgeo (~> 0.5.3)
rgeo-shapefile (~> 0.4.1)
rubyzip
rsolr (2.3.0)
builder (>= 2.1.2)
faraday (>= 0.9.0)
Expand Down Expand Up @@ -362,7 +349,6 @@ GEM
mime-types
nokogiri
rest-client
rubyzip (2.3.0)
safe_yaml (1.0.5)
sanitize (5.2.1)
crass (~> 1.0.2)
Expand Down Expand Up @@ -424,7 +410,6 @@ PLATFORMS
ruby

DEPENDENCIES
activemodel (~> 5.1, < 5.2)
assembly-objectfile
capistrano
capistrano-bundler
Expand All @@ -441,6 +426,7 @@ DEPENDENCIES
fastimage (~> 1.7)
ffi-geos (~> 1.0)
geo_combine
geoserver-publish (>= 0.4.0)
honeybadger
iso-639 (~> 0.2.10)
lyber-core (~> 6.1)
Expand All @@ -449,7 +435,6 @@ DEPENDENCIES
rake (~> 13.0)
resque
resque-pool
rgeoserver (~> 0.10)
rsolr
rspec
rubocop
Expand Down
2 changes: 0 additions & 2 deletions config/boot.rb
Expand Up @@ -50,8 +50,6 @@
puts "Loading config from #{env_file}"
require env_file

ENV['RGEOSERVER_CONFIG'] ||= File.expand_path('rgeoserver.yml', __dir__)

module GisRobotSuite
def self.connect_dor_services_app
Dor::Services::Client.configure(url: Settings.dor_services.url,
Expand Down
2 changes: 0 additions & 2 deletions config/environments/test.rb
@@ -1,5 +1,3 @@
# frozen_string_literal: true

REDIS_URL = Settings.redis.url

ENV['RGEOSERVER_CONFIG'] ||= File.expand_path(File.join(File.dirname(__FILE__), ENV['ROBOT_ENVIRONMENT'] + '_rgeoserver.yml'))
16 changes: 0 additions & 16 deletions config/environments/test_rgeoserver.yml

This file was deleted.

20 changes: 20 additions & 0 deletions config/settings.yml
Expand Up @@ -31,3 +31,23 @@ stacks:
url: 'https://stacks.example.org'

gdal_path: ''

geoserver:
public:
primary:
url: 'http://example.com/geoserver/rest'
user: admin
password: geoserver
replica: # Replica not filled out as it is not used yet
url:
user:
password:
restricted:
primary:
url: 'http://example.com/restricted/geoserver/rest'
user: admin
password: geoserver
replica: # Replica not filled out as it is not used yet
url:
user:
password:
21 changes: 12 additions & 9 deletions lib/robots/dor_repo/gis_delivery/finish_gis_delivery_workflow.rb
Expand Up @@ -17,16 +17,19 @@ def perform(druid)
druid = druid.delete_prefix('druid:')
LyberCore::Log.debug "finish-gis-delivery-workflow working on #{druid}"

# Connect to GeoServer master/slave to verify layer
geoserver_options = YAML.load(File.read(ENV['RGEOSERVER_CONFIG']))
[:geoserver_master, :geoserver_slave].each do |k|
catalog = RGeoServer.catalog geoserver_options[k]
LyberCore::Log.debug "Connected to #{catalog}"

# Verify layer
layer = RGeoServer::Layer.new catalog, name: druid.to_s
fail "finish-gis-delivery-workflow: #{druid} is missing GeoServer layer" if layer.new?
# Connect to both the public and restricted GeoServers to verify layer
# exists
available_in_geoserver = Settings.geoserver.map do |_key, setting|
connection = Geoserver::Publish::Connection.new(
{
"url" => setting[:primary][:url],
"user" => setting[:primary][:user],
"password" => setting[:primary][:password]
}
)
Geoserver::Publish::Layer.new(connection).find(layer_name: druid)
end
fail "finish-gis-delivery-workflow: #{druid} is missing GeoServer layer" unless available_in_geoserver.any?
end
end
end
Expand Down

0 comments on commit 7b44b2f

Please sign in to comment.