summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/ruby/tmftools.rb
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-11-16 01:02:47 +0000
committerKarl Berry <karl@freefriends.org>2006-11-16 01:02:47 +0000
commit3c85b55e2f245fb7edac7e445f107e6d0bb423ae (patch)
treec62b7f80edafe0455310d08e09f4218127bf9e87 /Master/texmf-dist/scripts/context/ruby/tmftools.rb
parente5ecff27a26ef59e1dbe9702677687fd7107be3a (diff)
context update
git-svn-id: svn://tug.org/texlive/trunk@2444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/tmftools.rb')
-rw-r--r--Master/texmf-dist/scripts/context/ruby/tmftools.rb61
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')