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 +++++++++++++++++++++++++++++++++++++++++++------- lib/sisu/v3/options.rb | 4 +-- lib/sisu/v3/remote.rb | 4 +-- lib/sisu/v3/sysenv.rb | 34 +++++++++++--------- 4 files changed, 97 insertions(+), 29 deletions(-) (limited to 'lib') 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/ diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 66866dc3..eeca31ec 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -201,9 +201,9 @@ module SiSU_commandline if x =~/^--\S+/ m << x end - elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.txz|sisupod(\.txz)?)$/ + elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/ if x =~/^(?:https?|file):\/\/\S+/ \ - or x =~/\S+?\.ss[mt]\.txz|sisupod\.txz/ \ + or x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ \ && FileTest.file?(x) x=x.gsub(/^file:\/\//,'') f << x diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb index bda7529b..1e974f9c 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v3/remote.rb @@ -180,8 +180,8 @@ module SiSU_Remote @requested_file=requested_file end def pod - re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz)?|[^\/]+?\.ssp)$/ - re_p=/(sisupod(?:\.txz)?|\S+?\.ss[mt](?:\.txz)?|[^\/]+?\.ssp)$/ + re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod\.(?:txz|zip)|\S+?(?:\.ss[mt]\.(?:txz|zip))?|[^\/]+?\.ssp)$/ + re_p=/(sisupod\.(?:txz|zip)|\S+?\.ss[mt]\.(?:txz|zip)?|[^\/]+?\.ssp)$/ if @requested_file =~ re_p_div @site,@pth,@pod= re_p_div.match(@requested_file).captures elsif @requested_file =~ re_p diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index a24937d2..f052e2a5 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -217,9 +217,10 @@ module SiSU_Env m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m stub_pwd=@@pwd[m,1] @@rc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] - @@yamlrc_path=(stub_pwd !~/^sisupod$/) \ - ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) - : ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod + @@yamlrc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] + #@@yamlrc_path=(stub_pwd !~/^sisupod$/) \ + #? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) + #: ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod @@ad_path=(stub_pwd !~/^sisupod$/) \ ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]) : ["#{@@home}/.sisu",@@sisu_etc] @@ -2496,11 +2497,9 @@ WOK unless FileTest.directory?(sisupod_processing_path) mkdir_p(sisupod_processing_path) end - if FileTest.file?("#{Dir.pwd}/#{fns_pod}") - system("unzip -q #{Dir.pwd}/#{fns_pod} -d #{processing_path.processing}") - else - SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/ - end + (FileTest.file?(fns_pod)) \ + ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") + : (SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/) sisupod_processing_path end end @@ -2563,10 +2562,14 @@ WOK end class Info_settings < Info_env def permission?(prog) #program defaults - (defined? @rc['permission_set'][prog]) ? @rc['permission_set'][prog] : false + (defined? @rc['permission_set'][prog]) \ + ? @rc['permission_set'][prog] + : false end def program?(prog) #program defaults - (defined? @rc['program_set'][prog]) ? @rc['program_set'][prog] : false + (defined? @rc['program_set'][prog]) \ + ? @rc['program_set'][prog] + : false end end class File_map < Info_env @@ -4783,10 +4786,13 @@ WOK skin_path=[] @env.sys.rc_path.each {|x| skin_path << "#{x}/skin"} skin_path << "#{@env.processing_path.processing}/external_document/skin" - skin=true - if @pwd_stub =~/^sisupod$/ \ - and @md.opt.mod.inspect !~/--trust/ - skin=false #security only run skins on sisupod if --trust flag is provided + skin=if @pwd_stub =~/^(?:doc|sisupod)$/ \ + and ((! @md.nil?) \ + && (defined? @md.opt) \ + && (defined? @md.opt.mod) \ + && @md.opt.mod.inspect =~/--trust/) + true #security only run skins on sisupod if --trust flag is provided + else false end doc_skin,dir_skin=nil,nil if skin -- cgit v1.2.3