Skip to content
This repository has been archived by the owner on Nov 26, 2019. It is now read-only.

Commit

Permalink
Monkey-patching solr_wrapper to get the solr checksum from archive.ap…
Browse files Browse the repository at this point in the history
…ache.org to include in what will be committed
  • Loading branch information
eddierubeiz committed Sep 7, 2018
1 parent 1529142 commit 10477fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/solr_wrapper_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ collection:
dir: solr/config
name: hydra-test
version: 6.3.0

# To simply ignore the checksum, you can set validate to false.
# The default is true; we are currently downloading the checksum.
# validate: false

# Attempt to use mirror url to keep travis tests from being blocked by
# apache for too many solr downloads.
mirror_url: http://lib-solr-mirror.princeton.edu/dist/
23 changes: 23 additions & 0 deletions lib/solr_wrapper_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Hack to monkey-patch solr_wrapper to get the checksum
# file from archive.apache.org instead of www.us.apache.org .

# This monkey patch is based on :
# https://github.com/cbeer/solr_wrapper/pull/119/files
# When the patch is accepted, you can simply remove this file
# as well as the reference to it in /chf-sufia/lib/tasks/dev.rake

if Gem.loaded_specs["solr_wrapper"].version > Gem::Version.new('2.0.0')
puts(""" The solr_wrapper gem has been upgraded. Time to
remove the monkey-patch in
* lib/tasks/dev.rake
* lib/solr_wrapper_patch.rb .
""")
end

module SolrWrapper
class ChecksumValidator
def checksumurl(suffix)
"http://archive.apache.org/dist/lucene/solr/#{config.static_config.version}/solr-#{config.static_config.version}.zip.#{suffix}"
end
end
end
4 changes: 4 additions & 0 deletions lib/tasks/dev.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ unless ENV['RAILS_ENV'] == "production"
require 'fcrepo_wrapper'
require 'active_fedora/rake_support'

# This can be removed when solr_wrapper is upgraded.
# See the patch file for more details.
require "#{Rails.root}/lib/solr_wrapper_patch"

namespace :dev do
# Starts Fedora and Solr, per config in `./config/solr_wrapper_test.rb` and
# and `./config/fcrepo_wrapper_test.rb`. You can still run individual files
Expand Down

0 comments on commit 10477fc

Please sign in to comment.