@floppy @manyfold the only real lever you have is ActionDispatch::Routing::Mapper::Base#mount, which is intended to be called on startup in routes.rb. You *could* call it later and mount other engines, I guess*, but there's no opposite #unmount.
*Would require some fiddling with ActionDispatch::Routing::RouteSet#draw via disable_clear_and_finalize because the default behaviour there is to clear routes when called.
In short, it's a voyage of discovery because there's no mechanism obvious to me.
@floppy any mileage in abusing one or more `constraints` blocks with custom FeatureConstraints#matches?
@rgarner hm, maybe…. This is all useful stuff thank you. Helpful to have ideas just bouncing around
@rgarner I’m trying to think how to make a system like https://plugins.octoprint.org/; could be that engines aren’t quite the right thing, but maybe there’s a way I can bend them to my will.
@floppy all an Engine really is is a Rack app (a Proc returning an array) that has a routing match associated with it at boot time via #mount (routes end up compiled so there's no real 'dynamic' there to speak of), so if your plugins map naturally to sprouting a bunch of new paths, so much the better – spike out something with constraints (no reboot required!)
If it's something different to that? Dunno. Couldn't divine the OctoPrint boundary from a cursory glance...
@floppy how about this? (naming/style are all over the place but you get the idea)
https://gist.github.com/rgarner/74f17bd661c9f82b024c65076e76abae
@floppy I suppose in your use case the only difference would be rather than mounting a fixed set, you'd need to iterate some form of manifest to mount
@rgarner very interesting, thank you! I’ve obviously nerd-sniped you very effectively with this question
@floppy don't define constants in blocks, obvs. I've just formatted this so you can paste it directly into your routes and test-drive. Also the naming is pish