From b4694609f708d52b7dbd88dfab53f3178451ad27 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 29 Aug 2012 21:30:02 -0400 Subject: v3: bin/sisu, hub, reorganize call --- lib/sisu/v3/hub.rb | 58 ++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 6fa69753..ac103830 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -59,8 +59,33 @@ module SiSU require_relative 'constants' # constants.rb require_relative 'sysenv' # sysenv.rb + include SiSU_Env include SiSU_Screen - @@pwd_the=Dir.pwd + require_relative 'options' # options.rb + require_relative 'param' # param.rb + include SiSU_Param + require_relative 'defaults' # defaults.rb + include SiSU_Viz + require_relative 'help' # help.rb + include SiSU_Help + require 'uri' + class HubMaster + def initialize(argv) + pwd_the=Dir.pwd + begin #% select what to do + home=ENV['HOME'] + opt=SiSU_Commandline::Options.new(argv) + SiSU::Processing.new(opt).actions + rescue + cmd=(opt ? opt.cmd : '') + SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do + __LINE__.to_s + ':' + __FILE__ + end + ensure + Dir.chdir(pwd_the) + end + end + end class OptionLoopFiles def initialize(opt) @opt=opt @@ -229,10 +254,11 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on class Processing require 'fileutils' include FileUtils - @@env=SiSU_Env::InfoEnv.new + @@env=nil attr_accessor :op def initialize(opt) @opt=opt + @@env=SiSU_Env::InfoEnv.new @msg,@msgs='',nil @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } end @@ -690,33 +716,5 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on end end end - begin #% select what to do - if RUBY_VERSION < '1.9' - require 'jcode' - $KCODE='UTF8' - end - require_relative 'constants' # constants.rb - require_relative 'options' # options.rb - require_relative 'sysenv' # sysenv.rb - include SiSU_Env; include SiSU_Screen - require_relative 'param' # param.rb - include SiSU_Param - require_relative 'defaults' # defaults.rb - include SiSU_Viz - require_relative 'help' # help.rb - include SiSU_Help - require 'uri' - home=ENV['HOME'] - argv=$* - @opt=SiSU_Commandline::Options.new(argv) - SiSU::Processing.new(@opt).actions - rescue - cmd=(@opt ? @opt.cmd : '') - SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do - __LINE__.to_s + ':' + __FILE__ - end - ensure - Dir.chdir(@@pwd_the) - end end __END__ -- cgit v1.2.3