From 2cd635d524721efaf5cf170b7bde79c1e910b096 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:20:18 -0400 Subject: v3: error & warning messages touched, revisit --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/cgi_pgsql.rb | 2 +- lib/sisu/v3/composite.rb | 4 +-- lib/sisu/v3/dal_hash_digest.rb | 2 +- lib/sisu/v3/dal_images.rb | 6 ++-- lib/sisu/v3/db_import.rb | 16 +++++++--- lib/sisu/v3/digests.rb | 5 ++- lib/sisu/v3/embedded.rb | 5 ++- lib/sisu/v3/epub_concordance.rb | 4 +-- lib/sisu/v3/html_promo.rb | 2 +- lib/sisu/v3/param.rb | 24 +++++++------- lib/sisu/v3/plaintext.rb | 5 ++- lib/sisu/v3/rexml.rb | 5 ++- lib/sisu/v3/screen_text_color.rb | 6 ++-- lib/sisu/v3/share_src.rb | 2 +- lib/sisu/v3/shared_sem.rb | 3 +- lib/sisu/v3/sitemaps.rb | 5 ++- lib/sisu/v3/sst_do_inline_footnotes.rb | 12 +++++-- lib/sisu/v3/sst_to_s_xml_sax.rb | 12 +++++-- lib/sisu/v3/sysenv.rb | 58 +++++++++++++++++----------------- lib/sisu/v3/texpdf.rb | 2 +- lib/sisu/v3/update.rb | 5 ++- lib/sisu/v3/webrick.rb | 9 ++++-- lib/sisu/v3/wikispeak.rb | 5 ++- 24 files changed, 124 insertions(+), 77 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 1f00bbc6..358c0f2f 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz sisu_3.2.11-1.dsc sisu_3.2.11-1.debian.tar.gz +* v3: error & warning messages touched, revisit + %% 3.2.10.orig.tar.xz (2012-05-28:22/1) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.10 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.10-1 diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index bcc854aa..f78f65f5 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -79,7 +79,7 @@ module SiSU_CGI_PgSQL available_db.flatten.each do |x| serve << x.gsub(/#{Db[:name_prefix]}(\S+)/,'\1') end - else put "WARNING: no postgresql database available, (have you created one?)" + else STDERR.puts "WARNING: no postgresql database available, (have you created one?)" end serve=serve.sort f1,f2,f3='','','' diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb index a104d281..90ec28dc 100644 --- a/lib/sisu/v3/composite.rb +++ b/lib/sisu/v3/composite.rb @@ -217,7 +217,7 @@ module SiSU_Assemble file[:prepared] else cX=SiSU_Screen::Ansi.new(@opt.cmd).cX - puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" + STDERR.puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" para end else tuned_file << para @@ -268,7 +268,7 @@ module SiSU_Assemble @ssm << loadfile else cX=SiSU_Screen::Ansi.new(@opt.cmd).cX - puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" + STDERR.puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" para end end diff --git a/lib/sisu/v3/dal_hash_digest.rb b/lib/sisu/v3/dal_hash_digest.rb index 039dc537..c30048db 100644 --- a/lib/sisu/v3/dal_hash_digest.rb +++ b/lib/sisu/v3/dal_hash_digest.rb @@ -108,7 +108,7 @@ module SiSU_DAL_Hash Digest::MD5.hexdigest(stripped_en) end t_o_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close - else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up + else STDERR.puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up end else en_plus end diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v3/dal_images.rb index e112636f..9c6dd872 100644 --- a/lib/sisu/v3/dal_images.rb +++ b/lib/sisu/v3/dal_images.rb @@ -75,7 +75,7 @@ module SiSU_DAL_Images end else if @md.opt.cmd =~/[vVM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'use of RMagick is not enabled in sisurc.yml').warn + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* use of RMagick is not enabled in sisurc.yml').warn end end data.each do |dob| @@ -101,7 +101,7 @@ module SiSU_DAL_Images img_col,img_row=img.columns,img.rows else if @md.opt.cmd =~/[vVM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn end imgk=SiSU_Env::SystemCall.new.imagemagick gmgk=SiSU_Env::SystemCall.new.graphicksmagick @@ -138,7 +138,7 @@ module SiSU_DAL_Images end else images=dob.obj.scan(m) do |image| - SiSU_Screen::Ansi.new(@md.opt.cmd,'where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/ end end end diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index 5cb12cde..03f5d221 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -164,9 +164,9 @@ module SiSU_DbImport @conn.do("COMMIT") end rescue DBI::DatabaseError => e - puts "Error code: #{e.err}" - puts "Error message: #{e.errstr}" - puts "Error SQLSTATE: #{e.state}" + STDERR.puts "Error code: #{e.err}" + STDERR.puts "Error message: #{e.errstr}" + STDERR.puts "Error SQLSTATE: #{e.state}" SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ end @@ -554,7 +554,10 @@ module SiSU_DbImport end end end - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end @tuple_array @@ -686,7 +689,10 @@ module SiSU_DbImport end t=SiSU_DbTuple::LoadUrls.new(@conn,f,u,@@id_t,@opt,@file_maint) tuple=t.tuple - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end tuple diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb index 169f9d2b..5ffabb58 100644 --- a/lib/sisu/v3/digests.rb +++ b/lib/sisu/v3/digests.rb @@ -84,7 +84,10 @@ module SiSU_DigestView end SiSU_DigestView::Source::Scroll.new(@particulars).songsheet SiSU_Env::InfoSkin.new(@md).select - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb index 861bdd08..87b37fc0 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v3/embedded.rb @@ -77,7 +77,10 @@ module SiSU_Embedded audio multimedia begin - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index 8a4d4136..df975a48 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -78,10 +78,10 @@ module SiSU_EPUB_Concordance if @md.wc_words < wordmax SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet else - SiSU_Screen::Ansi.new(@md.opt.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/ end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet end rescue diff --git a/lib/sisu/v3/html_promo.rb b/lib/sisu/v3/html_promo.rb index 9e5040c4..a2edea47 100644 --- a/lib/sisu/v3/html_promo.rb +++ b/lib/sisu/v3/html_promo.rb @@ -415,7 +415,7 @@ WOK end end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"category not found: #{category}").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* category not found: #{category}").warn unless @md.opt.cmd =~/q/ end adverts.join end diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index f1c4aa3a..78e42bd4 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -170,10 +170,10 @@ module SiSU_Param s elsif s.class==NilClass; nil elsif s.class !=String - puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" + STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else - SiSU_Screen::Ansi.new('v',"#{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ nil end end @@ -197,11 +197,11 @@ module SiSU_Param end b.delete_at(0) b.each do |d| - k,c=nil - k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d - @name_a_h[i][:hon]=c.strip if k=='hon' - @name_a_h[i][:affiliation]=c.strip if k=='affiliation' - @name_a_h[i][:nationality]=c.strip if k=='nationality' + k,c=nil + k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d + @name_a_h[i][:hon]=c.strip if k=='hon' + @name_a_h[i][:affiliation]=c.strip if k=='affiliation' + @name_a_h[i][:nationality]=c.strip if k=='nationality' end end l=@name_a_h.length @@ -1179,7 +1179,7 @@ module SiSU_Param if ok tell.txt_green if @opt.cmd =~/[vVM]/ else - SiSU_Screen::Ansi.new(@opt.cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"WARNING: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @opt.cmd =~/q/ end else SiSU_Screen::Ansi.new(@opt.cmd,'No SiSU markup version provided').warn if @opt.cmd =~/[VM]/ @@ -1518,13 +1518,13 @@ module SiSU_Param if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 - else SiSU_Screen::Ansi.new(@opt.cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/ + else SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/ end end if @en[:mark] != @en[:note] \ and @en[:note] > 0 @en[:mismatch]=@en[:note] - @en[:mark] - SiSU_Screen::Ansi.new(@opt.cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/ footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a') footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" end @@ -1535,7 +1535,7 @@ module SiSU_Param and @opt.inspect =~/P/ #@title=Md.new('Text Insert',@opt,@env).title else - SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/ end end if @author !~/[\S]/ @@ -1543,7 +1543,7 @@ module SiSU_Param and @opt.inspect =~/P/ #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator else - SiSU_Screen::Ansi.new(@opt.cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/ end end @struct={} diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index fa87da6d..2fa98883 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -102,7 +102,10 @@ module SiSU_Plaintext #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78 SiSU_Plaintext::Source::Scroll.new(dal_array,md,wrap_width).songsheet SiSU_Env::InfoSkin.new(md).select #watch - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/rexml.rb b/lib/sisu/v3/rexml.rb index 34a2acd9..886d7eab 100644 --- a/lib/sisu/v3/rexml.rb +++ b/lib/sisu/v3/rexml.rb @@ -101,7 +101,10 @@ module SiSU_Rexml SiSU_Screen::Ansi.new(@md.opt.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.cmd =~/q/ exit end - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb index 073fbf37..67022087 100644 --- a/lib/sisu/v3/screen_text_color.rb +++ b/lib/sisu/v3/screen_text_color.rb @@ -208,13 +208,13 @@ module SiSU_Screen STDERR.puts %{\t #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}#{yield if block_given?}\n\t An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}} end def warn - puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}" + STDERR.puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}" end def error - puts "\t #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off}" + STDERR.puts "\t #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off}" end def error2 - puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + STDERR.puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" end def version puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n" diff --git a/lib/sisu/v3/share_src.rb b/lib/sisu/v3/share_src.rb index bb4d2a56..ac466d33 100644 --- a/lib/sisu/v3/share_src.rb +++ b/lib/sisu/v3/share_src.rb @@ -85,7 +85,7 @@ module SiSU_Markup end end else - SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fns} -> #{@file.output_path.src.dir}").warn if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.cmd,"*WARN* Output directory does not exist","#{@opt.fns} -> #{@file.output_path.src.dir}").warn if @opt.cmd =~/[MVv]/ exit end end diff --git a/lib/sisu/v3/shared_sem.rb b/lib/sisu/v3/shared_sem.rb index 98c8483b..bd906efc 100644 --- a/lib/sisu/v3/shared_sem.rb +++ b/lib/sisu/v3/shared_sem.rb @@ -136,7 +136,8 @@ module SiSU_Sem def sem_marker_added_extra_parts unless @para =~ rgx.exclude @para.gsub!(rgx.whole_csc_ae,'') - if @para =~rgx.each_csc_ae; puts "WARNING semantic taggin error: #{@para}" + if @para =~rgx.each_csc_ae + STDERR.puts "WARNING semantic tagging error: #{@para}" end end @para diff --git a/lib/sisu/v3/sitemaps.rb b/lib/sisu/v3/sitemaps.rb index fa06a688..86a8e2fb 100644 --- a/lib/sisu/v3/sitemaps.rb +++ b/lib/sisu/v3/sitemaps.rb @@ -89,7 +89,10 @@ module SiSU_Sitemaps output_idx(sitemap_index) SiSU_Screen::Ansi.new(@opt.cmd,"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.cmd =~/q/ end - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb index 389871fc..ab9fbbce 100644 --- a/lib/sisu/v3/sst_do_inline_footnotes.rb +++ b/lib/sisu/v3/sst_do_inline_footnotes.rb @@ -93,7 +93,10 @@ module SiSU_ConvertFootnotes @@dal_array=[] @@fns=@opt.fns create_dal - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure Instantiate.new end @@ -108,7 +111,10 @@ module SiSU_ConvertFootnotes dal=if @@dal_array.empty?; read_fnm else @@dal_array.dup #check end - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure Instantiate.new end @@ -134,7 +140,7 @@ module SiSU_ConvertFootnotes dal.each {|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?} dal_array else - SiSU_Screen::Ansi.new(@md.opt.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/ '' end end diff --git a/lib/sisu/v3/sst_to_s_xml_sax.rb b/lib/sisu/v3/sst_to_s_xml_sax.rb index ff9493b4..20f68aca 100644 --- a/lib/sisu/v3/sst_to_s_xml_sax.rb +++ b/lib/sisu/v3/sst_to_s_xml_sax.rb @@ -100,7 +100,10 @@ module SiSU_SimpleXML_ModelSax else @@fns_array.dup #check end SiSU_SimpleXML_ModelSax::Convert::Songsheet.new(@fns_array,@particulars).songsheet - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure #file closed in songsheet end end @@ -108,7 +111,7 @@ module SiSU_SimpleXML_ModelSax dal=[] if FileTest.file?("#{Dir.pwd}/#{@opt.fns}") dal=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n") - else puts 'Error' + else STDERR.puts 'Error' end end private @@ -121,7 +124,10 @@ module SiSU_SimpleXML_ModelSax SiSU_SimpleXML_ModelSax::Convert::Scroll.new(@data,@particulars).songsheet SiSU_SimpleXML_ModelSax::Convert::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index acc38507..977fd3fe 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -264,8 +264,8 @@ module SiSU_Env require @prog else @mandatory \ - ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn) - : (SiSU_Screen::Ansi.new(@cmd,"#{@prog} load requested").warn) + ? (SiSU_Screen::Ansi.new(@cmd,"*WARN* module required: #{@prog}").warn) + : (SiSU_Screen::Ansi.new(@cmd,"*WARN* #{@prog} load requested").warn) end load_prog end @@ -300,7 +300,7 @@ module SiSU_Env @yamlrc_path.each do |v| if @@noyaml \ or FileTest.exist?("#{v}/noyaml") - puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml + STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml @@noyaml=true break else @@ -657,7 +657,7 @@ module SiSU_Env program='rcs' program_ref="\n\t\tdocument version information requested" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -665,7 +665,7 @@ module SiSU_Env program='cvs' program_ref="\n\t\tdocument version information requested" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -673,7 +673,7 @@ module SiSU_Env program='openssl' program_ref="\n\t\tused to generate requested source document identification digest" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -686,7 +686,7 @@ module SiSU_Env dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path Dir.chdir(pwd) dgst.scan(/\S+/) - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -699,7 +699,7 @@ module SiSU_Env dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path Dir.chdir(pwd) dgst.scan(/\S+/) - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -707,7 +707,7 @@ module SiSU_Env program='psql' program_ref="\n\t\tpsql requested" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -722,14 +722,14 @@ module SiSU_Env program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" (program_found?(program)) \ ? system("#{program} #{dbname_name}") - : (puts "\tWARN: #{program} is not available #{program_ref}") + : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}") end def relaxng(cmd='') #trang - convert between different schema languages for XML program='trang' program_ref="\n\t\tsee " (program_found?(program)) \ ? system("#{program} #{@input} #{@output}") - : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) end def qrencode #qrcode - for generating QR code program='qrencode' @@ -739,21 +739,21 @@ module SiSU_Env ? (system(%{ echo "#{@input}" | #{program} -s 3 -o #{@output} })) - : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) #found end def imagemagick #imagemagick is a image manipulation program program='identify' program_ref="\n\t\tsee " found=(program_found?(program)) ? true : false - puts "\tWARN: #{program} is not installed #{program_ref}" unless found + STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found end def graphicksmagick #graphicsmagick is a image manipulation program program='gm' program_ref="\n\t\tsee " found=(program_found?(program)) ? true : false - puts "\tWARN: #{program} is not installed #{program_ref}" unless found + STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found end def well_formed? #tidy - check for well formed xml xhtml etc. @@ -761,7 +761,7 @@ module SiSU_Env program_ref="\n\t\tsee " (program_found?(program)) \ ? system("#{@prog.tidy} -xml #{@input} > #{@output}") - : (puts "\tWARN: #{program} is not installed #{program_ref}") + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") end def tex2pdf_engine prog=['xetex','xelatex','pdflatex','pdfetex','pdftex'] @@ -799,7 +799,7 @@ module SiSU_Env when /pdflatex/; "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" end system(texpdf_cmd) - else puts "\tWARN: none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}" + else STDERR.puts "\t*WARN* none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}" end end def makeinfo #texinfo @@ -808,7 +808,7 @@ module SiSU_Env program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" (program_found?(program)) \ ? system("#{program} #{options} #{@input}\n") - : (puts "\tWARN: #{program} is not installed #{program_ref}") + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") end def scp program='scp' @@ -816,7 +816,7 @@ module SiSU_Env puts "scp disabled" #(program_found?(program)) \ #? system("scp -Cr #{@input} #{@output}") \ - #: (puts "\tWARN: #{program} not found" ) + #: (STDERR.puts "\t*WARN* #{program} not found" ) end def rsync(action='',chdir=nil) program='rsync' @@ -840,7 +840,7 @@ module SiSU_Env #{rsync_cmd} #{msg} ") dir_return - else puts "\tWARN: #{program} not found" + else STDERR.puts "\t*WARN* #{program} not found" end end def rm @@ -848,7 +848,7 @@ module SiSU_Env elsif @cmd =~/V/; FileUtils::rm(@input) elsif @cmd !~/q/; FileUtils::rm(@input) elsif @cmd =~/q/; FileUtils::rm(@input) - else puts "\tWARN: operation ignored" + else STDERR.puts "\t*WARN* operation ignored" end end end @@ -2694,7 +2694,7 @@ WOK end #system(tree) #enable if (/[vVM]/) else - SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/ + SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/ end sisupod_processing_path end @@ -2710,7 +2710,7 @@ WOK end (FileTest.file?(fns_pod)) \ ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") - : (SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/) + : (SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/) sisupod_processing_path end end @@ -3445,12 +3445,12 @@ WOK def make_file(path,filename) (File.writable?("#{path}/.")) \ ? File.new("#{path}/#{filename}",'w+') - : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn) + : (SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn) end def touch_file(path,filename) if File.writable?("#{path}/."); FileUtils::touch("#{path}/#{filename}") - else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn + else SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn end end def make_path(path) @@ -4276,10 +4276,10 @@ WOK self end def pdf_p - puts 'ERROR not available due to multiple page format sizes' + STDERR.puts 'ERROR not available due to multiple page format sizes' end def pdf_l - puts 'ERROR not available due to multiple page format sizes' + STDERR.puts 'ERROR not available due to multiple page format sizes' end def xhtml def dir @@ -5886,7 +5886,7 @@ WOK FileUtils::chmod(0644,"#{dest_path}/#{i}") end FileUtils::cd(@pwd) - else puts "\tWARN, did not find - #{src_path}" + else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} end end def cp_local_images @@ -5921,7 +5921,7 @@ WOK css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] - SiSU_Screen::Ansi.new(@cmd,"modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ + SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ css_path.each do |x| if FileTest.directory?(x) FileUtils::cd(x) @@ -5932,7 +5932,7 @@ WOK FileUtils::cd(@pwd) end end - else SiSU_Screen::Ansi.new(@cmd,"modify css is not set or is set to: false").warn if @cmd=~/[MV]/ + else SiSU_Screen::Ansi.new(@cmd,"*WARN* modify css is not set or is set to: false").warn if @cmd=~/[MV]/ end fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 14755300..4c224b22 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -262,7 +262,7 @@ module SiSU_TeX Dir.chdir(pwd_set) end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn end lst=Dir["*.{aux,log,out}"] lst.each {|file| File.unlink(file)} if lst diff --git a/lib/sisu/v3/update.rb b/lib/sisu/v3/update.rb index 9ba67e75..4630d640 100644 --- a/lib/sisu/v3/update.rb +++ b/lib/sisu/v3/update.rb @@ -71,7 +71,10 @@ module SiSU_UpdateControlFlag base_path="#{out}/#{@md.fnb}" SiSU_Screen::Ansi.new(@md.opt.cmd,'Checking previous output',base_path).green_hi_blue unless @md.opt.cmd =~/q/ SetCF.new(@md).set_flags - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/webrick.rb b/lib/sisu/v3/webrick.rb index ea0a494f..f8189bba 100644 --- a/lib/sisu/v3/webrick.rb +++ b/lib/sisu/v3/webrick.rb @@ -74,7 +74,10 @@ def brick(port,get='') s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true }) trap("INT"){ s.shutdown } s.start - rescue; SiSU_Errors::InfoError.new($!,$@,'-W',nil).error #fix + rescue + SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -167,7 +170,9 @@ WOK brick(@port,get) rescue; require_relative 'sysenv' # sysenv.rb - SiSU_Errors::InfoError.new($!,$@,'-W',nil).error #fix + SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix + __LINE__.to_s + ':' + __FILE__ + end ensure end __END__ diff --git a/lib/sisu/v3/wikispeak.rb b/lib/sisu/v3/wikispeak.rb index bde2527e..725be0a5 100644 --- a/lib/sisu/v3/wikispeak.rb +++ b/lib/sisu/v3/wikispeak.rb @@ -85,7 +85,10 @@ module SiSU_Wikispeak @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet SiSU_Env::InfoSkin.new(@md).select #watch - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end -- cgit v1.2.3