Skip to content

Commit

Permalink
Merge pull request #6082 from avalonmediasystem/fedora6_7.8_rebase_re…
Browse files Browse the repository at this point in the history
…base

Fedora6 7.8 rebase rebase
  • Loading branch information
cjcolvar authored Oct 23, 2024
2 parents 1ec2af0 + 5eaeccf commit 2d0eb7e
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 45 deletions.
15 changes: 8 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ jobs:
- image: avalonmediasystem/avalon:develop
environment:
- DATABASE_URL=postgresql://postgres@localhost:5432/postgres
- FEDORA_URL=http://localhost:8080/fcrepo/rest
- FEDORA_URL=http://fedoraAdmin:fedoraAdmin@localhost:8080/fcrepo/rest
- FEDORA_BASE_PATH=/test
- FEDORA_TIMEOUT=300
- RAILS_ENV=test
# Secondary container image on common network.
Expand All @@ -17,9 +18,9 @@ jobs:
- POSTGRES_USER=postgres
- POSTGRES_DB=avalon
- POSTGRES_PASSWORD=password
- image: ualbertalib/docker-fcrepo4:4.7
- image: fcrepo/fcrepo:6.5-tomcat9
environment:
CATALINA_OPTS: '-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC'
CATALINA_OPTS: -Dfcrepo.autoversioning.enabled=false
- image: zookeeper:3.9
environment:
ZOO_ADMINSERVER_ENABLED: false
Expand Down Expand Up @@ -142,7 +143,7 @@ jobs:
default: 4
docker:
# Primary container image where all steps run.
- image: avalonmediasystem/avalon:7.5.0-dev-ruby3
- image: avalonmediasystem/avalon:7.8.0-dev

working_directory: /home/app/avalon

Expand All @@ -165,10 +166,10 @@ workflows:
build_test_report:
jobs:
- build:
ruby_ver: '3.2'
name: 'Ruby3-2'
ruby_ver: '3.3'
name: 'Ruby3-3'
parallelism: 4
- upload-coverage:
parallelism: 4
requires:
- Ruby3-2
- Ruby3-3
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ gem 'terser'
gem 'shakapacker'

# Core Samvera
gem 'active-fedora', '~> 15.0'
gem 'active_fedora-datastreams', '~> 0.5'
#gem 'active-fedora', '~> 15.0'
#gem 'active_fedora-datastreams', '~> 0.5'
gem 'active-fedora', git: 'https://github.com/samvera/active_fedora.git', branch: 'fedora6_rebase'
gem 'active_fedora-datastreams', git: 'https://github.com/samvera-labs/active_fedora-datastreams.git', branch: 'fedora6_rebase'
gem 'hydra-head', '~> 13.0'
gem 'ldp', '~> 1.1.0'
gem 'noid-rails', '~> 3.2'
Expand Down
82 changes: 56 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ GIT
ims-lti
omniauth

GIT
remote: https://github.com/samvera-labs/active_fedora-datastreams.git
revision: 3e1b54f60e6d6316e114f608ee5c50c85d6598c6
branch: fedora6_rebase
specs:
active_fedora-datastreams (0.5.0)
active-fedora (>= 11.0.0.pre)
activemodel (>= 5.2)
nom-xml (>= 0.5.1)
om (~> 3.1)
rdf (~> 3.2)
rdf-rdfa (= 3.2.0)
rdf-rdfxml (~> 3.2)

GIT
remote: https://github.com/samvera-labs/samvera-persona.git
revision: ce6ada95684fe1c5487e8ee5d698b8529c69bf75
Expand All @@ -86,6 +100,24 @@ GIT
speedy-af (0.3.0)
activesupport (> 5.2)

