Created
August 14, 2009 14:36
-
-
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!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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