diff options
| author | Ralph Amissah <ralph@amissah.com> | 2007-12-20 00:21:53 +0000 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2007-12-20 00:21:53 +0000 | 
| commit | 3535397c41976bb298825c2ed2d5ded81cc0c924 (patch) | |
| tree | 9963c94af18fe96fdb32af442bbbdb96814d3033 /lib | |
| parent | rsync sisupod, bugfix (diff) | |
sisupod, bugfixes for rsync placement and for download and processing
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sisu/v0/hub.rb | 49 | ||||
| -rw-r--r-- | lib/sisu/v0/options.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/v0/remote.rb | 36 | ||||
| -rw-r--r-- | lib/sisu/v0/sysenv.rb | 15 | 
4 files changed, 52 insertions, 50 deletions
| diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index 418f096f..475d626a 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -62,40 +62,6 @@ module SiSU    require "#{SiSU_lib}/sysenv"    include SiSU_Screen    @@pwd=Dir.pwd -  class Remote_download -    def initialize(requested_file) -      @requested_file=requested_file -    end -    def pod -      re_p_div=/http:\/\/([^\/]+)(\/\S+?)\/(sisupod(?:\.zip)?|[^\/]+?\.ssp)$/ -      re_p=/(sisupod(?:\.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 -        pod_download_as=if name_source=~/(?:sisupod\.(?:zip|ssp))/ -          dir_stub + '.ssp' -        else name_source -        end -      end -      self -    end -  end    class Op      @@env=SiSU_Env::Info_env.new      def initialize(opt,req,message) @@ -126,8 +92,9 @@ module SiSU        if not @opt.files.empty?          @opt.files.each do |fns|            env=SiSU_Env::Info_env.new(fns) -          if fns =~ /(?:sisupod(?:\.zip)?|\.ssp)$/ -            pod_name=Remote_download.new(fns).pod.name +          if fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/ +            require "#{SiSU_lib}/remote" #check +            pod_name=SiSU_Remote::Remote_download.new(fns).pod.name              tell=SiSU_Screen::Ansi.new(@opt.cmd,pod_name)              tell.puts_blue unless @opt.cmd =~/q/              @opt.files.shift @@ -360,7 +327,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/            path[:xsd]=path[:xml] + '/rnc'            path[:xsd]=path[:xml] + '/rng'            #path_dtd="#{@@env.path.output}/_sisu/xml/dtd" -          re_p=/(sisupod(?:\.zip)?|[^\/]+?\.ssp)$/ +          re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip|[^\/]+?\.ssp)$/            unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line              unless ( FileTest.directory?(path[:css]) \              and FileTest.directory?(path[:xsd]) ) @@ -409,8 +376,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              path_image='./_sisu/processing/external_document/image'              path_skin='./_sisu/processing/external_document/skin/doc'              @get_s,@get_p=[],[] -            re_s=/((?:https?|file):\/\/\S+?\.sst)/ -            re_p=/((?:https?|file):\/\/\S+?(?:\/sisupod(?:\.zip)?|\.ssp))/ +            re_s=/((?:https?|file):\/\/\S+?\.sst)$/ +            re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/              @opt.files.each do |fns|                if fns =~re_s                  @get_s << re_s.match(fns)[1] if re_s @@ -434,7 +401,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              retry unless @retry_count > 1            ensure            end -          @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst/,'\1.-sst') } +          @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }          end          if @opt.cmd=~/m/               #% -m dal            op('dal','dal') @@ -557,7 +524,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/        @opt.files.each do |fns|          if FileTest.file?(fns)            @opt.fns=fns -          unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|sisupod(?:\.zip)?)$/ +          unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\S+?\.ssp)$/              if @opt.fns=~/\.kdi$/ \              and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/              elsif @opt.fns=~/\.sx[sdn]\.xml$/ \ diff --git a/lib/sisu/v0/options.rb b/lib/sisu/v0/options.rb index d2fa3c73..2332cebb 100644 --- a/lib/sisu/v0/options.rb +++ b/lib/sisu/v0/options.rb @@ -106,7 +106,7 @@ module SiSU_commandline            end            if x =~/^--\S+/;        m << x            end -        elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|sisupod(?:\.zip)?)$/ +        elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.zip|sisupod(\.zip)?)$/            if x =~/^(?:https?|file):\/\/\S+/;  f << x            elsif FileTest.file?(x); f << x            else  puts "file not found: #{x}" 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__ diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index a78bec85..fa6be6cb 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -375,15 +375,19 @@ module SiSU_Env            @@fnb ||=@fns[m,2]            @@fnt ||=@fns[m,3]            @@flv ||=document_language_versions_found[:f] -          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' -          else @@fnb + '.sst.zip' +          unless @@fns =~/\S+?\.zip/ +            @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' +            else @@fnb + '.sst.zip' +            end            end          else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/            @@fnb ||=@fns[m,1]            @@fnm ||=@fns[m,1]            @@fnt ||=@fns[m,2] -          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' -          else @@fnb + '.sst.zip' +          unless @@fns =~/\S+?\.zip/ +            @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' +            else @@fnb + '.sst.zip' +            end            end          end        end @@ -786,7 +790,7 @@ module SiSU_Env      @@image_flag,@@local_image=true,true   #warning on @@image_flag      @@fb=@@man_path=nil,nil      def initialize(fns='',md=nil) -      super() #you may not want to re-execute this tatic info so frequently! +      super() #you may not want to re-execute this static info so frequently!        @fns,@md=fns,md        @env=Env_call.new(fns) if fns        fnb=if @md \ @@ -2179,7 +2183,6 @@ WOK        @env=SiSU_Env::Info_env.new      end      def zap -p @zap        if @zap !~/\/\//; rm_rf(@zap) if FileTest.directory?(@zap)        else puts 'suspect zap request, ignored'        end | 