GIT
remote: https://github.com/samvera/active_fedora.git
revision: 0f5ccb1536224efec750941ce9a1f58f2e09cd3c
branch: fedora6_rebase
specs:
active-fedora (15.0.1)
active-triples (>= 0.11.0, < 2.0.0)
activemodel (>= 6.1)
activesupport (>= 6.1)
deprecation
faraday (>= 2.0)
faraday-encoding (>= 0.0.5)
faraday-follow_redirects
ldp (>= 0.7.0, < 2)
mutex_m
rsolr (>= 1.1.2, < 3)
ruby-progressbar (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -133,17 +165,6 @@ GEM
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active-fedora (15.0.0)
active-triples (>= 0.11.0, < 2.0.0)
activemodel (>= 6.1)
activesupport (>= 6.1)
deprecation
faraday (>= 1.0)
faraday-encoding (>= 0.0.5)
ldp (>= 0.7.0, < 2)
mutex_m
rsolr (>= 1.1.2, < 3)
ruby-progressbar (~> 1.0)
active-triples (1.2.0)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
Expand All @@ -155,13 +176,6 @@ GEM
active_encode (1.2.2)
addressable (~> 2.8)
rails
active_fedora-datastreams (0.5.0)
active-fedora (>= 11.0.0.pre)
activemodel (>= 5.2)
nom-xml (>= 0.5.1)
om (~> 3.1)
rdf (~> 3.2)
rdf-rdfxml (~> 3.2)
activejob (7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.3.6)
Expand Down Expand Up @@ -423,11 +437,14 @@ GEM
fakefs (2.5.0)
faker (3.4.2)
i18n (>= 1.8.11, < 2)
faraday (2.11.0)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-encoding (0.0.6)
faraday
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.3.0)
net-http
fastimage (2.3.1)
Expand Down Expand Up @@ -464,6 +481,9 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
haml (5.2.2)
temple (>= 0.8.0)
tilt
hashdiff (1.1.1)
hashie (5.0.0)
hooks (0.4.1)
Expand Down Expand Up @@ -497,7 +517,7 @@ GEM
hydra-access-controls (= 13.0.0)
hydra-core (= 13.0.0)
rails (>= 6.1, < 8.0)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
iconv (1.0.8)
iiif_manifest (1.6.0)
Expand Down Expand Up @@ -564,7 +584,7 @@ GEM
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
logger (1.6.0)
logger (1.6.1)
lograge (0.14.0)
actionpack (>= 4)
activesupport (>= 4)
Expand Down Expand Up @@ -674,7 +694,7 @@ GEM
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.8.1)
rack (2.2.9)
rack (2.2.10)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-protection (3.2.0)
Expand Down Expand Up @@ -735,11 +755,20 @@ GEM
bcp47_spec (~> 0.2)
bigdecimal (~> 3.1, >= 3.1.5)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (3.3.0)
rdf (~> 3.3)
rdf-isomorphic (3.3.0)
rdf (~> 3.3)
rdf-ldp (0.1.0)
deprecation
rdf
rdf-rdfa (3.2.0)
haml (~> 5.2)
htmlentities (~> 4.3)
rdf (~> 3.2)
rdf-aggregate-repo (~> 3.2)
rdf-vocab (~> 3.2)
rdf-xsd (~> 3.2)
rdf-rdfxml (3.3.0)
builder (~> 3.2, >= 3.2.4)
htmlentities (~> 4.3)
Expand Down Expand Up @@ -802,7 +831,7 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retriable (3.1.2)
rexml (3.3.6)
rexml (3.3.8)
roo (2.10.1)
nokogiri (~> 1)
rubyzip (>= 1.3.0, < 3.0.0)
Expand Down Expand Up @@ -947,6 +976,7 @@ GEM
sxp (2.0.0)
matrix (~> 0.4)
rdf (~> 3.3)
temple (0.10.3)
terser (1.2.3)
execjs (>= 0.3.0, < 3)
thor (1.3.1)
Expand All @@ -964,7 +994,7 @@ GEM
uber (0.0.15)
unf (0.2.0)
unicode-display_width (2.5.0)
unicode-types (1.9.0)
unicode-types (1.10.0)
uri (0.13.1)
user_agent_parser (2.18.0)
useragent (0.16.10)
Expand Down Expand Up @@ -1008,11 +1038,11 @@ PLATFORMS

