Snippet: List the Gems Your App Needs

» 06 Aug 2009

When you aren’t careful, it is easy to slip gems into your app without properly accounting for them. Often times it is simpler to just hope on system gems than mess with config.gem. This makes deployment more difficult and can make bringing a new development environment online take significant time and energy.

To fix this later, you need some idea of the gems on which your app depends. Put this snippet into the Rakefile below the boot line and run rake test | grep GEM

module Gem
      class << self
        alias orig_activate activate
        def activate(*args)
          puts "GEM: #{args.first}"
          orig_activate(*args)
        end
      end
    end