aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-06-17 22:38:31 -0400
committerRalph Amissah <ralph@amissah.com>2012-06-17 22:53:27 -0400
commitfed01af686fb007454eafff9127b16a6516b50c0 (patch)
tree9810fe775b188c35c5a7b3c5d2c428d114c8a49a /lib/sisu/v3/sysenv.rb
parentv3: 3.3.0 version & changelog "opened" (diff)
v3: shared_sisupod_source, common build for sisu (markup) source representationssisu_3.3.0
* to be used by sisupod.txz, git, (and src) * sisupod_make (--sisupod) * share_source (--source) NOTE not used git at present * changed representation of shared sisu source, include related files in directory rather than just markup file [reason for version bump] NOTE there are no changes to sisu markup (only the sharing of source files)
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb118
1 files changed, 61 insertions, 57 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 5e9533a2..1527e634 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -858,7 +858,7 @@ module SiSU_Env
@language=(l.nil? || l.empty?) \
? SiSU_Env::InfoEnv.new.language_default_set
: l
- @r=%{(?:#{Px[:lng_lst].join('|')})}
+ @r=%{(?:#{Px[:lng_lst_rgx]})}
@lang_info=SiSU_i18n::Languages.new
end
def lang_lst # from i18n
@@ -1010,7 +1010,7 @@ module SiSU_Env
@stub_md= @stub_pwd + '/sisu_site_metadata'
pt=Pathname.new(Dir.pwd)
stub=if output_dir_structure.by_language_code?
- r=Px[:lng_lst].join('|')
+ r=Px[:lng_lst_rgx]
stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/
lng=pt.split[-1].to_s
lng_part='/' + lng
@@ -1114,7 +1114,7 @@ module SiSU_Env
# image/ [all images for specific document gathered here]
# audio/
# video/
- spp="#{processing_path.processing}/sisupod"
+ spp="#{processing_path.processing}/#{Gt[:sisupod]}"
sppc="#{spp}/doc/_sisu"
lng_dirs=[]
if FileTest.directory?(spp) \
@@ -1157,17 +1157,17 @@ module SiSU_Env
# skin/
# doc [relevant skin if any other than default]
# image [all images for specific document gathered here]
- sisupod_processing_path="#{processing_path.processing}/sisupod"
+ sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}"
if FileTest.directory?(sisupod_processing_path) \
or FileTest.file?(sisupod_processing_path)
FileUtils::rm_rf(sisupod_processing_path)
end
paths=[]
paths=[
- "#{processing_path.processing}/sisupod/_sisu/skin/doc",
- "#{processing_path.processing}/sisupod/_sisu/skin/dir",
- "#{processing_path.processing}/sisupod/_sisu/skin/site",
- "#{processing_path.processing}/sisupod/_sisu/image"
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/doc",
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/dir",
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/site",
+ "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/image"
]
paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) }
end
@@ -1882,11 +1882,11 @@ WOK
"#{path.webserv}/#{images}"
end
def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names
- r=Px[:lng_lst].join('|')
+ r=Px[:lng_lst_rgx]
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
base_stub=@sys.pwd.gsub(u,'\1')
- if Dir.pwd =~/\/sisupod\/[^\/]+\/sisupod\/doc/
- "#{path.webserv}/doc"
+ if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/
+ "#{path.webserv}/#{Gt[:doc]}"
else
"#{path.webserv}/#{base_stub}"
end
@@ -2011,27 +2011,40 @@ WOK
: ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path]
end
def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
- unless FileTest.directory?(root_dir)
- FileUtils::mkdir_p(root_dir)
- File.chmod(0777,root_dir)
- end
- if usr_dir?
+ @opt=opt
+ def paths
processing_path_usr="#{root_dir}/#{user}"
- FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr)
- File.chmod(0700,processing_path_usr)
- end
- sisupod_processing_path=processing_path_usr + '/pods/' + opt.fno + '/sisupod'
- FileUtils::mkdir_p(sisupod_processing_path) unless FileTest.directory?(sisupod_processing_path)
- sisupod_processing_path_lng=if defined? opt.lng
- sisupod_processing_path + '/doc/' + opt.lng
- else
- sisupod_processing_path + '/doc'
- end
- unless FileTest.directory?(sisupod_processing_path_lng)
- FileUtils::mkdir_p(sisupod_processing_path_lng)
- File.chmod(0700,sisupod_processing_path_lng)
+ processing_path_fnb=processing_path_usr + '/' + Gt[:pods] + '/' + @opt.fng
+ processing_path_sisupod=processing_path_fnb + '/' + Gt[:sisupod]
+ { fnb: processing_path_fnb, sisupod: processing_path_sisupod }
+ end
+ def make
+ unless FileTest.directory?(root_dir)
+ FileUtils::mkdir_p(root_dir)
+ File.chmod(0777,root_dir)
+ end
+ if usr_dir?
+ processing_path_usr="#{root_dir}/#{user}"
+ FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr)
+ File.chmod(0700,processing_path_usr)
+ end
+ fn_base_bundle=paths[:fnb]
+ sisupod_processing_path=paths[:sisupod]
+ FileUtils::mkdir_p(sisupod_processing_path) unless FileTest.directory?(sisupod_processing_path)
+ sisupod_processing_path_lng=if defined? @opt.lng
+ sisupod_processing_path + '/' + Gt[:doc] + '/' + @opt.lng
+ else
+ sisupod_processing_path + '/' + Gt[:doc]
+ end
+#p sisup od_processing_path_lng
+ unless FileTest.directory?(sisupod_processing_path_lng)
+ #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu"
+ FileUtils::mkdir_p(sisupod_processing_path_lng)
+ File.chmod(0700,sisupod_processing_path_lng)
+ end
+ sisupod_processing_path
end
- sisupod_processing_path
+ self
end
def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
unless FileTest.directory?(root_dir)
@@ -2087,8 +2100,8 @@ WOK
and not @rc['git']['dir'].nil? \
and not @rc['git']['dir'].empty?
x=(@rc['git']['dir'] =~/^(?:~|home)$/) \
- ? home + '/' + 'sisu:'
- : @rc['git']['dir'] + '/' + 'sisu:'
+ ? home + '/' + Gt[:git]
+ : @rc['git']['dir'] + '/' + Gt[:git]
else defaults[:processing_git]
end
unless FileTest.directory?(pth)
@@ -2672,7 +2685,7 @@ WOK
end
def sisupod_gen_v3(fns_pod)
pwd=Dir.pwd
- sisupod_processing_path="#{processing_path.processing}/sisupod"
+ sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}"
if FileTest.directory?(sisupod_processing_path) \
or FileTest.file?(sisupod_processing_path)
FileUtils::rm_rf(sisupod_processing_path)
@@ -2688,7 +2701,7 @@ WOK
if f_pod \
&& FileTest.file?(f_pod)
tree=(SiSU_Env::SystemCall.new.program_found?('tree')) \
- ? "tree #{processing_path.processing}/sisupod"
+ ? "tree #{processing_path.processing}/#{Gt[:sisupod]}"
: ''
if FileTest.directory?(processing_path.processing)
Dir.chdir(processing_path.processing)
@@ -2703,7 +2716,7 @@ WOK
end
def sisupod_gen_v2(fns_pod)
pwd=Dir.pwd
- sisupod_processing_path="#{processing_path.processing}/sisupod"
+ sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}"
if FileTest.directory?(sisupod_processing_path) \
or FileTest.file?(sisupod_processing_path)
FileUtils::rm_rf(sisupod_processing_path)
@@ -3822,7 +3835,7 @@ WOK
@pwd=Dir.pwd
@env=SiSU_Env::InfoEnv.new
pt=Pathname.new(@pwd)
- r=Px[:lng_lst].join('|')
+ r=Px[:lng_lst_rgx]
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
@pwd_stub=pt.realpath.to_s[u,1]
@rc=@@rc ||=GetInit.instance.sisu_yaml.rc
@@ -4659,7 +4672,7 @@ WOK
end
end
def src
- @md.fns
+ @md.fno
end
def po #check
(@fno.empty?) \
@@ -4710,10 +4723,8 @@ WOK
"#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
elsif output_dir_structure.dump?
@md.opt.opt_act[:dump][:inst]
- elsif output_dir_structure.by_language_code?
- "#{output_path.base.dir}/#{@ft}/#{@md.opt.lng}"
else
- "#{output_path.base.dir}/#{@ft}"
+ "#{output_path.base.dir}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}"
end
end
def ab_pod
@@ -4745,11 +4756,7 @@ WOK
end
end
def ab_src
- if output_dir_structure.by_language_code?
- "#{output_path.base.url}/#{@ft}/#{@md.opt.lng}"
- else
- "#{output_path.base.url}/#{@ft}"
- end
+ "#{output_path.base.url}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}"
end
def ab_pod
"#{output_path.base.url}/#{@ft}"
@@ -4783,11 +4790,7 @@ WOK
end
end
def ab_pod
- if output_dir_structure.by_language_code?
- "#{@ft}"
- else
- "#{@ft}"
- end
+ "#{@ft}"
end
self
end
@@ -4811,12 +4814,13 @@ WOK
end
end
def ab_src
+ locate="#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}"
if output_dir_structure.dump_or_redirect?
'.'
elsif output_dir_structure.by_language_code?
- "#{@ft}/#{@md.opt.lng}"
+ "../../#{locate}"
else
- "#{@ft}"
+ "../#{locate}"
end
end
def ab_pod
@@ -4948,7 +4952,7 @@ WOK
end
def sisupod
def ft
- Gt[:src] + '/' + Gt[:pod]
+ Gt[:src]
end
def dir
set_path(ft).dir.ab_pod
@@ -4969,7 +4973,7 @@ WOK
end
def po
def dir
- "#{output_path.base.dir}/po4a/#{@md.fnb}/po/#{@md.opt.lng}"
+ "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/po/#{@md.opt.lng}"
end
def url
"#{output_path.base.url}/po4a/#{@md.fnb}/po/#{@md.opt.lng}"
@@ -4978,7 +4982,7 @@ WOK
end
def pot
def dir
- "#{output_path.base.dir}/po4a/#{@md.fnb}/pot"
+ "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/pot"
end
def url
"#{output_path.base.url}/po4a/#{@md.fnb}/pot"
@@ -5649,7 +5653,7 @@ WOK
def apply
if @m.respond_to?(:make) \
and @md.make.respond_to(:skin)
- skin_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/
+ skin_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/#{Gt[:sisupod]}\/\S+?\/#{Gt[:pod]}\/#{Gt[:doc]}/
[
"#{@env.path.pwd}/_sisu/skin",
"#{@env.path.home}/.sisu/skin",
@@ -5657,7 +5661,7 @@ WOK
"#{@env.processing_path.processing_sisupod(@md.opt)}/external_document/skin"
]
else #sisupod
- pt=/(\/\S+?\/sisupod\/\S+?\/sisupod\/doc)/.match(@md.opt.f_pth[:pth])[1]
+ pt=/(\/\S+?\/#{Gt[:sisupod]}\/\S+?\/#{Gt[:pod]}\/#{Gt[:doc]})/.match(@md.opt.f_pth[:pth])[1]
[ "#{pt}/_sisu/skin" ]
end
sk_doc,sk_dir="doc/#{@md.make.skin}.rb","dir/skin_#{@env.stub_pwd}.rb"