gems:unpack for gems that don’t unpack

I couldn't figure out why my gems wouldn't unpack until I ran across this: My gems have rake tasks and I have to include them in the app's rakefile to make them available so Rails won't unpack them.

I did this instead:

  def muck_gems
    ['cms-lite', 'disguise', 'uploader', 'muck-solr', 'muck-raker', 'muck-engine',
    'muck-users', 'muck-activities', 'muck-comments', 'muck-profiles', 'muck-friends',
    'muck-contents', 'muck-blogs', 'muck-shares'] #'muck-invites'

execute commands in a different directory

def inside(dir, &block) { block.arity == 1 ? yield(dir) : yield } end

desc "unpacks all muck gems into vendor/gems using versions installed on the local machine." task :unpack do gem_path = File.join(File.dirname(FILE), '..', '..', 'vendor', 'gems') FileUtils.mkdir_p(gem_path) unless File.exists?(gem_path) inside gem_path do muck_gems.each do |gem_name| system("gem unpack #{gem_name}") system("gem specification #{gem_name} > .specification") end end end