Recent Blog Posts

  • Inbox Zero is Hard for Me
    By Johanna Rothman - Tuesday Jan, 6
    This year, after I archived my last year’s inbox, I decided my email problem was getting worse, not better. “I’m Johanna Rothman, and I have a problem collecting email in my inbox.&#... more »
  • Career Survey
    By Jared Richardson - Sunday Jan, 4
    The upcoming Career 2.0 book is in high gear, but we'd like to include more than our experiences. Over on the Career 2.0 blog we've posted a few questions about your career. Best moves, worst experien... more »
  • Tactics vs. Strategy (SOA & The Tarpit of Irrelevancy)
    By Neal Ford - Friday Jan, 2
    This is the first in a series of blog posts where I discuss what I see wrong with SOA (Service Oriented Architecture) in the way that it's being sold by vendors. The first installment is about how the... more »
  • Collaborating with Other Writers
    By Johanna Rothman - Friday Jan, 2
    Merlin, via 43 Folders Clips has a video of Eric Idle, on John Cleese’s Approach to Writing. Aside from John Cleese’s specificity, Idle talks about how he had trouble finding collaborators until... more »
  • Happy New Year
    By Johanna Rothman - Thursday Jan, 1
    Everyone, I thank you for reading and commenting. I hope you have a healthy and happy 2009. ... more »

Smart asset management for Rails plugins

Posted by: Matthew Bass on 11/17/2008

Many Rails plugins require that certain files like images, CSS, and JavaScript get copied to the public folder during installation. The typical way to do this is add code to install.rb, which then gets executed when you first install the plugin in your Rails project. What happens when the assets in a plugin you’re using change, though? You end up having to manually copy files around anytime the plugin gets updated, which is an extremely error-prone process.

I extracted asset_copier from an existing Terralien project. It fixes this problem beautifully. Once installed, it keeps the assets in your Rails project synchronized with your plugin. It even deletes assets from the Rails project that have been removed in the plugin.

To learn more, check out this post. If instant gratification is more your thing, install the gem directly and apply it to your target plugin:

sudo gem install pelargir-asset_copier --source=http://gems.github.com
cd ~/some_rails_project
script/generate asset_copier some_plugin

be the first to rate this blog


About Matthew Bass

Matthew Bass is an independent software developer, entrepreneur, speaker, and writer. He has over ten years of experience across a diverse set of technologies and has worked at places like SAS Institute, the world's largest privately held software company. An agilist from the very beginning, he continues evangelizing and experimenting with pair programming, test-first and behavior-driven development, and continuous integration. Matthew has spoken at several regional and national software conferences and regularly writes for publications like InfoQ.