From 9680068ed1eee6cab4367714213f8052145529b6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 12 Aug 2014 00:11:35 -0400 Subject: v5 v6: hub, organisation & loose ends * tweak triggers * split file further * remove mod --- lib/sisu/v5/hub_actions.rb | 759 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 588 insertions(+), 171 deletions(-) (limited to 'lib/sisu/v5/hub_actions.rb') diff --git a/lib/sisu/v5/hub_actions.rb b/lib/sisu/v5/hub_actions.rb index 8717f815..785f507e 100644 --- a/lib/sisu/v5/hub_actions.rb +++ b/lib/sisu/v5/hub_actions.rb @@ -66,22 +66,30 @@ module SiSU_Hub_Actions def initialize(opt) @opt=opt end + def report + def version_info? + if @opt.act[:version_info][:set]==:on + SiSU_Env::InfoAbout.new(@opt).sisu_version + end + end + self + end def prepare def site? if @opt.act[:site_init][:set]==:on #% --init-site, -C initialize/configure require_relative '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/ \ + if @opt.selections.str =~/--init(?:ialize)?=site/ \ and @opt.selections.str =~/RZ/ - SiSU::Operations.new(@opt).remote_put_base_site_rsync_match - else SiSU::Operations.new(@opt).remote_put_base_site_rsync + SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync_match + else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync end elsif @opt.act[:scp][:set]==:on - if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ + if @opt.selections.str =~/--init(?:ialize)?=site/ \ and @opt.selections.str =~/CCr/ - SiSU::Operations.new(@opt).remote_put_base_site_all - else SiSU::Operations.new(@opt).remote_put_base_site + SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_all + else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site end end end @@ -92,16 +100,16 @@ module SiSU_Hub_Actions #require_relative '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/ \ + # if @opt.selections.str =~/--init(?:ialize)?=site/ \ # and @opt.selection =~/RZ/ - # SiSU::Operations.new(@opt).remote_put_base_site_rsync_match - # else SiSU::Operations.new(@opt).remote_put_base_site_rsync + # SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync_match + # else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync # end #elsif @opt.act[:scp][:set]==:on - # if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ + # if @opt.selections.str =~/--init(?:ialize)?=site/ \ # and @opt.selection =~/CCr/ - # SiSU::Operations.new(@opt).remote_put_base_site_all - # else SiSU::Operations.new(@opt).remote_put_base_site + # SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_all + # else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site # end #end end @@ -127,306 +135,721 @@ module SiSU_Hub_Actions end end end + def search_form? + if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form + SiSU_Hub_Actions::Operations.new(@opt).cgi + end + end + def webrick? + if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick + SiSU_Hub_Actions::Operations.new(@opt).webrick + end + end self end def outputs - if @opt.f_pths.length > 0 - def each_file - def abstract_objects? - if @opt.act[:ao][:set]==:on #% --ao --dal, -m - unless @opt.act[:po4a][:set]==:on # --po4a, -P + def each_file + def abstract_objects? + if @opt.act[:ao][:set]==:on #% --ao --dal, -m + if @opt.f_pths.length > 0 + unless @opt.act[:po4a][:set]==:on # --po4a, -P if @opt.fno =~ /\.ssm$/ - require_relative 'ao_composite' # ao_composite.rb #pre-processing + require_relative 'ao_composite' # ao_composite.rb #pre-processing SiSU_Assemble::Composite.new(@opt).read end - require_relative 'ao' # -m ao.rb + require_relative 'ao' # ao.rb SiSU_AO::Source.new(@opt).read end + else + msg='document abstraction request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def qrcode? - if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q - require_relative 'qrcode' # qrcode.rb + end + def qrcode? + if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q + if @opt.f_pths.length > 0 + require_relative 'qrcode' # qrcode.rb SiSU_QRcode::Source.new(@opt).read + else + msg='qrcode request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def hash_digests? - if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree - require_relative 'digests' # digests.rb + end + def hash_digests? + if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree + if @opt.f_pths.length > 0 + require_relative 'digests' # digests.rb SiSU_DigestView::Source.new(@opt).read + else + msg='hash digest request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def text? - if @opt.act[:txt][:set]==:on #% --txt, -t -a - require_relative 'txt_plain' # txt_plain.rb + end + def text? + if @opt.act[:txt][:set]==:on #% --txt, -t -a + if @opt.f_pths.length > 0 + require_relative 'txt_plain' # txt_plain.rb SiSU_Txt_Plain::Source.new(@opt).read + else + msg='text request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:txt_textile][:set]==:on #% --textile - require_relative 'txt_textile' # txt_textile.rb + end + if @opt.act[:txt_textile][:set]==:on #% --textile + if @opt.f_pths.length > 0 + require_relative 'txt_textile' #txt_textile.rb SiSU_Txt_Textile::Source.new(@opt).read + else + msg='textile request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc - require_relative 'txt_asciidoc' # txt_asciidoc.rb + end + if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc + if @opt.f_pths.length > 0 + require_relative 'txt_asciidoc' # txt_asciidoc.rb SiSU_Txt_AsciiDoc::Source.new(@opt).read + else + msg='asciidoc request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:txt_markdown][:set]==:on #% --markdown - require_relative 'txt_markdown' # txt_markdown.rb + end + if @opt.act[:txt_markdown][:set]==:on #% --markdown + if @opt.f_pths.length > 0 + require_relative 'txt_markdown' # txt_markdown.rb SiSU_Txt_Markdown::Source.new(@opt).read + else + msg='markdown request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:txt_rst][:set]==:on #% --rst, --rest - require_relative 'txt_rst' # txt_rst.rb + end + if @opt.act[:txt_rst][:set]==:on #% --rst, --rest + if @opt.f_pths.length > 0 + require_relative 'txt_rst' # txt_rst.rb SiSU_Txt_rST::Source.new(@opt).read + else + msg='rst request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def html? - if @opt.act[:html][:set]==:on #% --html, -h -H - require_relative 'html' # html.rb + end + def html? + if @opt.act[:html][:set]==:on #% --html, -h + if @opt.f_pths.length > 0 + require_relative 'html' # html.rb SiSU_HTML::Source.new(@opt).read else - if @opt.act[:html_seg][:set]==:on #% --html-seg (-h -H) - require_relative 'html' # html.rb + msg='html request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end + end + else + if @opt.act[:html_seg][:set]==:on #% --html-seg + if @opt.f_pths.length > 0 + require_relative 'html' # html.rb SiSU_HTML::Source.new(@opt).read + else + msg='html seg request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:html_scroll][:set]==:on #% --html-scroll (-h -H) - require_relative 'html' # html.rb + end + if @opt.act[:html_scroll][:set]==:on #% --html-scroll + if @opt.f_pths.length > 0 + require_relative 'html' # html.rb SiSU_HTML::Source.new(@opt).read + else + msg='html scroll request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - if @opt.act[:concordance][:set]==:on #% --concordance, -w - require_relative 'html_concordance' # html_concordance.rb + end + if @opt.act[:concordance][:set]==:on #% --concordance, -w + if @opt.f_pths.length > 0 + require_relative 'html_concordance' # html_concordance.rb SiSU_Concordance::Source.new(@opt).read + else + msg='concordance request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def xhtml? - if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml - require_relative 'xhtml' # xhtml.rb + end + def xhtml? + if @opt.act[:xhtml][:set]==:on #% --xhtml, -b + if @opt.f_pths.length > 0 + require_relative 'xhtml' # xhtml.rb SiSU_XHTML::Source.new(@opt).read + else + msg='xhtml request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:epub][:set]==:on #% --epub, -e - require_relative 'xhtml_epub2' # xhtml_epub2.rb + end + if @opt.act[:epub][:set]==:on #% --epub, -e + if @opt.f_pths.length > 0 + require_relative 'xhtml_epub2' # xhtml_epub2.rb SiSU_XHTML_EPUB2::Source.new(@opt).read + else + msg='epub request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def xml? - if @opt.act[:odt][:set]==:on #% --odt, -o opendocument - require_relative 'xml_odf_odt' # xml_odf_odt.rb + end + def xml? + if @opt.act[:odt][:set]==:on #% --odt, -o + if @opt.f_pths.length > 0 + require_relative 'xml_odf_odt' # xml_odf_odt.rb SiSU_XML_ODF_ODT::Source.new(@opt).read + else + msg='odt request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu - require_relative 'xml_scaffold_structure_sisu' # xml_scaffold_structure_sisu.rb + end + if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu + if @opt.f_pths.length > 0 + require_relative 'xml_scaffold_structure_sisu' # xml_scaffold_structure_sisu.rb SiSU_XML_Scaffold_Structure_Sisu::Source.new(@opt).read + else + msg='xml scaffold request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse - require_relative 'xml_scaffold_structure_collapsed' # xml_scaffold_structure_collapsed.rb + end + if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse + if @opt.f_pths.length > 0 + require_relative 'xml_scaffold_structure_collapsed' # xml_scaffold_structure_collapsed.rb SiSU_XML_Scaffold_Structure_Collapse::Source.new(@opt).read + else + msg='xml scaffold request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook - require_relative 'xml_docbook5' # xml_docbook5.rb + end + if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook + if @opt.f_pths.length > 0 + require_relative 'xml_docbook5' # xml_docbook5.rb SiSU_XML_Docbook_Book::Source.new(@opt).read + else + msg='docbook request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook - require_relative 'xml_fictionbook2' # xml_fictionbook2.rb + end + if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook + if @opt.f_pths.length > 0 + require_relative 'xml_fictionbook2' # xml_fictionbook2.rb SiSU_XML_Fictionbook::Source.new(@opt).read + else + msg='fictionbook request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type - require_relative 'xml_sax' # xml_sax.rb + end + if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x + if @opt.f_pths.length > 0 + require_relative 'xml_sax' # xml_sax.rb SiSU_XML_SAX::Source.new(@opt).read + else + msg='xml sax request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type - require_relative 'xml_dom' # xml_dom.rb + end + if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X + if @opt.f_pths.length > 0 + require_relative 'xml_dom' # xml_dom.rb SiSU_XML_DOM::Source.new(@opt).read + else + msg='xml dom request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def pdf? - if @opt.act[:pdf][:set]==:on \ - or @opt.act[:pdf_p][:set]==:on \ - or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf - require_relative 'texpdf' # texpdf.rb + end + def pdf? + if @opt.act[:pdf][:set]==:on \ + or @opt.act[:pdf_p][:set]==:on \ + or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p + if @opt.f_pths.length > 0 + require_relative 'texpdf' # texpdf.rb SiSU_TeX::Source.new(@opt).read + else + msg='pdf request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def man_or_info? - if @opt.act[:manpage][:set]==:on #% --manpage, -i - require_relative 'manpage' # manpage.rb + end + def man_or_info? + if @opt.act[:manpage][:set]==:on #% --manpage, -i + if @opt.f_pths.length > 0 + require_relative 'manpage' # manpage.rb SiSU_Manpage::Source.new(@opt).read + else + msg='manpage request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end - if @opt.act[:texinfo][:set]==:on #% --texinfo, -I - require_relative 'texinfo' # texinfo.rb + end + if @opt.act[:texinfo][:set]==:on #% --texinfo, -I + if @opt.f_pths.length > 0 + require_relative 'texinfo' # texinfo.rb SiSU_TexInfo::Source.new(@opt).read + else + msg='texinfo request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def sqlite_discrete? - if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d DB sqlite - require_relative 'dbi_discrete' # dbi_discrete.rb + end + def sqlite_discrete? + if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d + if @opt.f_pths.length > 0 + require_relative 'dbi_discrete' # dbi_discrete.rb SiSU_DBI_Discrete::SQL.new(@opt).build + else + msg='sqlite (discrete) request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def manifest? - if @opt.act[:manifest][:set]==:on #% --manifest, -y - require_relative 'manifest' # manifest.rb + end + def manifest? + if @opt.act[:manifest][:set]==:on #% --manifest, -y + if @opt.f_pths.length > 0 + require_relative 'manifest' # manifest.rb ((@opt.act[:sisupod][:set]==:on \ || @opt.act[:share_source][:set]==:on) \ && @opt.f_pths.length < 2 ) \ ? nil : SiSU_Manifest::Source.new(@opt).read + else + msg='manifest request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - def harvest? - if @opt.act[:harvest][:set]==:on - require_relative 'harvest' # harvest.rb - SiSU_Harvest::Source.new(@opt).read # -h -H html.rb + end + def harvest? + if @opt.act[:harvest][:set]==:on #% --harvest + if @opt.f_pths.length > 0 + require_relative 'harvest' # harvest.rb + SiSU_Harvest::Source.new(@opt).read + else + msg='harvest request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow). + mark(msg) + else puts msg + end end end - self end - def loop_files - def share_source? - if @opt.act[:share_source][:set]==:on \ - or @opt.act[:sisupod][:set]==:on \ - or @opt.act[:git][:set]==:on - begin + self + end + def loop_files + def share_source? + if @opt.act[:share_source][:set]==:on \ + or @opt.act[:sisupod][:set]==:on \ + or @opt.act[:git][:set]==:on + begin + if @opt.f_pths.length > 0 require_relative 'src_shared' - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do SiSU_Source::SiSUpodSource.new(@opt).read end - if @opt.act[:share_source][:set]==:on - require_relative 'src_share' # -s src_share.rb + else + msg='share markup source request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg + end + end + if @opt.act[:share_source][:set]==:on + if @opt.f_pths.length > 0 + require_relative 'src_share' # src_share.rb begin ensure - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option_bundle do SiSU_Markup::Source.new(@opt).read end end + else + msg='share markup source request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg + end end - if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod - require_relative 'src_sisupod_make' # -S src_sisupod_make.rb + end + if @opt.act[:sisupod][:set]==:on #% --sisupod, -S + if @opt.f_pths.length > 0 + require_relative 'src_sisupod_make' # src_sisupod_make.rb begin - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option_bundle do SiSU_Doc::Source.new(@opt).sisupod_tar_xz end ensure end + else + msg='sisupod (share markup source) request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg + end end - if @opt.act[:git][:set]==:on #% --git, -g sisu git - require_relative 'git' # -g git.rb + end + if @opt.act[:git][:set]==:on #% --git, -g + if @opt.f_pths.length > 0 + require_relative 'git' # git.rb begin - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do SiSU_Git::Source.new(@opt).read end ensure - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option_bundle do SiSU_Git::Source.new(@opt).git_commit end end + else + msg='git request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg + end end - if (@opt.act[:sisupod][:set]==:on \ - || @opt.act[:share_source][:set]==:on) \ - and @opt.act[:manifest][:set]==:on #% --manifest, -y - require_relative 'manifest' # -y manifest.rb + end + if (@opt.act[:sisupod][:set]==:on \ + || @opt.act[:share_source][:set]==:on) \ + and @opt.act[:manifest][:set]==:on #% --manifest, -y + if @opt.f_pths.length > 0 + require_relative 'manifest' # manifest.rb begin ensure - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option_bundle do SiSU_Manifest::Source.new(@opt).read end end + else + msg='manifest request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg + end end - ensure + end + ensure + if @opt.f_pths.length > 0 env=SiSU_Env::InfoEnv.new(@opt.fns) path_pod=env.processing_path.processing_sisupod(@opt).paths unless @opt.act[:maintenance][:set]==:on FileUtils::rm_rf("#{path_pod[:sisupod]}/*") \ if FileTest.directory?(path_pod[:sisupod]) end + else + #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + # mark('*** request requires sisu markup files') end end - if @opt.act[:po4a][:set]==:on #% --po4a, -P + end + if @opt.act[:po4a][:set]==:on #% --po4a, -P + if @opt.f_pths.length > 0 require_relative 'po4a' begin - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Po4a::Source.new(@opt).read # -P po4a.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do + SiSU_Po4a::Source.new(@opt).read # po4a.rb end ensure end + else + msg='po4a request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg + end end - if @opt.act[:images][:set]==:on #% --images, -j + end + if @opt.act[:images][:set]==:on #% --images, -j + if @opt.f_pths.length > 0 require_relative 'shared_images' - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Images::Source.new(@opt).read # -j shared_images.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do + SiSU_Images::Source.new(@opt).read # shared_images.rb + end + else + msg='place images request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg end end end - def run_termsheet? #broken, revisit later - if @opt.selections.str =~/--termsheet/ #% -T termsheet/standard form #fix later + end + def run_termsheet? #broken, revisit later + if @opt.selections.str =~/--termsheet/ #% -T termsheet/standard form #fix later + if @opt.f_pths.length > 0 @opt.files.each do |fns| if FileTest.file?(fns) @opt.fns=fns case @opt.fns when /\.(termsheet.rb)$/ - SiSU::Operations.new(@opt).termsheet - else #print "not processed --> ", fns, "\n" + SiSU_Hub_Actions::Operations.new(@opt).termsheet + else #print "not processed --> ", fns, "\n" end - else SiSU::Operations.new(@opt).not_found + else SiSU_Hub_Actions::Operations.new(@opt).not_found end end + else + msg='process termsheet request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg + end end end - def sql? - if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql + end + def sql? + if @opt.act[:psql][:set]==:on #% --pg, -D + if @opt.f_pths.length > 0 require_relative 'dbi' - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do + SiSU_DBI::SQL.new(@opt).connect # dbi.rb + end + else + msg='pgsql request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg end end - if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite + end + if @opt.act[:sqlite][:set]==:on #% --sqlite, -d + if @opt.f_pths.length > 0 require_relative 'dbi' - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do + SiSU_DBI::SQL.new(@opt).connect # dbi.rb + end + else + msg='sqlite request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg end end end - def manifest? - if @opt.act[:manifest][:set]==:on #% --manifest, -y + end + def manifest? + if @opt.act[:manifest][:set]==:on #% --manifest, -y + if @opt.f_pths.length > 1 require_relative 'manifest' - SiSU::OptionLoopFiles.new(@opt).manifest_on_files_translated do - SiSU_Manifest::Source.new(@opt).read # -y manifest.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt).manifest_on_files_translated do + SiSU_Manifest::Source.new(@opt).read # manifest.rb end end end - def sitemaps? - if @opt.act[:sitemap][:set]==:on #% --sitemap, -Y + end + def sitemaps? + if @opt.act[:sitemap][:set]==:on #% --sitemap, -Y + if @opt.f_pths.length > 0 require_relative 'sitemaps' - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do + SiSU_Sitemaps::Source.new(@opt).read # sitemaps.rb end end end - def remote_placement? - if @opt.act[:harvest][:set] !=:on - if @opt.act[:scp][:set]==:on #% -r copy to remote server - require_relative 'remote' # -r remote.rb - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do + end + def remote_placement? + if @opt.act[:harvest][:set] !=:on + if @opt.act[:scp][:set]==:on #% -r copy to remote server + if @opt.f_pths.length > 0 + require_relative 'remote' # remote.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do SiSU_Remote::Put.new(@opt).scp end end - if @opt.act[:rsync][:set]==:on #% -R copy to remote server - require_relative 'remote' # -R remote.rb - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do + end + if @opt.act[:rsync][:set]==:on #% -R copy to remote server + if @opt.f_pths.length > 0 + require_relative 'remote' # remote.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do SiSU_Remote::Put.new(@opt).rsync end end - else end + else end - def urls? - if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y + end + def urls? + if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y + if @opt.f_pths.length > 0 require_relative 'urls' - SiSU::OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Urls::Source.new(@opt).read #% urls.rb + SiSU_Hub_Loops::OptionLoopFiles.new(@opt). + loop_files_on_given_option do + SiSU_Urls::Source.new(@opt).read #% urls.rb + end + else + msg='urls request requires sisu markup files' + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan). + mark(msg) + else puts msg end end end - self end + self end def init? SiSU_Env::InfoProcessingFlag.new @@ -439,7 +862,7 @@ module SiSU_Hub_Actions ).grey end if @opt.act[:ao][:set]==:on \ - or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C + or @opt.act[:maintenance][:set]==:on #% --maintenance, -M env=SiSU_Env::InfoEnv.new(@opt.fns) path={} path[:css]=env.path.output + '/_sisu/css' @@ -450,22 +873,16 @@ module SiSU_Hub_Actions 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 if @opt.act[:maintenance][:set] ==:on - $VERBOSE=false #debug $VERBOSE=true + $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 if @opt.act[:maintenance][:set] ==:on - $VERBOSE=false #debug $VERBOSE=true + $VERBOSE=false #debug $VERBOSE=true end end end - 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][:set]==:on #% --webrick, -W webrick - SiSU::Operations.new(@opt).webrick - end if @opt.act[:ao][:set]==:on @retry_count= -1 begin @@ -487,7 +904,7 @@ module SiSU_Hub_Actions 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 + SiSU_Hub_Actions::Operations.new.counter end if @get_p.length > 0 #% remote sisupod require_relative 'remote' # remote.rb @@ -515,35 +932,35 @@ module SiSU_Hub_Actions def counter @@n_do=0 end - def remote_put_base_site_rsync # -CR + def remote_put_base_site_rsync # -CR SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ if @opt.act[:maintenance][:set] ==:on - require_relative 'remote' # remote.rb + require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base end - def remote_put_base_site_rsync_match # -CCRZ + def remote_put_base_site_rsync_match # -CCRZ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ if @opt.act[:maintenance][:set] ==:on - require_relative 'remote' # remote.rb + require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base_sync end - def remote_put_base_site # -Cr + def remote_put_base_site # -Cr SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ if @opt.act[:maintenance][:set] ==:on - require_relative 'remote' # remote.rb + require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base end - def remote_put_base_site_all # -CCr + def remote_put_base_site_all # -CCr SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ if @opt.act[:maintenance][:set] ==:on - require_relative 'remote' # remote.rb + require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base_all end - def cgi # -F - require_relative 'cgi' # cgi.rb + def cgi # -F + require_relative 'cgi' # cgi.rb SiSU_CGI::SearchSQL.new(@opt).read end - def termsheet # -t + def termsheet # -t system("sisu_termsheet #{@opt.selections.str} #{@opt.fns}\n") @@n_do=@@n_do+1 SiSU_Screen::Ansi.new( @@ -551,7 +968,7 @@ module SiSU_Hub_Actions 'Termsheet(s) processed' ).term_sheet_title unless @opt.act[:quiet][:set] ==:on end - def webrick # -W + def webrick # -W prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} } require_relative 'webrick' -- cgit v1.2.3