diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v0/hub.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v0/param.rb | 8 | ||||
-rw-r--r-- | lib/sisu/v0/sysenv.rb | 340 | ||||
-rw-r--r-- | lib/sisu/v0/texpdf.rb | 12 |
4 files changed, 211 insertions, 159 deletions
diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index 475d626a..da1c6324 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -7,14 +7,14 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah All Rights Reserved. + 2007, 2008 Ralph Amissah All Rights Reserved. * License: GPL 3 or later: SiSU, a framework for document structuring, publishing and search Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah + 2007, 2008 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 @@ -546,8 +546,10 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end end begin #% select what to do - require 'jcode' - $KCODE='UTF8' + if RUBY_VERSION < '1.9' + require 'jcode' + $KCODE='UTF8' + end require "#{SiSU_lib}/options" require "#{SiSU_lib}/sysenv" include SiSU_Env diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 8bf0d760..2f2043fb 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -7,14 +7,14 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah All Rights Reserved. + 2007, 2008 Ralph Amissah All Rights Reserved. * License: GPL 3 or later: SiSU, a framework for document structuring, publishing and search Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah + 2007, 2008 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 @@ -60,7 +60,9 @@ module SiSU_Param require 'uri' require 'pstore' - require 'ftools' + if RUBY_VERSION < '1.9' + require 'ftools' + end require "#{SiSU_lib}/sysenv" include SiSU_Env require "#{SiSU_lib}/param_identify_markup" diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index fa6be6cb..b4252e28 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -7,14 +7,14 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah All Rights Reserved. + 2007, 2008 Ralph Amissah All Rights Reserved. * License: GPL 3 or later: SiSU, a framework for document structuring, publishing and search Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah + 2007, 2008 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 @@ -88,7 +88,7 @@ module SiSU_Env @t.month end def year_static - '2007' + '2008' end end class Info_system @@ -101,24 +101,22 @@ module SiSU_Env data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @stub_pwd ||=@@pwd[m,1] - prcss_dir='_sisu_processing' + prcss_dir='_sisu_processing~' prcss_dir_tmp_root="/tmp/#{prcss_dir}" prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" - @processing_dir=if @@home \ + if @@user + tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + else #error + tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}" + end + tmp_processing_home=if @@home \ and File.writable?("#{@@home}/.") "#{@@home}/#{prcss_dir_stub}" - #elsif File.writable?("#{@@pwd}/."); "#{@@pwd}/#{prcss_dir}" else prcss_dir_stub end - tmp_processing_base=if @@user; "#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" - else "#{prcss_dir_stub}" - end - tmp_processing_base_user=if @@user; "#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" - else "/tmp/#{prcss_dir_stub}" - end - tmp_processing=if @@user; "#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" - else "/tmp/#{prcss_dir_stub}" - end + processing_path=tmp_processing_individual + processing_dir=prcss_dir user=ENV['USER'] port_pgsql=if defined? ENV['PGPORT'] \ and not (ENV['PGPORT'].nil? \ @@ -141,9 +139,9 @@ module SiSU_Env WEBSERV_RSS=:webserv_rss WEBSERV_SQLITE=:webserv_sqlite OUTPUT_LOCAL=:output_local + PROCESSING_DIR=:processing_dir PROCESSING_PATH=:processing_path PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root - PROCESSING_PATH_TMP=:processing_path_tmp PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base PROCESSING_DAL=:processing_dal PROCESSING_TUNE=:processing_tune @@ -165,47 +163,47 @@ module SiSU_Env SQLITE_PATH=:sqlite_path SQLITE_PORT=:sqlite_port DEFAULT_DIR={ - IMAGES => '_sisu/image', - SISU_ETC => etc, - SISU_SHARE => share, - SAMPLE_DATA_PATH => data, - IMAGE_STUB => '_sisu/image', - STYLESHEET_STUB => '_sisu/css', - IMAGE_LOCAL => @@pwd + '/_sisu/image', - WEBSERV_PATH => out + '/www', - #WEBSERV_DIR => www, # uncomment for urls... - #WEBSERV_IMAGE => out + '/www/_sisu/image', - WEBSERV_MAN => out + '/www/man', #alter - WEBSERV_PHP => out + '/www/php', - WEBSERV_CGI => '/usr/lib/cgi-bin', - WEBSERV_RSS => out + '/www/feed', - WEBSERV_SQLITE => out + '/www/sqlite', - OUTPUT_LOCAL => @@home + '/sisu_www', - PROCESSING_PATH => @processing_dir, + IMAGES => '_sisu/image', + SISU_ETC => etc, + SISU_SHARE => share, + SAMPLE_DATA_PATH => data, + IMAGE_STUB => '_sisu/image', + STYLESHEET_STUB => '_sisu/css', + IMAGE_LOCAL => @@pwd + '/_sisu/image', + WEBSERV_PATH => out + '/www', + #WEBSERV_DIR => www, # uncomment for urls... + #WEBSERV_IMAGE => out + '/www/_sisu/image', + WEBSERV_MAN => out + '/www/man', #alter + WEBSERV_PHP => out + '/www/php', + WEBSERV_CGI => '/usr/lib/cgi-bin', + WEBSERV_RSS => out + '/www/feed', + WEBSERV_SQLITE => out + '/www/sqlite', + OUTPUT_LOCAL => @@home + '/sisu_www', + PROCESSING_DIR => processing_dir, + PROCESSING_PATH => processing_path, PROCESSING_DIR_TMP_ROOT => prcss_dir_tmp_root, - PROCESSING_PATH_TMP_BASE => tmp_processing_base, - PROCESSING_PATH_TMP => tmp_processing, - PROCESSING_DAL => 'dal', - PROCESSING_TUNE => 'tune', - PROCESSING_LATEX => 'tex', - PROCESSING_TEXINFO => 'texinfo', - PROCESSING_LOUT => 'lout', - PROCESSING_ENCODING => 'encoding', - #TEXINFO_STUB => 'texinfo', - PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal - LANGUAGE => 'English', - LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used - MULTILINGUAL => true, - CONCORD_MAX => 260000, - DIGEST => 'md5', - WEBSERV_HOST_CGI => 'http://localhost', - WEBSERV_PORT_CGI => 8081, #8111,8123,8081 - POSTGRESQL_USER => @@user, #'ralph', # change user !!! - POSTGRESQL_PORT => port_pgsql, - #POSGRESQL_LINKS_PATH => '', - SQLITE_USER => @@user, - SQLITE_PATH => @@user, #?? - SQLITE_PORT => '**', + PROCESSING_PATH_TMP_BASE => processing_path, + PROCESSING_DAL => 'dal', + PROCESSING_TUNE => 'tune', + PROCESSING_LATEX => 'tex', + PROCESSING_TEXINFO => 'texinfo', + PROCESSING_LOUT => 'lout', + PROCESSING_ENCODING => 'encoding', + #TEXINFO_STUB => 'texinfo', + PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal + LANGUAGE => 'English', + LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used + MULTILINGUAL => true, + CONCORD_MAX => 260000, + DIGEST => 'md5', + WEBSERV_HOST_CGI => ' http://localhost', + WEBSERV_PORT_CGI => 8081, #8111,8123,8081 + POSTGRESQL_USER => @@user, #'ralph', # change user !!! + POSTGRESQL_PORT => port_pgsql, + #POSGRESQL_LINKS_PATH => '', + SQLITE_USER => @@user, + SQLITE_PATH => @@user, #?? + SQLITE_PORT => '**', } @@default_dir=DEFAULT_DIR m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @@ -1340,33 +1338,70 @@ WOK def processing_dir_tmp_root defaults[:processing_dir_tmp_root] end - def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc) - unless FileTest.directory?(defaults[:processing_dir_tmp_root]) - File.mkpath(defaults[:processing_dir_tmp_root]) - File.chmod(0777,defaults[:processing_dir_tmp_root]) - end - File.mkpath(defaults[:processing_path]) unless FileTest.directory?(defaults[:processing_path]) - File.mkpath(defaults[:processing_path_tmp]) unless FileTest.directory?(defaults[:processing_path_tmp]) - path_processing=if defined? @rc['processing']['path'] \ - and @rc['processing']['path'] - unless FileTest.directory?("#{path.home}/#{@rc['processing']['path']}") - File.mkpath("#{path.home}/#{@rc['processing']['path']}") + def processing_path_root + proposed_path_base=if defined? @rc['processing']['path'] \ + and not @rc['processing']['path'].nil? \ + and not @rc['processing']['path'].empty? + x=if @rc['processing']['path'] =~/^(?:~|home)$/ + home #fix + else @rc['processing']['path'] + end + else nil + end + proposed_dir=if defined? @rc['processing']['dir'] \ + and not @rc['processing']['dir'].nil? \ + and not @rc['processing']['dir'].empty? + @rc['processing']['dir'] + else defaults[:processing_dir] + end + path=if proposed_path_base \ + and FileTest.directory?(proposed_path_base) \ + and File.writable?("#{proposed_path_base}/.") + x=if proposed_dir + "#{proposed_path_base}/#{proposed_dir}" + else + "#{proposed_path_base}/#{defaults[:processing_dir]}" end - ["#{path.home}/#{@rc['processing']['path']}",defaults[:processing_path],defaults[:processing_path_tmp]] - else [defaults[:processing_path],defaults[:processing_path_tmp]] + else defaults[:processing_dir_tmp_root] + end + end + def processing_path_usr? + case processing_path_root + when /^\/home/; false + else true + end + end + def processing_path + if processing_path_usr? + "#{processing_path_root}/#{user}/#{stub_pwd}" + else + "#{processing_path_root}/#{stub_pwd}" # see defaults[:processing_path] end - @processing=nil + end + def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc) + unless FileTest.directory?(processing_path_root) + File.mkpath(processing_path_root) + File.chmod(0777,processing_path_root) + end + if processing_path_usr? + processing_path_usr="#{processing_path_root}/#{user}" + File.mkpath(processing_path_usr) unless FileTest.directory?(processing_path_usr) + File.chmod(0700,processing_path_usr) + end + File.mkpath(processing_path) unless FileTest.directory?(processing_path) + File.chmod(0700,processing_path) + path_processing=[processing_path,defaults[:processing_path],defaults[:processing_path_home]] + processing=nil path_processing.each do |v| # - #if File.writable?("#{v}/.") #check now is earlier - @processing=v - unless FileTest.directory?(@processing) - puts "a processing directory (#@processing) is being created for use by sisu" - File.mkpath(@processing) - end - break - #end + processing=v + unless FileTest.directory?(processing) + puts "a processing directory (#{processing}) is being created for use by sisu" + File.mkpath(processing) + File.chmod(0700,processing) + end + break end - @processing + processing end def composite_file pth=path.dal #"#{processing}/composite" @@ -1374,15 +1409,15 @@ WOK pth end def dal - pth=if defined? @rc['processing']['dal']; "#{processing}/#{@rc['processing']['dal']}" - else "#{processing}/#{defaults[:processing_dal]}" + pth=if defined? @rc['processing']['dal']; "#{processing}/#{@rc['processing']['dal']}" + else "#{processing}/#{defaults[:processing_dal]}" end File.mkpath(pth) unless FileTest.directory?(pth) pth end def tune - pth=if defined? @rc['processing']['tune']; "#{processing}/#{@rc['processing']['tune']}" - else "#{processing}/#{defaults[:processing_tune]}" + pth=if defined? @rc['processing']['tune']; "#{processing}/#{@rc['processing']['tune']}" + else "#{processing}/#{defaults[:processing_tune]}" end File.mkpath(pth) unless FileTest.directory?(pth) pth @@ -1391,15 +1426,15 @@ WOK "#{processing}/odf" end def tex - pth=if defined? @rc['processing']['latex']; "#{processing}/#{@rc['processing']['latex']}" - else "#{processing}/#{defaults[:processing_latex]}" + pth=if defined? @rc['processing']['latex']; "#{processing}/#{@rc['processing']['latex']}" + else "#{processing}/#{defaults[:processing_latex]}" end File.mkpath(pth) unless FileTest.directory?(pth) pth end def texi - pth=if defined? @rc['processing']['texinfo']; "#{processing}/#{@rc['processing']['texinfo']}" - else "#{processing}/#{defaults[:processing_texinfo]}" + pth=if defined? @rc['processing']['texinfo']; "#{processing}/#{@rc['processing']['texinfo']}" + else "#{processing}/#{defaults[:processing_texinfo]}" end File.mkpath(pth) unless FileTest.directory?(pth) pth @@ -1408,15 +1443,15 @@ WOK "#{processing}/#{defaults[:processing_texinfo]}" end def lout - pth=if defined? @rc['processing']['lout']; "#{processing}/#{@rc['processing']['lout']}" - else "#{processing}/#{defaults[:processing_lout]}" + pth=if defined? @rc['processing']['lout']; "#{processing}/#{@rc['processing']['lout']}" + else "#{processing}/#{defaults[:processing_lout]}" end File.mkpath(pth) unless FileTest.directory?(pth) pth end def feed - if defined? @rc['webserv']['feed']; "#{public_output}/#{@rc['webserv']['feed']}" - else defaults[:webserv_feed] + if defined? @rc['webserv']['feed']; "#{public_output}/#{@rc['webserv']['feed']}" + else defaults[:webserv_feed] end end def feed_home @@ -1435,8 +1470,8 @@ WOK end end def php - if defined? @rc['webserv']['php']; "#{public_output}/#{@rc['webserv']['php']}" - else defaults[:webserv_php] + if defined? @rc['webserv']['php']; "#{public_output}/#{@rc['webserv']['php']}" + else defaults[:webserv_php] end end # programs @@ -1653,15 +1688,15 @@ WOK else 'filesystem' end output=case output_type - when /^filesystem(?:_url)?/; url.dir_url - when /^remote(?:_webserv)?/; url.remote - when /^(?:webserv|local_webserv)/; url.local - when /^local(:\d+)/; url.hostname + $1 + '/' + stub_pwd - when /^localhost(:\d+)/; url.localhost + $1 + '/' + stub_pwd - when /^localhost/; url.localhost - when /^webrick/; url.webrick - when /^path/; url.webserv_map_pwd - else url.webserv_map_pwd + when /^filesystem(?:_url)?/; url.dir_url + when /^remote(?:_webserv)?/; url.remote + when /^(?:webserv|local_webserv)/; url.local + when /^local(:\d+)/; url.hostname + $1 + '/' + stub_pwd + when /^localhost(:\d+)/; url.localhost + $1 + '/' + stub_pwd + when /^localhost/; url.localhost + when /^webrick/; url.webrick + when /^path/; url.webserv_map_pwd + else url.webserv_map_pwd end end def images @@ -1670,7 +1705,9 @@ WOK def images_local if FileTest.directory?(defaults[:image_local]) if @@image_flag - require 'ftools' + if RUBY_VERSION < '1.9' + require 'ftools' + end images=Dir.glob("#{defaults[:image_local]}/*.{png,jpg,gif}") pth="#{path.webserv}/#@stub_pwd" File.mkpath("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image") @@ -1696,7 +1733,9 @@ WOK def images_external if FileTest.directory?(image_external) if @@image_flag - require 'ftools' + if RUBY_VERSION < '1.9' + require 'ftools' + end images=Dir.glob("#{image_external}/*.{png,jpg,gif}") pth="#{path.webserv}/#@stub_pwd" File.mkpath("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") @@ -1777,7 +1816,7 @@ WOK elsif defined? @rc['program_select']['console_web_browser'] \ and @rc['program_select']['console_web_browser'] =~/\S\S+/ @rc['program_select']['console_web_browser'] - else 'console-www-browser' #'links2' 'elinks' 'epiphany' + else 'console-www-browser' #'lynx' 'links2' 'elinks' 'epiphany' end end def console_www_browser @@ -1874,7 +1913,7 @@ WOK is end def postgresql - is=if defined? @rc['program_set']['postgresql']; @rc['program_set']['postgresql'] + is=if defined? @rc['program_set']['postgresql']; @rc['program_set']['postgresql'] else '' end if is.nil? \ @@ -1884,7 +1923,7 @@ WOK is end def sqlite - is=if defined? @rc['program_set']['sqlite']; @rc['program_set']['sqlite'] + is=if defined? @rc['program_set']['sqlite']; @rc['program_set']['sqlite'] else '' end if is.nil? \ @@ -1903,16 +1942,16 @@ WOK conf=if defined? @rc['default']['language']; @rc['default']['language'] else nil end - l=if pwd=~m ; pwd[m1,1] #2 directory: by visible directory name - elsif conf; @rc['default']['language'] #3 config: from sisurc.yaml - else defaults[:language] #4 sisu: program default + l=if pwd=~m ; pwd[m1,1] #2 directory: by visible directory name + elsif conf; @rc['default']['language'] #3 config: from sisurc.yaml + else defaults[:language] #4 sisu: program default end #1 document: param gets SiSU_Env::Standardise_language.new(l) end def multilingual if defined? @rc['default']['multilingual'] \ - and @rc['default']['multilingual'] != nil; @rc['default']['multilingual'] - else defaults[:multilingual] + and @rc['default']['multilingual'] != nil; @rc['default']['multilingual'] + else defaults[:multilingual] end end def lang_filename(l) @@ -1926,12 +1965,12 @@ WOK end if (l != defaults[:language_code]) \ or (language.code != defaults[:language_code]) #watch - if x==1; @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' - elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' - elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" - else @lang[:pre],@lang[:mid],@lang[:post]='','','' + if x==1; @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' + elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' + elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" + else @lang[:pre],@lang[:mid],@lang[:post]='','','' end - else @lang[:pre],@lang[:mid],@lang[:post]='','','' + else @lang[:pre],@lang[:mid],@lang[:post]='','','' end @lang end @@ -2036,12 +2075,12 @@ WOK class Info_settings < Info_env def permission?(prog) #program defaults if defined? @rc['permission_set'][prog]; @rc['permission_set'][prog] - else false + else false end end def program?(prog) #program defaults if defined? @rc['program_set'][prog]; @rc['program_set'][prog] - else false + else false end end end @@ -2074,33 +2113,33 @@ WOK and @md.cmd !~ /[hH]/ ft << @md.fn[:manifest] end - if @md.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] + if @md.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] end - if @md.cmd =~ /x/; ft << @md.fn[:sax] + if @md.cmd =~ /x/; ft << @md.fn[:sax] end - if @md.cmd =~ /X/; ft << @md.fn[:dom] + if @md.cmd =~ /X/; ft << @md.fn[:dom] end - if @md.cmd =~ /b/; ft << @md.fn[:xhtml] + if @md.cmd =~ /b/; ft << @md.fn[:xhtml] end - if @md.cmd =~ /a/; ft << @md.fn[:plain] + if @md.cmd =~ /a/; ft << @md.fn[:plain] end - if @md.cmd =~ /i/; ft << @md.fn[:manpage] + if @md.cmd =~ /i/; ft << @md.fn[:manpage] end - if @md.cmd =~ /[g]/; ft << @md.fn[:wiki] + if @md.cmd =~ /g/; ft << @md.fn[:wiki] end - if @md.cmd =~ /N/; ft << @md.fn[:digest] + if @md.cmd =~ /N/; ft << @md.fn[:digest] end - if @md.cmd =~ /o/; ft << @md.fn[:odf] + if @md.cmd =~ /o/; ft << @md.fn[:odf] end - if @md.cmd =~ /O/; ft << @md.fn[:oai_pmh] + if @md.cmd =~ /O/; ft << @md.fn[:oai_pmh] end - if @md.cmd =~ /s/; ft << @md.fns + if @md.cmd =~ /s/; ft << @md.fns end - if @md.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi' + if @md.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi' end @fnb=@md.fnb else # still needed where/when param is not parsed - if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??' + if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??' end if @opt.cmd =~ /w/ \ and @opt.cmd !~ /[hH]/ @@ -2110,29 +2149,29 @@ WOK and @opt.cmd !~ /[hH]/ ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' end - if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' + if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' end - if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' + if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' end - if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' + if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' end - if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' + if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' end - if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1' + if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1' end - if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' + if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' end - if @opt.cmd =~ /[g]/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt' + if @opt.cmd =~ /g/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt' end - if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' + if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' end - if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' + if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' end - if @opt.cmd =~ /O/; ft << 'oai_pmh.xml' + if @opt.cmd =~ /O/; ft << 'oai_pmh.xml' end - if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm' + if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm' end - if @opt.cmd =~ /S/; ft << '.zip' << '.kdi' + if @opt.cmd =~ /S/; ft << '.zip' << '.kdi' end if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml' end @@ -2146,7 +2185,7 @@ WOK @filetypes=if filetypes !~/..+/; '' # -r called alone, copy all elsif @opt.cmd =~/u/; '' # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u elsif filetypes =~/\S+?,\S+/; '*{' + filetypes + '}' # more than one relevant file type - else '*' + filetypes # one relevant file type + else '*' + filetypes # one relevant file type end @source_path=if @fnb \ and not @fnb.empty? @@ -2498,7 +2537,9 @@ WOK class Info_version <Info_env require 'rbconfig' def get_version - require 'ftools' + if RUBY_VERSION < '1.9' + require 'ftools' + end @version={} @pwd=ENV['PWD'] yst_etc="#{defaults[:sisu_etc]}/version.yml" @@ -2600,6 +2641,13 @@ WOK def dbi "DBI:Pg:database=#{psql.db};port=#{psql.port}" end + def password + if defined? @rc['db']['postgresql']['password'] \ + and @rc['db']['postgresql']['password']=~/\S+/ + @rc['db']['postgresql']['password'] + else '' + end + end self end def mysql diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index ead5752b..d19384cf 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -7,14 +7,14 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah All Rights Reserved. + 2007, 2008 Ralph Amissah All Rights Reserved. * License: GPL 3 or later: SiSU, a framework for document structuring, publishing and search Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007 Ralph Amissah + 2007, 2008 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 @@ -183,12 +183,12 @@ module SiSU_TeX portrait_pdf="#{pwd}/#{tex_fn_base}.pdf" landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" if FileTest.file?(portrait_pdf) - File.install(portrait_pdf,"#@dir_sisu/#{@md.fnb}/#{@md.fn[:pdf_p]}") - File.unlink(portrait_pdf) + cp(portrait_pdf,"#@dir_sisu/#{@md.fnb}/#{@md.fn[:pdf_p]}") + rm(portrait_pdf) end if FileTest.file?(landscape_pdf) - File.install(landscape_pdf,"#@dir_sisu/#{@md.fnb}/#{@md.fn[:pdf_l]}") - File.unlink(landscape_pdf) + cp(landscape_pdf,"#@dir_sisu/#{@md.fnb}/#{@md.fn[:pdf_l]}") + rm(landscape_pdf) end tell=SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)') tell.generic_number unless @md.cmd =~/q/ |