Skip to content

Instantly share code, notes, and snippets.

@mperham
Created August 14, 2009 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mperham/167863 to your computer and use it in GitHub Desktop.
Save mperham/167863 to your computer and use it in GitHub Desktop.
Rails gems:install task that does not depend on database gems being installed already!
task :gems_install do
GEMS = []
module Rails
class Config
def gem(name, options = {})
GEMS << Rails::GemDependency.new(name, options)
end
def method_missing(*args)
# ignore
end
end
class Initializer
def self.run
yield Config.new
end
end
class GemDependency
def installed?
# the stock installed? method does not work for me, it ignores many installed gems
# since it only checks loaded gems, not all gems.
self.specification
end
end
end
require File.dirname(__FILE__) + '/config/environment'
GEMS.each(&:install)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment