Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release-4.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Coble committed Jun 21, 2018
2 parents 695d80a + dd9dd93 commit f1c2f36
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 79 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ before_install:
- gem install bundler
rvm:
- 2.3.1
before_script:
- "cp config/log4r.yml.sample config/log4r.yml"
cache: bundler
script: "bundle exec rake dul_hydra:ci:build"
# To exclude antivirus tests:
Expand Down
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ ruby '2.3.1'
gem 'rails', '4.2.7'

gem 'ddr-alerts', '1.1.0'
gem 'ddr-batch', '1.6.1'
gem 'ddr-models', '2.10.2'
gem 'ddr-batch', '1.7.0'
gem 'ddr-models', '2.11.0'

gem 'hydra-head', '7.2.2'
gem 'blacklight', '5.19.2'
Expand All @@ -17,8 +17,6 @@ gem 'virtus', '~> 1.0.5'
gem 'ezid-client', '~> 1.7'
gem 'bagit'

gem 'log4r'

# Background processing
gem 'resque', '1.25.2'
gem 'resque-pool', '~> 0.6.0'
Expand Down Expand Up @@ -61,6 +59,7 @@ end

group :production do
gem 'mysql2', '~> 0.4.5'
gem 'passenger'
end

gem 'sass-rails'
Expand Down
25 changes: 14 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ GEM
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concurrent-ruby (1.0.4)
crass (1.0.4)
daemons (1.2.4)
database_cleaner (1.5.3)
ddr-alerts (1.1.0)
rails (~> 4.2)
ddr-antivirus (2.1.1)
ddr-batch (1.6.1)
ddr-models (~> 2.10)
ddr-batch (1.7.0)
ddr-models (~> 2.11)
devise (~> 3.4)
log4r
paperclip (~> 5.2)
rails (~> 4.1)
ddr-models (2.10.2)
ddr-models (2.11.0)
active-fedora (>= 7.3.1, < 8)
activeresource
cancancan (~> 1.12)
Expand Down Expand Up @@ -250,9 +250,9 @@ GEM
rdf-xsd (~> 1.1, >= 1.1.5)
sparql (~> 1.99)
sparql-client (~> 1.99)
log4r (1.1.10)
logger (1.2.8)
loofah (2.0.3)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
Expand Down Expand Up @@ -294,6 +294,9 @@ GEM
cocaine (~> 0.5.5)
mime-types
mimemagic (~> 0.3.0)
passenger (5.3.2)
rack
rake (>= 0.8.1)
public_suffix (2.0.5)
rack (1.6.5)
rack-protection (1.5.5)
Expand All @@ -317,8 +320,8 @@ GEM
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails-observers (0.1.5)
activemodel (>= 4.0)
railties (4.2.7)
Expand Down Expand Up @@ -520,8 +523,8 @@ DEPENDENCIES
capybara (~> 2.0)
database_cleaner
ddr-alerts (= 1.1.0)
ddr-batch (= 1.6.1)
ddr-models (= 2.10.2)
ddr-batch (= 1.7.0)
ddr-models (= 2.11.0)
deprecation
devise
equivalent-xml
Expand All @@ -531,12 +534,12 @@ DEPENDENCIES
hydra-head (= 7.2.2)
jettywrapper (~> 1.8)
jquery-rails
log4r
mime-types (~> 2.6)
mysql2 (~> 0.4.5)
nest (= 1.1.2)
orderly
paperclip (~> 5.2)
passenger
rails (= 4.2.7)
responders (~> 2.0)
resque (= 1.25.2)
Expand Down
65 changes: 63 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,68 @@ class CatalogController < ApplicationController
# since we aren't specifying it otherwise.
config.add_search_field('all_fields', :label => 'All Fields') do |field|
field.solr_local_parameters = {
:qf => "id #{Ddr::Index::Fields::ACTIVE_FEDORA_MODEL} title_tesim creator_tesim subject_tesim description_tesim identifier_tesim #{Ddr::Index::Fields::PERMANENT_ID}"
:qf => ["id",
solr_name(:abstract, :stored_searchable),
solr_name(:affiliation, :stored_searchable),
solr_name(:alternative, :stored_searchable),
solr_name(:artist, :stored_searchable),
solr_name(:biblical_book, :stored_searchable),
solr_name(:bibliographicCitation, :stored_searchable),
solr_name(:box_number, :stored_searchable),
solr_name(:call_number, :stored_searchable),
solr_name(:category, :stored_searchable),
solr_name(:chapter_and_verse, :stored_searchable),
solr_name(:company, :stored_searchable),
solr_name(:composer, :stored_searchable),
solr_name(:creator, :stored_searchable),
solr_name(:contributor, :stored_searchable),
solr_name(:description, :stored_searchable),
solr_name(:dedicatee, :stored_searchable),
solr_name(:engraver, :stored_searchable),
solr_name(:extent, :stored_searchable),
solr_name(:folder, :stored_searchable),
solr_name(:format, :stored_searchable),
solr_name(:genre, :stored_searchable),
solr_name(:headline, :stored_searchable),
solr_name(:identifier, :stored_searchable),
solr_name(:illustrated,:stored_searchable),
solr_name(:illustrator,:stored_searchable),
solr_name(:instrumentation, :stored_searchable),
solr_name(:interviewer_name, :stored_searchable),
solr_name(:isPartOf, :stored_searchable),
solr_name(:issue_number, :stored_searchable),
solr_name(:language_name, :stored_searchable),
solr_name(:lithographer, :stored_searchable),
solr_name(:lyricist, :stored_searchable),
solr_name(:medium, :stored_searchable),
solr_name(:negative_number, :stored_searchable),
solr_name(:nested_path_text, :searchable),
solr_name(:oclc_number, :stored_searchable),
solr_name(:performer, :stored_searchable),
solr_name(:placement_company, :stored_searchable),
solr_name(:print_number, :stored_searchable),
solr_name(:producer, :stored_searchable),
solr_name(:product, :stored_searchable),
solr_name(:provenance, :stored_searchable),
solr_name(:publication, :stored_searchable),
solr_name(:publisher, :stored_searchable),
solr_name(:rights, :stored_searchable),
solr_name(:roll_number, :stored_searchable),
solr_name(:series, :stored_searchable),
solr_name(:setting, :stored_searchable),
solr_name(:spatial, :stored_searchable),
solr_name(:sponsor, :stored_searchable),
solr_name(:subject, :stored_searchable),
solr_name(:subseries, :stored_searchable),
solr_name(:temporal, :stored_searchable),
solr_name(:title, :stored_searchable),
solr_name(:tone, :stored_searchable),
solr_name(:type, :stored_searchable),
solr_name(:volume, :stored_searchable),
Ddr::Index::Fields::ALL_TEXT,
Ddr::Index::Fields::LOCAL_ID,
Ddr::Index::Fields::PERMANENT_ID,
Ddr::Index::Fields::YEAR_FACET].join(' ')
}
end

