From 705ccf77b4b61dca16137ada741d1765a52ca573 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:16:23 -0400 Subject: v3: hub (affecting options +others) sisupod processing (v2 enabled) --- lib/sisu/v3/hub.rb | 84 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 11 deletions(-) (limited to 'lib/sisu/v3/hub.rb') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 5319bfdc..088fb309 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -68,7 +68,7 @@ module SiSU @opt,@req,@message=opt,req,message @n_do=0 end - def pod_output(fns_pod) + def pod3_output(fns_pod) dir_pwd=@@env.path.pwd dir_pod=@@env.sisupod_gen_v3(fns_pod) Dir.chdir("#{dir_pod}/doc") @@ -95,6 +95,33 @@ module SiSU @pwd=`pwd`.strip Dir.chdir(@pwd) end + def pod2_output(fns_pod) + dir_pwd=@@env.path.pwd + dir_pod=@@env.sisupod_gen_v2(fns_pod) + Dir.chdir(dir_pod) + system("ls") + files=Dir['*.ss[tm]'] + files_ssm=Dir['*.ssm'] + files_sst=Dir['*.sst'] + content=if files_ssm.length > 0 + files_ssm.join(' ') + elsif files_sst.length > 0 + files_sst.join(' ') + else + p 'no files found' + end + @opt.fns=content + if FileTest.directory?(dir_pod) + Dir.chdir(dir_pod) + system(" + sisu3 -CC #{@opt.cmd} #{@opt.mod.join(' ')} #{content} + #sisu3 -CC #{@opt.cmd} -G #{@opt.mod.join(' ')} #{content} + ") + Dir.chdir(dir_pwd) + end + @pwd=`pwd`.strip + Dir.chdir(@pwd) + end def select require_relative @req if @req =~/^conf$/ # -C @@ -113,7 +140,19 @@ module SiSU end SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/ @opt.files.shift - pod_output(pod_name) + pod3_output(pod_name) + break + elsif fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/ + require_relative 'remote' # remote.rb #check + pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.zip|\.ssp)$/ + SiSU_Remote::Remote_download.new(fns).pod.name + else + re_p=/(\S+?\.ss[mt](?:\.zip)?)$/ + re_p.match(fns).captures.join + end + SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/ + @opt.files.shift + pod2_output(pod_name) break else put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm') @@ -333,8 +372,18 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ path[:xsd]=path[:xml] + '/xsd' path[:xsd]=path[:xml] + '/rnc' path[:xsd]=path[:xml] + '/rng' - re_p=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/ - unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line + re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/ + unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line + unless ( FileTest.directory?(path[:css]) \ + 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 + end + end + re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/ + unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line unless ( FileTest.directory?(path[:css]) \ and FileTest.directory?(path[:xsd]) ) @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX @@ -379,17 +428,30 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ path_skin='./_sisu/processing/external_document/skin/doc' @get_s,@get_p,@get_pl=[],[],[] re_s=/((?:https?|file):\/\/\S+?\.sst)$/ - re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ - re_pl=/^(\/\S+?\.ss[mt]\.txz)/ + re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ + re_pl3=/^(\/\S+?\.ss[mt]\.txz)/ + @opt.files.each do |fns| + if fns =~re_s + @get_s << re_s.match(fns)[1] if re_s + end + if fns =~re_p3 + @get_p << re_p3.match(fns)[1] if re_p3 + end + if fns =~re_pl3 + @get_pl << re_pl3.match(fns)[1] if re_p3 + end + end + re_p2=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/ + re_pl2=/^(\/\S+?\.ss[mt]\.zip)/ @opt.files.each do |fns| if fns =~re_s @get_s << re_s.match(fns)[1] if re_s end - if fns =~re_p - @get_p << re_p.match(fns)[1] if re_p + if fns =~re_p2 + @get_p << re_p2.match(fns)[1] if re_p2 end - if fns =~re_pl - @get_pl << re_pl.match(fns)[1] if re_p + if fns =~re_pl2 + @get_pl << re_pl2.match(fns)[1] if re_p2 end end if @get_s.length > 0 #% remote markup file .sst @@ -555,7 +617,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)|\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\S+?\.ssp)$/ + unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)?|\S+?\.ssp)$/ if @opt.cmd.inspect=~/-P/ elsif @opt.fns=~/\.kdi$/ \ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/ -- cgit v1.2.3