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 --- lib/sisu/v3/sysenv.rb | 58 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'lib/sisu/v3/sysenv.rb') 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 -- cgit v1.2.3 From 33417c59a25d9c68698d319d298da1fecaec1673 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:28:19 -0400 Subject: v3: warn when files to be copied not found, add --- lib/sisu/v3/sysenv.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lib/sisu/v3/sysenv.rb') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 977fd3fe..e03c668d 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -2141,7 +2141,10 @@ WOK src="#{path.share}/image" images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] images.each do |i| #move to avoid repeated tests - FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}") + if FileTest.file?("#{src}/#{i}") + FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}") + else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} + end end pth end @@ -5882,8 +5885,11 @@ WOK FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) FileUtils::chmod(0755,dest_path) source.each do |i| - FileUtils::cp_r(i,"#{dest_path}/#{i}") - FileUtils::chmod(0644,"#{dest_path}/#{i}") + if FileTest.file?(i) + FileUtils::cp(i,"#{dest_path}/#{i}") + FileUtils::chmod(0644,"#{dest_path}/#{i}") + else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} + end end FileUtils::cd(@pwd) else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} @@ -5927,7 +5933,10 @@ WOK FileUtils::cd(x) source=Dir.glob("*.{css}") source.each do |i| - FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") + if FileTest.file?(i) + FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") + else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]} + end end FileUtils::cd(@pwd) end -- cgit v1.2.3 From 26e5e47cb281d7ee98abcc619332b87b321aaed0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:39:42 -0400 Subject: v3: images, regular & sisupod --- lib/sisu/v3/sysenv.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'lib/sisu/v3/sysenv.rb') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index e03c668d..f57185fc 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -5668,6 +5668,38 @@ WOK @pwd_stub=@pwd[m,1] @env=SiSU_Env::InfoEnv.new end + def apply + if @md.make.skin + skin_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ + [ + "#{@env.path.pwd}/_sisu/skin", + "#{@env.path.home}/.sisu/skin", + '/etc/sisu/skin', + "#{@env.processing_path.processing_sisupod(@md.opt)}/external_document/skin" + ] + else #sisupod + pt=/(\/\S+?\/sisupod\/\S+?\/sisupod\/doc)/.match(@md.opt.f_pth[:pth])[1] + [ "#{pt}/_sisu/skin" ] + end + sk_doc,sk_dir="doc/#{@md.make.skin}.rb","dir/skin_#{@env.stub_pwd}.rb" + skin_path.each do |v| #document skin priority 1 + if FileTest.file?("#{v}/#{sk_doc}") + @skin_apply={ name: @md.make.skin, name_path: "#{v}/#{sk_doc}", type: :doc } + break + end + end + unless @skin_apply.length > 0 + skin_path.each do |v| #directory skin priority 2 + if FileTest.file?("#{v}/#{sk_dir}") + @skin_apply={ name: "skin_#{@env.stub_pwd}.rb", name_path: "#{v}/#{sk_dir}", type: :dir } + break + end + end + end + else nil + end + @skin_apply + end def select # skin loading logic here load "#{SiSU_lib}/defaults.rb" skin_path=[] -- cgit v1.2.3 From 35e3bcae6aac45cdbcc1c7f63bbeb1870c171bff Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 22:29:09 -0400 Subject: v3: images, copy (system link removed) --- lib/sisu/v3/sysenv.rb | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) (limited to 'lib/sisu/v3/sysenv.rb') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index f57185fc..b8dd37b0 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3404,28 +3404,6 @@ WOK %x{ruby -v}.strip end end - class CreateSystemLink #revisit problems created 2004w41 - require 'fileutils' - include FileUtils::Verbose - def initialize - @env=SiSU_Env::InfoEnv.new - end - def images - unless FileTest.directory?("#{@env.path.output}/_sisu") - FileUtils::mkdir_p("#{@env.path.output}/_sisu") - end - unless File.exist?("#{@env.path.output}/_sisu/image_sys") \ - or File.symlink?("#{@env.path.output}/_sisu/image_sys") - File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys") - end - end - def man_forms - #File.symlink("../../man/form", "#{@env.path.output}/man/form") unless File.symlink?("#{@env.path.output}/man/form")==true - end - def man_pdf - #File.symlink("../../man/form", "#{@env.path.output}/man/pdf") unless File.symlink?("#{@env.path.output}/man/pdf")==true - end - end class InfoFile