diff options
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/tmftools.rb')
-rw-r--r-- | Master/texmf-dist/scripts/context/ruby/tmftools.rb | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/Master/texmf-dist/scripts/context/ruby/tmftools.rb b/Master/texmf-dist/scripts/context/ruby/tmftools.rb index d125c5cae69..074e949d139 100644 --- a/Master/texmf-dist/scripts/context/ruby/tmftools.rb +++ b/Master/texmf-dist/scripts/context/ruby/tmftools.rb @@ -21,10 +21,11 @@ # tmftools --analyze > kpsewhat.log # tmftools --analyze --strict > kpsewhat.log # tmftools --analyze --delete --force "texmf-local/fonts/.*/somename" +# tmftools --serve # the real thing -banner = ['TMFTools', 'version 1.0.0 (experimental, no help yet)', '2005', 'PRAGMA ADE/POD'] +banner = ['TMFTools', 'version 1.1.0 (experimental, no help yet)', '2005/2006', 'PRAGMA ADE/POD'] unless defined? ownpath ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') @@ -33,27 +34,58 @@ end require 'base/switch' require 'base/logger' -require 'base/kpsefast' class Commands include CommandBase def init_kpse - k = KPSEFAST.new - k.rootpath = @commandline.option('rootpath') - k.treepath = @commandline.option('treepath') - k.progname = @commandline.option('progname') - k.engine = @commandline.option('engine') - k.format = @commandline.option('format') - k.diskcache = @commandline.option('diskcache') - k.renewcache = @commandline.option('renewcache') - k.load_cnf - k.expand_variables - k.load_lsr + # require 'base/kpseremote' + # if KpseRemote::available? then + if ENV['KPSEMETHOD'] && ENV['KPSEPORT'] then + require 'base/kpseremote' + k = KpseRemote.new + else + k = nil + end + if k && k.okay? then + k.progname = @commandline.option('progname') + k.engine = @commandline.option('engine') + k.format = @commandline.option('format') + else + require 'base/kpsefast' + k = KpseFast.new + k.rootpath = @commandline.option('rootpath') + k.treepath = @commandline.option('treepath') + k.progname = @commandline.option('progname') + k.engine = @commandline.option('engine') + k.format = @commandline.option('format') + k.diskcache = @commandline.option('diskcache') + k.renewcache = @commandline.option('renewcache') + k.load_cnf + k.expand_variables + k.load_lsr + end return k end + def serve + if ENV['KPSEMETHOD'] && ENV['KPSEPORT'] then + require 'base/kpseremote' + begin + KpseRemote::start_server + rescue + end + end + end + + def reload + begin + init_kpse.load + rescue + end + end + def main if option = @commandline.option('expand-braces') and not option.empty? then puts init_kpse.expand_braces(option) @@ -128,6 +160,9 @@ commandline.registerflag('verbose') commandline.registeraction('help') commandline.registeraction('version') +commandline.registeraction('reload', 'reload file database') +commandline.registeraction('serve', 'act as kpse server') + commandline.expand Commands.new(commandline,logger,banner).send(commandline.action || 'main') |