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 --- bin/sisu | 11 +++++---- bin/sisu2 | 13 +++++++---- bin/sisu3 | 11 +++++---- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/hub.rb | 58 ++++++++++++++++++++++------------------------ 5 files changed, 52 insertions(+), 43 deletions(-) diff --git a/bin/sisu b/bin/sisu index 87215ec0..f840f8bb 100644 --- a/bin/sisu +++ b/bin/sisu @@ -45,21 +45,24 @@ WOK $KCODE='u' if RUBY_VERSION < '1.9' argv=$* SiSU_version_dir=case argv.inspect - when /--v2/ + when /"(?:--v2)"/ check_sisu_legacy_ruby_version? 'v2' - when /--v3/ + when /"(?:--v3)"/ check_sisu_stable_ruby_version? 'v3' - when /--dev/ + when /"(?:--dev)"/ check_sisu_dev_ruby_version? - 'v3' #'v3dv' + 'v3' else check_sisu_stable_ruby_version? 'v3' end SiSU_lib="sisu/#{SiSU_version_dir}" require "#{SiSU_lib}/hub" + unless SiSU_version_dir == 'v2' + SiSU::HubMaster.new(argv) + end rescue STDERR.puts 'ERROR' STDERR.puts $! diff --git a/bin/sisu2 b/bin/sisu2 index 4a329e5c..d8aac3dd 100644 --- a/bin/sisu2 +++ b/bin/sisu2 @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # encoding: utf-8 -#SiSU: copyright (C) 1997 - 2011 Ralph Amissah; License GPL, see appended program information +#SiSU: copyright (C) 1997 - 2012 Ralph Amissah; License GPL, see appended program information begin def ruby_version_ok?(base_version) @v ||=RUBY_VERSION.scan(/\d+/) @@ -45,21 +45,24 @@ WOK $KCODE='u' if RUBY_VERSION < '1.9' argv=$* SiSU_version_dir=case argv.inspect - when /--v2/ + when /"(?:--v2)"/ check_sisu_legacy_ruby_version? 'v2' - when /--v3/ + when /"(?:--v3)"/ check_sisu_stable_ruby_version? 'v3' - when /--dev/ + when /"(?:--dev)"/ check_sisu_dev_ruby_version? - 'v3' #'v3dv' + 'v3' else check_sisu_legacy_ruby_version? 'v2' end SiSU_lib="sisu/#{SiSU_version_dir}" require "#{SiSU_lib}/hub" + unless SiSU_version_dir == 'v2' + SiSU::HubMaster.new(argv) + end rescue STDERR.puts 'ERROR' STDERR.puts $! diff --git a/bin/sisu3 b/bin/sisu3 index 87215ec0..f840f8bb 100644 --- a/bin/sisu3 +++ b/bin/sisu3 @@ -45,21 +45,24 @@ WOK $KCODE='u' if RUBY_VERSION < '1.9' argv=$* SiSU_version_dir=case argv.inspect - when /--v2/ + when /"(?:--v2)"/ check_sisu_legacy_ruby_version? 'v2' - when /--v3/ + when /"(?:--v3)"/ check_sisu_stable_ruby_version? 'v3' - when /--dev/ + when /"(?:--dev)"/ check_sisu_dev_ruby_version? - 'v3' #'v3dv' + 'v3' else check_sisu_stable_ruby_version? 'v3' end SiSU_lib="sisu/#{SiSU_version_dir}" require "#{SiSU_lib}/hub" + unless SiSU_version_dir == 'v2' + SiSU::HubMaster.new(argv) + end rescue STDERR.puts 'ERROR' STDERR.puts $! diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index f7fc8126..0731f23a 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -35,6 +35,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.3.3.orig.tar.xz * v3: constants, year static (current): YEAR=2012 +* v3: bin/sisu, hub, reorganize call + %% 3.3.2.orig.tar.xz (2012-06-30:26/6) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.3.2 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.3.2-1 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