From 3535397c41976bb298825c2ed2d5ded81cc0c924 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 20 Dec 2007 00:21:53 +0000 Subject: sisupod, bugfixes for rsync placement and for download and processing --- lib/sisu/v0/remote.rb | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'lib/sisu/v0/remote.rb') diff --git a/lib/sisu/v0/remote.rb b/lib/sisu/v0/remote.rb index aa7799ad..4197d62d 100644 --- a/lib/sisu/v0/remote.rb +++ b/lib/sisu/v0/remote.rb @@ -165,9 +165,10 @@ module SiSU_Remote threads.each {|thr| thr.join} if threads #and threads.length > 0 end def sisupod - if @get_p.length > 0 #% remote sisupod + get_p=@get_s + if get_p.length > 0 #% remote sisupod require 'net/http' - for requested_pod in @get_p + for requested_pod in get_p pod_info=Remote_download.new(requested_pod) @opt.fns=pod_info.pod.name Net::HTTP.start(pod_info.pod.site) do |http| @@ -180,5 +181,36 @@ module SiSU_Remote end end end + class Remote_download + def initialize(requested_file) + @requested_file=requested_file + end + def pod + re_p_div=/http:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip)?|[^\/]+?\.ssp)$/ + re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt](?:\.zip)?|[^\/]+?\.ssp)$/ + if @requested_file =~ re_p_div + @site,@pth,@pod= re_p_div.match(@requested_file).captures + elsif @requested_file =~ re_p + @pod= re_p.match(@requested_file).captures + end + def site + @site + end + def path + @pth + end + def dir_stub + re_p_stub=/.+?([^\/]+)$/ + pod_stub= re_p_stub.match(path).captures.join if path + end + def name_source + @pod + end + def name + name_source + end + self + end + end end __END__ -- cgit v1.2.3