Plugger: Plugging Plugins Plucked From Rails 4

Written By : Kevin Lawver

We’ve known plugins were being removed in Rails 4, and I’ve disagreed with the decision since I first saw the deprecation warning filling my console. To me, plugins live in a place between a single file library in /lib and gems. I can see why the Rails folks want to get rid of them, because having yet another thing to load at startup is a pain. But, for us and for a lot of our customers, they aren’t broken, so why fix them? And for us especially, it would be a pain to turn a couple dozen Moonshine plugins into gems when there are serious issues doing what Moonshine needs to do as a gem that aren’t a problem when it’s a plugin (was that vague enough?).

Ruby to the rescue! Introducing Plugger, the little gem that could. It does one thing and does it well enough that I shipped it. What does it do? It restores plugins in Rails 4! Yes, I know!

Since rails’ plugin action is still there, though severely broken, I created a new executable for plugger called… “plugger”. It’s basically Rails 3’s plugin action with some very minor changes.

All you need to do is add it to your Gemfile, bundle install, and your plugins should load under Rails 4. Now, it’s not going to magically make them compatible with Rails 4, but it will at least try to load your init.rb, generators and rake tasks.

It hasn’t been extensively tested other than with various Moonshine plugins, but it seems to work just fine. As always, issues and pull requests are welcome!