Created
February 6, 2010 18:28
-
-
Save HotFusionMan/296876 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
=begin | |
http://groups.google.com/group/capistrano/msg/9f17c9c7787ac390 | |
Message from discussion deploy:check and config.gem | |
From: Tom Copeland <[email protected]> | |
Date: Thu, 4 Feb 2010 06:57:50 -0500 | |
Local: Thurs, Feb 4 2010 3:57 am | |
Subject: Re: [capistrano] deploy:check and config.gem | |
On Feb 4, 2010, at 6:39 AM, Tom Copeland wrote: | |
> Hi all - | |
> I saw some discussion of this in the archives, but has anyone done integration between deploy:check and config.gem? I know there are tricky bits - e.g., config/environments/foo.rb could declare its own dependencies - but maybe just something for the simple case of all dependencies being declared in config/environment.rb? | |
Maybe (paste this in your in deploy.rb): | |
=end | |
class Collecter | |
attr_accessor :dependencies | |
def initialize | |
@dependencies = {} | |
File.read("config/environment.rb").split("\n").collect {|line| line.strip }.select {|line| line[0] != '#' }.select {|line| line.match(/^config.gem/) }.each do |line| | |
self.instance_eval(line) | |
end | |
end | |
def gem(name, args) | |
@dependencies[name] = args | |
args[:version] = ">=0.0.1" unless args.include?(:version) | |
end | |
def config | |
self | |
end | |
end | |
Collecter.new.dependencies.each do |name, args| | |
depend :remote, :gem, name, args[:version] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment