Skip to content

Commit

Permalink
Remove dependency on DOR (fedora 3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Feb 11, 2020
1 parent df811b3 commit f77da50
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 195 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ gem 'uglifier' # compressor for JavaScript assets
# Stanford gems
gem 'assembly-image', '~> 1.7'
gem 'assembly-objectfile', '~> 1.9'
gem 'dor-services', '~> 8.1'
gem 'dor-services-client', '~> 4.0'
gem 'dor-workflow-client'
gem 'druid-tools'

group :test do
gem 'coveralls', require: false
Expand Down
126 changes: 3 additions & 123 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,6 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active-fedora (8.7.0)
active-triples (~> 0.4.0)
activesupport (>= 4.2.10)
deprecation
nom-xml (>= 0.5.1)
om (~> 3.1)
rdf-rdfxml (~> 1.1)
rsolr (>= 1.0.11, < 3)
rubydora (>= 1.8.0, < 3)
active-triples (0.4.1)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
deprecation (~> 0.1)
rdf (~> 1.1)
rdf-vocab (~> 0.8)
activejob (5.2.4.1)
activesupport (= 5.2.4.1)
globalid (>= 0.3.6)
Expand Down Expand Up @@ -121,7 +106,6 @@ GEM
thor (>= 0.19.4, < 2.0)
tins (~> 1.6)
crass (1.0.6)
daemons (1.3.1)
deep_merge (1.2.1)
deprecation (0.99.0)
activesupport
Expand All @@ -140,28 +124,6 @@ GEM
capistrano-one_time_key
capistrano-shared_configs
docile (1.3.2)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dor-rights-auth (1.4.0)
nokogiri
dor-services (8.5.0)
active-fedora (>= 8.7.0, < 9)
activesupport (~> 5.1)
deprecation (~> 0)
dor-rights-auth (~> 1.0, >= 1.2.0)
dor-workflow-client (~> 3.1)
druid-tools (>= 0.4.1)
json (>= 1.8.1)
nokogiri (~> 1.6)
om (~> 3.0)
rdf (~> 1.1, >= 1.1.7)
rest-client (>= 1.7, < 3)
retries (~> 0.0.5)
rsolr (>= 1.0.3, < 3)
rubydora (~> 2.1)
solrizer (~> 3.0)
stanford-mods (>= 2.3.1)
stanford-mods-normalizer (~> 0.1)
dor-services-client (4.10.0)
activesupport (>= 4.2, < 7)
cocina-models (~> 0.15.0)
Expand Down Expand Up @@ -219,8 +181,6 @@ GEM
dry-equalizer (~> 0.2)
dry-initializer (~> 3.0)
dry-schema (~> 1.4, >= 1.4.3)
edtf (3.0.5)
activesupport (>= 3.0, < 7.0)
equivalent-xml (0.6.0)
nokogiri (>= 1.4.3)
erubi (1.9.0)
Expand All @@ -237,20 +197,10 @@ GEM
ffi (1.12.2)
globalid (0.4.2)
activesupport (>= 4.2.0)
haml (5.1.2)
temple (>= 0.8.0)
tilt
honeybadger (4.5.6)
hooks (0.4.1)
uber (~> 0.0.14)
htmlentities (4.3.4)
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
iso-639 (0.2.8)
jaro_winkler (1.5.4)
jbuilder (2.10.0)
activesupport (>= 5.0.0)
Expand All @@ -271,7 +221,6 @@ GEM
activerecord
kaminari-core (= 1.2.0)
kaminari-core (1.2.0)
link_header (0.0.8)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand All @@ -296,11 +245,6 @@ GEM
json
nokogiri
nokogiri-happymapper
mods (2.4.1)
edtf
iso-639
nokogiri (>= 1.6.6)
nom-xml (~> 1.0)
mono_logger (1.1.0)
multi_json (1.14.1)
multipart-post (2.1.1)
Expand All @@ -309,22 +253,12 @@ GEM
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
netrc (0.11.0)
nio4r (2.5.2)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
nokogiri-happymapper (0.8.1)
nokogiri (~> 1.5)
nom-xml (1.1.0)
activesupport (>= 3.2.18)
i18n
nokogiri
okcomputer (1.18.1)
om (3.2.0)
activemodel (>= 5.1, < 7)
activesupport
nokogiri (>= 1.4.2)
solrizer (~> 3.3)
orm_adapter (0.5.0)
parallel (1.19.1)
parser (2.7.0.2)
Expand Down Expand Up @@ -375,25 +309,6 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdf (1.99.1)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (1.99.0)
rdf (~> 1.99)
rdf-rdfa (1.99.3)
haml (>= 4.0, < 6.0)
htmlentities (~> 4.3)
rdf (~> 1.99)
rdf-aggregate-repo (~> 1.1)
rdf-xsd (~> 1.1)
rdf-rdfxml (1.99.1)
htmlentities (~> 4.3)
rdf (~> 1.99)
rdf-rdfa (~> 1.99)
rdf-xsd (~> 1.99)
rdf-vocab (0.8.8)
rdf (~> 1.1, >= 1.1.10)
rdf-xsd (1.99.0)
rdf (~> 1.99)
redis (4.1.3)
redis-namespace (1.7.0)
redis (>= 3.0.4)
Expand All @@ -410,15 +325,6 @@ GEM
resque-pool (0.7.1)
rake (>= 10.0, < 14.0)
resque (>= 1.22, < 3)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retries (0.0.5)
rsolr (2.3.0)
builder (>= 2.1.2)
faraday (>= 0.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
Expand Down Expand Up @@ -448,15 +354,6 @@ GEM
ruby-prof (1.2.0)
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.2)
rubydora (2.1.0)
activemodel (>= 4.2.10)
activesupport
deprecation
equivalent-xml
hooks (~> 0.3)
mime-types
nokogiri
rest-client
sassc (2.0.1)
ffi (~> 1.9)
rake
Expand All @@ -481,12 +378,6 @@ GEM
rack (~> 2.0)
rack-protection (= 2.0.8.1)
tilt (~> 2.0)
solrizer (3.4.1)
activesupport
daemons
nokogiri
stomp
xml-simple
sprockets (4.0.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -498,14 +389,7 @@ GEM
sshkit (1.20.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stanford-mods (2.6.1)
activesupport
mods (~> 2.2)
stanford-mods-normalizer (0.1.0)
nokogiri (~> 1.8)
stomp (1.4.9)
sync (0.5.0)
temple (0.8.2)
term-ansicolor (1.7.1)
tins (~> 1.0)
thor (0.20.3)
Expand All @@ -518,12 +402,8 @@ GEM
turbolinks-source (5.2.0)
tzinfo (1.2.6)
thread_safe (~> 0.1)
uber (0.0.15)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)
unicode-display_width (1.6.1)
vegas (0.1.11)
rack (>= 1.0.0)
Expand All @@ -532,7 +412,6 @@ GEM
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
xml-simple (1.1.5)
zeitwerk (2.2.2)

PLATFORMS
Expand All @@ -551,8 +430,9 @@ DEPENDENCIES
devise
devise-remote-user
dlss-capistrano (~> 3.1)
dor-services (~> 8.1)
dor-services-client (~> 4.0)
dor-workflow-client
druid-tools
equivalent-xml
factory_bot_rails
honeybadger (~> 4.5)
Expand Down Expand Up @@ -582,4 +462,4 @@ DEPENDENCIES
uglifier

BUNDLED WITH
2.1.2
2.1.4
2 changes: 2 additions & 0 deletions app/lib/csv_importer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'csv'

class CsvImporter
# load CSV allowing UTF-8 to pass through, deleting blank columns
# @param [String] filename
Expand Down
44 changes: 25 additions & 19 deletions app/lib/pre_assembly/digital_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,15 @@ def initialize(bundle, container: nil, stageable_items: nil, object_files: nil,
# set this object's content_md_creation_style
# @return [Symbol]
def content_md_creation_style
# map the content type tags set inside an object to content metadata creation styles supported by the assembly-objectfile gem
# format is 'tag_value' => 'gem style name'
content_type_tag_mapping = {
'Image' => :simple_image,
'File' => :file,
'Book (flipbook, ltr)' => :simple_book,
'Book (image-only)' => :simple_book,
'Manuscript (flipbook, ltr)' => :simple_book,
'Manuscript (image-only)' => :simple_book,
'Map' => :map,
'3D' => :'3d'
}
content_type_tag_mapping[content_type_tag] || content_structure.to_sym
# map the object type to content metadata creation styles supported by the assembly-objectfile gem
{
Cocina::Models::Vocab.image => :simple_image,
Cocina::Models::Vocab.object => :file,
Cocina::Models::Vocab.book => :simple_book,
Cocina::Models::Vocab.manuscript => :simple_book,
Cocina::Models::Vocab.map => :map,
Cocina::Models::Vocab.three_dimensional => :'3d'
}.fetch(object_type, content_structure.to_sym)
end

####
Expand Down Expand Up @@ -85,10 +81,10 @@ def druid

attr_reader :assembly_directory

def content_type_tag
dor_object = Dor::Item.find(pid)
dor_object.content_type_tag
rescue ActiveFedora::ObjectNotFoundError
# @return [String] one of the values from Cocina::Models::DRO::TYPES
def object_type
object_client.find.type
rescue Dor::Services::Client::NotFoundResponse
''
end

Expand Down Expand Up @@ -141,10 +137,15 @@ def openable?
version_client.openable?
end

def object_client
@object_client ||= Dor::Services::Client.object(druid.druid)
end

def version_client
@version_client ||= Dor::Services::Client.object(druid.druid).version
object_client.version
end


def current_object_version
@current_object_version ||= version_client.current.to_i
end
Expand All @@ -165,7 +166,12 @@ def create_new_version

# Call web service to add assemblyWF to the object in DOR.
def initialize_assembly_workflow
Dor::Config.workflow.client.create_workflow_by_name(druid.druid, 'assemblyWF', version: current_object_version)
workflow_client.create_workflow_by_name(druid.druid, 'assemblyWF', version: current_object_version)
end

def workflow_client
logger = Logger.new(Settings.workflow.logfile, Settings.workflow.shift_age)
Dor::Workflow::Client.new(url: Settings.workflow_url, logger: logger, timeout: Settings.workflow.timeout)
end
end
end

0 comments on commit f77da50

Please sign in to comment.