On 18/09/06, Charles Brian Quinn <[EMAIL PROTECTED]> wrote:
Or alternatively via Capistrano. (This is a def that is part of a Gem plugin).
# Auto selects a gem from a list and installs it.
#
# *gem* has no mechanism on the command line of disambiguating builds for
# different platforms, and instead asks the user. This method has the necessary
# conversation to select the +version+ relevant to +platform+ (or the one nearest
# the top of the list if you don't specify +version+).
def select(package, version=nil, platform='ruby')
selections={}
cmd="#{GEM_INSTALL} #{if version then '-v '+version.to_s end} #{package}"
sudo cmd do |channel, stream, data|
data.each_line do | line |
case line
when /\s(\d+).*\(#{platform}\)/
if selections[channel[:host]].nil?
selections[channel[:host]]=$1.dup+"\n"
logger.info "Selecting #$&", "#{stream} :: #{channel[:host]}"
end
when /\s\d+\./
# Discard other selections from data stream
when /^>/
channel.send_data selections[channel[:host]]
logger.debug line, "#{stream} :: #{channel[:host]}"
else
logger.info line, "#{stream} :: #{channel[:host]}"
end
end
end
end
on separate versioning:
The flip-side to separate versioning is that you can write a script to
automagically install everything for a new rails setup and not be
prompted for the version of mongrel in the middle of your massive,
long-running install script.... I believe.
Or alternatively via Capistrano. (This is a def that is part of a Gem plugin).
# Auto selects a gem from a list and installs it.
#
# *gem* has no mechanism on the command line of disambiguating builds for
# different platforms, and instead asks the user. This method has the necessary
# conversation to select the +version+ relevant to +platform+ (or the one nearest
# the top of the list if you don't specify +version+).
def select(package, version=nil, platform='ruby')
selections={}
cmd="#{GEM_INSTALL} #{if version then '-v '+version.to_s end} #{package}"
sudo cmd do |channel, stream, data|
data.each_line do | line |
case line
when /\s(\d+).*\(#{platform}\)/
if selections[channel[:host]].nil?
selections[channel[:host]]=$1.dup+"\n"
logger.info "Selecting #$&", "#{stream} :: #{channel[:host]}"
end
when /\s\d+\./
# Discard other selections from data stream
when /^>/
channel.send_data selections[channel[:host]]
logger.debug line, "#{stream} :: #{channel[:host]}"
else
logger.info line, "#{stream} :: #{channel[:host]}"
end
end
end
end
--
Neil Wilson ([EMAIL PROTECTED])
_______________________________________________ Mongrel-users mailing list Mongrel-users@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-users