aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-02-06 21:20:53 -0500
committerRalph Amissah <ralph@amissah.com>2013-02-06 21:20:53 -0500
commit9729605b3202aa4c808be01fe65faf88fd353df4 (patch)
tree0dda6b309870f6d744914992a26640871ac86c80 /lib
parentv4 (v3): utils (debug renamed), SiSU_Utils::CodeMarker (from Debug::Mark) (diff)
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)
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v4/sysenv.rb5
-rw-r--r--lib/sisu/v4/utils.rb11
2 files changed, 14 insertions, 2 deletions
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)