DEPENDENCIES
about_page!
active-fedora (~> 15.0)
active-fedora!
active_annotations!
active_elastic_job
active_encode (>= 1.2.2)
active_fedora-datastreams (~> 0.5)
active_fedora-datastreams!
activejob-traffic_control
activejob-uniqueness
activerecord-session_store (>= 2.0.0)
Expand Down
10 changes: 9 additions & 1 deletion app/controllers/media_objects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,15 @@ def update_media_object
master_file.date_digitized = DateTime.parse(file_spec[:date_digitized]).to_time.utc.iso8601 if file_spec[:date_digitized].present?
master_file.identifier += Array(params[:files][index][:other_identifier])
master_file.comment += Array(params[:files][index][:comment])
master_file.media_object = @media_object
begin
master_file.media_object = @media_object
rescue ActiveFedora::Rollback => e
file_location = file_spec.dig(:file_location) || '<unknown>'
message = "Problem saving MasterFile for #{file_location}:"
error_messages += [message]
error_messages += [e.message]
break
end
if file_spec[:files].present?
if master_file.update_derivatives(file_spec[:files], false)
master_file.update_stills_from_offset!
Expand Down
2 changes: 1 addition & 1 deletion app/models/derivative.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def self.from_output(output, managed = true)
derivative.track_id = output[:id]
derivative.duration = output[:duration].to_i
# FIXME: Implement this in ActiveEncode or determine mimetype here
derivative.mime_type = output[:mime_type]
derivative.mime_type = output[:mime_type].presence
derivative.quality = output[:label].sub(/quality-/, '')

derivative.audio_bitrate = output[:audio_bitrate]
Expand Down
4 changes: 4 additions & 0 deletions app/models/media_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def section_ids
return [] if self.section_list.nil?
@section_ids = JSON.parse(self.section_list)
end

def published?
!avalon_publisher.blank?
end

def destroy
# attempt to stop the matterhorn processing job
Expand Down
53 changes: 53 additions & 0 deletions config/initializers/active_fedora_general.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,28 @@ def set_entities(permission, type, values, changeable)
end
# End of overrides for AccessControl dirty tracking and autosaving

class UUIDIdentifierService
def mint
SecureRandom.uuid
end
end
ActiveFedora::Base.identifier_service_class = UUIDIdentifierService

ActiveFedora::Persistence.module_eval do
# This is only used when creating a new record. If the object doesn't have an id
# and assign_id can mint an id for the object, then assign it to the resource.
# Otherwise the resource will have the id assigned by the LDP server
def assign_rdf_subject
@ldp_source = if !id && new_id = assign_id
subject_uri = base_path_for_resource + self.class.id_to_uri(new_id).gsub(ActiveFedora.fedora.base_uri, '') if base_path_for_resource != ActiveFedora.fedora.base_uri
subject_uri ||= self.class.id_to_uri(new_id)
ActiveFedora::LdpResource.new(ActiveFedora.fedora.connection, subject_uri, @resource)
else
ActiveFedora::LdpResource.new(ActiveFedora.fedora.connection, @ldp_source.subject, @resource, base_path_for_resource)
end
end
end

# Override ActiveFedora::Associations::Builder::Orders::FixFirstLast to remove attempts to set first and last from list_source on saving
ActiveFedora::Associations::Builder::Orders::FixFirstLast.module_eval do
def save(*args)
Expand Down Expand Up @@ -143,3 +165,34 @@ def predicate
options[:has_member_relation] || ::RDF::Vocab::LDP.contains
end
end

ActiveFedora::Associations::IndirectlyContainsAssociation.class_eval do
def insert_record(record, force = true, validate = true)
container.save!
if force
record.save!
else
return false unless record.save(validate: validate)
end

save_through_record(record)

# Add triples to the parent object
owner.send(:attribute_will_change!, reflection.name)
owner.resource << ::RDF::Statement(owner.resource, reflection.predicate, record.id)
owner.save

true
end

private

def delete_record(record)
record_proxy_finder.find(record).delete

# Remove triples from the parent object
owner.send(:attribute_will_change!, reflection.name)
owner.resource.delete({ predicate: reflection.predicate, object: record.id})
owner.save
end
end
4 changes: 4 additions & 0 deletions config/initializers/presenter_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def xpath(*args)
ng_xml.xpath(*args)
end
end

sp.config IndexedFile do
self.defaults = { original_name: nil }
end
end

SpeedyAF::Base.class_eval do
Expand Down
Loading

0 comments on commit 2d0eb7e

Please sign in to comment.