-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test coverage for Hydra::Works::GenericFile::Derivatives. #183
Conversation
Instead of adding mime_type to the signature to accommodate the HydraDerivatives use, we're going to refactor HydraDerivatives to wrap the IO objects in a class that has their attributes. This will be similar to how CurationConcerns operates. |
This PR is blocked by the hydra-derivatives work @grosscol referenced above. Once that's done, this PR should depend upon that work and change the way it handles MIME types. |
@@ -59,6 +59,70 @@ f1.content = "The quick brown fox jumped over the lazy dog." | |||
bf1.save | |||
``` | |||
|
|||
## Extending Directly Contained Derivatives |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For simplicity's sake, can we name this heading something like "Custom Derivatives"? While I appreciate the specificity around how the derivs will be contained (in LDP parlance), I suspect many users of Hydra::Works may not have much knowledge of the intricacies of LDP.
if file.respond_to? :mime_type | ||
return file.mime_type | ||
elsif file.respond_to? :content_type | ||
return file.content_type | ||
elsif file.respond_to? :path | ||
return Hydra::PCDM::GetMimeTypeForFile.call(file.path) | ||
elsif mime_type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the mime_type is provided shouldn't it have precedence over the result from GetMimeTypeForFile
? That's basically a wild ass guess based on file extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are working on getting rid of providing the mime_type option, but I agree.
Remove datastream from makes_derivatives. update to new signature move tests over from curation_concerns. get persist_derivatives pending specs to pass update readme
a5ac9b1
to
aa66ee0
Compare
# @option opts [Boolean] update_existing when set to false, always adds a new file. When set to true, performs a create_or_update | ||
# @option opts [Boolean] versioning whether to create new version entries | ||
|
||
def self.call(object, file, opts={}) | ||
type = opts.fetch(:type, ::RDF::URI("http://pcdm.org/use#ServiceFile")) | ||
def self.call(object, file, destination_name, opts={}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe opts can be filled in from the output_file_service.call from Hydra::Derivatives. Only a custom processor would be able to fill this in now. As it stood, the only opt that was ever passed was :mime_type
, and that has been addressed.
Basically, update_existing
and versioning
always get set to true
for persisting derivatives. I would like to have versioning
set to false instead. I would not like to have versions of thumbnails.
Hydra::Derivatives will not pass opts to output_file_service. Do not version deriviatives such as thumbnails by default. Change default value of versioning to false.
https://coveralls.io/builds/3251106/source?filename=lib%2Fhydra%2Fworks%2Fprocessor.rb#L5 Any idea why this is no longer covered? |
👍 |
The processor is no longer needed because of the RetrieveSourceFile service in Derivatives. I just updated the gemfiles and gemspecs. Feel free to rebase. I'll be on a plane during the call today. |
Test coverage for Hydra::Works::GenericFile::Derivatives.
Closes #152.