From ebc9b30cafa7d4ef1fcca7eeb82207dd2572d4c2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:25:31 -0400 Subject: v5 v6: bin/sisu, hub, options, pass message: sisu_called_from_directory --- bin/sisu | 8 +++++--- data/doc/sisu/CHANGELOG_v5 | 2 ++ data/doc/sisu/CHANGELOG_v6 | 2 ++ lib/sisu/v5/constants.rb | 1 + lib/sisu/v5/hub.rb | 7 +++---- lib/sisu/v5/options.rb | 13 ++++++------- lib/sisu/v5/sst_convert_markup.rb | 3 ++- lib/sisu/v6/constants.rb | 1 + lib/sisu/v6/hub.rb | 7 +++---- lib/sisu/v6/options.rb | 13 ++++++------- lib/sisu/v6/sst_convert_markup.rb | 3 ++- 11 files changed, 33 insertions(+), 27 deletions(-) diff --git a/bin/sisu b/bin/sisu index 51840e07..ffc5a8a5 100644 --- a/bin/sisu +++ b/bin/sisu @@ -179,6 +179,8 @@ class Orient path_lib: sisu_path_lib, version_info_path: sisu_version_info_path, language_list: language_list.codes, + language_list_regex: language_list.regex, + called_from: sisu_called_from_directory, } end def get_processing_info @@ -233,7 +235,7 @@ class Orient Dir.chdir(markup_dir) $sisu_document_markup_directory_base_fixed_path= Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'') - SiSU::HubMaster.new(argv_sub) + SiSU::HubMaster.new(argv_sub,sisu_called_from_directory) elsif markup_dir =~/https?:/ markup_file.each do |mf| (FileTest.file?(mf)) \ @@ -244,7 +246,7 @@ class Orient $sisu_document_markup_directory_base_fixed_path= Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'') argv_sub=command_line_modifiers + markup_file - SiSU::HubMaster.new(argv_sub) + SiSU::HubMaster.new(argv_sub,sisu_called_from_directory) else p "Error directory specified #{markup_dir} not found" end ensure @@ -256,7 +258,7 @@ class Orient $sisu_document_markup_directory=Dir.pwd.gsub(/\/$/,'') $sisu_document_markup_directory_base_fixed_path= Dir.pwd.gsub(/(^|\/)(?:#{language_list.regex})$/,'') - SiSU::HubMaster.new(processing.argv) + SiSU::HubMaster.new(processing.argv,sisu_called_from_directory) end end end diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 4e3fa157..2650bd15 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.5.1.orig.tar.xz sisu_5.5.1.orig.tar.xz sisu_5.5.1-1.dsc +* bin/sisu, hub, options, message pass sisu_called_from_directory + %% 5.5.0.orig.tar.xz (2014-07-11:27/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.5.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.5.0-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 83be145c..d908dc06 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.1.1.orig.tar.xz sisu_6.1.1.orig.tar.xz sisu_6.1.1-1.dsc +* bin/sisu, hub, options, message pass sisu_called_from_directory + %% 6.1.0.orig.tar.xz (2014-07-11:27/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.1.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.1.0-1 diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 05678b32..d242ef1d 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -237,6 +237,7 @@ Px={ po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', lng_lst: SiSU_is[:language_list], + lng_lst_rgx: SiSU_is[:language_list_regex], lv1: '*', lv2: '=', lv3: '=', diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index d9359862..5d291f9b 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -79,10 +79,9 @@ module SiSU error('uri NOT FOUND (LoadError)') end class HubMaster - def initialize(argv) - pwd_the=Dir.pwd + def initialize(argv,call_path) begin #% select what to do (set options & start processing (files selected if any)) - opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set + opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set SiSU::Processing.new(opt).actions # do it rescue cmd=(opt ? opt.cmd : '') @@ -90,7 +89,7 @@ module SiSU __LINE__.to_s + ':' + __FILE__ end ensure - Dir.chdir(pwd_the) + Dir.chdir(call_path) end end end diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 591bb990..e7d0f023 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -69,7 +69,6 @@ module SiSU_Commandline end require_relative 'sysenv' # sysenv.rb require_relative 'param_make' # param_make.rb - @@sisu_call_origin_path=nil class HeaderCommon def sisu_document_make_instructions @pagenew= @@ -155,18 +154,18 @@ module SiSU_Commandline end end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod + attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil - def initialize(a) - @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location= - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' + def initialize(a,call_path) + @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@sub_location='' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? - @@sisu_call_origin_path ||=Dir.pwd - @base_path=@@sisu_call_origin_path + @call_path=call_path + @base_path= + call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v5/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb index cec67960..cdceba7c 100644 --- a/lib/sisu/v5/sst_convert_markup.rb +++ b/lib/sisu/v5/sst_convert_markup.rb @@ -313,7 +313,8 @@ end #%% files to match for this conversion set -------------------------> require_relative 'options' # options.rb argv=$* -@opt=SiSU_Commandline::Options.new(argv) +base_path=Dir.pwd +@opt=SiSU_Commandline::Options.new(argv,base_path) case @opt.mod.inspect when /=kdi/ SiSU_Modify::ConvertMarkup.new(@opt).conversion diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb index 53ed226a..87611bf9 100644 --- a/lib/sisu/v6/constants.rb +++ b/lib/sisu/v6/constants.rb @@ -237,6 +237,7 @@ Px={ po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', lng_lst: SiSU_is[:language_list], + lng_lst_rgx: SiSU_is[:language_list_regex], lv1: '*', lv2: '=', lv3: '=', diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index 94d0eb8e..7508dcbc 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -79,10 +79,9 @@ module SiSU error('uri NOT FOUND (LoadError)') end class HubMaster - def initialize(argv) - pwd_the=Dir.pwd + def initialize(argv,call_path) begin #% select what to do (set options & start processing (files selected if any)) - opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set + opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set SiSU::Processing.new(opt).actions # do it rescue cmd=(opt ? opt.cmd : '') @@ -90,7 +89,7 @@ module SiSU __LINE__.to_s + ':' + __FILE__ end ensure - Dir.chdir(pwd_the) + Dir.chdir(call_path) end end end diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index e181ee8e..1850c6d4 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -69,7 +69,6 @@ module SiSU_Commandline end require_relative 'sysenv' # sysenv.rb require_relative 'param_make' # param_make.rb - @@sisu_call_origin_path=nil class HeaderCommon def sisu_document_make_instructions @pagenew= @@ -155,18 +154,18 @@ module SiSU_Commandline end end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod + attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil - def initialize(a) - @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location= - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' + def initialize(a,call_path) + @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@sub_location='' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? - @@sisu_call_origin_path ||=Dir.pwd - @base_path=@@sisu_call_origin_path + @call_path=call_path + @base_path= + call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v6/sst_convert_markup.rb b/lib/sisu/v6/sst_convert_markup.rb index 0b749fc5..8d523d0f 100644 --- a/lib/sisu/v6/sst_convert_markup.rb +++ b/lib/sisu/v6/sst_convert_markup.rb @@ -313,7 +313,8 @@ end #%% files to match for this conversion set -------------------------> require_relative 'options' # options.rb argv=$* -@opt=SiSU_Commandline::Options.new(argv) +base_path=Dir.pwd +@opt=SiSU_Commandline::Options.new(argv,base_path) case @opt.mod.inspect when /=kdi/ SiSU_Modify::ConvertMarkup.new(@opt).conversion -- cgit v1.2.3