From cfe3d294a03935ae807c6c3b313b4e7dc4a241f4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 1 Nov 2007 02:15:50 +0000 Subject: generate from remote markup source, image path fix and some cosmetic re-arrangement --- lib/sisu/v0/hub.rb | 68 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 27 deletions(-) (limited to 'lib/sisu/v0/hub.rb') diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index 029c99c5..2053ea8b 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -85,8 +85,9 @@ module SiSU @pod end def name - pod_download_as=if name_source=~/(?:sisupod\.(?:zip|ssp))/; dir_stub + '.ssp' - else name_source + pod_download_as=if name_source=~/(?:sisupod\.(?:zip|ssp))/ + dir_stub + '.ssp' + else name_source end end self @@ -116,7 +117,8 @@ module SiSU end def select require "#{SiSU_lib}/#@req" - if @req =~/^conf$/; SiSU_Initialize::Source.new(@opt).read # -C + if @req =~/^conf$/ # -C + SiSU_Initialize::Source.new(@opt).read end if not @opt.files.empty? @opt.files.each do |fns| @@ -135,7 +137,8 @@ module SiSU if @req=~/^dal$/ \ and FileTest.file?(@opt.fns) \ and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/ - if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing + if fns =~ /\.ssm$/ + require "#{SiSU_lib}/composite" #pre-processing SiSU_Assemble::Composite.new(@opt).read @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst') end @@ -145,7 +148,8 @@ module SiSU when /\.(?:(?:-|ssm\.)?sst|ssm)$/ case @req when /^dal$/ - if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing + if fns =~ /\.ssm$/ + require "#{SiSU_lib}/composite" #pre-processing SiSU_Assemble::Composite.new(@opt).read @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst') end @@ -254,8 +258,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end def webrick # -W port=prt=@fns - prt=if prt !~/\d+/; 'webrick default (sysenv)' - else "webrick port set to #{prt}" + prt=if prt !~/\d+/ + 'webrick default (sysenv)' + else "webrick port set to #{prt}" end puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} } system("sisu_webrick #{port}&\n") @@ -298,7 +303,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ Op.new(@opt,req,msg).select if req and msg end def actions - if @opt.mod.inspect =~/--convert|--to|--from/; require "#{SiSU_lib}/sst_convert_markup" + if @opt.mod.inspect =~/--convert|--to|--from/ + require "#{SiSU_lib}/sst_convert_markup" end if @opt.cmd =~/([abCcDdFfgGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ @@ -310,7 +316,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ extra='' if @opt.cmd !~/[mn]/ extra+=if @opt.cmd =~/[abghHhIiJjNOoptTwXxz]/ \ - and @opt.cmd !~/[mn]/; 'm' #% add dal + and @opt.cmd !~/[mn]/ + 'm' #% add dal elsif ((@opt.cmd =~/[Dd]/ \ or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ and @opt.mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \ @@ -332,16 +339,17 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end end @opt.cmd=@opt.cmd + extra - if @opt.cmd =~/[vVM]/ #% version information + if @opt.cmd =~/[vVM]/ #% version information if @opt.cmd =~/V/ \ - and @opt.files.empty? #% environment + and @opt.files.empty? #% environment SiSU_Help::Help.new('env',@opt).environment else SiSU_Help::Help.new('env',@opt).sisu_version end end - if @opt.cmd =~/^-L$/; SiSU_Help::Help.new('license',@opt).help_request #% version information + if @opt.cmd =~/^-L$/ #% version information + SiSU_Help::Help.new('license',@opt).help_request end - if @opt.cmd =~/m/i #% -m for -C + if @opt.cmd =~/m/i #% -m for -C path={} path[:css]=@@env.path.output + '/_sisu/css' path[:xml]=@@env.path.output + '/_sisu/xml' @@ -355,12 +363,13 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ and FileTest.directory?(path[:xsd]) ) @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX end - if @opt.cmd =~/M/; $VERBOSE=false #debug $VERBOSE=true + if @opt.cmd =~/M/ + $VERBOSE=false #debug $VERBOSE=true # -M test other expected directories including images end end end - if @opt.cmd =~/C/ #% -C initialize/configure + if @opt.cmd =~/C/ #% -C initialize/configure op('conf','configure site') if @opt.cmd =~/R/ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ @@ -376,19 +385,22 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end end end - if @opt.cmd =~/F/ #% -F cgi sample search form + if @opt.cmd =~/F/ #% -F cgi sample search form Operations.new(@opt).cgi end - if @opt.cmd =~/W/; Operations.new(@opt).webrick #% -W webrick #@argv==port + if @opt.cmd =~/W/ #% -W webrick #@argv==port + Operations.new(@opt).webrick end - if @opt.cmd =~/k/ #% -k dummy, build character encoding table + if @opt.cmd =~/k/ #% -k dummy, build character encoding table #Operations.new(@opt.cmd).encoding end - if @opt.cmd =~/Z/; op('zap','Zap, deletions') #% -Z wipe previous output clean + if @opt.cmd =~/Z/ #% -Z wipe previous output clean + op('zap','Zap, deletions') end - if @opt.cmd =~/s/; op('share_src','SiSU markup source') #% -s sisu source + if @opt.cmd =~/s/ #% -s sisu source + op('share_src','SiSU markup source') end - if @opt.cmd =~/m/ #% -m is remote url requested? (download if) + if @opt.cmd =~/m/ #% -m is remote url requested? (download if) @retry_count= -1 begin path_image='./_sisu/processing/external_document/image' @@ -404,29 +416,31 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ @get_p << re_p.match(fns)[1] if re_p end end - if @get_s.length > 0 #% remote markup file .sst + if @get_s.length > 0 #% remote markup file .sst require "#{SiSU_lib}/remote" SiSU_Remote::Get.new(@opt,@get_s).fns Operations.new.counter end - if @get_p.length > 0 #% remote sisupod + if @get_p.length > 0 #% remote sisupod require "#{SiSU_lib}/remote" SiSU_Remote::Get.new(@opt,@get_p).sisupod end - rescue; SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok + rescue + SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok @retry_count +=1 retry unless @retry_count > 1 ensure end @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst/,'\1.-sst') } end - if @opt.cmd=~/m/; op('dal','dal') #% -m dal + if @opt.cmd=~/m/ #% -m dal + op('dal','dal') end @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') } if @opt.cmd =~/S/ - op('sisupod_make','sisupod (zip)') #% -S make sisupod + op('sisupod_make','sisupod (zip)') #% -S make sisupod if @opt.fns=~/\.kdi._sst/ - op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source + op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source end end if @opt.cmd =~/N/; op('digests','digests') #% -N digest tree -- cgit v1.2.3