Using Gems Instead of Rails Plugins on Heroku

Heroku is great, you can have a rails app running live in a few minutes ! There are still a few tricky points you’ve got to sort out a little differently. One of them is using rails plugins or extensions. The usage way is to have a submodule in your git repository, but heroku does not support submodules … You are left with 2 choices :

  • Expand the submodule as classical files in your main git repository
  • Use the extension or plugin as a gem (if possible)

When I can, I’ll go the second route. Last time, I ran into a problem. I wanted to use radiant-tags-extension gem with my radiant app, but I could not launch the install rake task

1
rake radiant:extensions:tags:install

I eventually found out that rake tasks from gems are not automatically available from the mail rake command. I also found this and it did the trick.

in <railsapproot>/lib/tasks/gems.rake

1
Dir["#Gem.searcher.find('radiant-tags-extension').full_gem_path}/lib/tasks/*.rake"].each { |ext| load ext }

Comments