samvera-labs / active_encode

Declare encode job classes that can be run by a variety of encoding services
Other
6 stars 8 forks source link

Follow rails pattern for optional dependency gems #97

Open cjcolvar opened 2 years ago

cjcolvar commented 2 years ago

See discussion on https://github.com/samvera-labs/active_encode/pull/94

Try doing something more like rails / valkyrie to load gems for adapters and warn users when they aren't installed and attempting to use them. https://github.com/samvera/valkyrie/blob/1ad73aed5b41aa1957912f198015629e05a2a2b1/lib/valkyrie/persistence/fedora.rb#L3-L9

jrochkind commented 2 years ago

Oh I see you already have a ticket on this!

For a concrete example of how it ends up working now, see documentation in #101

There are other possible alternatives:

So something like the Rails/valkyrie approach is probably the least bad low hanging fruit improvement.

I think it is preferable to expand on what valkyrie does, and formally specify the version specification (1.x, 2.x etc) of the "optional dependency" that is required. I think Rails does do that, although its' error message has in the past confusingly not told you what version it needed! I wrote more about this here: https://bibwild.wordpress.com/2015/09/09/optional-gem-dependencies/