Comments (13)
@flyingzumwalt seems like the solution should be that hydra-derivatives accepts parameters for these. Is the gem currently making too many assumptions about the model?
from hydra-derivatives.
@awead one solution would be to use .send
instead of .attached_files
, but I bet there is a reason that it didn't already do that?
Example
def source_file
object.send(source_name.to_sym)
end
instead of
def source_file
object.attached_files[source_name.to_s]
end
from hydra-derivatives.
or maybe rely on a retrieve_attached_file method
def retrieve_attached_file(object, attachment_ref)
object.send(attachment_ref.to_sym)
end
def source_file
retrieve_attached_file(object, source_name)
end
def output_file(path)
# first, check for a defined file
output_file = if retrieve_attached_file(object, path)
object.attached_files[path]
else
ActiveFedora::File.new("#{object.uri}/#{path}").tap do |file|
object.attach_file(file, path)
end
end
end
from hydra-derivatives.
I would love it if hydra-derivatives didn't assume that you were using fedora at all. Let the object
know how persistence happens, and let the calls to transform_file
tell hydra-derivatives which methods to call on that object in order to retrieve the source and return the output.
from hydra-derivatives.
Then hydra-derivatives would become the first hydra gem that's truly useful outside of the hydra/fedora sphere.
from hydra-derivatives.
👍 to that.
from hydra-derivatives.
@flyingzumwalt specify a default retrieve_attached_file
method that is the current process using attached_files, but the implementor overrides that? Or make it explicit:
class Hydra::Derivatives::Processor::Base
def retrieve_attached_file
raise NotImplementedError, "You must specify a method for retrieving the file's content"
end
end
from hydra-derivatives.
That doesn't work. That would mean all of your Processors have to choose
which attached_file strategy to assume. I should be able to use the Image
processor, etc. regardless of how files are attached to my object.
from hydra-derivatives.
fair enough!
from hydra-derivatives.
👍 to this work, hydra-derivatives assumptions about the model keep us from adopting it.
from hydra-derivatives.
Solving this by refactoring Processors to use a RetrieveSourceFile service for retrieving source file and a PersistOutputFile service for persisting output file. These services can be configured in the initializer and/or in your calls to transform_file.
from hydra-derivatives.
from hydra-derivatives.
Fixed in #61. Test coverage in #66.
from hydra-derivatives.
Related Issues (20)
- Consider adding a Dockerfile for development?
- Hydra::Derivatives::Processors::Document #convert_to_format possible bug HOT 4
- Point README badge to CircleCI
- Fix CI Build HOT 4
- Evaluate making ActiveFedora an optional dependency. HOT 1
- Add support for Ruby 2.7.z releases
- Add support for Rails 6.0.z releases HOT 1
- Hydra::Derivatives::Processors::Jpeg2kImage.level_count_for_size can return -1 HOT 3
- "gray" vs "grey" breaking default jp2k recipe lookup? HOT 2
- Use more universally-compatible pixel format for mp4 derivatives HOT 1
- Add Circle CI step that fails if branch name is master
- Add language to README about branch naming
- Update CONTRIBUTING.md to match the maintenance template
- Update references of hard-coded legacy master branch name to main branch name
- Support Rails 6.1 releases HOT 1
- Support Ruby 3.0 releases HOT 2
- Configure nightly CircleCI test suite executions
- Update the gemspec to require MFA for RubyGems releases
- Identify a new Product Owner HOT 1
- IO::EAGAINWaitReadable error in ShellBasedProcessor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hydra-derivatives.