Expand All @@ -112,7 +173,7 @@ class CatalogController < ApplicationController

config.add_search_field('title') do |field|
# solr_parameters hash are sent to Solr as ordinary url query params.
field.solr_parameters = { :'spellcheck.dictionary' => 'title' }
field.solr_parameters = { :'spellcheck.dictionary' => 'default' }

# :solr_local_parameters will be sent using Solr LocalParams
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
Expand Down
1 change: 1 addition & 0 deletions app/jobs/publication_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def self.send_notification(email:, subject: 'Publication Job', message:)
mail = JobMailer.basic(to: email,
subject: subject,
message: message)
mail.deliver_now
end

def self.publication_scope(object)
Expand Down
2 changes: 1 addition & 1 deletion app/services/build_batch_from_datastream_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def matching_component_query_by_filename(collection, filename)
Ddr::Index::Query.new do
model 'Component'
is_governed_by collection
raw "#{Ddr::Index::Fields::ORIGINAL_FILENAME}:/#{filename}.*/"
raw "#{Ddr::Index::Fields::ORIGINAL_FILENAME}:/#{filename}\\..*/"
fields 'id'
end
end
Expand Down
11 changes: 1 addition & 10 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

require 'rails/all'

# log4r
require 'log4r'
require 'log4r/yamlconfigurator'
require 'log4r/outputter/datefileoutputter'
include Log4r

if defined?(Bundler)
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Expand Down Expand Up @@ -67,10 +61,7 @@ class Application < Rails::Application

config.active_record.raise_in_transactional_callbacks = true

# assign log4r's logger as Rails' logger
log4r_config = YAML.load_file(File.join(File.dirname(__FILE__),"log4r.yml"))
YamlConfigurator.decode_yaml(log4r_config['log4r_config'])
config.logger = Log4r::Logger[Rails.env]
config.logger = Logger.new(config.paths["log"].first, 5, 10**7)

# Load environment variable from file
# http://railsapps.github.io/rails-environment-variables.html
Expand Down
4 changes: 0 additions & 4 deletions config/initializers/log_formatting.rb

This file was deleted.

42 changes: 0 additions & 42 deletions config/log4r.yml.sample

This file was deleted.

1 change: 1 addition & 0 deletions lib/dul_hydra/configurable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ module Configurable
:ead_id,
:license,
:local_id,
:research_help_contact,
:rights_note,
]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dul_hydra/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DulHydra
VERSION = "4.9.3"
VERSION = "4.10.0"
end
10 changes: 10 additions & 0 deletions spec/jobs/publication_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

RSpec.describe PublicationJob, type: :job do

describe '.send_notification' do
let(:email) { 'nobody@example.com' }
let(:subject) { 'Test Email' }
let(:message) { 'Text of test message' }
it 'sends an email' do
expect{ described_class.send_notification(email: email, subject: subject, message: message) }
.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end

describe '.publication_scope' do
it 'returns the correct string' do
expect(described_class.publication_scope(Collection.new)).to eq(I18n.t('dul_hydra.publication.scope.collection'))
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/publish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
it "should generate an email" do
expect(JobMailer).to receive(:basic).with(to: email,
subject: 'Publication Job COMPLETED',
message: expected_msg)
message: expected_msg).and_call_original
described_class.perform('test-1', email)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/un_publish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
it "should generate an email" do
expect(JobMailer).to receive(:basic).with(to: email,
subject: 'Un-Publication Job COMPLETED',
message: expected_msg)
message: expected_msg).and_call_original
described_class.perform('test-1', email)
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/lib/dul_hydra_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
its(:fixity_check_limit) { is_expected.to eq(10000) }
its(:fixity_check_period_in_days) { is_expected.to eq(60) }
its(:batches_per_page) { is_expected.to eq(10) }
its(:user_editable_admin_metadata_fields) { is_expected.to include(:research_help_contact) }
end

end
13 changes: 13 additions & 0 deletions spec/services/build_batch_from_datastream_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,18 @@
expect(batch.batch_objects.first.pid).to eq(component.pid)
end
end
describe 'match on entire filename except for extension' do
let(:comp) { FactoryGirl.build(:component) }
before do
component.update_attributes(original_filename: 'abc001.tif')
comp.admin_policy = collection
comp.original_filename = 'abc001001.tif'
comp.save!
end
it 'finds the correct component' do
batch = batch_builder.call
expect(batch.batch_objects.first.pid).to eq(component.pid)
end
end
end
end

0 comments on commit f1c2f36

Please sign in to comment.