From 9729605b3202aa4c808be01fe65faf88fd353df4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 21:20:53 -0500 Subject: v4: utils, SiSU_Utils::Path.new.base_markup provides base markup directory * base markup directory contains sisu markup files, any language sub-directories (with sisu markup files) and sisu resource configuration sub-directory, if any (./_sisu) (identifies when needed in runtime) --- lib/sisu/v4/sysenv.rb | 5 +++-- lib/sisu/v4/utils.rb | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index c5a1cebb..2ac8897f 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -60,6 +60,7 @@ @@lang_info=nil module SiSU_Env require_relative 'constants' # constants.rb + require_relative 'utils' # utils.rb require 'fileutils' include FileUtils::Verbose require 'singleton' @@ -213,7 +214,7 @@ module SiSU_Env } @@default_dir=DEFAULT_DIR m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @@pwd=@pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + @@pwd=@pwd=SiSU_Utils::Path.new.base_markup stub_pwd=@pwd[m,1] attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path def initialize @@ -3926,7 +3927,7 @@ WOK class InfoDb < InfoEnv @@rc=nil def initialize - @@pwd=@pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + @@pwd=@pwd=SiSU_Utils::Path.new.base_markup @env=SiSU_Env::InfoEnv.new pt=Pathname.new(@pwd) r=Px[:lng_lst_rgx] diff --git a/lib/sisu/v4/utils.rb b/lib/sisu/v4/utils.rb index 7567d26a..040e06b6 100644 --- a/lib/sisu/v4/utils.rb +++ b/lib/sisu/v4/utils.rb @@ -99,6 +99,17 @@ module SiSU_Utils @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") end end + class Path + def initialize(dir=Dir.pwd) + @dir=dir + end + def base_markup + (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + end + def bmd + base_markup + end + end end __END__ puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:red) -- cgit v1.2.3