From bd5e94912c594372eca319e75e15c364b7e124ea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 00:27:47 -0500 Subject: v5 v6: wrappers round require --- data/doc/sisu/CHANGELOG_v5 | 2 + data/doc/sisu/CHANGELOG_v6 | 2 + lib/sisu/v5/ao_hash_digest.rb | 6 ++- lib/sisu/v5/ao_images.rb | 8 +++- lib/sisu/v5/cgi_pgsql.rb | 10 ++-- lib/sisu/v5/cgi_sqlite.rb | 10 ++-- lib/sisu/v5/composite.rb | 10 ++-- lib/sisu/v5/db_import.rb | 1 - lib/sisu/v5/dbi.rb | 9 ++-- lib/sisu/v5/dbi_discrete.rb | 17 +++++-- lib/sisu/v5/defaults.rb | 6 ++- lib/sisu/v5/html.rb | 6 ++- lib/sisu/v5/hub.rb | 20 ++++++-- lib/sisu/v5/options.rb | 6 ++- lib/sisu/v5/param.rb | 8 +++- lib/sisu/v5/particulars.rb | 6 ++- lib/sisu/v5/remote.rb | 14 ++++-- lib/sisu/v5/rexml.rb | 12 ++++- lib/sisu/v5/shared_markup_alt.rb | 6 ++- lib/sisu/v5/src_kdissert_share.rb | 8 +++- lib/sisu/v5/sst_from_xml.rb | 8 +++- lib/sisu/v5/sysenv.rb | 99 +++++++++++++++++++++++++++++++-------- lib/sisu/v5/texpdf.rb | 12 ++++- lib/sisu/v5/utils.rb | 6 +++ lib/sisu/v5/webrick.rb | 22 ++++++--- lib/sisu/v5/xhtml_epub2.rb | 6 ++- lib/sisu/v5/xml_fictionbook2.rb | 6 ++- lib/sisu/v5/xml_odf_odt.rb | 8 +++- lib/sisu/v6/ao_hash_digest.rb | 6 ++- lib/sisu/v6/ao_images.rb | 8 +++- lib/sisu/v6/cgi_pgsql.rb | 10 ++-- lib/sisu/v6/cgi_sqlite.rb | 10 ++-- lib/sisu/v6/composite.rb | 10 ++-- lib/sisu/v6/db_import.rb | 1 - lib/sisu/v6/dbi.rb | 9 ++-- lib/sisu/v6/dbi_discrete.rb | 17 +++++-- lib/sisu/v6/defaults.rb | 6 ++- lib/sisu/v6/html.rb | 6 ++- lib/sisu/v6/hub.rb | 20 ++++++-- lib/sisu/v6/options.rb | 6 ++- lib/sisu/v6/param.rb | 8 +++- lib/sisu/v6/particulars.rb | 6 ++- lib/sisu/v6/remote.rb | 14 ++++-- lib/sisu/v6/rexml.rb | 12 ++++- lib/sisu/v6/shared_markup_alt.rb | 6 ++- lib/sisu/v6/src_kdissert_share.rb | 8 +++- lib/sisu/v6/sst_from_xml.rb | 8 +++- lib/sisu/v6/sysenv.rb | 99 +++++++++++++++++++++++++++++++-------- lib/sisu/v6/texpdf.rb | 12 ++++- lib/sisu/v6/utils.rb | 6 +++ lib/sisu/v6/webrick.rb | 22 ++++++--- lib/sisu/v6/xhtml_epub2.rb | 6 ++- lib/sisu/v6/xml_fictionbook2.rb | 6 ++- lib/sisu/v6/xml_odf_odt.rb | 8 +++- 54 files changed, 516 insertions(+), 148 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 8e3bafe6..c44bb54b 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.3.1.orig.tar.xz sisu_5.3.1.orig.tar.xz sisu_5.3.1-1.dsc +* wrappers round require + %% 5.3.0.orig.tar.xz (2014-01-26:03/7) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.3.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.3.0-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 0cef8ddb..0f5eff45 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.1.orig.tar.xz sisu_6.0.1.orig.tar.xz sisu_6.0.1-1.dsc +* wrappers round require + %% 6.0.0.orig.tar.xz (2014-01-26:03/7) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.0-1 diff --git a/lib/sisu/v5/ao_hash_digest.rb b/lib/sisu/v5/ao_hash_digest.rb index 585ff659..3f372893 100644 --- a/lib/sisu/v5/ao_hash_digest.rb +++ b/lib/sisu/v5/ao_hash_digest.rb @@ -75,7 +75,11 @@ module SiSU_AO_Hash data=@data.compact @tuned_file=[] sha_ =(@env.digest.type=='sha256' ? true : false) - sha_ ? (require 'digest/sha2') : (require 'digest/md5') + begin + sha_ ? (require 'digest/sha2') : (require 'digest/md5') + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error((sha_ ? 'digest/sha2' : 'digest/md5') + ' NOT FOUND') + end data.each do |t_o| unless t_o.obj.is_a?(Array) t_o.obj=t_o.obj.strip diff --git a/lib/sisu/v5/ao_images.rb b/lib/sisu/v5/ao_images.rb index ab42034d..d01c98b8 100644 --- a/lib/sisu/v5/ao_images.rb +++ b/lib/sisu/v5/ao_images.rb @@ -62,8 +62,12 @@ =end module SiSU_AO_Images class Images - #require 'RMagick' - #include Magick + #begin + # require 'RMagick' + # include Magick + #rescue LoadError + # SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('RMagic NOT FOUND (LoadError)') + #end def initialize(md,data) @md,@data=md,data end diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 33e43b46..0a514672 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -192,9 +192,13 @@ module SiSU_CGI_PgSQL * Description: generates naive cgi search form for search of sisu database (pgsql) #{gpl} =end - require 'cgi' - require 'fcgi' - require 'dbi' + begin + require 'cgi' + require 'fcgi' + require 'dbi' + rescue LoadError + puts 'cgi, fcgi or dbi NOT FOUND (LoadError)' + end @stub_default='#{@name_of[:db]}' @image_src='#{@image_src}' @hosturl_cgi='#{@name_of[:host_url_cgi]}' diff --git a/lib/sisu/v5/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index 8ebe0c16..aa38e6f1 100644 --- a/lib/sisu/v5/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -165,9 +165,13 @@ module SiSU_CGI_SQLite * Description: generates naive cgi search form for search of sisu database (sqlite) #{gpl} =end - require 'cgi' - require 'fcgi' - require 'dbi' + begin + require 'cgi' + require 'fcgi' + require 'dbi' + rescue LoadError + puts 'cgi, fcgi or dbi NOT FOUND (LoadError)' + end @stub_default='sisu_sqlite' @image_src='#{@image_src}' @hosturl_cgi='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin' diff --git a/lib/sisu/v5/composite.rb b/lib/sisu/v5/composite.rb index c1457779..9e7ccb5c 100644 --- a/lib/sisu/v5/composite.rb +++ b/lib/sisu/v5/composite.rb @@ -178,10 +178,14 @@ module SiSU_Assemble end tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ # and NetTest imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[ti]$/.match(loadfile).captures.join + '/_sisu/image' #watch - require 'uri' + begin + require 'uri' + require 'open-uri' + require 'pp' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri, open-uri or pp NOT FOUND (LoadError)') + end image_uri=URI.parse(imagedir) - require 'open-uri' - require 'pp' insert=open(loadfile) insert_array=insert.dup insert.close diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index 8d9fc229..0dc5a29b 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -66,7 +66,6 @@ module SiSU_DbImport require_relative 'db_load_tuple' # db_load_tuple.rb require_relative 'db_sqltxt' # db_sqltxt.rb require_relative 'html_lite_shared' # html_lite_shared.rb - require 'sqlite3' class Import < SiSU_DbText::Prepare include SiSU_Param include SiSU_Screen diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index d92f1964..1ab9bc9c 100644 --- a/lib/sisu/v5/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -120,9 +120,12 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet end def read_sqlite begin - @conn=@db.sqlite.conn_sqlite3 - rescue - ensure + begin + require 'sqlite3' + @conn=@db.sqlite.conn_sqlite3 + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 NOT FOUND (LoadError)') + end end end def connect diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index 0981455c..cd8c7de1 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -69,8 +69,12 @@ module SiSU_DBI_Discrete #% database building include SiSU_DbDBI require_relative 'html_lite_shared' # html_lite_shared.rb include SiSU_FormatShared - require 'fileutils' - include FileUtils::Verbose + begin + require 'fileutils' + include FileUtils::Verbose + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end class SQL def initialize(opt) SiSU_Env::Load.new('dbi',true).prog @@ -145,9 +149,12 @@ module SiSU_DBI_Discrete #% database building end def read_sqlite begin - @conn=@db.sqlite.conn_sqlite3 - rescue - ensure + begin + require 'sqlite3' + @conn=@db.sqlite.conn_sqlite3 + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 not available') + end end end def connect diff --git a/lib/sisu/v5/defaults.rb b/lib/sisu/v5/defaults.rb index fd56c2c4..25dd270a 100644 --- a/lib/sisu/v5/defaults.rb +++ b/lib/sisu/v5/defaults.rb @@ -62,7 +62,11 @@ =end $latex_run=nil module SiSU_Viz - require 'uri' + begin + require 'uri' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'css' # css.rb diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index f473f1b7..1b738561 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -61,7 +61,11 @@ =end module SiSU_HTML - require 'pstore' + begin + require 'pstore' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)') + end require_relative 'particulars' # particulars.rb include SiSU_Particulars require_relative 'defaults' # defaults.rb diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index d0393a3b..b7d62a38 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -72,7 +72,11 @@ module SiSU require_relative 'defaults' # defaults.rb include SiSU_Viz require_relative 'utils' # utils.rb - require 'uri' + begin + require 'uri' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri NOT FOUND (LoadError)') + end class HubMaster def initialize(argv) pwd_the=Dir.pwd @@ -246,8 +250,12 @@ module SiSU end end class Processing - require 'fileutils' - include FileUtils + begin + require 'fileutils' + include FileUtils + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end @@env=nil attr_accessor :op def initialize(opt) @@ -645,7 +653,11 @@ module SiSU end def actions if @opt.act[:profile][:set]==:on - require 'profile' + begin + require 'profile' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('profile NOT FOUND (LoadError)') + end end action_on_file_ =if @opt.act[:rsync][:set]==:on \ && @opt.act[:site_init][:set]==:on diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 65af15b4..112a7a09 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -62,7 +62,11 @@ =end module SiSU_Commandline - require 'pathname' + begin + require 'pathname' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb require_relative 'param_make' # param_make.rb @@sisu_call_origin_path=nil diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index e8eb3fc6..ad29ff92 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -61,8 +61,12 @@ =end module SiSU_Param - require 'uri' - require 'pstore' + begin + require 'uri' + require 'pstore' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri or pstore NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'param_make' # param_make.rb diff --git a/lib/sisu/v5/particulars.rb b/lib/sisu/v5/particulars.rb index 0687150a..6efbc94c 100644 --- a/lib/sisu/v5/particulars.rb +++ b/lib/sisu/v5/particulars.rb @@ -62,7 +62,11 @@ =end module SiSU_Particulars - require 'singleton' + begin + require 'singleton' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'param' # param.rb diff --git a/lib/sisu/v5/remote.rb b/lib/sisu/v5/remote.rb index 145ec9b2..e06e7b33 100644 --- a/lib/sisu/v5/remote.rb +++ b/lib/sisu/v5/remote.rb @@ -112,8 +112,12 @@ module SiSU_Remote @tell=lambda { SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@msg,"#{@msgs.inspect if @msgs}") } end def fns - require 'open-uri' - require 'pp' + begin + require 'open-uri' + require 'pp' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('open-uri or pp NOT FOUND (LoadError)') + end require_relative 'composite' # composite.rb @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ threads=[] @@ -158,7 +162,11 @@ module SiSU_Remote def sisupod get_p=@get_s if get_p.length > 0 #% remote sisupod - require 'net/http' + begin + require 'net/http' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('net/http NOT FOUND (LoadError)') + end for requested_pod in get_p pod_info=RemoteDownload.new(requested_pod) Net::HTTP.start(pod_info.pod.site) do |http| diff --git a/lib/sisu/v5/rexml.rb b/lib/sisu/v5/rexml.rb index c00797a3..bc9f7541 100644 --- a/lib/sisu/v5/rexml.rb +++ b/lib/sisu/v5/rexml.rb @@ -62,14 +62,22 @@ =end module SiSU_Rexml # load XML file for REXML parsing - require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + begin + require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)') + end require_relative 'param' # param.rb include SiSU_Param require_relative 'sysenv' # sysenv.rb include SiSU_Env include SiSU_Viz class Rexml - require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + begin + require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)') + end def initialize(md,fno) @md,@fno=md,fno @env=SiSU_Env::InfoEnv.new(@md.fns) diff --git a/lib/sisu/v5/shared_markup_alt.rb b/lib/sisu/v5/shared_markup_alt.rb index 4a1959e8..5a37c934 100644 --- a/lib/sisu/v5/shared_markup_alt.rb +++ b/lib/sisu/v5/shared_markup_alt.rb @@ -208,7 +208,11 @@ module SiSU_TextRepresentation end @env ||=SiSU_Env::InfoEnv.new(@md.fns) @sha_ =((@env.digest.type =='sha256') ? true : false) - @sha_ ? (require 'digest/sha2') : (require 'digest/md5') + begin + @sha_ ? (require 'digest/sha2') : (require 'digest/md5') + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error((@sha_ ? 'digest/sha2' : 'digest/md5') + ' NOT FOUND') + end end def digest(txt) d=nil diff --git a/lib/sisu/v5/src_kdissert_share.rb b/lib/sisu/v5/src_kdissert_share.rb index f91aec55..8ccb9708 100644 --- a/lib/sisu/v5/src_kdissert_share.rb +++ b/lib/sisu/v5/src_kdissert_share.rb @@ -64,8 +64,12 @@ module SiSU_KdiSource require_relative 'sysenv' # sysenv.rb include SiSU_Env class Source - require 'fileutils' - include FileUtils + begin + require 'fileutils' + include FileUtils + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt @env=SiSU_Env::InfoEnv.new(@opt.fns) diff --git a/lib/sisu/v5/sst_from_xml.rb b/lib/sisu/v5/sst_from_xml.rb index 110d7df5..c969ac31 100644 --- a/lib/sisu/v5/sst_from_xml.rb +++ b/lib/sisu/v5/sst_from_xml.rb @@ -64,8 +64,12 @@ module SiSU_sstFromXML require_relative 'sysenv' # sysenv.rb class Convert - require 'rexml/document' - include REXML + begin + require 'rexml/document' + include REXML + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt @sisu,@sisu_base=[],[] diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index a8fcbd7a..5563513f 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -66,12 +66,20 @@ module SiSU_Env require_relative 'constants' # constants.rb require_relative 'utils' # utils.rb - require 'fileutils' - include FileUtils::Verbose - require 'singleton' + begin + require 'singleton' + require 'fileutils' + include FileUtils::Verbose + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton or fileutils NOT FOUND (LoadError)') + end @@noyaml=false class InfoDate - require 'date' + begin + require 'date' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('date NOT FOUND (LoadError)') + end attr_accessor :dt,:t def initialize @dt,@t=Date.today.to_s,Time.now @@ -97,7 +105,11 @@ module SiSU_Env end end class InfoSystemGen - require 'rbconfig' + begin + require 'rbconfig' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)') + end @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] out=Config::CONFIG['localstatedir'] etc=Config::CONFIG['sysconfdir'] + '/sisu' @@ -242,10 +254,18 @@ module SiSU_Env end if load_prog \ and @prog=~/dbi/ - require 'dbi' #revisit + begin + require 'dbi' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('dbi NOT FOUND (LoadError)') + end end if load_prog - require @prog + begin + require @prog + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("#{@prog} NOT FOUND (LoadError)") + end else @mandatory \ ? (SiSU_Screen::Ansi.new(@prog,"*WARN* module required: #{@prog}").warn) @@ -330,7 +350,11 @@ module SiSU_Env f=S_CONF[:rc_yml] p_f="#{v}/#{f}" if FileTest.exist?(p_f) - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@sisurc_path=v @@rc=YAML::load(File::open(p_f)) break @@ -339,7 +363,11 @@ module SiSU_Env f='sisurc.yaml' p_f="#{v}/#{f}" if FileTest.exist?(p_f) - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@sisurc_path=v @@rc=YAML::load(File::open(p_f)) break @@ -378,7 +406,11 @@ module SiSU_Env else if FileTest.exist?("#{v}/list.yml") unless @@ad[:promo_list] - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) end @@ad[:flag_promo]=true @@ -396,7 +428,11 @@ module SiSU_Env else if FileTest.exist?("#{v}/promo.yml") unless @@ad[:promo] - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) end @@ad[:flag_promo]=true @@ -1030,9 +1066,13 @@ module SiSU_Env end end class InfoEnv < EnvCall - require 'pathname' - require 'fileutils' - include FileUtils + begin + require 'pathname' + require 'fileutils' + include FileUtils + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)') + end attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir @@image_flag,@@local_image=true,true #warning on @@image_flag @@fb,@@man_path=nil,nil @@ -3169,8 +3209,12 @@ WOK end end class CleanOutput - require 'fileutils' - include FileUtils::Verbose + begin + require 'fileutils' + include FileUtils::Verbose + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt z=SiSU_Env::FileMap.new(opt) @@ -3326,7 +3370,11 @@ WOK end class InfoRemote < FileMap @@flag_remote=false - require 'socket' + begin + require 'socket' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('socket NOT FOUND (LoadError)') + end def initialize(opt) super(opt) # @opt=opt @@ -3674,8 +3722,12 @@ WOK end class InfoVersion #{x}
" unless x =~/^(\.)+$/ } diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index 33e3a529..2073bb4b 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -61,7 +61,11 @@ =end module SiSU_XHTML_EPUB2 - require 'pstore' + begin + require 'pstore' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)') + end require_relative 'particulars' # particulars.rb include SiSU_Particulars require_relative 'defaults' # defaults.rb diff --git a/lib/sisu/v5/xml_fictionbook2.rb b/lib/sisu/v5/xml_fictionbook2.rb index 6549fa12..c72332bb 100644 --- a/lib/sisu/v5/xml_fictionbook2.rb +++ b/lib/sisu/v5/xml_fictionbook2.rb @@ -227,7 +227,11 @@ module SiSU_XML_Fictionbook endnotes end def extract_images #work on - require "base64" + begin + require 'base64' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('base64 NOT FOUND (LoadError)') + end images_raw,images_base64_fb2=[],[] images_base64={} if defined? @md.make.cover_image[:cover] diff --git a/lib/sisu/v5/xml_odf_odt.rb b/lib/sisu/v5/xml_odf_odt.rb index a6a7a127..3cb2fbbf 100644 --- a/lib/sisu/v5/xml_odf_odt.rb +++ b/lib/sisu/v5/xml_odf_odt.rb @@ -73,8 +73,12 @@ module SiSU_XML_ODF_ODT require_relative 'txt_shared' # txt_shared.rb @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 class Source - require 'zlib' - require 'find' + begin + require 'zlib' + require 'find' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('zlib or find NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) diff --git a/lib/sisu/v6/ao_hash_digest.rb b/lib/sisu/v6/ao_hash_digest.rb index b2fd8bfd..ce45b9e4 100644 --- a/lib/sisu/v6/ao_hash_digest.rb +++ b/lib/sisu/v6/ao_hash_digest.rb @@ -75,7 +75,11 @@ module SiSU_AO_Hash data=@data.compact @tuned_file=[] sha_ =(@env.digest.type=='sha256' ? true : false) - sha_ ? (require 'digest/sha2') : (require 'digest/md5') + begin + sha_ ? (require 'digest/sha2') : (require 'digest/md5') + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error((sha_ ? 'digest/sha2' : 'digest/md5') + ' NOT FOUND') + end data.each do |t_o| unless t_o.obj.is_a?(Array) t_o.obj=t_o.obj.strip diff --git a/lib/sisu/v6/ao_images.rb b/lib/sisu/v6/ao_images.rb index 76721d63..0279994d 100644 --- a/lib/sisu/v6/ao_images.rb +++ b/lib/sisu/v6/ao_images.rb @@ -62,8 +62,12 @@ =end module SiSU_AO_Images class Images - #require 'RMagick' - #include Magick + #begin + # require 'RMagick' + # include Magick + #rescue LoadError + # SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('RMagic NOT FOUND (LoadError)') + #end def initialize(md,data) @md,@data=md,data end diff --git a/lib/sisu/v6/cgi_pgsql.rb b/lib/sisu/v6/cgi_pgsql.rb index 2bcd42e3..3b0b610b 100644 --- a/lib/sisu/v6/cgi_pgsql.rb +++ b/lib/sisu/v6/cgi_pgsql.rb @@ -192,9 +192,13 @@ module SiSU_CGI_PgSQL * Description: generates naive cgi search form for search of sisu database (pgsql) #{gpl} =end - require 'cgi' - require 'fcgi' - require 'dbi' + begin + require 'cgi' + require 'fcgi' + require 'dbi' + rescue LoadError + puts 'cgi, fcgi or dbi NOT FOUND (LoadError)' + end @stub_default='#{@name_of[:db]}' @image_src='#{@image_src}' @hosturl_cgi='#{@name_of[:host_url_cgi]}' diff --git a/lib/sisu/v6/cgi_sqlite.rb b/lib/sisu/v6/cgi_sqlite.rb index fff0f98f..daf915e6 100644 --- a/lib/sisu/v6/cgi_sqlite.rb +++ b/lib/sisu/v6/cgi_sqlite.rb @@ -165,9 +165,13 @@ module SiSU_CGI_SQLite * Description: generates naive cgi search form for search of sisu database (sqlite) #{gpl} =end - require 'cgi' - require 'fcgi' - require 'dbi' + begin + require 'cgi' + require 'fcgi' + require 'dbi' + rescue LoadError + puts 'cgi, fcgi or dbi NOT FOUND (LoadError)' + end @stub_default='sisu_sqlite' @image_src='#{@image_src}' @hosturl_cgi='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin' diff --git a/lib/sisu/v6/composite.rb b/lib/sisu/v6/composite.rb index 044f31c4..ebbd14f6 100644 --- a/lib/sisu/v6/composite.rb +++ b/lib/sisu/v6/composite.rb @@ -178,10 +178,14 @@ module SiSU_Assemble end tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ # and NetTest imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[ti]$/.match(loadfile).captures.join + '/_sisu/image' #watch - require 'uri' + begin + require 'uri' + require 'open-uri' + require 'pp' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri, open-uri or pp NOT FOUND (LoadError)') + end image_uri=URI.parse(imagedir) - require 'open-uri' - require 'pp' insert=open(loadfile) insert_array=insert.dup insert.close diff --git a/lib/sisu/v6/db_import.rb b/lib/sisu/v6/db_import.rb index e9fc4d5c..e1342b1d 100644 --- a/lib/sisu/v6/db_import.rb +++ b/lib/sisu/v6/db_import.rb @@ -66,7 +66,6 @@ module SiSU_DbImport require_relative 'db_load_tuple' # db_load_tuple.rb require_relative 'db_sqltxt' # db_sqltxt.rb require_relative 'html_lite_shared' # html_lite_shared.rb - require 'sqlite3' class Import < SiSU_DbText::Prepare include SiSU_Param include SiSU_Screen diff --git a/lib/sisu/v6/dbi.rb b/lib/sisu/v6/dbi.rb index 6804ab97..acb75e0f 100644 --- a/lib/sisu/v6/dbi.rb +++ b/lib/sisu/v6/dbi.rb @@ -120,9 +120,12 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet end def read_sqlite begin - @conn=@db.sqlite.conn_sqlite3 - rescue - ensure + begin + require 'sqlite3' + @conn=@db.sqlite.conn_sqlite3 + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 NOT FOUND (LoadError)') + end end end def connect diff --git a/lib/sisu/v6/dbi_discrete.rb b/lib/sisu/v6/dbi_discrete.rb index b842c767..0ac84db4 100644 --- a/lib/sisu/v6/dbi_discrete.rb +++ b/lib/sisu/v6/dbi_discrete.rb @@ -69,8 +69,12 @@ module SiSU_DBI_Discrete #% database building include SiSU_DbDBI require_relative 'html_lite_shared' # html_lite_shared.rb include SiSU_FormatShared - require 'fileutils' - include FileUtils::Verbose + begin + require 'fileutils' + include FileUtils::Verbose + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end class SQL def initialize(opt) SiSU_Env::Load.new('dbi',true).prog @@ -145,9 +149,12 @@ module SiSU_DBI_Discrete #% database building end def read_sqlite begin - @conn=@db.sqlite.conn_sqlite3 - rescue - ensure + begin + require 'sqlite3' + @conn=@db.sqlite.conn_sqlite3 + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 not available') + end end end def connect diff --git a/lib/sisu/v6/defaults.rb b/lib/sisu/v6/defaults.rb index ca3c0c04..a26edae9 100644 --- a/lib/sisu/v6/defaults.rb +++ b/lib/sisu/v6/defaults.rb @@ -62,7 +62,11 @@ =end $latex_run=nil module SiSU_Viz - require 'uri' + begin + require 'uri' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'css' # css.rb diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb index 8a909677..148672e5 100644 --- a/lib/sisu/v6/html.rb +++ b/lib/sisu/v6/html.rb @@ -61,7 +61,11 @@ =end module SiSU_HTML - require 'pstore' + begin + require 'pstore' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)') + end require_relative 'particulars' # particulars.rb include SiSU_Particulars require_relative 'defaults' # defaults.rb diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index 7e2a009d..62b8eaa0 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -72,7 +72,11 @@ module SiSU require_relative 'defaults' # defaults.rb include SiSU_Viz require_relative 'utils' # utils.rb - require 'uri' + begin + require 'uri' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri NOT FOUND (LoadError)') + end class HubMaster def initialize(argv) pwd_the=Dir.pwd @@ -246,8 +250,12 @@ module SiSU end end class Processing - require 'fileutils' - include FileUtils + begin + require 'fileutils' + include FileUtils + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end @@env=nil attr_accessor :op def initialize(opt) @@ -645,7 +653,11 @@ module SiSU end def actions if @opt.act[:profile][:set]==:on - require 'profile' + begin + require 'profile' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('profile NOT FOUND (LoadError)') + end end action_on_file_ =if @opt.act[:rsync][:set]==:on \ && @opt.act[:site_init][:set]==:on diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index 632ac5a8..93d11acc 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -62,7 +62,11 @@ =end module SiSU_Commandline - require 'pathname' + begin + require 'pathname' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb require_relative 'param_make' # param_make.rb @@sisu_call_origin_path=nil diff --git a/lib/sisu/v6/param.rb b/lib/sisu/v6/param.rb index b74e0dc1..bc9bf9df 100644 --- a/lib/sisu/v6/param.rb +++ b/lib/sisu/v6/param.rb @@ -61,8 +61,12 @@ =end module SiSU_Param - require 'uri' - require 'pstore' + begin + require 'uri' + require 'pstore' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri or pstore NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'param_make' # param_make.rb diff --git a/lib/sisu/v6/particulars.rb b/lib/sisu/v6/particulars.rb index 44fa536a..7e850f4c 100644 --- a/lib/sisu/v6/particulars.rb +++ b/lib/sisu/v6/particulars.rb @@ -62,7 +62,11 @@ =end module SiSU_Particulars - require 'singleton' + begin + require 'singleton' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton NOT FOUND (LoadError)') + end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'param' # param.rb diff --git a/lib/sisu/v6/remote.rb b/lib/sisu/v6/remote.rb index 3c4982c8..ed5d7fba 100644 --- a/lib/sisu/v6/remote.rb +++ b/lib/sisu/v6/remote.rb @@ -112,8 +112,12 @@ module SiSU_Remote @tell=lambda { SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@msg,"#{@msgs.inspect if @msgs}") } end def fns - require 'open-uri' - require 'pp' + begin + require 'open-uri' + require 'pp' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('open-uri or pp NOT FOUND (LoadError)') + end require_relative 'composite' # composite.rb @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ threads=[] @@ -158,7 +162,11 @@ module SiSU_Remote def sisupod get_p=@get_s if get_p.length > 0 #% remote sisupod - require 'net/http' + begin + require 'net/http' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('net/http NOT FOUND (LoadError)') + end for requested_pod in get_p pod_info=RemoteDownload.new(requested_pod) Net::HTTP.start(pod_info.pod.site) do |http| diff --git a/lib/sisu/v6/rexml.rb b/lib/sisu/v6/rexml.rb index f9b94cee..63e70a42 100644 --- a/lib/sisu/v6/rexml.rb +++ b/lib/sisu/v6/rexml.rb @@ -62,14 +62,22 @@ =end module SiSU_Rexml # load XML file for REXML parsing - require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + begin + require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)') + end require_relative 'param' # param.rb include SiSU_Param require_relative 'sysenv' # sysenv.rb include SiSU_Env include SiSU_Viz class Rexml - require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + begin + require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir'] + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)') + end def initialize(md,fno) @md,@fno=md,fno @env=SiSU_Env::InfoEnv.new(@md.fns) diff --git a/lib/sisu/v6/shared_markup_alt.rb b/lib/sisu/v6/shared_markup_alt.rb index b84d167a..4971dde0 100644 --- a/lib/sisu/v6/shared_markup_alt.rb +++ b/lib/sisu/v6/shared_markup_alt.rb @@ -208,7 +208,11 @@ module SiSU_TextRepresentation end @env ||=SiSU_Env::InfoEnv.new(@md.fns) @sha_ =((@env.digest.type =='sha256') ? true : false) - @sha_ ? (require 'digest/sha2') : (require 'digest/md5') + begin + @sha_ ? (require 'digest/sha2') : (require 'digest/md5') + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error((@sha_ ? 'digest/sha2' : 'digest/md5') + ' NOT FOUND') + end end def digest(txt) d=nil diff --git a/lib/sisu/v6/src_kdissert_share.rb b/lib/sisu/v6/src_kdissert_share.rb index ecf559fb..9624e460 100644 --- a/lib/sisu/v6/src_kdissert_share.rb +++ b/lib/sisu/v6/src_kdissert_share.rb @@ -64,8 +64,12 @@ module SiSU_KdiSource require_relative 'sysenv' # sysenv.rb include SiSU_Env class Source - require 'fileutils' - include FileUtils + begin + require 'fileutils' + include FileUtils + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt @env=SiSU_Env::InfoEnv.new(@opt.fns) diff --git a/lib/sisu/v6/sst_from_xml.rb b/lib/sisu/v6/sst_from_xml.rb index 728f3f54..ee864b03 100644 --- a/lib/sisu/v6/sst_from_xml.rb +++ b/lib/sisu/v6/sst_from_xml.rb @@ -64,8 +64,12 @@ module SiSU_sstFromXML require_relative 'sysenv' # sysenv.rb class Convert - require 'rexml/document' - include REXML + begin + require 'rexml/document' + include REXML + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt @sisu,@sisu_base=[],[] diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 46bb30ca..437d4088 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -66,12 +66,20 @@ module SiSU_Env require_relative 'constants' # constants.rb require_relative 'utils' # utils.rb - require 'fileutils' - include FileUtils::Verbose - require 'singleton' + begin + require 'singleton' + require 'fileutils' + include FileUtils::Verbose + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton or fileutils NOT FOUND (LoadError)') + end @@noyaml=false class InfoDate - require 'date' + begin + require 'date' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('date NOT FOUND (LoadError)') + end attr_accessor :dt,:t def initialize @dt,@t=Date.today.to_s,Time.now @@ -97,7 +105,11 @@ module SiSU_Env end end class InfoSystemGen - require 'rbconfig' + begin + require 'rbconfig' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)') + end @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] out=Config::CONFIG['localstatedir'] etc=Config::CONFIG['sysconfdir'] + '/sisu' @@ -242,10 +254,18 @@ module SiSU_Env end if load_prog \ and @prog=~/dbi/ - require 'dbi' #revisit + begin + require 'dbi' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('dbi NOT FOUND (LoadError)') + end end if load_prog - require @prog + begin + require @prog + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("#{@prog} NOT FOUND (LoadError)") + end else @mandatory \ ? (SiSU_Screen::Ansi.new(@prog,"*WARN* module required: #{@prog}").warn) @@ -330,7 +350,11 @@ module SiSU_Env f=S_CONF[:rc_yml] p_f="#{v}/#{f}" if FileTest.exist?(p_f) - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@sisurc_path=v @@rc=YAML::load(File::open(p_f)) break @@ -339,7 +363,11 @@ module SiSU_Env f='sisurc.yaml' p_f="#{v}/#{f}" if FileTest.exist?(p_f) - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@sisurc_path=v @@rc=YAML::load(File::open(p_f)) break @@ -378,7 +406,11 @@ module SiSU_Env else if FileTest.exist?("#{v}/list.yml") unless @@ad[:promo_list] - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) end @@ad[:flag_promo]=true @@ -396,7 +428,11 @@ module SiSU_Env else if FileTest.exist?("#{v}/promo.yml") unless @@ad[:promo] - require 'yaml' + begin + require 'yaml' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') + end @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) end @@ad[:flag_promo]=true @@ -1030,9 +1066,13 @@ module SiSU_Env end end class InfoEnv < EnvCall - require 'pathname' - require 'fileutils' - include FileUtils + begin + require 'pathname' + require 'fileutils' + include FileUtils + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)') + end attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir @@image_flag,@@local_image=true,true #warning on @@image_flag @@fb,@@man_path=nil,nil @@ -3169,8 +3209,12 @@ WOK end end class CleanOutput - require 'fileutils' - include FileUtils::Verbose + begin + require 'fileutils' + include FileUtils::Verbose + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt z=SiSU_Env::FileMap.new(opt) @@ -3326,7 +3370,11 @@ WOK end class InfoRemote < FileMap @@flag_remote=false - require 'socket' + begin + require 'socket' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('socket NOT FOUND (LoadError)') + end def initialize(opt) super(opt) # @opt=opt @@ -3674,8 +3722,12 @@ WOK end class InfoVersion #{x}
" unless x =~/^(\.)+$/ } diff --git a/lib/sisu/v6/xhtml_epub2.rb b/lib/sisu/v6/xhtml_epub2.rb index 6447431f..1d4305ab 100644 --- a/lib/sisu/v6/xhtml_epub2.rb +++ b/lib/sisu/v6/xhtml_epub2.rb @@ -61,7 +61,11 @@ =end module SiSU_XHTML_EPUB2 - require 'pstore' + begin + require 'pstore' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)') + end require_relative 'particulars' # particulars.rb include SiSU_Particulars require_relative 'defaults' # defaults.rb diff --git a/lib/sisu/v6/xml_fictionbook2.rb b/lib/sisu/v6/xml_fictionbook2.rb index 9cd7909e..0498a7f0 100644 --- a/lib/sisu/v6/xml_fictionbook2.rb +++ b/lib/sisu/v6/xml_fictionbook2.rb @@ -227,7 +227,11 @@ module SiSU_XML_Fictionbook endnotes end def extract_images #work on - require "base64" + begin + require 'base64' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('base64 NOT FOUND (LoadError)') + end images_raw,images_base64_fb2=[],[] images_base64={} if defined? @md.make.cover_image[:cover] diff --git a/lib/sisu/v6/xml_odf_odt.rb b/lib/sisu/v6/xml_odf_odt.rb index bf9d8df8..b478805f 100644 --- a/lib/sisu/v6/xml_odf_odt.rb +++ b/lib/sisu/v6/xml_odf_odt.rb @@ -73,8 +73,12 @@ module SiSU_XML_ODF_ODT require_relative 'txt_shared' # txt_shared.rb @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 class Source - require 'zlib' - require 'find' + begin + require 'zlib' + require 'find' + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('zlib or find NOT FOUND (LoadError)') + end def initialize(opt) @opt=opt @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) -- cgit v1.2.3