diff options
Diffstat (limited to 'lib/sisu/v3/hub.rb')
-rw-r--r-- | lib/sisu/v3/hub.rb | 176 |
1 files changed, 119 insertions, 57 deletions
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 029c2861..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 @@ -104,7 +131,6 @@ module SiSU @opt.files.each_with_index do |fns,i| env=SiSU_Env::Info_env.new(fns) if fns =~ /sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz|\.ssp)$/ -# env=SiSU_Env::Info_env.new(fns) require_relative 'remote' # remote.rb #check pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.txz|\.ssp)$/ SiSU_Remote::Remote_download.new(fns).pod.name @@ -114,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') @@ -305,36 +343,47 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.cmd =~/E/ # re-assign character require 'profile' end - if @opt.act[:harvest] - require_relative 'harvest' # harvest.rb - SiSU_Harvest::Source.new(@opt).read # -h -H html.rb + if @opt.act[:harvest][:bool] + require_relative 'harvest' # harvest.rb + SiSU_Harvest::Source.new(@opt).read # -h -H html.rb elsif @opt.mod.inspect =~/--convert|--to|--from/ - require_relative 'sst_convert_markup' # sst_convert_markup.rb + require_relative 'sst_convert_markup' # sst_convert_markup.rb elsif @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX flag=SiSU_Env::Info_processing_flag.new - 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.act[:license] #% license information + if @opt.act[:license][:bool] #% license information SiSU_Help::Help.new('license',@opt).help_request end - if @opt.act[:dal] or @opt.act[:maintenance] #% --maintenance, -m for -C + if @opt.act[:dal][:bool] \ + or @opt.act[:maintenance][:bool] #% --maintenance, -m for -C path={} path[:css]=@@env.path.output + '/_sisu/css' path[:xml]=@@env.path.output + '/_sisu/xml' 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 @@ -344,7 +393,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end end end - if @opt.act[:site_init] #% --init-site, -C initialize/configure + if @opt.act[:site_init][:bool] #% --init-site, -C initialize/configure op('conf','configure site') if @opt.cmd =~/R/ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ @@ -360,36 +409,49 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end end end - if @opt.act[:sample_search_form] #% --sample-search-form, -F cgi sample search form + if @opt.act[:sample_search_form][:bool] #% --sample-search-form, -F cgi sample search form Operations.new(@opt).cgi end - if @opt.act[:webrick] #% --webrick, -W webrick + if @opt.act[:webrick][:bool] #% --webrick, -W webrick Operations.new(@opt).webrick end - if @opt.cmd =~/Z/ #% -Z wipe previous output clean + if @opt.cmd =~/Z/ #% -Z wipe previous output clean op('zap','Zap, deletions') end - if @opt.act[:share_source] + if @opt.act[:share_source][:bool] op('share_src','SiSU markup source') end - if @opt.act[:dal] + if @opt.act[:dal][:bool] @retry_count= -1 begin path_image='./_sisu/processing/external_document/image' 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 @@ -397,8 +459,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ SiSU_Remote::Get.new(@opt,@get_s).fns Operations.new.counter end - if @get_p.length > 0 #% remote sisupod - require_relative 'remote' # remote.rb + if @get_p.length > 0 #% remote sisupod + require_relative 'remote' # remote.rb SiSU_Remote::Get.new(@opt,@get_p).sisupod end rescue @@ -409,60 +471,60 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') } end - if @opt.act[:dal] #%--dal, -m + if @opt.act[:dal][:bool] #%--dal, -m op('dal','dal') end @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') } - if @opt.act[:sisupod] #% --sisupod, -S make sisupod + if @opt.act[:sisupod][:bool] #% --sisupod, -S make sisupod op('sisupod_make','sisupod (txz)') 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.act[:qrcode] #% --qrcode, -Q + if @opt.act[:qrcode][:bool] #% --qrcode, -Q op('qrcode','QRcode') end - if @opt.act[:hash_digests] #% --hash-digests, -N digest tree + if @opt.act[:hash_digests][:bool] #% --hash-digests, -N digest tree op('digests','digests') end - if @opt.act[:html] #% --html, -h + if @opt.act[:html][:bool] #% --html, -h op('html','html') end - if @opt.act[:txt] #% --txt, -t -a + if @opt.act[:txt][:bool] #% --txt, -t -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file op('plaintext','plaintext') end - if @opt.act[:epub] #% --epub, -e + if @opt.act[:epub][:bool] #% --epub, -e op('epub','ePub') end - if @opt.act[:odt] #% --odt, -o opendocument + if @opt.act[:odt][:bool] #% --odt, -o opendocument op('odf','OpenDocument') end - if @opt.act[:xml_sax] #% --xml-sax, -x xml sax type + if @opt.act[:xml_sax][:bool] #% --xml-sax, -x xml sax type op('xml','xml sax') end - if @opt.act[:xml_dom] #% --xml-dom, -x xml dom type + if @opt.act[:xml_dom][:bool] #% --xml-dom, -x xml dom type op('xml_dom','xml dom') end - #if @opt.act[:fictionbook] #% --fictionbook, -f fictionbook xml + #if @opt.act[:fictionbook] #% --fictionbook, -f fictionbook xml # op('xml_fictionbook','xml fictionbook') #end - if @opt.act[:xhtml] #% --xhtml, -b xhtml + if @opt.act[:xhtml][:bool] #% --xhtml, -b xhtml op('xhtml','xhtml sax') end - if @opt.act[:concordance] #% --concordance, -w + if @opt.act[:concordance][:bool] #% --concordance, -w op('concordance','Concordance') end - if @opt.cmd =~/O/ #% -O open archive initiative, metadata harvesting + if @opt.cmd =~/O/ #% -O open archive initiative, metadata harvesting op('xml_md_oai_pmh_dc','OAI PMH') end - if @opt.act[:po4a] #% --po4a, -P + if @opt.act[:po4a][:bool] #% --po4a, -P op('po4a','po4a') end - if @opt.act[:git] #% --git, -g sisu git + if @opt.act[:git][:bool] #% --git, -g sisu git op('git','SiSU Git') end - if @opt.cmd =~/T/ #% -T termsheet/standard form + if @opt.cmd =~/T/ #% -T termsheet/standard form SiSU_Help::Help.new('termsheet').help_request @opt.files.each do |fns| if FileTest.file?(fns) @@ -476,38 +538,38 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end Operations.new.counter end - if @opt.cmd =~/k/ #% -T temporary tests + if @opt.cmd =~/k/ #% -T temporary tests op('xml_scaffold','XML scaffold') end - if @opt.act[:pdf] #% --pdf, -p latex/ texpdf + if @opt.act[:pdf][:bool] #% --pdf, -p latex/ texpdf op('texpdf','LaTeX pdf') end - if @opt.act[:manpage] #% --manpage, -i + if @opt.act[:manpage][:bool] #% --manpage, -i op('manpage','manpage') end - if @opt.act[:texinfo] #% --texinfo, -I + if @opt.act[:texinfo][:bool] #% --texinfo, -I op('texinfo','TeX Info') end - if @opt.act[:psql] #% --pg, -D DB postgresql + if @opt.act[:psql][:bool] #% --pg, -D DB postgresql op('dbi','postgresql') end - if @opt.act[:sqlite] #% --sqlite, -d DB sqlite + if @opt.act[:sqlite][:bool] #% --sqlite, -d DB sqlite op('dbi','sqlite') end - if @opt.act[:dal] #% --dal, -m embedded content + if @opt.act[:dal][:bool] #% --dal, -m embedded content op('embedded','Embedded Content') end - if @opt.act[:manifest] #% --manifest, -y + if @opt.act[:manifest][:bool] #% --manifest, -y op('manifest','Manifest') end - if @opt.act[:sitemap] #% --sitemap, -Y + if @opt.act[:sitemap][:bool] #% --sitemap, -Y op('sitemaps','Sitemap') end if @opt.mod.inspect !~/--harvest/ - if @opt.act[:scp] #% -r copy to remote server + if @opt.act[:scp][:bool] #% -r copy to remote server op('remote','scp') end - if @opt.act[:rsync] #% -R copy to remote server + if @opt.act[:rsync][:bool] #% -R copy to remote server op('remote','rsync') end else @@ -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/ |