diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-08-12 00:13:56 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-08-12 00:13:56 -0400 |
commit | 9eae7919e8fbdca44578c4bd870a561d0458eaed (patch) | |
tree | b3e011a68039675a3b994a79ea44b4e9fbac22d0 | |
parent | debian/changelog (5.6.0-1) (diff) | |
parent | v5 v6: hub, organisation & loose ends (diff) |
Merge tag 'sisu_5.6.1' into debian/sid
SiSU 5.6.1
45 files changed, 2086 insertions, 1038 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 1bcef2b4..899855eb 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -31,6 +31,20 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 5.6.1.orig.tar.xz (2014-08-12:32/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.6.1 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.6.1-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.1.orig.tar.xz + sisu_5.6.1.orig.tar.xz + sisu_5.6.1-1.dsc + +* hub, organization & loose ends + * tweak triggers + * split file further + * remove mod + +* webrick, wb.cgi fixed and omitted (use discarded) + %% 5.6.0.orig.tar.xz (2014-08-08:31/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.6.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.6.0-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 1f19f07f..479f823c 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -21,6 +21,20 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 6.2.2.orig.tar.xz (2014-08-12:32/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.2.2 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.2.2-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.2.orig.tar.xz + sisu_6.2.2.orig.tar.xz + sisu_6.2.2-1.dsc + +* hub, organization & loose ends + * tweak triggers + * split file further + * remove mod + +* webrick, wb.cgi fixed and omitted (use discarded) + %% 6.2.1.orig.tar.xz (2014-08-08:31/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.2.1 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.2.1-1 diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml index d6865084..ec730471 100644 --- a/data/sisu/v5/v/version.yml +++ b/data/sisu/v5/v/version.yml @@ -1,5 +1,5 @@ --- :project: SiSU -:version: 5.6.0 -:date_stamp: 2014w31/5 -:date: "2014-08-08" +:version: 5.6.1 +:date_stamp: 2014w32/2 +:date: "2014-08-12" diff --git a/data/sisu/v6/v/version.yml b/data/sisu/v6/v/version.yml index 62a2c21c..8f74a7e0 100644 --- a/data/sisu/v6/v/version.yml +++ b/data/sisu/v6/v/version.yml @@ -1,5 +1,5 @@ --- :project: SiSU -:version: 6.2.1 -:date_stamp: 2014w31/5 -:date: "2014-08-08" +:version: 6.2.2 +:date_stamp: 2014w32/2 +:date: "2014-08-12" diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index b372da4c..1553f8aa 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -472,19 +472,21 @@ module SiSU_AO_DocumentStructure end end class ObjectFlag - attr_accessor :obj,:is,:of,:flag,:mod,:tmp + attr_accessor :obj,:is,:of,:flag,:act,:selections,:tmp def initialize @of=:flag - @is=@obj=@flag=@mod=@tmp=nil + @is=@obj=@flag=@act=@selections=@tmp=nil end def flag(h,o=nil) of= @of #Symbol, classification - group is= :flag #Symbol, classification - specific type obj= nil #String, text content flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content - mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content + act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content + selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@obj,@flag,@mod,@tmp=of,is,obj,flag,mod,tmp + @of, @is,@obj,@flag,@act,@selections,@tmp= + of,is, obj, flag, act, selections, tmp self end def flag_ocn(h,o=nil) @@ -492,9 +494,11 @@ module SiSU_AO_DocumentStructure is= :flag_ocn #Symbol, classification - specific type obj= nil #String, text content flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content - mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content + act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content + selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@obj,@flag,@mod,@tmp=of,is,obj,flag,mod,tmp + @of, @is,@obj,@flag,@act,@selections,@tmp= + of,is, obj, flag, act, selections,tmp self end end diff --git a/lib/sisu/v5/cgi.rb b/lib/sisu/v5/cgi.rb index 201f028b..da416eed 100644 --- a/lib/sisu/v5/cgi.rb +++ b/lib/sisu/v5/cgi.rb @@ -71,9 +71,9 @@ module SiSU_CGI #% database building doc @webserv=@opt.files[0].to_s.strip end def read - if @opt.act[:psql][:set]==:on + if @opt.act[:sample_search_form][:db]==:pg # cgi_pgsql.rb SiSU_CGI_PgSQL::SearchPgSQL.new(@opt,@webserv).pgsql - elsif @opt.act[:sqlite][:set]==:on + elsif @opt.act[:sample_search_form][:db]==:sqlite # cgi_sqlite.rb SiSU_CGI_SQLite::SearchSQLite.new(@opt,@webserv).sqlite else puts <<-WOK diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb index b126d320..9f0a8356 100644 --- a/lib/sisu/v5/conf.rb +++ b/lib/sisu/v5/conf.rb @@ -78,7 +78,7 @@ module SiSU_Initialize ConfigSite.new(@opt).dtd ConfigSite.new(@opt).cp_local_images ConfigSite.new(@opt).cp_external_images - ConfigSite.new(@opt).cp_webserver_images #if @opt.mod.inspect =~/--init(?:ialize)?=site/ + ConfigSite.new(@opt).cp_webserver_images end end class ConfigSite #config files such as css are not updated if they already exist unless forced using the --init=site modifier diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index 79d3f70a..b9c3eebe 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -95,8 +95,7 @@ module SiSU_DBI_Discrete #% database building create_and_populate end def maintenance_check(opt,file,line) - #p opt.mod - #p opt.cmd + #p opt.selections.str p "at #{file} #{line}" end def prepare @@ -169,7 +168,7 @@ module SiSU_DBI_Discrete #% database building begin SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], - "DBI (#{@sql_type}) #{@opt.mod}", + "DBI (#{@sql_type}) #{@opt.selections.str}", @opt.fns ).dbi_title unless @opt.act[:quiet][:set]==:on @db.sqlite_discrete.conn_sqlite3 diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index fed4ae55..68db1f13 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -67,6 +67,7 @@ module SiSU include SiSU_Env include SiSU_Screen require_relative 'hub_actions' # hub_actions.rb + require_relative 'hub_loop_markup_files' # hub_loop_markup_files.rb require_relative 'hub_options' # hub_options.rb require_relative 'dp' # dp.rb include SiSU_Param @@ -81,13 +82,13 @@ module SiSU end class HubMaster def initialize(argv,call_path) - begin #% select what to do (set options & start processing (files selected if any)) - opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set - SiSU::Processing.new(opt).version_info - SiSU::Processing.new(opt).actions_without_files # do it - SiSU::Processing.new(opt).actions_on_files # do it + begin + opt=SiSU_Commandline::Options.new(argv,call_path) + SiSU::Processing.new(opt).actions_without_files + SiSU::Processing.new(opt).actions_on_files + SiSU::Processing.new(opt).actions_without_files_post rescue - selection=(opt ? opt.selection : '') + selection=(opt ? opt.selections.src : '') SiSU_Screen::Ansi.new(selection,$!,$@).rescue do __LINE__.to_s + ':' + __FILE__ end @@ -96,115 +97,6 @@ module SiSU end end end - class HubClose - def initialize(call_path) - begin - @env=SiSU_Env::InfoEnv.new - rescue - ensure - if FileTest.directory?(@env.processing_path.processing) \ - and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ - FileUtils::cd(@env.processing_path.processing_base_tmp) do - FileUtils::rm_rf('.') - end - end - Dir.chdir(call_path) - end - end - end - class OptionLoopFiles - attr_reader :opt - def initialize(opt) - @opt=opt - @r=Px[:lng_lst_rgx] - end - def loop_files_on_given_option - @opt.files.each_with_index do |fno,i| - @opt.fno,@opt.fns=fno,fno - @opt.f_pth=@opt.f_pths[i] - if fno !~/\.-sst$/ - @opt.pth=@opt.paths[i] - @opt.lng=@opt.lngs[i] - end - @@pwd=@opt.pth - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - Dir.chdir(@opt.f_pth[:pth]) #watch - SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track - @env=SiSU_Env::InfoEnv.new(fno) - yield - end - end - def loop_files_on_given_option_bundle - @files_bundle={} - @opt.files.each_with_index do |fno,i| - fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') - unless @files_bundle[fn_base_bundle] - @files_bundle[fn_base_bundle]={ status: :todo } - end - end - @opt.files.each_with_index do |fno,i| - fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') - unless @files_bundle[fn_base_bundle][:status] == :done - @files_bundle[fn_base_bundle][:status] = :done - @opt.fns=fno - @opt.fno=fno - @opt.f_pth=@opt.f_pths[i] - if fno !~/\.-sst$/ - @opt.pth=@opt.paths[i] - @opt.lng=@opt.lngs[i] - end - @@pwd=@opt.pth - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - Dir.chdir(@opt.f_pth[:pth]) #watch - @env=SiSU_Env::InfoEnv.new(fno) - yield - else next - end - end - end - def manifest_on_files_translated - number_of_files={} - @opt.files.each_with_index do |fns,i| - fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') - (number_of_files[fn].is_a?(Array)) \ - ? (number_of_files[fn] << i) - : (number_of_files.store(fn,[i])) - end - files_translated_idx=[] - number_of_files.each do |x| - if x[1].length > 1 - files_translated_idx << x[1] - end - end - if files_translated_idx.flatten.length > 1 - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - 'Manifest re-run on (currently generated) translated 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=Dir.pwd - @opt.lng='en' - elsif @opt.fno =~/\.txz$/ - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - else - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - end - @@pwd=@opt.pth - Dir.chdir(@opt.pth) #watch - @env=SiSU_Env::InfoEnv.new(@opt.fns) - yield - end - end - end - end class Processing begin require 'fileutils' @@ -239,43 +131,50 @@ module SiSU @remove_faulty_markup_files_array.join(',') end end + def do_each_file_loop_check_and_perform_selected_actions(opt) + actions=SiSU_Hub_Actions::HubActions.new(opt) + actions.outputs.each_file.abstract_objects? + actions.outputs.each_file.qrcode? + actions.outputs.each_file.hash_digests? + actions.outputs.each_file.text? + actions.outputs.each_file.html? + actions.outputs.each_file.xhtml? + actions.outputs.each_file.xml? + actions.outputs.each_file.pdf? + actions.outputs.each_file.man_or_info? + actions.outputs.each_file.sqlite_discrete? + actions.outputs.each_file.manifest? + end def do_each_file_loop_options - @opt.files.each_with_index do |fno,i| - @opt.fno=fno - @opt.fns=fno. - gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). - gsub(/\.ssm$/,'.ssm.sst') - @opt.f_pth=@opt.f_pths[i] - if @opt.fns !~/\.-sst$/ - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - else - @opt.pth=Dir.pwd - @opt.lng='en' - end - unless @opt.pth.nil? - @@pwd=@opt.pth - Dir.chdir(@opt.pth) #watch + if @opt.files.length > 0 + @opt.files.each_with_index do |fno,i| + @opt.fno=fno + @opt.fns=fno. + gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). + gsub(/\.ssm$/,'.ssm.sst') + @opt.f_pth=@opt.f_pths[i] + if @opt.fns !~/\.-sst$/ + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + else + @opt.pth=Dir.pwd + @opt.lng='en' + end + unless @opt.pth.nil? + @@pwd=@opt.pth + Dir.chdir(@opt.pth) #watch + end + #@env=SiSU_Env::InfoEnv.new(@opt.fns) + do_each_file_loop_check_and_perform_selected_actions(@opt) end - @env=SiSU_Env::InfoEnv.new(@opt.fns) - actions=SiSU_Hub_Actions::HubActions.new(@opt) - actions.outputs.each_file.abstract_objects? - actions.outputs.each_file.qrcode? - actions.outputs.each_file.hash_digests? - actions.outputs.each_file.text? - actions.outputs.each_file.html? - actions.outputs.each_file.xhtml? - actions.outputs.each_file.xml? - actions.outputs.each_file.pdf? - actions.outputs.each_file.man_or_info? - actions.outputs.each_file.sqlite_discrete? - actions.outputs.each_file.manifest? + else + do_each_file_loop_check_and_perform_selected_actions(@opt) end end def do_loop_files_on_given_option_pre begin if @opt.act[:zap][:set]==:on #% --zap, -Z - OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt).loop_files_on_given_option do require_relative 'zap' SiSU_Zap::Source.new(@opt).read # -Z zap.rb end @@ -285,25 +184,38 @@ module SiSU end def do_loop_files_on_given_option_post actions=SiSU_Hub_Actions::HubActions.new(@opt) - actions.outputs.loop_files.share_source? - actions.outputs.loop_files.run_termsheet? - actions.outputs.loop_files.sql? + if defined? actions.outputs.loop_files.share_source? + actions.outputs.loop_files.share_source? + end + if defined? actions.outputs.loop_files.run_termsheet? + actions.outputs.loop_files.run_termsheet? + end + if defined? actions.outputs.loop_files.sql? + actions.outputs.loop_files.sql? + end SiSU_Hub_Actions::Operations.new.counter - actions.outputs.loop_files.manifest? - actions.outputs.loop_files.sitemaps? - actions.outputs.loop_files.urls? - end - def version_info - if @opt.act[:version_info][:set]==:on - SiSU_Env::InfoAbout.new(@opt).sisu_version + if defined? actions.outputs.loop_files.manifest? + actions.outputs.loop_files.manifest? + end + if defined? actions.outputs.loop_files.sitemaps? + actions.outputs.loop_files.sitemaps? + end + if defined? actions.outputs.loop_files.urls? + actions.outputs.loop_files.urls? end end def actions_without_files actions=SiSU_Hub_Actions::HubActions.new(@opt) + actions.report.version_info? actions.prepare.site? - actions.prepare.remote_site? actions.prepare.sql? end + def actions_without_files_post + actions=SiSU_Hub_Actions::HubActions.new(@opt) + actions.prepare.remote_site? + actions.prepare.search_form? + actions.prepare.webrick? + end def actions_on_files if @opt.act[:profile][:set]==:on begin @@ -314,71 +226,51 @@ module SiSU end end actions=SiSU_Hub_Actions::HubActions.new(@opt) - actions.outputs.each_file.harvest? #check + actions.outputs.each_file.harvest? actions.outputs.init? do_loop_files_on_given_option_pre do_each_file_loop_options #remove_skipped_files_if_any_from_processing_files_array # NEEDS WORK do_loop_files_on_given_option_post - print_error_message_if_files_skipped - actions.outputs.sql? #check location - if @opt.f_pths.length > 0 - if (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil - end - if (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on \ - || @opt.act[:urls_selected][:set]==:on \ - || @opt.act[:urls_all][:set]==:on) - @tell.call.print_brown unless @opt.files.join.empty? - end - 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 - if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ - FileUtils::cd(@@env.processing_path.processing_base_tmp) do - FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on - end + #print_error_message_if_files_skipped + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil + end + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on \ + || @opt.act[:urls_selected][:set]==:on \ + || @opt.act[:urls_all][:set]==:on) + @tell.call.print_brown unless @opt.files.join.empty? + end + if defined? @@env.processing_path.processing \ + and @@env.user \ + and FileTest.directory?(@@env.processing_path.processing) \ + and @@env.processing_path.processing =~/#{@@env.user}$/ + #clean tmp processing dir of content as is located in public area + if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ + FileUtils::cd(@@env.processing_path.processing_base_tmp) do + FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on end end - elsif @opt.f_pths.length == 0 - STDERR.puts %{requested action requires valid sisu markup file [filename (.sst .ssm)] or wildcard (that includes a valid filename)} - if (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).warn(:fuchsia) - end - else #% sisu help refer to man pages - actions.prepare(@opt).site? - unless done==:ok - #SiSU_Env::InfoAbout.new(@opt).sisu_about - end end - @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|zip)|sisupod\.(?:txz|zip)?|\S+?\.ssp)$/ - if @opt.selections.str=~/--pg/ - elsif @opt.fns=~/\.kdi$/ \ - and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/ - elsif @opt.fns=~/\.sx[sdn]\.xml$/ \ - and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/ - elsif @opt.fns=~/\.ssi$/ \ - and @opt.mod.inspect =~/--identify/ - else SiSU_Hub_Actions::Operations.new(@opt).not_recognised - end - end - if @opt.fns =~/\.ssm\.sst$/ \ - and @opt.selections.str !~/[S_M]/ # rework necessary, revist, the _ flag is a hack, to keep ._sst files - @msg,@msgs='temporary file removed',nil - @tell.call.warn unless @opt.act[:quiet][:set]==:on - File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER + end + end + class HubClose + def initialize(call_path) + begin + @env=SiSU_Env::InfoEnv.new + rescue + ensure + if FileTest.directory?(@env.processing_path.processing) \ + and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ + FileUtils::cd(@env.processing_path.processing_base_tmp) do + FileUtils::rm_rf('.') end - else #SiSU::Operations.new(fns,'html').not_found end + Dir.chdir(call_path) end end end 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' diff --git a/lib/sisu/v5/hub_loop_markup_files.rb b/lib/sisu/v5/hub_loop_markup_files.rb new file mode 100644 index 00000000..9d86e73f --- /dev/null +++ b/lib/sisu/v5/hub_loop_markup_files.rb @@ -0,0 +1,176 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/licenses/gpl.html> + + <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git + <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/hub_loop_markup_files.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: SiSU information Structuring Universe, text structuring, + processing, publishing, search + +=end +module SiSU_Hub_Loops + require_relative 'constants' # constants.rb + require_relative 'se' # se.rb + include SiSU_Env + include SiSU_Screen + require_relative 'hub_actions' # hub_actions.rb + require_relative 'hub_options' # hub_options.rb + require_relative 'dp' # dp.rb + include SiSU_Param + require_relative 'defaults' # defaults.rb + include SiSU_Viz + require_relative 'utils' # utils.rb + begin + require 'uri' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('uri NOT FOUND (LoadError)') + end + class OptionLoopFiles + attr_reader :opt + def initialize(opt) + @opt=opt + @r=Px[:lng_lst_rgx] + end + def loop_files_on_given_option + @opt.files.each_with_index do |fno,i| + @opt.fno,@opt.fns=fno,fno + @opt.f_pth=@opt.f_pths[i] + if fno !~/\.-sst$/ + @opt.pth=@opt.paths[i] + @opt.lng=@opt.lngs[i] + end + @@pwd=@opt.pth + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + Dir.chdir(@opt.f_pth[:pth]) #watch + SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track + @env=SiSU_Env::InfoEnv.new(fno) + yield + end + end + def loop_files_on_given_option_bundle + @files_bundle={} + @opt.files.each_with_index do |fno,i| + fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') + unless @files_bundle[fn_base_bundle] + @files_bundle[fn_base_bundle]={ status: :todo } + end + end + @opt.files.each_with_index do |fno,i| + fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') + unless @files_bundle[fn_base_bundle][:status] == :done + @files_bundle[fn_base_bundle][:status] = :done + @opt.fns=fno + @opt.fno=fno + @opt.f_pth=@opt.f_pths[i] + if fno !~/\.-sst$/ + @opt.pth=@opt.paths[i] + @opt.lng=@opt.lngs[i] + end + @@pwd=@opt.pth + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + Dir.chdir(@opt.f_pth[:pth]) #watch + @env=SiSU_Env::InfoEnv.new(fno) + yield + else next + end + end + end + def manifest_on_files_translated + number_of_files={} + @opt.files.each_with_index do |fns,i| + fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') + (number_of_files[fn].is_a?(Array)) \ + ? (number_of_files[fn] << i) + : (number_of_files.store(fn,[i])) + end + files_translated_idx=[] + number_of_files.each do |x| + if x[1].length > 1 + files_translated_idx << x[1] + end + end + if files_translated_idx.flatten.length > 1 + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest re-run on (currently generated) translated 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=Dir.pwd + @opt.lng='en' + elsif @opt.fno =~/\.txz$/ + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + else + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + end + @@pwd=@opt.pth + Dir.chdir(@opt.pth) #watch + @env=SiSU_Env::InfoEnv.new(@opt.fns) + yield + end + end + end + end +end +__END__ diff --git a/lib/sisu/v5/hub_options.rb b/lib/sisu/v5/hub_options.rb index d822ebd5..849be52f 100644 --- a/lib/sisu/v5/hub_options.rb +++ b/lib/sisu/v5/hub_options.rb @@ -267,11 +267,11 @@ module SiSU_Commandline end def init a=@a + s=expand_numeric_shortcuts(a) + q=set_files_and_paths_and_general_extract(s) + files=(q[:files].length > 0) ? :true : :false + @select_arr=opt_cmd_and_mod_adjust(q[:opt_ch],q[:selections],files) if a.length > 0 - s=expand_numeric_shortcuts(a) - q=set_files_and_paths_and_general_extract(s) - files=(q[:files].length > 0) ? :true : :false - @select_arr=opt_cmd_and_mod_adjust(q[:opt_ch],q[:selections],files) @what=q[:what] unless q[:what].empty? @paths = q[:paths] @files = q[:files] @@ -557,10 +557,6 @@ module SiSU_Commandline s.strip! end def opt_cmd_and_mod_adjust(ch,select_arr,files) -if @select_arr.length > 0 - p __LINE__ - p @selection -end select_arr=select_arr.flatten sel_init=select_arr.flatten shortcut=SiSU_Env::InfoProcessingFlag.new @@ -709,7 +705,7 @@ end if ch =~/F/ then select_arr << '--sample-search-form' ch=ch.gsub(/[F]/,'') end - if ch =~/w/ then select_arr << '--webrick' + if ch =~/W/ then select_arr << '--webrick' ch=ch.gsub(/[w]/,'') end if ch =~/M/ then select_arr << '--maintenance' @@ -743,6 +739,12 @@ end end end else + if ch =~/c/ then select_arr << '--color-toggle' + ch=ch.gsub(/[c]/,'') + end + if ch =~/k/ then select_arr << '--color-off' + ch=ch.gsub(/[k]/,'') + end if ch =~/C/ then select_arr << '--config' ch=ch.gsub(/[C]+/,'') end @@ -754,9 +756,21 @@ end ch=ch.gsub(/[D]/,'') end end + if ch =~/W/ then select_arr << '--webrick' + ch=ch.gsub(/[w]/,'') + end if ch =~/v/ then select_arr << '--version' ch=ch.gsub(/[v]/,'') end + if ch =~/M/ then select_arr << '--maintenance' + ch=ch.gsub(/[M]/,'') + end + if ch =~/V/ then select_arr << '--very-verbose' + ch=ch.gsub(/[V]/,'') + end + if ch =~/q/ then select_arr << '--quiet' + ch=ch.gsub(/[q]/,'') + end end select_arr=select_arr.flatten.compact.uniq.sort end @@ -1360,10 +1374,20 @@ end :md5 else :na end - act[:sample_search_form]=select_arr.inspect \ - =~/"--sample-search-form"/ \ - ? { bool: true, set: :on } - : { bool: false, set: :na } + act[:sample_search_form]=if select_arr.inspect \ + =~/"--sample-search-form"/ + if select_arr.inspect \ + =~/"--db[-=]pg"/ + { bool: true, set: :on, db: :pg } + elsif select_arr.inspect \ + =~/"--db[-=]sqlite"/ + { bool: true, set: :on, db: :sqlite } + else + { bool: true, set: :on, db: :na } + end + else + { bool: false, set: :na, db: :na } + end act[:webrick]=select_arr.inspect \ =~/"--webrick"/ \ ? { bool: true, set: :on } @@ -1506,7 +1530,7 @@ end { bool: false, set: :na } end act[:verbose_plus]=if select_arr.inspect \ - =~/"--very-verbose"/ + =~/"--very-verbose"|"--verbose-very"/ act[:console_messages] << ' --very-verbose ' { bool: true, set: :on } else diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb index 66798dbd..f0c48b3e 100644 --- a/lib/sisu/v5/po4a.rb +++ b/lib/sisu/v5/po4a.rb @@ -187,8 +187,8 @@ module SiSU_Po4a @brace_url=SiSU_Viz::Defaults.new.url_decoration @vz=SiSU_Viz::Defaults.new @tab="\t" - @@endnotes_=(@md.opt.mod.inspect =~/--endnote/) ? true : false # --footnote - @br=(@md.opt.mod.inspect =~/--dos/) ? "\r\n" : "\n" # --unix + @@endnotes_=(@md.opt.selections.str =~/--endnote/) ? true : false # --footnote + @br=(@md.opt.selections.str =~/--dos/) ? "\r\n" : "\n" # --unix @pot={ body: [], open: [], close: [], head: [], metadata: [], tail: [] } end def songsheet diff --git a/lib/sisu/v5/se_db.rb b/lib/sisu/v5/se_db.rb index 3c6fdcba..fcb5fc0d 100644 --- a/lib/sisu/v5/se_db.rb +++ b/lib/sisu/v5/se_db.rb @@ -94,10 +94,10 @@ module SiSU_Info_Db def psql def user(opt=nil) if opt \ - and opt.selections.str.inspect =~/--db-user[=-]["']?(\S+)["']+/ + and opt.selections.str =~/--db-user[=-]["']?(\S+)["']+/ $1 elsif opt \ - and opt.mod =~/--webserv[=-]webrick/ + and opt.selections.str =~/--webserv[=-]webrick/ @env.user else ((defined? @rc['db']['postgresql']['user']) \ diff --git a/lib/sisu/v5/se_info_env.rb b/lib/sisu/v5/se_info_env.rb index 5d91e433..6e3dc2ef 100644 --- a/lib/sisu/v5/se_info_env.rb +++ b/lib/sisu/v5/se_info_env.rb @@ -1634,7 +1634,7 @@ WOK http=http.strip end def webserv_base_cgi(opt=nil) #web url for local webserv (localhost, or hostname) - http=if opt.selections.str =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ + http_cgi=if opt.selections.str =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ m=$1 (m=~/http\/\/:/) ? m : %{http://#{m}} elsif defined? @rc['webserv_cgi']['host'] \ @@ -1642,7 +1642,7 @@ WOK http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) http + @rc['webserv_cgi']['host'] + ':' \ - + port.webserv_port_cgi(opt) + + port.webserv_port_cgi(opt).to_s else http + @rc['webserv_cgi']['host'] end @@ -1650,11 +1650,11 @@ WOK http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) http + webserv_host_base + ':' \ - + port.webserv_port_cgi(opt) - else "#{http}#{webserv_host_base}" + + port.webserv_port_cgi(opt).to_s + else http + webserv_host_base end end - http=http.strip + http_cgi=http_cgi.strip #%q{http://#{ENV['HTTP_HOST']}} end def webrick #must have a port #REMOVE @@ -1666,12 +1666,13 @@ WOK 'https://' else defaults end - "#{http}#{@rc['webserv_cgi']['host']}" + http + @rc['webserv_cgi']['host'] elsif webserv_host_base \ and webserv_host_base.is_a?(String) - http + webserv_host_base + webserv_host_base else - http + 'localhost' + #http + 'localhost' + 'localhost' end end def webserv #web url for local webserv (localhost, or hostname) @@ -1833,8 +1834,7 @@ WOK else if defined? @rc['webserv_cgi']['port'] if @rc['webserv_cgi']['port'].nil? \ - and (defined? @md.opt.mod \ - and not @md.opt.mod.nil? \ + and (defined? @md.opt.selections \ and @md.opt.selections.str=~/webrick/) defaults[:webserv_port_cgi] elsif not @rc['webserv_cgi']['port'].nil? @@ -1847,14 +1847,13 @@ WOK end def webserv_port_cgi(opt=nil) port=if opt \ - and @md.opt.act[:sample_search_form][:set]==:on \ - and opt.selections.str=~/port=(\d+)/ + and opt.act[:sample_search_form][:set]==:on \ + and opt.selections.str=~/port[=-](\d+)/ $1 else port=if defined? @rc['webserv_cgi']['port'] if @rc['webserv_cgi']['port'].nil? \ - and (defined? opt.mod \ - and not opt.mod.nil? \ + and (defined? opt.selections \ and opt.selections.str=~/webrick/) defaults[:webserv_port_cgi] elsif not @rc['webserv_cgi']['port'].nil? @@ -1862,14 +1861,14 @@ WOK else nil end else - if (defined? opt.mod \ - and not opt.mod.nil? \ + if (defined? opt.selections \ and opt.selections.str=~/webrick/) defaults[:webserv_port_cgi] else nil end end end + port.to_s end self end diff --git a/lib/sisu/v5/sitemaps.rb b/lib/sisu/v5/sitemaps.rb index 2d157096..fd2d58c6 100644 --- a/lib/sisu/v5/sitemaps.rb +++ b/lib/sisu/v5/sitemaps.rb @@ -88,7 +88,7 @@ module SiSU_Sitemaps @fnb_utf8_xml=@md.fnb.dup @trans.char_enc.utf8(@fnb_utf8_xml) if @sys.locale =~/utf-?8/i #% utf8 output_map(sitemap) - elsif @opt.mod.inspect =~/--sitemaps/ + elsif @opt.selections.str =~/--sitemaps/ @sitemap_idx_fn='sitemapindex.xml' @env=SiSU_Env::InfoEnv.new output_idx(sitemap_index) diff --git a/lib/sisu/v5/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb index 6002e2fc..2ce0fc7f 100644 --- a/lib/sisu/v5/sst_convert_markup.rb +++ b/lib/sisu/v5/sst_convert_markup.rb @@ -201,22 +201,22 @@ WOK and @opt.files.length > 0 mr=nil #%% changes to make m match, r replace --------------------------> - if @opt.mod.inspect =~/--help/ then help - elsif @opt.mod.inspect =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/ - ext=case @opt.mod.inspect + if @opt.selections.str =~/--help/ then help + elsif @opt.selections.str =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/ + ext=case @opt.selections.str when /(?:convert|to)[=-](?:xml|sxs|sax)/ then '.sxs.xml' when /(?:convert|to)[=-](?:sxd|dom)/ then '.sxd.xml' when /(?:convert|to)[=-](?:sxn|node)/ then '.sxn.xml' end message("#{@opt.files.inspect}\n\nWARNING, PROCEED AT YOUR OWN RISK,\noverwriting any equivalent file with the extension #{ext}") - mr=case @opt.mod.inspect + mr=case @opt.selections.str when /(?:convert|to)[=-](?:sxs|sax|xml )/ then convert_to_simple_xml_model_sax when /(?:convert|to)[=-](?:sxd|dom)/ then convert_to_simple_xml_model_dom when /(?:convert|to)[=-](?:sxn|node)/ then convert_to_simple_xml_model_node else help end else - mr=case @opt.mod.inspect + mr=case @opt.selections.str when /(?:(?:37)?to-?38|--(?:convert|to)[=-](?:current|0.38))/ then convert_37_to_38 when /(?:(?:38)?to-?37|--(?:convert|to)[=-](?:0.37))/ then convert_38_to_37 when /(?:36to37)/ then convert_filename_36_to_37 @@ -227,7 +227,7 @@ WOK else help end end - unless @opt.mod.inspect =~/kdi/ + unless @opt.selections.str =~/kdi/ match_and_replace=mr #start_processing =/not used in this example/i end_processing =/END\s+OF\s+FILE/ @@ -236,8 +236,8 @@ WOK @new,@matched,@flag_start,@flag_end,@empty1,@empty2=true,false,false,false,false,false o="#{i}.bk" #o is for old markup_version=SiSU_Markup::MarkupIdentify.new(@opt).markup_version? - if (@opt.mod.inspect=~/37/ and markup_version=~/0.38/) \ - or (@opt.mod.inspect=~/current|38/ and markup_version=~/0.37/) + if (@opt.selections.str=~/37/ and markup_version=~/0.38/) \ + or (@opt.selections.str=~/current|38/ and markup_version=~/0.37/) puts "#{i} #{markup_version}" file=File.open(i,'r') cont=file.readlines @@ -300,7 +300,7 @@ WOK if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - puts "Requested conversion #{@opt.mod.inspect} markup #{markup_version} identified in #{i}" + puts "Requested conversion #{@opt.selections.str} markup #{markup_version} identified in #{i}" end end end @@ -315,7 +315,7 @@ require_relative 'hub_options' # hub_options.rb argv=$* base_path=Dir.pwd @opt=SiSU_Commandline::Options.new(argv,base_path) -case @opt.mod.inspect +case @opt.selections.str when /=kdi/ SiSU_Modify::ConvertMarkup.new(@opt).conversion when /(?:36|37|38)?to-?(?:37|38)|--convert|--to|--from|default/ @@ -324,7 +324,7 @@ when /(?:36|37|38)?to-?(?:37|38)|--convert|--to|--from|default/ SiSU_Modify::ConvertMarkup.new(@opt).conversion end else - @opt.mod='--help' + @opt.selections.str='--help' SiSU_Modify::ConvertMarkup.new(@opt).help end __END__ diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb index c3340fbd..c54543e2 100644 --- a/lib/sisu/v5/sst_do_inline_footnotes.rb +++ b/lib/sisu/v5/sst_do_inline_footnotes.rb @@ -138,7 +138,7 @@ module SiSU_ConvertFootnotes meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract if @md.en[:mismatch]==0 \ - or @md.opt.mod.inspect =~/=footnotes-force/ + or @md.opt.selections.str =~/=footnotes-force/ meta=nil ao=SiSU_ConvertFootnotes::Make.new(@md,file_array).song SiSU_Screen::Ansi.new( diff --git a/lib/sisu/v5/sst_identify_markup.rb b/lib/sisu/v5/sst_identify_markup.rb index 236ca593..70070ebb 100644 --- a/lib/sisu/v5/sst_identify_markup.rb +++ b/lib/sisu/v5/sst_identify_markup.rb @@ -436,8 +436,8 @@ WOK WOK end def query - tell=if @opt.mod.inspect =~/--query/ - tell=case @opt.mod.inspect + tell=if @opt.selections.str =~/--query/ + tell=case @opt.selections.str when /history/ "#{sisu_3_0}#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}" when /3.0/ @@ -464,7 +464,7 @@ WOK "#{sisu_0_16}\n#{sisu_0_1}" when /0.[1-9]|0.1[1-4]/ sisu_0_1 - else puts "NOT RECOGNISED: #{@opt.mod.inspect}" + else puts "NOT RECOGNISED: #{@opt.selections.str}" help_query end tell diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb index 7171ee64..02d52e93 100644 --- a/lib/sisu/v5/txt_asciidoc.rb +++ b/lib/sisu/v5/txt_asciidoc.rb @@ -138,7 +138,7 @@ module SiSU_Txt_AsciiDoc @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v5/txt_markdown.rb b/lib/sisu/v5/txt_markdown.rb index 9a184635..3eb09b16 100644 --- a/lib/sisu/v5/txt_markdown.rb +++ b/lib/sisu/v5/txt_markdown.rb @@ -137,7 +137,7 @@ module SiSU_Txt_Markdown @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v5/txt_rst.rb b/lib/sisu/v5/txt_rst.rb index 0147a6de..d06a0533 100644 --- a/lib/sisu/v5/txt_rst.rb +++ b/lib/sisu/v5/txt_rst.rb @@ -138,7 +138,7 @@ module SiSU_Txt_rST @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v5/txt_textile.rb b/lib/sisu/v5/txt_textile.rb index 43124493..d087830b 100644 --- a/lib/sisu/v5/txt_textile.rb +++ b/lib/sisu/v5/txt_textile.rb @@ -138,7 +138,7 @@ module SiSU_Txt_Textile @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v5/webrick.rb b/lib/sisu/v5/webrick.rb index f6ff970b..5a8a3223 100644 --- a/lib/sisu/v5/webrick.rb +++ b/lib/sisu/v5/webrick.rb @@ -74,7 +74,6 @@ module SiSU_Webserv include SiSU_Env include SiSU_Screen def initialize - begin #% @cX=SiSU_Screen::Ansi.new('yes').cX @env=SiSU_Env::InfoEnv.new port=SiSU_Env::InfoPort.new @@ -93,29 +92,58 @@ module SiSU_Webserv @week=Time.now.strftime(%{%Yw%W}) puts "\n" @mount.each { |x,y| - puts " #{@cX.cyan}#{x}#{@cX.off}\t#{@cX.grey}see#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/wb.cgi#{@cX.off} #{@cX.ruby}@#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}" + puts " * #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}" } - puts "#{@cX.grey}" - wb_s2=[] - #% writes file wb.cgi to shared directories ... - #% wb_top - wb_top=%q(#!/usr/bin/env ruby - # * arch-tag: webrick info on environment, mounted directories, and contents of pwd + get=Dir.pwd + brick(@port,get) + end + def brick(port,get='') + cgidir=if get=~/pwd/ then Dir.pwd + else '/usr/lib/cgi-bin' + end + port=SiSU_Env::InfoPort.new.webrick begin - require 'time' - require 'cgi' - require 'fcgi' - rescue LoadError - puts 'time, cgi or fcgi NOT FOUND (LoadError)' + s=HTTPServer.new( + Port: port, + DocumentRoot: Dir::pwd + '/htdocs', + CGIPathEnv: ENV['PATH'] + ) + cgi_dir=File.expand_path(cgidir) + @mount.each { |x,y| # mount subdirectories + s.mount(x, HTTPServlet::FileHandler, y, true) + } + s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true }) + trap("INT"){ s.shutdown } + s.start + rescue + SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix + __LINE__.to_s + ':' + __FILE__ + end + ensure end - ls=Dir.entries('./') - dir_contents=[] - ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ } - dir_contents=dir_contents.sort.join(' ') - #host=ENV['HOSTNAME'] - #host=%x{echo $HOSTNAME} - ) - wb_s1=<<WOK + end + def wb_cgi + begin #% + wb_s2='' + #% writes file wb.cgi to shared directories ... + #% wb_top + wb_top=%q(#!/usr/bin/env ruby + # * arch-tag: webrick info on environment, mounted directories, and contents of pwd + begin + require 'time' + require 'cgi' + require 'fcgi' + rescue LoadError + puts 'time, cgi or fcgi NOT FOUND (LoadError)' + end + ls=Dir.entries('./') + dir_contents=[] + ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ } + dir_contents=dir_contents.sort.join(' ') + #host=ENV['HOSTNAME'] + #host=%x{echo $HOSTNAME} + ) + wb_s1=<<-WOK page=CGI.new "html3" page.out { @@ -130,60 +158,31 @@ module SiSU_Webserv page.p {''} + page.p {''} + page.p {page.b{"Webrick Served Directories: "}} + -WOK + WOK #% wb_s2 (mounts) - @mount.each do |x,y| wb_s2 << <<WOK - page.p {page.b{'<a href="#{@host}:#{@port}#{x}/">#{x}</a> '} + '<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>'} + -WOK - end + @mount.each do |x,y| wb_s2 += <<-WOK + page.p {%{<a href="#{@host}:#{@port}#{x}/">#{x}</a> } + + %{<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>}} + + WOK + end #% wb_end - wb_end=<<WOK + wb_end=<<-WOK page.p {page.b{"Contents of PWD (see URL): "}} + page.p {"#\{dir_contents}"} } } } -WOK - @mount.each { |x,y| #% wb puts - puts y - filename=File.new("#{y}/wb.cgi",'w') - filename << wb_top - filename << wb_s1 - filename << wb_s2 - filename << wb_end - filename.close - FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &") - } - puts " #{@cX.off}" - #get=@argv.shift if @argv[0] =~/pwd/ #% argv - get=Dir.pwd - brick(@port,get) - rescue - require_relative 'se' # se.rb - SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix - __LINE__.to_s + ':' + __FILE__ - end - ensure - end - end - def brick(port,get='') - cgidir=if get=~/pwd/; Dir.pwd - else '/usr/lib/cgi-bin' # @env.path.cgi - end - port=SiSU_Env::InfoPort.new.webrick - begin - s=HTTPServer.new( - Port: port, - DocumentRoot: Dir::pwd + '/htdocs', - CGIPathEnv: ENV['PATH'] - ) - cgi_dir=File.expand_path(cgidir) - @mount.each { |x,y| # mount subdirectories - s.mount(x, HTTPServlet::FileHandler, y, true) + WOK + @mount.each { |x,y| #% wb puts + puts y + filename=File.new("#{y}/wb.cgi",'w') + filename << wb_top + filename << wb_s1 + filename << wb_s2 + filename << wb_end + filename.close + FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &") } - s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true }) - trap("INT"){ s.shutdown } - s.start rescue SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix __LINE__.to_s + ':' + __FILE__ diff --git a/lib/sisu/v6/ao_doc_objects.rb b/lib/sisu/v6/ao_doc_objects.rb index 44660469..f32f28c8 100644 --- a/lib/sisu/v6/ao_doc_objects.rb +++ b/lib/sisu/v6/ao_doc_objects.rb @@ -472,19 +472,21 @@ module SiSU_AO_DocumentStructure end end class ObjectFlag - attr_accessor :obj,:is,:of,:flag,:mod,:tmp + attr_accessor :obj,:is,:of,:flag,:act,:selections,:tmp def initialize @of=:flag - @is=@obj=@flag=@mod=@tmp=nil + @is=@obj=@flag=@act=@selections=@tmp=nil end def flag(h,o=nil) of= @of #Symbol, classification - group is= :flag #Symbol, classification - specific type obj= nil #String, text content flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content - mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content + act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content + selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@obj,@flag,@mod,@tmp=of,is,obj,flag,mod,tmp + @of, @is,@obj,@flag,@act,@selections,@tmp= + of,is, obj, flag, act, selections, tmp self end def flag_ocn(h,o=nil) @@ -492,9 +494,11 @@ module SiSU_AO_DocumentStructure is= :flag_ocn #Symbol, classification - specific type obj= nil #String, text content flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content - mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content + act= h[:act] || ((defined? o.act) ? o.act : nil) #String, text content + selections= h[:selections] || ((defined? o.selections) ? o.selections : nil) #String, text content tmp= h[:flag] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@obj,@flag,@mod,@tmp=of,is,obj,flag,mod,tmp + @of, @is,@obj,@flag,@act,@selections,@tmp= + of,is, obj, flag, act, selections,tmp self end end diff --git a/lib/sisu/v6/cgi.rb b/lib/sisu/v6/cgi.rb index 9a0dab33..1413eb5c 100644 --- a/lib/sisu/v6/cgi.rb +++ b/lib/sisu/v6/cgi.rb @@ -71,9 +71,9 @@ module SiSU_CGI #% database building doc @webserv=@opt.files[0].to_s.strip end def read - if @opt.act[:psql][:set]==:on + if @opt.act[:sample_search_form][:db]==:pg # cgi_pgsql.rb SiSU_CGI_PgSQL::SearchPgSQL.new(@opt,@webserv).pgsql - elsif @opt.act[:sqlite][:set]==:on + elsif @opt.act[:sample_search_form][:db]==:sqlite # cgi_sqlite.rb SiSU_CGI_SQLite::SearchSQLite.new(@opt,@webserv).sqlite else puts <<-WOK diff --git a/lib/sisu/v6/conf.rb b/lib/sisu/v6/conf.rb index 22111002..8f717249 100644 --- a/lib/sisu/v6/conf.rb +++ b/lib/sisu/v6/conf.rb @@ -78,7 +78,7 @@ module SiSU_Initialize ConfigSite.new(@opt).dtd ConfigSite.new(@opt).cp_local_images ConfigSite.new(@opt).cp_external_images - ConfigSite.new(@opt).cp_webserver_images #if @opt.mod.inspect =~/--init(?:ialize)?=site/ + ConfigSite.new(@opt).cp_webserver_images end end class ConfigSite #config files such as css are not updated if they already exist unless forced using the --init=site modifier diff --git a/lib/sisu/v6/dbi_discrete.rb b/lib/sisu/v6/dbi_discrete.rb index d4ddb202..99c8a7b3 100644 --- a/lib/sisu/v6/dbi_discrete.rb +++ b/lib/sisu/v6/dbi_discrete.rb @@ -95,8 +95,7 @@ module SiSU_DBI_Discrete #% database building create_and_populate end def maintenance_check(opt,file,line) - #p opt.mod - #p opt.cmd + #p opt.selections.str p "at #{file} #{line}" end def prepare @@ -169,7 +168,7 @@ module SiSU_DBI_Discrete #% database building begin SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], - "DBI (#{@sql_type}) #{@opt.mod}", + "DBI (#{@sql_type}) #{@opt.selections.str}", @opt.fns ).dbi_title unless @opt.act[:quiet][:set]==:on @db.sqlite_discrete.conn_sqlite3 diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index bb2f2176..cd66bc17 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -67,6 +67,7 @@ module SiSU include SiSU_Env include SiSU_Screen require_relative 'hub_actions' # hub_actions.rb + require_relative 'hub_loop_markup_files' # hub_loop_markup_files.rb require_relative 'hub_options' # hub_options.rb require_relative 'dp' # dp.rb include SiSU_Param @@ -81,13 +82,13 @@ module SiSU end class HubMaster def initialize(argv,call_path) - begin #% select what to do (set options & start processing (files selected if any)) - opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set - SiSU::Processing.new(opt).version_info - SiSU::Processing.new(opt).actions_without_files # do it - SiSU::Processing.new(opt).actions_on_files # do it + begin + opt=SiSU_Commandline::Options.new(argv,call_path) + SiSU::Processing.new(opt).actions_without_files + SiSU::Processing.new(opt).actions_on_files + SiSU::Processing.new(opt).actions_without_files_post rescue - selection=(opt ? opt.selection : '') + selection=(opt ? opt.selections.src : '') SiSU_Screen::Ansi.new(selection,$!,$@).rescue do __LINE__.to_s + ':' + __FILE__ end @@ -96,115 +97,6 @@ module SiSU end end end - class HubClose - def initialize(call_path) - begin - @env=SiSU_Env::InfoEnv.new - rescue - ensure - if FileTest.directory?(@env.processing_path.processing) \ - and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ - FileUtils::cd(@env.processing_path.processing_base_tmp) do - FileUtils::rm_rf('.') - end - end - Dir.chdir(call_path) - end - end - end - class OptionLoopFiles - attr_reader :opt - def initialize(opt) - @opt=opt - @r=Px[:lng_lst_rgx] - end - def loop_files_on_given_option - @opt.files.each_with_index do |fno,i| - @opt.fno,@opt.fns=fno,fno - @opt.f_pth=@opt.f_pths[i] - if fno !~/\.-sst$/ - @opt.pth=@opt.paths[i] - @opt.lng=@opt.lngs[i] - end - @@pwd=@opt.pth - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - Dir.chdir(@opt.f_pth[:pth]) #watch - SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track - @env=SiSU_Env::InfoEnv.new(fno) - yield - end - end - def loop_files_on_given_option_bundle - @files_bundle={} - @opt.files.each_with_index do |fno,i| - fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') - unless @files_bundle[fn_base_bundle] - @files_bundle[fn_base_bundle]={ status: :todo } - end - end - @opt.files.each_with_index do |fno,i| - fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') - unless @files_bundle[fn_base_bundle][:status] == :done - @files_bundle[fn_base_bundle][:status] = :done - @opt.fns=fno - @opt.fno=fno - @opt.f_pth=@opt.f_pths[i] - if fno !~/\.-sst$/ - @opt.pth=@opt.paths[i] - @opt.lng=@opt.lngs[i] - end - @@pwd=@opt.pth - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - Dir.chdir(@opt.f_pth[:pth]) #watch - @env=SiSU_Env::InfoEnv.new(fno) - yield - else next - end - end - end - def manifest_on_files_translated - number_of_files={} - @opt.files.each_with_index do |fns,i| - fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') - (number_of_files[fn].is_a?(Array)) \ - ? (number_of_files[fn] << i) - : (number_of_files.store(fn,[i])) - end - files_translated_idx=[] - number_of_files.each do |x| - if x[1].length > 1 - files_translated_idx << x[1] - end - end - if files_translated_idx.flatten.length > 1 - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - 'Manifest re-run on (currently generated) translated 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=Dir.pwd - @opt.lng='en' - elsif @opt.fno =~/\.txz$/ - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - else - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - end - @@pwd=@opt.pth - Dir.chdir(@opt.pth) #watch - @env=SiSU_Env::InfoEnv.new(@opt.fns) - yield - end - end - end - end class Processing begin require 'fileutils' @@ -239,43 +131,50 @@ module SiSU @remove_faulty_markup_files_array.join(',') end end + def do_each_file_loop_check_and_perform_selected_actions(opt) + actions=SiSU_Hub_Actions::HubActions.new(opt) + actions.outputs.each_file.abstract_objects? + actions.outputs.each_file.qrcode? + actions.outputs.each_file.hash_digests? + actions.outputs.each_file.text? + actions.outputs.each_file.html? + actions.outputs.each_file.xhtml? + actions.outputs.each_file.xml? + actions.outputs.each_file.pdf? + actions.outputs.each_file.man_or_info? + actions.outputs.each_file.sqlite_discrete? + actions.outputs.each_file.manifest? + end def do_each_file_loop_options - @opt.files.each_with_index do |fno,i| - @opt.fno=fno - @opt.fns=fno. - gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). - gsub(/\.ssm$/,'.ssm.sst') - @opt.f_pth=@opt.f_pths[i] - if @opt.fns !~/\.-sst$/ - @opt.pth=@opt.f_pths[i][:pth] - @opt.lng=@opt.f_pths[i][:lng] - else - @opt.pth=Dir.pwd - @opt.lng='en' - end - unless @opt.pth.nil? - @@pwd=@opt.pth - Dir.chdir(@opt.pth) #watch + if @opt.files.length > 0 + @opt.files.each_with_index do |fno,i| + @opt.fno=fno + @opt.fns=fno. + gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). + gsub(/\.ssm$/,'.ssm.sst') + @opt.f_pth=@opt.f_pths[i] + if @opt.fns !~/\.-sst$/ + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + else + @opt.pth=Dir.pwd + @opt.lng='en' + end + unless @opt.pth.nil? + @@pwd=@opt.pth + Dir.chdir(@opt.pth) #watch + end + #@env=SiSU_Env::InfoEnv.new(@opt.fns) + do_each_file_loop_check_and_perform_selected_actions(@opt) end - @env=SiSU_Env::InfoEnv.new(@opt.fns) - actions=SiSU_Hub_Actions::HubActions.new(@opt) - actions.outputs.each_file.abstract_objects? - actions.outputs.each_file.qrcode? - actions.outputs.each_file.hash_digests? - actions.outputs.each_file.text? - actions.outputs.each_file.html? - actions.outputs.each_file.xhtml? - actions.outputs.each_file.xml? - actions.outputs.each_file.pdf? - actions.outputs.each_file.man_or_info? - actions.outputs.each_file.sqlite_discrete? - actions.outputs.each_file.manifest? + else + do_each_file_loop_check_and_perform_selected_actions(@opt) end end def do_loop_files_on_given_option_pre begin if @opt.act[:zap][:set]==:on #% --zap, -Z - OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Hub_Loops::OptionLoopFiles.new(@opt).loop_files_on_given_option do require_relative 'zap' SiSU_Zap::Source.new(@opt).read # -Z zap.rb end @@ -285,25 +184,38 @@ module SiSU end def do_loop_files_on_given_option_post actions=SiSU_Hub_Actions::HubActions.new(@opt) - actions.outputs.loop_files.share_source? - actions.outputs.loop_files.run_termsheet? - actions.outputs.loop_files.sql? + if defined? actions.outputs.loop_files.share_source? + actions.outputs.loop_files.share_source? + end + if defined? actions.outputs.loop_files.run_termsheet? + actions.outputs.loop_files.run_termsheet? + end + if defined? actions.outputs.loop_files.sql? + actions.outputs.loop_files.sql? + end SiSU_Hub_Actions::Operations.new.counter - actions.outputs.loop_files.manifest? - actions.outputs.loop_files.sitemaps? - actions.outputs.loop_files.urls? - end - def version_info - if @opt.act[:version_info][:set]==:on - SiSU_Env::InfoAbout.new(@opt).sisu_version + if defined? actions.outputs.loop_files.manifest? + actions.outputs.loop_files.manifest? + end + if defined? actions.outputs.loop_files.sitemaps? + actions.outputs.loop_files.sitemaps? + end + if defined? actions.outputs.loop_files.urls? + actions.outputs.loop_files.urls? end end def actions_without_files actions=SiSU_Hub_Actions::HubActions.new(@opt) + actions.report.version_info? actions.prepare.site? - actions.prepare.remote_site? actions.prepare.sql? end + def actions_without_files_post + actions=SiSU_Hub_Actions::HubActions.new(@opt) + actions.prepare.remote_site? + actions.prepare.search_form? + actions.prepare.webrick? + end def actions_on_files if @opt.act[:profile][:set]==:on begin @@ -314,71 +226,51 @@ module SiSU end end actions=SiSU_Hub_Actions::HubActions.new(@opt) - actions.outputs.each_file.harvest? #check + actions.outputs.each_file.harvest? actions.outputs.init? do_loop_files_on_given_option_pre do_each_file_loop_options #remove_skipped_files_if_any_from_processing_files_array # NEEDS WORK do_loop_files_on_given_option_post - print_error_message_if_files_skipped - actions.outputs.sql? #check location - if @opt.f_pths.length > 0 - if (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil - end - if (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on \ - || @opt.act[:urls_selected][:set]==:on \ - || @opt.act[:urls_all][:set]==:on) - @tell.call.print_brown unless @opt.files.join.empty? - end - 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 - if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ - FileUtils::cd(@@env.processing_path.processing_base_tmp) do - FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on - end + #print_error_message_if_files_skipped + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil + end + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on \ + || @opt.act[:urls_selected][:set]==:on \ + || @opt.act[:urls_all][:set]==:on) + @tell.call.print_brown unless @opt.files.join.empty? + end + if defined? @@env.processing_path.processing \ + and @@env.user \ + and FileTest.directory?(@@env.processing_path.processing) \ + and @@env.processing_path.processing =~/#{@@env.user}$/ + #clean tmp processing dir of content as is located in public area + if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ + FileUtils::cd(@@env.processing_path.processing_base_tmp) do + FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on end end - elsif @opt.f_pths.length == 0 - STDERR.puts %{requested action requires valid sisu markup file [filename (.sst .ssm)] or wildcard (that includes a valid filename)} - if (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).warn(:fuchsia) - end - else #% sisu help refer to man pages - actions.prepare(@opt).site? - unless done==:ok - #SiSU_Env::InfoAbout.new(@opt).sisu_about - end end - @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|zip)|sisupod\.(?:txz|zip)?|\S+?\.ssp)$/ - if @opt.selections.str=~/--pg/ - elsif @opt.fns=~/\.kdi$/ \ - and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/ - elsif @opt.fns=~/\.sx[sdn]\.xml$/ \ - and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/ - elsif @opt.fns=~/\.ssi$/ \ - and @opt.mod.inspect =~/--identify/ - else SiSU_Hub_Actions::Operations.new(@opt).not_recognised - end - end - if @opt.fns =~/\.ssm\.sst$/ \ - and @opt.selections.str !~/[S_M]/ # rework necessary, revist, the _ flag is a hack, to keep ._sst files - @msg,@msgs='temporary file removed',nil - @tell.call.warn unless @opt.act[:quiet][:set]==:on - File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER + end + end + class HubClose + def initialize(call_path) + begin + @env=SiSU_Env::InfoEnv.new + rescue + ensure + if FileTest.directory?(@env.processing_path.processing) \ + and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ + FileUtils::cd(@env.processing_path.processing_base_tmp) do + FileUtils::rm_rf('.') end - else #SiSU::Operations.new(fns,'html').not_found end + Dir.chdir(call_path) end end end diff --git a/lib/sisu/v6/hub_actions.rb b/lib/sisu/v6/hub_actions.rb index f6fb7d39..2be0304b 100644 --- a/lib/sisu/v6/hub_actions.rb +++ b/lib/sisu/v6/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' diff --git a/lib/sisu/v6/hub_loop_markup_files.rb b/lib/sisu/v6/hub_loop_markup_files.rb new file mode 100644 index 00000000..4570b705 --- /dev/null +++ b/lib/sisu/v6/hub_loop_markup_files.rb @@ -0,0 +1,176 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/licenses/gpl.html> + + <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git + <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> + <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/hub_loop_markup_files.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: SiSU information Structuring Universe, text structuring, + processing, publishing, search + +=end +module SiSU_Hub_Loops + require_relative 'constants' # constants.rb + require_relative 'se' # se.rb + include SiSU_Env + include SiSU_Screen + require_relative 'hub_actions' # hub_actions.rb + require_relative 'hub_options' # hub_options.rb + require_relative 'dp' # dp.rb + include SiSU_Param + require_relative 'defaults' # defaults.rb + include SiSU_Viz + require_relative 'utils' # utils.rb + begin + require 'uri' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('uri NOT FOUND (LoadError)') + end + class OptionLoopFiles + attr_reader :opt + def initialize(opt) + @opt=opt + @r=Px[:lng_lst_rgx] + end + def loop_files_on_given_option + @opt.files.each_with_index do |fno,i| + @opt.fno,@opt.fns=fno,fno + @opt.f_pth=@opt.f_pths[i] + if fno !~/\.-sst$/ + @opt.pth=@opt.paths[i] + @opt.lng=@opt.lngs[i] + end + @@pwd=@opt.pth + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + Dir.chdir(@opt.f_pth[:pth]) #watch + SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track + @env=SiSU_Env::InfoEnv.new(fno) + yield + end + end + def loop_files_on_given_option_bundle + @files_bundle={} + @opt.files.each_with_index do |fno,i| + fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') + unless @files_bundle[fn_base_bundle] + @files_bundle[fn_base_bundle]={ status: :todo } + end + end + @opt.files.each_with_index do |fno,i| + fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') + unless @files_bundle[fn_base_bundle][:status] == :done + @files_bundle[fn_base_bundle][:status] = :done + @opt.fns=fno + @opt.fno=fno + @opt.f_pth=@opt.f_pths[i] + if fno !~/\.-sst$/ + @opt.pth=@opt.paths[i] + @opt.lng=@opt.lngs[i] + end + @@pwd=@opt.pth + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + Dir.chdir(@opt.f_pth[:pth]) #watch + @env=SiSU_Env::InfoEnv.new(fno) + yield + else next + end + end + end + def manifest_on_files_translated + number_of_files={} + @opt.files.each_with_index do |fns,i| + fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') + (number_of_files[fn].is_a?(Array)) \ + ? (number_of_files[fn] << i) + : (number_of_files.store(fn,[i])) + end + files_translated_idx=[] + number_of_files.each do |x| + if x[1].length > 1 + files_translated_idx << x[1] + end + end + if files_translated_idx.flatten.length > 1 + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest re-run on (currently generated) translated 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=Dir.pwd + @opt.lng='en' + elsif @opt.fno =~/\.txz$/ + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + else + @opt.pth=@opt.f_pths[i][:pth] + @opt.lng=@opt.f_pths[i][:lng] + end + @@pwd=@opt.pth + Dir.chdir(@opt.pth) #watch + @env=SiSU_Env::InfoEnv.new(@opt.fns) + yield + end + end + end + end +end +__END__ diff --git a/lib/sisu/v6/hub_options.rb b/lib/sisu/v6/hub_options.rb index acd95612..cedcdcfe 100644 --- a/lib/sisu/v6/hub_options.rb +++ b/lib/sisu/v6/hub_options.rb @@ -267,11 +267,11 @@ module SiSU_Commandline end def init a=@a + s=expand_numeric_shortcuts(a) + q=set_files_and_paths_and_general_extract(s) + files=(q[:files].length > 0) ? :true : :false + @select_arr=opt_cmd_and_mod_adjust(q[:opt_ch],q[:selections],files) if a.length > 0 - s=expand_numeric_shortcuts(a) - q=set_files_and_paths_and_general_extract(s) - files=(q[:files].length > 0) ? :true : :false - @select_arr=opt_cmd_and_mod_adjust(q[:opt_ch],q[:selections],files) @what=q[:what] unless q[:what].empty? @paths = q[:paths] @files = q[:files] @@ -557,10 +557,6 @@ module SiSU_Commandline s.strip! end def opt_cmd_and_mod_adjust(ch,select_arr,files) -if @select_arr.length > 0 - p __LINE__ - p @selection -end select_arr=select_arr.flatten sel_init=select_arr.flatten shortcut=SiSU_Env::InfoProcessingFlag.new @@ -709,7 +705,7 @@ end if ch =~/F/ then select_arr << '--sample-search-form' ch=ch.gsub(/[F]/,'') end - if ch =~/w/ then select_arr << '--webrick' + if ch =~/W/ then select_arr << '--webrick' ch=ch.gsub(/[w]/,'') end if ch =~/M/ then select_arr << '--maintenance' @@ -743,6 +739,12 @@ end end end else + if ch =~/c/ then select_arr << '--color-toggle' + ch=ch.gsub(/[c]/,'') + end + if ch =~/k/ then select_arr << '--color-off' + ch=ch.gsub(/[k]/,'') + end if ch =~/C/ then select_arr << '--config' ch=ch.gsub(/[C]+/,'') end @@ -754,9 +756,21 @@ end ch=ch.gsub(/[D]/,'') end end + if ch =~/W/ then select_arr << '--webrick' + ch=ch.gsub(/[w]/,'') + end if ch =~/v/ then select_arr << '--version' ch=ch.gsub(/[v]/,'') end + if ch =~/M/ then select_arr << '--maintenance' + ch=ch.gsub(/[M]/,'') + end + if ch =~/V/ then select_arr << '--very-verbose' + ch=ch.gsub(/[V]/,'') + end + if ch =~/q/ then select_arr << '--quiet' + ch=ch.gsub(/[q]/,'') + end end select_arr=select_arr.flatten.compact.uniq.sort end @@ -1360,10 +1374,20 @@ end :md5 else :na end - act[:sample_search_form]=select_arr.inspect \ - =~/"--sample-search-form"/ \ - ? { bool: true, set: :on } - : { bool: false, set: :na } + act[:sample_search_form]=if select_arr.inspect \ + =~/"--sample-search-form"/ + if select_arr.inspect \ + =~/"--db[-=]pg"/ + { bool: true, set: :on, db: :pg } + elsif select_arr.inspect \ + =~/"--db[-=]sqlite"/ + { bool: true, set: :on, db: :sqlite } + else + { bool: true, set: :on, db: :na } + end + else + { bool: false, set: :na, db: :na } + end act[:webrick]=select_arr.inspect \ =~/"--webrick"/ \ ? { bool: true, set: :on } @@ -1506,7 +1530,7 @@ end { bool: false, set: :na } end act[:verbose_plus]=if select_arr.inspect \ - =~/"--very-verbose"/ + =~/"--very-verbose"|"--verbose-very"/ act[:console_messages] << ' --very-verbose ' { bool: true, set: :on } else diff --git a/lib/sisu/v6/po4a.rb b/lib/sisu/v6/po4a.rb index e6042492..0f432f98 100644 --- a/lib/sisu/v6/po4a.rb +++ b/lib/sisu/v6/po4a.rb @@ -187,8 +187,8 @@ module SiSU_Po4a @brace_url=SiSU_Viz::Defaults.new.url_decoration @vz=SiSU_Viz::Defaults.new @tab="\t" - @@endnotes_=(@md.opt.mod.inspect =~/--endnote/) ? true : false # --footnote - @br=(@md.opt.mod.inspect =~/--dos/) ? "\r\n" : "\n" # --unix + @@endnotes_=(@md.opt.selections.str =~/--endnote/) ? true : false # --footnote + @br=(@md.opt.selections.str =~/--dos/) ? "\r\n" : "\n" # --unix @pot={ body: [], open: [], close: [], head: [], metadata: [], tail: [] } end def songsheet diff --git a/lib/sisu/v6/se_db.rb b/lib/sisu/v6/se_db.rb index 542b4ef3..ac226675 100644 --- a/lib/sisu/v6/se_db.rb +++ b/lib/sisu/v6/se_db.rb @@ -94,10 +94,10 @@ module SiSU_Info_Db def psql def user(opt=nil) if opt \ - and opt.selections.str.inspect =~/--db-user[=-]["']?(\S+)["']+/ + and opt.selections.str =~/--db-user[=-]["']?(\S+)["']+/ $1 elsif opt \ - and opt.mod =~/--webserv[=-]webrick/ + and opt.selections.str =~/--webserv[=-]webrick/ @env.user else ((defined? @rc['db']['postgresql']['user']) \ diff --git a/lib/sisu/v6/se_info_env.rb b/lib/sisu/v6/se_info_env.rb index bda773ff..0ce6f63a 100644 --- a/lib/sisu/v6/se_info_env.rb +++ b/lib/sisu/v6/se_info_env.rb @@ -1634,7 +1634,7 @@ WOK http=http.strip end def webserv_base_cgi(opt=nil) #web url for local webserv (localhost, or hostname) - http=if opt.selections.str =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ + http_cgi=if opt.selections.str =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ m=$1 (m=~/http\/\/:/) ? m : %{http://#{m}} elsif defined? @rc['webserv_cgi']['host'] \ @@ -1642,7 +1642,7 @@ WOK http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) http + @rc['webserv_cgi']['host'] + ':' \ - + port.webserv_port_cgi(opt) + + port.webserv_port_cgi(opt).to_s else http + @rc['webserv_cgi']['host'] end @@ -1650,11 +1650,11 @@ WOK http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) http + webserv_host_base + ':' \ - + port.webserv_port_cgi(opt) - else "#{http}#{webserv_host_base}" + + port.webserv_port_cgi(opt).to_s + else http + webserv_host_base end end - http=http.strip + http_cgi=http_cgi.strip #%q{http://#{ENV['HTTP_HOST']}} end def webrick #must have a port #REMOVE @@ -1666,12 +1666,13 @@ WOK 'https://' else defaults end - "#{http}#{@rc['webserv_cgi']['host']}" + http + @rc['webserv_cgi']['host'] elsif webserv_host_base \ and webserv_host_base.is_a?(String) - http + webserv_host_base + webserv_host_base else - http + 'localhost' + #http + 'localhost' + 'localhost' end end def webserv #web url for local webserv (localhost, or hostname) @@ -1833,8 +1834,7 @@ WOK else if defined? @rc['webserv_cgi']['port'] if @rc['webserv_cgi']['port'].nil? \ - and (defined? @md.opt.mod \ - and not @md.opt.mod.nil? \ + and (defined? @md.opt.selections \ and @md.opt.selections.str=~/webrick/) defaults[:webserv_port_cgi] elsif not @rc['webserv_cgi']['port'].nil? @@ -1847,14 +1847,13 @@ WOK end def webserv_port_cgi(opt=nil) port=if opt \ - and @md.opt.act[:sample_search_form][:set]==:on \ - and opt.selections.str=~/port=(\d+)/ + and opt.act[:sample_search_form][:set]==:on \ + and opt.selections.str=~/port[=-](\d+)/ $1 else port=if defined? @rc['webserv_cgi']['port'] if @rc['webserv_cgi']['port'].nil? \ - and (defined? opt.mod \ - and not opt.mod.nil? \ + and (defined? opt.selections \ and opt.selections.str=~/webrick/) defaults[:webserv_port_cgi] elsif not @rc['webserv_cgi']['port'].nil? @@ -1862,14 +1861,14 @@ WOK else nil end else - if (defined? opt.mod \ - and not opt.mod.nil? \ + if (defined? opt.selections \ and opt.selections.str=~/webrick/) defaults[:webserv_port_cgi] else nil end end end + port.to_s end self end diff --git a/lib/sisu/v6/sitemaps.rb b/lib/sisu/v6/sitemaps.rb index e656693a..1b2cabef 100644 --- a/lib/sisu/v6/sitemaps.rb +++ b/lib/sisu/v6/sitemaps.rb @@ -88,7 +88,7 @@ module SiSU_Sitemaps @fnb_utf8_xml=@md.fnb.dup @trans.char_enc.utf8(@fnb_utf8_xml) if @sys.locale =~/utf-?8/i #% utf8 output_map(sitemap) - elsif @opt.mod.inspect =~/--sitemaps/ + elsif @opt.selections.str =~/--sitemaps/ @sitemap_idx_fn='sitemapindex.xml' @env=SiSU_Env::InfoEnv.new output_idx(sitemap_index) diff --git a/lib/sisu/v6/sst_convert_markup.rb b/lib/sisu/v6/sst_convert_markup.rb index 6e73d25f..60436165 100644 --- a/lib/sisu/v6/sst_convert_markup.rb +++ b/lib/sisu/v6/sst_convert_markup.rb @@ -201,22 +201,22 @@ WOK and @opt.files.length > 0 mr=nil #%% changes to make m match, r replace --------------------------> - if @opt.mod.inspect =~/--help/ then help - elsif @opt.mod.inspect =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/ - ext=case @opt.mod.inspect + if @opt.selections.str =~/--help/ then help + elsif @opt.selections.str =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/ + ext=case @opt.selections.str when /(?:convert|to)[=-](?:xml|sxs|sax)/ then '.sxs.xml' when /(?:convert|to)[=-](?:sxd|dom)/ then '.sxd.xml' when /(?:convert|to)[=-](?:sxn|node)/ then '.sxn.xml' end message("#{@opt.files.inspect}\n\nWARNING, PROCEED AT YOUR OWN RISK,\noverwriting any equivalent file with the extension #{ext}") - mr=case @opt.mod.inspect + mr=case @opt.selections.str when /(?:convert|to)[=-](?:sxs|sax|xml )/ then convert_to_simple_xml_model_sax when /(?:convert|to)[=-](?:sxd|dom)/ then convert_to_simple_xml_model_dom when /(?:convert|to)[=-](?:sxn|node)/ then convert_to_simple_xml_model_node else help end else - mr=case @opt.mod.inspect + mr=case @opt.selections.str when /(?:(?:37)?to-?38|--(?:convert|to)[=-](?:current|0.38))/ then convert_37_to_38 when /(?:(?:38)?to-?37|--(?:convert|to)[=-](?:0.37))/ then convert_38_to_37 when /(?:36to37)/ then convert_filename_36_to_37 @@ -227,7 +227,7 @@ WOK else help end end - unless @opt.mod.inspect =~/kdi/ + unless @opt.selections.str =~/kdi/ match_and_replace=mr #start_processing =/not used in this example/i end_processing =/END\s+OF\s+FILE/ @@ -236,8 +236,8 @@ WOK @new,@matched,@flag_start,@flag_end,@empty1,@empty2=true,false,false,false,false,false o="#{i}.bk" #o is for old markup_version=SiSU_Markup::MarkupIdentify.new(@opt).markup_version? - if (@opt.mod.inspect=~/37/ and markup_version=~/0.38/) \ - or (@opt.mod.inspect=~/current|38/ and markup_version=~/0.37/) + if (@opt.selections.str=~/37/ and markup_version=~/0.38/) \ + or (@opt.selections.str=~/current|38/ and markup_version=~/0.37/) puts "#{i} #{markup_version}" file=File.open(i,'r') cont=file.readlines @@ -300,7 +300,7 @@ WOK if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - puts "Requested conversion #{@opt.mod.inspect} markup #{markup_version} identified in #{i}" + puts "Requested conversion #{@opt.selections.str} markup #{markup_version} identified in #{i}" end end end @@ -315,7 +315,7 @@ require_relative 'hub_options' # hub_options.rb argv=$* base_path=Dir.pwd @opt=SiSU_Commandline::Options.new(argv,base_path) -case @opt.mod.inspect +case @opt.selections.str when /=kdi/ SiSU_Modify::ConvertMarkup.new(@opt).conversion when /(?:36|37|38)?to-?(?:37|38)|--convert|--to|--from|default/ @@ -324,7 +324,7 @@ when /(?:36|37|38)?to-?(?:37|38)|--convert|--to|--from|default/ SiSU_Modify::ConvertMarkup.new(@opt).conversion end else - @opt.mod='--help' + @opt.selections.str='--help' SiSU_Modify::ConvertMarkup.new(@opt).help end __END__ diff --git a/lib/sisu/v6/sst_do_inline_footnotes.rb b/lib/sisu/v6/sst_do_inline_footnotes.rb index afa4ca3a..60e8d7dd 100644 --- a/lib/sisu/v6/sst_do_inline_footnotes.rb +++ b/lib/sisu/v6/sst_do_inline_footnotes.rb @@ -138,7 +138,7 @@ module SiSU_ConvertFootnotes meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract if @md.en[:mismatch]==0 \ - or @md.opt.mod.inspect =~/=footnotes-force/ + or @md.opt.selections.str =~/=footnotes-force/ meta=nil ao=SiSU_ConvertFootnotes::Make.new(@md,file_array).song SiSU_Screen::Ansi.new( diff --git a/lib/sisu/v6/sst_identify_markup.rb b/lib/sisu/v6/sst_identify_markup.rb index 51af46c4..920098ed 100644 --- a/lib/sisu/v6/sst_identify_markup.rb +++ b/lib/sisu/v6/sst_identify_markup.rb @@ -436,8 +436,8 @@ WOK WOK end def query - tell=if @opt.mod.inspect =~/--query/ - tell=case @opt.mod.inspect + tell=if @opt.selections.str =~/--query/ + tell=case @opt.selections.str when /history/ "#{sisu_3_0}#{sisu_2_0}#{sisu_1_0}#{sisu_0_69}#{sisu_0_66}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}" when /3.0/ @@ -464,7 +464,7 @@ WOK "#{sisu_0_16}\n#{sisu_0_1}" when /0.[1-9]|0.1[1-4]/ sisu_0_1 - else puts "NOT RECOGNISED: #{@opt.mod.inspect}" + else puts "NOT RECOGNISED: #{@opt.selections.str}" help_query end tell diff --git a/lib/sisu/v6/txt_asciidoc.rb b/lib/sisu/v6/txt_asciidoc.rb index fbf9bb29..1b6798c6 100644 --- a/lib/sisu/v6/txt_asciidoc.rb +++ b/lib/sisu/v6/txt_asciidoc.rb @@ -138,7 +138,7 @@ module SiSU_Txt_AsciiDoc @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v6/txt_markdown.rb b/lib/sisu/v6/txt_markdown.rb index 54d48eab..0828bdb8 100644 --- a/lib/sisu/v6/txt_markdown.rb +++ b/lib/sisu/v6/txt_markdown.rb @@ -137,7 +137,7 @@ module SiSU_Txt_Markdown @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v6/txt_rst.rb b/lib/sisu/v6/txt_rst.rb index 0b3dcdde..7eca551d 100644 --- a/lib/sisu/v6/txt_rst.rb +++ b/lib/sisu/v6/txt_rst.rb @@ -138,7 +138,7 @@ module SiSU_Txt_rST @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v6/txt_textile.rb b/lib/sisu/v6/txt_textile.rb index 09ca494d..ff5dd727 100644 --- a/lib/sisu/v6/txt_textile.rb +++ b/lib/sisu/v6/txt_textile.rb @@ -138,7 +138,7 @@ module SiSU_Txt_Textile @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" - @@endnotes_=case md.opt.mod.inspect + @@endnotes_=case md.opt.selections.str when /--footnote/ then false when /--endnote/ then true else true diff --git a/lib/sisu/v6/webrick.rb b/lib/sisu/v6/webrick.rb index 8ebbf2d6..feb28c7d 100644 --- a/lib/sisu/v6/webrick.rb +++ b/lib/sisu/v6/webrick.rb @@ -74,7 +74,6 @@ module SiSU_Webserv include SiSU_Env include SiSU_Screen def initialize - begin #% @cX=SiSU_Screen::Ansi.new('yes').cX @env=SiSU_Env::InfoEnv.new port=SiSU_Env::InfoPort.new @@ -93,29 +92,58 @@ module SiSU_Webserv @week=Time.now.strftime(%{%Yw%W}) puts "\n" @mount.each { |x,y| - puts " #{@cX.cyan}#{x}#{@cX.off}\t#{@cX.grey}see#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/wb.cgi#{@cX.off} #{@cX.ruby}@#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}" + puts " * #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}" } - puts "#{@cX.grey}" - wb_s2=[] - #% writes file wb.cgi to shared directories ... - #% wb_top - wb_top=%q(#!/usr/bin/env ruby - # * arch-tag: webrick info on environment, mounted directories, and contents of pwd + get=Dir.pwd + brick(@port,get) + end + def brick(port,get='') + cgidir=if get=~/pwd/ then Dir.pwd + else '/usr/lib/cgi-bin' + end + port=SiSU_Env::InfoPort.new.webrick begin - require 'time' - require 'cgi' - require 'fcgi' - rescue LoadError - puts 'time, cgi or fcgi NOT FOUND (LoadError)' + s=HTTPServer.new( + Port: port, + DocumentRoot: Dir::pwd + '/htdocs', + CGIPathEnv: ENV['PATH'] + ) + cgi_dir=File.expand_path(cgidir) + @mount.each { |x,y| # mount subdirectories + s.mount(x, HTTPServlet::FileHandler, y, true) + } + s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true }) + trap("INT"){ s.shutdown } + s.start + rescue + SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix + __LINE__.to_s + ':' + __FILE__ + end + ensure end - ls=Dir.entries('./') - dir_contents=[] - ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ } - dir_contents=dir_contents.sort.join(' ') - #host=ENV['HOSTNAME'] - #host=%x{echo $HOSTNAME} - ) - wb_s1=<<WOK + end + def wb_cgi + begin #% + wb_s2='' + #% writes file wb.cgi to shared directories ... + #% wb_top + wb_top=%q(#!/usr/bin/env ruby + # * arch-tag: webrick info on environment, mounted directories, and contents of pwd + begin + require 'time' + require 'cgi' + require 'fcgi' + rescue LoadError + puts 'time, cgi or fcgi NOT FOUND (LoadError)' + end + ls=Dir.entries('./') + dir_contents=[] + ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ } + dir_contents=dir_contents.sort.join(' ') + #host=ENV['HOSTNAME'] + #host=%x{echo $HOSTNAME} + ) + wb_s1=<<-WOK page=CGI.new "html3" page.out { @@ -130,60 +158,31 @@ module SiSU_Webserv page.p {''} + page.p {''} + page.p {page.b{"Webrick Served Directories: "}} + -WOK + WOK #% wb_s2 (mounts) - @mount.each do |x,y| wb_s2 << <<WOK - page.p {page.b{'<a href="#{@host}:#{@port}#{x}/">#{x}</a> '} + '<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>'} + -WOK - end + @mount.each do |x,y| wb_s2 += <<-WOK + page.p {%{<a href="#{@host}:#{@port}#{x}/">#{x}</a> } + + %{<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>}} + + WOK + end #% wb_end - wb_end=<<WOK + wb_end=<<-WOK page.p {page.b{"Contents of PWD (see URL): "}} + page.p {"#\{dir_contents}"} } } } -WOK - @mount.each { |x,y| #% wb puts - puts y - filename=File.new("#{y}/wb.cgi",'w') - filename << wb_top - filename << wb_s1 - filename << wb_s2 - filename << wb_end - filename.close - FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &") - } - puts " #{@cX.off}" - #get=@argv.shift if @argv[0] =~/pwd/ #% argv - get=Dir.pwd - brick(@port,get) - rescue - require_relative 'se' # se.rb - SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix - __LINE__.to_s + ':' + __FILE__ - end - ensure - end - end - def brick(port,get='') - cgidir=if get=~/pwd/; Dir.pwd - else '/usr/lib/cgi-bin' # @env.path.cgi - end - port=SiSU_Env::InfoPort.new.webrick - begin - s=HTTPServer.new( - Port: port, - DocumentRoot: Dir::pwd + '/htdocs', - CGIPathEnv: ENV['PATH'] - ) - cgi_dir=File.expand_path(cgidir) - @mount.each { |x,y| # mount subdirectories - s.mount(x, HTTPServlet::FileHandler, y, true) + WOK + @mount.each { |x,y| #% wb puts + puts y + filename=File.new("#{y}/wb.cgi",'w') + filename << wb_top + filename << wb_s1 + filename << wb_s2 + filename << wb_end + filename.close + FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &") } - s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true }) - trap("INT"){ s.shutdown } - s.start rescue SiSU_Errors::Rescued.new($!,$@,'-W',nil).location do #fix __LINE__.to_s + ':' + __FILE__ @@ -37,8 +37,8 @@ #require 'mkmf' #create_makefile("sisu") #% manual settings, edit/update as required (note current default settings are obtained from sisu version yml file) -SiSU_version_next_stable = '5.6.0' #% set version -SiSU_version_next_unstable = '6.2.1' #% set version +SiSU_version_next_stable = '5.6.1' #% set version +SiSU_version_next_unstable = '6.2.2' #% set version #% rake file SiSU_version_generic_next_stable = '5.4.x' SiSU_version_generic_next_unstable = '6.0.x' |