From 64c73059f10392d585de786917634af98742e1f8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 12 May 2012 00:53:26 -0400 Subject: v3: hub, fixes, still a construction zone --- lib/sisu/v3/hub.rb | 432 ++++++++++++++++++++--------------------------------- 1 file changed, 161 insertions(+), 271 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 1e86db71..d1cb48f1 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -101,16 +101,17 @@ module SiSU end end if files_translated_idx.flatten.length > 1 - SiSU_Screen::Ansi.new(@opt.cmd,'Manifest re-run on (currently generated) tranlated files',"").grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'Manifest re-run on (currently generated) tranlated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on files_translated_idx.flatten.each do |i| @opt.fns=@opt.files[i] @opt.f_pth=@opt.f_pths[i] - if @opt.fns !~/\.-sst$/ - @opt.pth=@opt.paths[i] - @opt.lng=@opt.lngs[i] - else + if @opt.fns =~/\.-sst$/ @opt.pth=Dir.pwd @opt.lng='en' + elsif @opt.fno =~/\.txz$/ + else + @opt.pth=@opt.paths[i] + @opt.lng=@opt.lngs[i] end @@pwd=@opt.pth Dir.chdir(@opt.pth) #watch @@ -120,148 +121,6 @@ module SiSU end end end - class Op - @@env=SiSU_Env::InfoEnv.new - def initialize(opt,req,message) - @opt,@req,@message=opt,req,message - @n_do=0 - end - def pod3_output(fns_pod) - dir_pwd=@@env.path.pwd - dir_pod=@@env.sisupod_gen_v3(fns_pod) - Dir.chdir("#{dir_pod}/doc") - #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 #check - if FileTest.directory?("#{dir_pod}/doc") - Dir.chdir("#{dir_pod}/doc") - 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 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 not @opt.files.empty? - @opt.files.each_with_index do |fns,i| - env=SiSU_Env::InfoEnv.new(fns) - if fns =~ /sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz|\.ssp)$/ - require_relative 'remote' # remote.rb #check - pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.txz|\.ssp)$/ - SiSU_Remote::RemoteDownload.new(fns).pod.name - else - re_p=/(\S+?\.ss[mt](?:\.txz)?)$/ - re_p.match(fns).captures.join - end - SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/ - @opt.files.shift - 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::RemoteDownload.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') - if fns !~/\.-sst$/ - @opt.fns=fns - @opt.pth=@opt.paths[i] - @opt.f_pth=@opt.f_pths[i] - @opt.lng=@opt.lngs[i] - @@pwd=@opt.pth - else - @opt.fns=fns - @opt.pth=Dir.pwd - @opt.f_pth=@opt.f_pths[i] #@opt.f_pth= { pth: Dir.pwd } - @opt.lng='en' - #@opt.lng=@opt.lngs[i] - @@pwd=@opt.pth - end - Dir.chdir(@opt.pth) #watch - env=SiSU_Env::InfoEnv.new(fns) - if @req !~/(?:urls|remote)$/ - if @opt.cmd.inspect =~/-P/ \ - and @req =~ /^po4a$/ - require_relative 'composite' # composite.rb #pre-processing - SiSU_Po4a::Source.new(@opt).read # -P po4a.rb - else - if @req !~/^conf$/ \ - and @opt.fns !~/http:\/\// - SiSU::Operations.new(@opt).not_found - end - end - elsif FileTest.file?(put) - if @opt.mod.inspect !~/harvest/ #decide whether should permit harvest in single operation - case @req - when /^urls$/; SiSU_Urls::Source.new(@opt).read # -u -v -V -M - when /^remote$/ - case @message - when /scp/; SiSU_Remote::Put.new(@opt).scp # -r - when /rsync/; SiSU_Remote::Put.new(@opt).rsync # -R - else #SiSU_Remote::Put.new(put,@opt.cmd).scp - end - end - @n_do=@n_do+1 - SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/ - end - else SiSU::Operations.new(@opt).not_found - end - end - end - #elsif @req =~/^dbi$/; SiSU_DBI::SQL.new(@opt).connect # -D -d - #elsif @req=~/^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S - end - SiSU::Operations.new.counter - end - end class Operations @@n_do=0 def initialize(opt='') @@ -272,22 +131,22 @@ module SiSU @@n_do=0 end def remote_put_base_site_rsync # -CR -p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base end def remote_put_base_site_rsync_match # -CCRZ -p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base_sync end def remote_put_base_site # -Cr -p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base end def remote_put_base_site_all # -CCr -p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ +p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base_all end @@ -302,7 +161,7 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ def termsheet # -t system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n") @@n_do=@@n_do+1 - SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.act[:quiet][:set] ==:on end def webrick # -W port=prt=@fns @@ -347,36 +206,31 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ @msg,@msgs='',nil @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } end - def op(req,msg) - SiSU::Op.new(@opt,req,msg).select if req and msg - end def actions - if @opt.cmd =~/E/ # re-assign character + if @opt.act[:profile][:set]==:on require 'profile' end - if @opt.act[:harvest][:bool] - require_relative 'harvest' # harvest.rb - SiSU_Harvest::Source.new(@opt).read # -h -H html.rb + if @opt.act[:harvest][:set]==:on + 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 =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_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::InfoProcessingFlag.new - if @opt.cmd =~/[vVM]/ #% version information - if (@opt.cmd =~/V/) \ - && (@opt.files.empty?) #% environment - SiSU_Help::Help.new('env',@opt).environment - else SiSU_Help::Help.new('env',@opt).sisu_version + if @opt.cmd =~/[vVM]/ #% version information + unless @opt.files.empty? + SiSU_Help::Help.new('env',@opt).sisu_version end end - if @opt.act[:license][:bool] #% license information + if @opt.act[:license][:set]==:on #% license information SiSU_Help::Help.new('license',@opt).help_request end - if @opt.act[:dal][:bool] \ - or @opt.act[:maintenance][:bool] #% --maintenance, -m for -C + if @opt.act[:dal][:set]==:on \ + or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C path={} path[:css]=@@env.path.output + '/_sisu/css' path[:xml]=@@env.path.output + '/_sisu/xml' @@ -385,34 +239,35 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ path[:xsd]=path[:xml] + '/rng' 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 + # unless ( FileTest.directory?(path[:css]) \ + # and FileTest.directory?(path[:xsd]) ) + # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX + # end + if @opt.act[:maintenance][:set] ==:on + $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 - end - if @opt.cmd =~/M/ - $VERBOSE=false #debug $VERBOSE=true + # unless ( FileTest.directory?(path[:css]) \ + # and FileTest.directory?(path[:xsd]) ) + # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX + # end + if @opt.act[:maintenance][:set] ==:on + $VERBOSE=false #debug $VERBOSE=true end end end - if @opt.act[:site_init][:bool] #% --init-site, -C initialize/configure - op('conf','configure site') - if @opt.cmd =~/R/ + if @opt.act[:site_init][:set]==:on #% --init-site, -C initialize/configure + requires('conf') #% --init-site, -C initialize/configure + SiSU_Initialize::Source.new(@opt).read + if @opt.act[:rsync][:set]==:on if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ and @opt.cmd =~/RZ/ SiSU::Operations.new(@opt).remote_put_base_site_rsync_match else SiSU::Operations.new(@opt).remote_put_base_site_rsync end - elsif @opt.cmd =~/r/ + elsif @opt.act[:scp][:set]==:on if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ and @opt.cmd =~/CCr/ SiSU::Operations.new(@opt).remote_put_base_site_all @@ -420,16 +275,17 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ end end end - if @opt.act[:sample_search_form][:bool] #% --sample-search-form, -F cgi sample search form + if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form SiSU::Operations.new(@opt).cgi end - if @opt.act[:webrick][:bool] #% --webrick, -W webrick + if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick SiSU::Operations.new(@opt).webrick end - if @opt.cmd =~/Z/ #% -Z wipe previous output clean - op('zap','Zap, deletions') + if @opt.act[:zap][:set]==:on #% --zap -Z wipe previous output clean DUPLICATE + #requires('zap') + #SiSU_Zap::Source.new(@opt).read # -Z zap.rb end - if @opt.act[:dal][:bool] + if @opt.act[:dal][:set]==:on @retry_count= -1 begin path_image='./_sisu/processing/external_document/image' @@ -449,23 +305,13 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ @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_p2 - # @get_p << re_p2.match(fns)[1] if re_p2 - # end - # 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 - require_relative 'remote' # remote.rb + if @get_s.length > 0 #% remote markup file .sst + require_relative 'remote' # remote.rb SiSU_Remote::Get.new(@opt,@get_s).fns SiSU::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 @@ -476,9 +322,7 @@ p "#{__LINE__}:#{__FILE__}" 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') } end - #@opt.files_mod=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') } def requires(req) require_relative req end @@ -495,110 +339,129 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ @opt.pth=Dir.pwd @opt.lng='en' end - @@pwd=@opt.pth - Dir.chdir(@opt.pth) #watch + unless @opt.pth.nil? + @@pwd=@opt.pth + Dir.chdir(@opt.pth) #watch + end @env=SiSU_Env::InfoEnv.new(@opt.fns) - if @opt.act[:dal][:bool] #% --dal, -m - if @opt.fno =~ /\.ssm$/ - require_relative 'composite' # composite.rb #pre-processing - SiSU_Assemble::Composite.new(@opt).read + if @opt.act[:dal][:set]==:on #% --dal, -m + unless @opt.act[:po4a][:set]==:on # --po4a, -P + if @opt.fno =~ /\.ssm$/ + require_relative 'composite' # composite.rb #pre-processing + SiSU_Assemble::Composite.new(@opt).read + end + requires('dal') # -m dal.rb + SiSU_DAL::Source.new(@opt).read end - requires('dal') # -m dal.rb - SiSU_DAL::Source.new(@opt).read end - if @opt.act[:share_source][:bool] + if @opt.act[:share_source][:set]==:on requires('share_src') # -s share_src.rb SiSU_Markup::Source.new(@opt).read end - if @opt.act[:sisupod][:bool] #% --sisupod, -S make sisupod - requires('sisupod_make') # -S sisupod_make.rb - SiSU_Doc::Source.new(@opt).read - end - if @opt.act[:qrcode][:bool] #% --qrcode, -Q + if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q requires('qrcode') # -Q qrcode.rb SiSU_QRcode::Source.new(@opt).read end - if @opt.act[:hash_digests][:bool] #% --hash-digests, -N digest tree + if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree requires('digests') # -N digests.rb SiSU_DigestView::Source.new(@opt).read end - if @opt.act[:txt][:bool] #% --txt, -t -a + if @opt.act[:txt][:set]==:on #% --txt, -t -a requires('plaintext') # -t -a plaintext.rb SiSU_Plaintext::Source.new(@opt).read end - if @opt.act[:html][:bool] #% --html, -h + if @opt.act[:html][:set]==:on #% --html, -h requires('html') # -h -H html.rb SiSU_HTML::Source.new(@opt).read end - if @opt.act[:concordance][:bool] #% --concordance, -w + if @opt.act[:concordance][:set]==:on #% --concordance, -w requires('concordance') # -w concordance.rb SiSU_Concordance::Source.new(@opt).read end - if @opt.act[:epub][:bool] #% --epub, -e + if @opt.act[:epub][:set]==:on #% --epub, -e requires('epub') # -e epub.rb SiSU_EPUB::Source.new(@opt).read end - if @opt.act[:odt][:bool] #% --odt, -o opendocument + if @opt.act[:odt][:set]==:on #% --odt, -o opendocument requires('odf') # -o odf.rb SiSU_ODF::Source.new(@opt).read end - if @opt.act[:xhtml][:bool] #% --xhtml, -b xhtml + if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml requires('xhtml') # -b xhtml.rb SiSU_XHTML::Source.new(@opt).read end - if @opt.act[:xml_sax][:bool] #% --xml-sax, -x xml sax type + if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type requires('xml') # -x xml.rb SiSU_XML_SAX::Source.new(@opt).read end - if @opt.act[:xml_dom][:bool] #% --xml-dom, -x xml dom type + if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -x xml dom type requires('xml_dom') # -X xml_dom.rb SiSU_XML_DOM::Source.new(@opt).read end - if @opt.act[:pdf][:bool] #% --pdf, -p latex/ texpdf + if @opt.act[:pdf][:set]==:on #% --pdf, -p latex/ texpdf requires('texpdf') # -p texpdf.rb SiSU_TeX::Source.new(@opt).read end - if @opt.act[:manpage][:bool] #% --manpage, -i + if @opt.act[:manpage][:set]==:on #% --manpage, -i requires('manpage') # -i manpage.rb SiSU_Manpage::Source.new(@opt).read end - if @opt.act[:texinfo][:bool] #% --texinfo, -I + if @opt.act[:texinfo][:set]==:on #% --texinfo, -I requires('texinfo') # -I texinfo.rb SiSU_TexInfo::Source.new(@opt).read end - if @opt.act[:sqlite_discreet][:bool] #% --sqlite, -d DB sqlite + if @opt.act[:sqlite_discreet][:set]==:on #% --sqlite, -d DB sqlite requires('dbi_discreet') # -d dbi_discreet.rb SiSU_DBI_Discreet::SQL.new(@opt).build end - if @opt.act[:manifest][:bool] #% --manifest, -y + if @opt.act[:manifest][:set]==:on #% --manifest, -y requires('manifest') # -y manifest.rb SiSU_Manifest::Source.new(@opt).read end end end - def loop_files_on_given_option_do - if @opt.act[:images][:bool] #% --images, -j - OptionLoopFiles.new(@opt).loop_files_on_given_option do - requires('shared_images') - SiSU_Images::Source.new(@opt).read # -j shared_images.rb + def pre_loop_files_on_given_option_do + if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod + requires('sisupod_make') # -S sisupod_make.rb + begin + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Doc::Source.new(@opt).read + end + ensure + SiSU_Doc::Source.new(@opt).sisupod_tar_xz end end - if @opt.cmd =~/O/ #% -O open archive initiative, metadata harvesting - op('xml_md_oai_pmh_dc','OAI PMH') + end + def post_loop_files_on_given_option_do + if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod + requires('sisupod_make') # -S sisupod_make.rb + begin + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Doc::Source.new(@opt).read + end + ensure + SiSU_Doc::Source.new(@opt).sisupod_tar_xz + end end - if @opt.act[:po4a][:bool] #% --po4a, -P + if @opt.act[:images][:set]==:on #% --images, -j + requires('shared_images') OptionLoopFiles.new(@opt).loop_files_on_given_option do - requires('po4a') - SiSU_Po4a::Source.new(@opt).read # -P po4a.rb + SiSU_Images::Source.new(@opt).read # -j shared_images.rb end end - if @opt.act[:git][:bool] #% --git, -g sisu git + if @opt.act[:po4a][:set]==:on #% --po4a, -P + requires('po4a') OptionLoopFiles.new(@opt).loop_files_on_given_option do - #requires('git') - #fix + SiSU_Po4a::Source.new(@opt).read # -P po4a.rb + end + end + if @opt.act[:git][:set]==:on #% --git, -g sisu git + requires('git') + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Git::Source.new(@opt).read # -g git.rb end 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) @@ -613,70 +476,97 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ end SiSU::Operations.new.counter end - if @opt.cmd =~/k/ #% -T temporary tests + if @opt.cmd =~/k/ #% -k temporary tests OptionLoopFiles.new(@opt).loop_files_on_given_option do #requires('xml_scaffold') #fix end end - if @opt.act[:psql][:bool] #% --pg, -D DB postgresql + if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql requires('dbi') if @opt.files.length > 0 #switch test to actual commands OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end else SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end - if @opt.act[:sqlite][:bool] #% --sqlite, -d DB sqlite + if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite requires('dbi') if @opt.files.length > 0 #switch test to actual commands OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end else SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end - if @opt.act[:manifest][:bool] #% --manifest, -y + if @opt.act[:dal][:set]==:on #% --dal, -m embedded content + # OptionLoopFiles.new(@opt).loop_files_on_given_option do + # requires('embedded') + # SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check + # end + end + if @opt.act[:zap][:set]==:on #% --zap, -Z + # OptionLoopFiles.new(@opt).loop_files_on_given_option do + # requires('zap') + # SiSU_Zap::Source.new(@opt).read # -Z zap.rb + # end + end + if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod + # OptionLoopFiles.new(@opt).loop_files_on_given_option do + # requires('sisupod_make') + # SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb + # end + end + if @opt.act[:manifest][:set]==:on #% --manifest, -y + requires('manifest') OptionLoopFiles.new(@opt).manifest_on_files_translated do - requires('manifest') - SiSU_Manifest::Source.new(@opt).read # -y manifest.rb + SiSU_Manifest::Source.new(@opt).read # -y manifest.rb end end - if @opt.act[:sitemap][:bool] #% --sitemap, -Y + if @opt.act[:sitemap][:set]==:on #% --sitemap, -Y + requires('sitemaps') OptionLoopFiles.new(@opt).loop_files_on_given_option do - requires('sitemaps') - SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb + SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb end end - if @opt.mod.inspect !~/--harvest/ - if @opt.act[:scp][:bool] #% -r copy to remote server - op('remote','scp') + if @opt.act[:harvest][:set] !=:on + if @opt.act[:scp][:set]==:on #% -r copy to remote server + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Remote::Put.new(@opt).scp # -r + end end - if @opt.act[:rsync][:bool] #% -R copy to remote server - op('remote','rsync') + if @opt.act[:rsync][:set]==:on #% -R copy to remote server + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Remote::Put.new(@opt).rsync # -R + end end else end - op('urls','urls') + if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y + requires('urls') + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Urls::Source.new(@opt).read #% -u -v -V -M + end + end end - #if @opt.mod=~/^conf$/ # -C - if @opt.cmd=~/C/ # -C - requires('conf') # -s conf.rb + if @opt.act[:site_init][:set]==:on #% -C + requires('conf') # -s conf.rb SiSU_Initialize::Source.new(@opt).read end + #pre_loop_files_on_given_option_do each_file_loop_options - loop_files_on_given_option_do - @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.cmd =~/q/ + post_loop_files_on_given_option_do + @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? if defined? @@env.processing_path.processing \ and @@env.user \ and FileTest.directory?(@@env.processing_path.processing) \ and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area FileUtils::cd(@@env.processing_path.processing_base_tmp) do - FileUtils::rm_rf(@@env.user) unless @opt.cmd =~/M/ + FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on end end elsif @opt.mod.inspect =~/--query/ @@ -695,7 +585,7 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/ elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps require_relative 'sitemaps' # sitemaps.rb SiSU_Sitemaps::Source.new(@opt).read - if @opt.cmd =~/R/ + if @opt.act[:rsync][:set]==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_sitemaps end -- cgit v1.2.3