Skip to content

Commit

Permalink
complete/correct renaming of smpl to media
Browse files Browse the repository at this point in the history
  • Loading branch information
ndushay authored and jermnelson committed Aug 15, 2019
1 parent 42d1df9 commit fceaef2
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/lib/pre_assembly/digital_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def stage_files
end
end

# Technical metadata combined file for SMPL.
# Technical metadata combined file for Media.
def generate_technical_metadata
create_technical_metadata
write_technical_metadata
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pre_assembly/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize(params)
csv_file = params[:csv_filename] || 'media_manifest.csv'
@csv_filename = File.join(@bundle_dir, csv_file)

# default publish/shelve/preserve attributes per "type" as defined in smpl filenames
# default publish/shelve/preserve attributes per "type" as defined in media filenames
@file_attributes = {
'default' => { publish: 'no', shelve: 'no', preserve: 'yes' },
'pm' => { publish: 'no', shelve: 'no', preserve: 'yes' },
Expand Down
4 changes: 2 additions & 2 deletions app/models/bundle_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def progress_log_file
@progress_log_file ||= File.join(output_dir, "#{project_name}_progress.yml")
end

# TODO: See #274. Possibly need to keep for SMPL style projects (if they don't use manifest?)
# TODO: See #274. Possibly need to keep for Media style projects (if they don't use manifest?)
# @deprecated - since it's not currently configurable, and non-default usage isn't tested anyway
def stageable_discovery
{}
Expand Down Expand Up @@ -118,7 +118,7 @@ def verify_bundle_directory
return if errors.key?(:bundle_dir)
return errors.add(:bundle_dir, "'#{bundle_dir}' not found.") unless File.directory?(bundle_dir)
errors.add(:bundle_dir, "missing manifest: #{bundle_dir}/#{manifest}") unless File.exist?(File.join(bundle_dir, manifest))
return unless media_cm_style? # only smpl objects require smpl_manifest.csv
return unless media_cm_style? # only media objects require media_manifest.csv
errors.add(:bundle_dir, "missing Media manifest: #{bundle_dir}/#{media_manifest}") unless File.exist?(File.join(bundle_dir, media_manifest))
end

Expand Down
14 changes: 7 additions & 7 deletions app/services/discovery_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def process_dobj(dobj)
empty_files = dobj.object_files.count { |obj| obj.filesize == 0 }
errors[:empty_files] = empty_files if empty_files > 0

if using_smpl_manifest? # if we are using a SMPL manifest, let's add how many files were found
if using_media_manifest? # if we are using a media manifest, let's add how many files were found
bundle_id = File.basename(dobj.container)
cm_files = smpl.manifest[bundle_id].fetch(:files, [])
cm_files = media.manifest[bundle_id].fetch(:files, [])
counts[:files_in_manifest] = cm_files.count
relative_paths = dobj.object_files.map(&:relative_path)
counts[:files_found] = (cm_files.pluck(:filename) & relative_paths).count
Expand Down Expand Up @@ -83,13 +83,13 @@ def registration_check(druid)
end

# @return [Boolean]
def using_smpl_manifest?
content_md_creation == 'smpl_cm_style' && File.exist?(File.join(bundle_dir, bundle.bundle_context.smpl_manifest))
def using_media_manifest?
content_md_creation == 'media_cm_style' && File.exist?(File.join(bundle_dir, bundle.bundle_context.media_manifest))
end

# @return [PreAssembly::Smpl]
def smpl
@smpl ||= PreAssembly::Smpl.new(csv_filename: bundle.bundle_context.smpl_manifest, bundle_dir: bundle_dir)
# @return [PreAssembly::Media]
def media
@media ||= PreAssembly::Media.new(csv_filename: bundle.bundle_context.media_manifest, bundle_dir: bundle_dir)
end

# By using jbuilder on an enumerator, we reduce memory footprint (vs. to_a)
Expand Down
4 changes: 2 additions & 2 deletions app/views/bundle_contexts/_new_bc_form.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
['Simple Book', 'simple_book'],
['Book as Image','book_as_image'],
['File', 'file'],
['Media', 'smpl'],
['Media', 'media'],
['3D', '3d'],
]
%>
Expand All @@ -53,7 +53,7 @@
[
["Default", "default"],
["Filename", "filename"],
["Media", "smpl_cm_style"]
["Media", "media_cm_style"]
]
%>
</div>
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/pre_assembly/bundle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@
describe '#exclude_from_content' do
it 'behaves correctly' do
skip 'web app does not need to support exclude_from_content'
expect(smpl_multimedia.send(:exclude_from_content, smpl_multimedia.path_in_bundle('image1.tif'))).to be_falsey
expect(smpl_multimedia.send(:exclude_from_content, smpl_multimedia.path_in_bundle('descMetadata.xml'))).to be_truthy
expect(multimedia.send(:exclude_from_content, multimedia.path_in_bundle('image1.tif'))).to be_falsey
expect(multimedia.send(:exclude_from_content, multimedia.path_in_bundle('descMetadata.xml'))).to be_truthy
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/services/discovery_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

before do
allow(dobj).to receive(:object_files).and_return([obj_file, obj_file])
allow(report).to receive(:using_smpl_manifest?).and_return(false)
allow(report).to receive(:using_media_manifest?).and_return(false)
allow(report).to receive(:registration_check).and_return({}) # pretend everything is in Dor
end

Expand Down
4 changes: 2 additions & 2 deletions spec/test_data/exemplar_templates/TEMPLATE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ project_style:

'book_as_image' # Like simple_book, but with <contentMetadata type="book"> and <resource type="image"> instead of "page".

'media' # Used for SMPL projects
'media' # Used for media projects

'3d' # Bundles 3d file types into <contentMetadata type="3d"> and 3d file extensions into <resource type="3d"> and others into <resource type="file">

Expand Down Expand Up @@ -82,5 +82,5 @@ content_md_creation:
# part of a single resource node.
'dpg' # Collects files together into a single resource based on DPG filenaming convention (ignoring _00_,_05_, etc.) -- files with the same name but different extensions will become
# part of a single resource node.
'media' # Only used by SMPL projects. Will generate a content metadata file using the Media preContentMetadata.
'media' # Only used by media projects. Will generate a content metadata file using the Media preContentMetadata.
'none' # Do not generate any contentMetadata.xml file. Select this option only if you have a previously created valid contentMetadata.xml in the root of your staged folder.
4 changes: 2 additions & 2 deletions spec/test_data/project_config_files/media_acc_only.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
project_name: 'media_manifest_with_thumb-accession-only'
project_name: 'media-accession-only'

project_style:
content_structure: 'media'

bundle_dir: 'spec/test_data/media_multimedia'
bundle_dir: 'spec/test_data/multimedia'

content_md_creation:
style: 'media'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
project_name: 'media-staging-style-copy'

project_style:
content_structure: 'smpl'
content_structure: 'media'

bundle_dir: 'spec/test_data/multimedia'

staging_style: 'copy'

content_md_creation:
style: 'media'
smpl_manifest: 'media_manifest.csv'
media_manifest: 'media_manifest.csv'

stageable_discovery:
glob: '**/*'
Expand Down
2 changes: 1 addition & 1 deletion spec/test_data/project_config_files/multimedia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bundle_dir: 'spec/test_data/multimedia'

content_md_creation:
style: 'media'
smpl_manifest: smedia_manifest_with_thumb.csv'
media_manifest: 'media_manifest_with_thumb.csv'

object_discovery:
use_manifest: false
Expand Down

0 comments on commit fceaef2

Please sign in to comment.