aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-05-23 22:46:26 -0400
committerRalph Amissah <ralph@amissah.com>2011-05-23 22:46:26 -0400
commita14b86c35fcd6cb81057b43cfdc0dcdf5aa20eef (patch)
tree6356a6f59a89a9ed81cc68e7356c83c9ec42630a /lib/sisu/v3/sysenv.rb
parentdebian/changelog (3.0.9-1) (diff)
parentv3: defaults, fix path to homepage image (more fixes remain...) (diff)
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb916
1 files changed, 553 insertions, 363 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 5a59ebf8..a35a9eef 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -445,6 +445,8 @@ module SiSU_Env
'language'
elsif by_filetype?
'filetype'
+ elsif by_filename?
+ 'filename'
else
'filename'
end
@@ -521,12 +523,13 @@ module SiSU_Env
@m
end
def filename(code,name,suffix)
- d=SiSU_Env::Info_env.new(@fns)
- fnl=d.i18n.lang_filename(code)
- if code
- "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}"
- else "#{name}#{suffix}"
- end
+ #d=SiSU_Env::Info_env.new(@fns)
+ #fnl=d.i18n.lang_filename(code)
+ "#{name}#{suffix}"
+ #if code
+ # "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}"
+ #else "#{name}#{suffix}"
+ #end
end
def lang(code)
@fn={
@@ -774,7 +777,7 @@ module SiSU_Env
#? system("scp -Cr #{@input} #{@output}") \
#: (puts "\tWARN: #{program} not found" )
end
- def rsync(action='',chdir='.')
+ def rsync(action='',chdir=nil)
program='rsync'
if program_found?(program)
vb=if @cmd =~/q/; 'q'
@@ -783,12 +786,18 @@ module SiSU_Env
end
msg=''
msg=" && echo 'OK: #{@input} -> #{@output}'" unless @cmd =~/q/
- puts "rsync -az#{vb} #{action} #{@input} #{@output}" if @cmd =~/[vVM]/
+ puts "rsync -az#{vb} #{action} #{@input} #{@output}" if @cmd =~/[vVM]/
+ dir_change,dir_return='',''
+ if chdir \
+ && chdir != Dir.pwd
+ dir_change=Dir.chdir(chdir)
+ dir_return=Dir.pwd
+ end
+ dir_change
system("
- cd #{chdir}
rsync -az#{vb} #{action} #{@input} #{@output} #{msg}
- cd -
")
+ dir_return
else puts "\tWARN: #{program} not found"
end
end
@@ -1436,6 +1445,81 @@ WOK
end
self
end
+ def path_rel_links
+ def html_scroll_2
+ if @env.output_dir_structure.by_language_code?
+ '../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../'
+ else
+ '../'
+ end
+ end
+ def html_seg_2
+ if @env.output_dir_structure.by_language_code?
+ '../../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../../'
+ else
+ '../'
+ end
+ end
+ def html_scroll_1
+ if @env.output_dir_structure.by_language_code?
+ '../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../'
+ else
+ './'
+ end
+ end
+ def html_seg_1
+ if @env.output_dir_structure.by_language_code?
+ '../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../../'
+ else
+ './'
+ end
+ end
+ def default_output_css
+ if @env.output_dir_structure.by_language_code?
+ '../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../'
+ else
+ '../'
+ end
+ end
+ def html_scroll_css
+ default_output_css
+ end
+ def xhtml_css
+ default_output_css
+ end
+ def xml_css
+ default_output_css
+ end
+ def html_seg_css
+ if @env.output_dir_structure.by_language_code?
+ '../../../'
+ elsif @env.output_dir_structure.by_filetype?
+ '../../'
+ else
+ '../'
+ end
+ end
+ def manifest_css
+ if @env.output_dir_structure.by_language_code?
+ '../../_sisu/css'
+ elsif @env.output_dir_structure.by_filetype?
+ ''
+ else
+ '../'
+ end
+ end
+ self
+ end
def path #dir
def home
@sys.home
@@ -2375,7 +2459,7 @@ WOK
end
class File_map < Info_env
attr_accessor :local_sisu_source
- def initialize(opt='') #watch
+ def initialize(opt='') #watch / REVIEW
super()
@opt=opt #,opt.fns,opt.cmd
@env=(@opt.fns && !(@opt.fns.empty?) \
@@ -2642,250 +2726,277 @@ WOK
remote_host_base_general
end
def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built
- self.remote_host_base.each do |remote_conn|
- local_gen=@source_path
- remote_gen=case @opt.cmd
- when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u
- when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/."
- else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- end
- local_epub=@source_path_epub
- local_src=@source_path_src
- local_pod=@source_path_pod
- remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/."
- remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
- remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
- src_txt=@opt.fnc
- src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
- if (local_gen =~/\S/ \
- and local_gen !~/\/\//) \
- and (remote_gen =~/\S/ \
- and remote_gen !~/\/\//) \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- System_call.new(local_gen,remote_gen).scp
- if FileTest.file?("#{local_src}/#{src_txt}")
- System_call.new("#{local_src}/#{src_txt}",remote_src).scp
+ def document
+ self.remote_host_base.each do |remote_conn|
+ local_gen=@source_path
+ remote_gen=case @opt.cmd
+ when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u
+ when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/."
+ else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
end
- if FileTest.file?("#{local_pod}/#{src_pod}")
- System_call.new("#{local_src}/#{src_pod}",remote_pod).scp
+ local_epub=@source_path_epub
+ local_src=@source_path_src
+ local_pod=@source_path_pod
+ remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/."
+ remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
+ remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
+ src_txt=@opt.fnc
+ src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
+ if (local_gen =~/\S/ \
+ and local_gen !~/\/\//) \
+ and (remote_gen =~/\S/ \
+ and remote_gen !~/\/\//) \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ System_call.new(local_gen,remote_gen).scp
+ if FileTest.file?("#{local_src}/#{src_txt}")
+ System_call.new("#{local_src}/#{src_txt}",remote_src).scp
+ end
+ if FileTest.file?("#{local_pod}/#{src_pod}")
+ System_call.new("#{local_src}/#{src_pod}",remote_pod).scp
+ end
+ if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub")
+ System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp
+ end
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "#{local_gen} -> #{remote_gen}"
+ if FileTest.file?("#{local_src}/#{src_doc}")
+ puts "#{local_src}/#{src_doc}* -> #{remote_src}"
+ end
+ if FileTest.file?("#{local_pod}/#{src_doc}.zip")
+ puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
+ end
+ else
+ puts 'suspect scp request, ignored'
+ puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
+ puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
end
- if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub")
- System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp
+ end
+ end
+ def site_base #base site
+ self.remote_host_base.each do |remote_conn|
+ local=@source_path
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ puts "begin scp_base: #{local} -> #{remote}"
+ System_call.new("#{local}/#{@env.path.style}/",remote).scp
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "begin scp_base: #{local} -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
end
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "#{local_gen} -> #{remote_gen}"
- if FileTest.file?("#{local_src}/#{src_doc}")
- puts "#{local_src}/#{src_doc}* -> #{remote_src}"
+ end
+ end
+ def site_base_all #base site
+ self.remote_host_base.each do |remote_conn|
+ local=@source_path
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ puts "begin scp_base_all: #{local} -> #{remote}"
+ System_call.new("#{local}/_sisu/image_sys/",remote).scp
+ System_call.new("#{local}/_sisu/image/",remote).scp
+ System_call.new("#{local}/#{@env.path.style}/",remote).scp
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "scp_base_all: #{local} -> #{remote}"
+ puts "#{local}/_sisu/image_sys/ -> #{remote}"
+ puts "#{local}/_sisu/image/ -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
end
- if FileTest.file?("#{local_pod}/#{src_doc}.zip")
- puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
+ end
+ end
+ self
+ end
+ def images_from_skin
+ skin=Info_skin.new(@md).select
+ skin_array=nil
+ skin_images_array=[]
+ if skin
+ skin_array=IO.readlines(skin,"\n")
+ skin_array.each do |l|
+ if l !~/^#/
+ if l =~/([a-z0-9._-]+\.(?:png|jpg|gif))/i
+ skin_images_array << $1
+ end
end
- else
- puts 'suspect scp request, ignored'
- puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
- puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
end
end
+ skin_images_array
end
def rsync
- self.remote_host_base.each do |remote_conn|
- local_gen=@source_path
- local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
- remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- remote_images="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image/."
- remote_images_external="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image_external/."
- local_epub=@source_path_epub
- local_src=@source_path_src
- local_pod=@source_path_pod
- remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/."
- remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
- remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
- src_txt=@opt.fnc
- src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
- if (local_gen =~/\S/ \
- and local_gen !~/\/\//) \
- and (remote_gen =~/\S/ \
- and remote_gen !~/\/\//) \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- delete_extra_files='--delete' # '--delete-after'
- inp=[]
- begin
- local_dirs=%{-f"+ */" -f"- *" #{@md.file.output_path.base.dir}/*}
- System_call.new(local_dirs,remote_gen,@opt.cmd).rsync
- rescue
- local_dirs=%{--include='*/' --exclude='*' @md.file.output_path.base.dir}
- System_call.new(local_dirs,remote_gen,@opt.cmd).rsync
- end
- if @opt.cmd =~/h/ \
- && FileTest.file?(@md.file.place_file.html_scroll.dir)
- inp << @md.file.output_path.html_seg.rel << @md.file.place_file.html_scroll.rel
- end
- if @opt.cmd =~/w/ \
- && FileTest.file?(@md.file.place_file.html_concordance.dir)
- inp << @md.file.place_file.html_concordance.rel
- end
- if @opt.cmd =~/e/ \
- && FileTest.file?(@md.file.place_file.epub.dir)
- inp << @md.file.place_file.epub.rel
- end
- if @opt.cmd =~/o/ \
- && FileTest.file?(@md.file.place_file.odt.dir)
- inp << @md.file.place_file.odt.rel
- end
- if @opt.cmd =~/b/ \
- && FileTest.file?(@md.file.place_file.xhtml.dir)
- inp << @md.file.place_file.xhtml.rel
- end
- if @opt.cmd =~/x/ \
- && FileTest.file?(@md.file.place_file.xml_sax.dir)
- inp << @md.file.place_file.xml_sax.rel
- end
- if @opt.cmd =~/X/ \
- && FileTest.file?(@md.file.place_file.xml_dom.dir)
- inp << @md.file.place_file.xml_dom.rel
- end
- if @opt.cmd =~/[at]/ \
- && FileTest.file?(@md.file.place_file.txt.dir)
- inp << @md.file.place_file.txt.rel
- end
- if @opt.cmd =~/N/ \
- && FileTest.file?(@md.file.place_file.hash_digest.dir)
- inp << @md.file.place_file.hash_digest.rel
- end
- if @opt.cmd =~/s/ \
- && FileTest.file?(@md.file.place_file.src.dir)
- inp << @md.file.place_file.src.rel
- end
- if @opt.cmd =~/S/ \
- && FileTest.file?(@md.file.place_file.sisupod.dir)
- inp << @md.file.place_file.sisupod.rel
- end
- if @opt.cmd =~/p/
- inp << @md.file.output_path.pdf.rel + '/' + @opt.fnb + '*'
- end
- if @opt.cmd =~/y/ \
- && FileTest.file?(@md.file.place_file.manifest.dir)
- inp << @md.file.place_file.manifest.rel
- end
- if inp.length > 0
- local_gen=inp.join(' ')
- remote_rel=remote_conn[:name] + '/' + @md.file.output_path.stub.rcp
- remote_rel='/home/ralph/tst'
- System_call.new(local_gen,remote_rel,@opt.cmd).rsync('--relative',@md.file.output_path.base.dir)
- end
- if FileTest.file?("#{local_src}/#{src_txt}")
+ @f=SiSU_Env::SiSU_file.new(@md)
+ def document
+ self.remote_host_base.each do |remote_conn|
+ local_gen=@source_path
+ local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+ local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
+ remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp
+ src_txt=@opt.fnc
+ if (local_gen =~/\S/ \
+ and local_gen !~/\/\//) \
+ and (remote_gen =~/\S/ \
+ and remote_gen !~/\/\//) \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
# System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync
- if defined? @md.ec[:image] and not @md.ec[:image].empty?
- images="#{local_gen_image}/" + @md.ec[:image].join(" #{local_gen_image}/")
-# System_call.new(images,remote_images,@opt.cmd).rsync
+ delete_extra_files='--delete' # '--delete-after'
+ inp=[]
+ if @opt.cmd =~/h/ \
+ && FileTest.file?(@f.place_file.html_scroll.dir)
+ inp << @f.output_path.html_seg.rel << @f.place_file.html_scroll.rel
+ end
+ if @opt.cmd =~/w/ \
+ && FileTest.file?(@f.place_file.html_concordance.dir)
+ inp << @f.place_file.html_concordance.rel
+ end
+ if @opt.cmd =~/e/ \
+ && FileTest.file?(@f.place_file.epub.dir)
+ inp << @f.place_file.epub.rel
+ end
+ if @opt.cmd =~/o/ \
+ && FileTest.file?(@f.place_file.odt.dir)
+ inp << @f.place_file.odt.rel
+ end
+ if @opt.cmd =~/b/ \
+ && FileTest.file?(@f.place_file.xhtml.dir)
+ inp << @f.place_file.xhtml.rel
+ end
+ if @opt.cmd =~/x/ \
+ && FileTest.file?(@f.place_file.xml_sax.dir)
+ inp << @f.place_file.xml_sax.rel
+ end
+ if @opt.cmd =~/X/ \
+ && FileTest.file?(@f.place_file.xml_dom.dir)
+ inp << @f.place_file.xml_dom.rel
+ end
+ if @opt.cmd =~/[at]/ \
+ && FileTest.file?(@f.place_file.txt.dir)
+ inp << @f.place_file.txt.rel
+ end
+ if @opt.cmd =~/N/ \
+ && FileTest.file?(@f.place_file.hash_digest.dir)
+ inp << @f.place_file.hash_digest.rel
+ end
+ if @opt.cmd =~/s/ \
+ && FileTest.file?(@f.place_file.src.dir)
+ inp << @f.place_file.src.rel
+ end
+ if @opt.cmd =~/S/ \
+ && FileTest.file?(@f.place_file.sisupod.dir)
+ inp << @f.place_file.sisupod.rel
+ end
+ if @opt.cmd =~/p/
+ inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*'
+ end
+ if @opt.cmd =~/y/ \
+ && FileTest.file?(@f.place_file.manifest.dir)
+ inp << @f.place_file.manifest.rel
+ end
+ local_gen=if inp.length > 0
+ inp.join(' ')
+ else ''
+ end
+ local_css,images,images_external,images_system='','','',''
+ if @opt.cmd =~/[hwbxX]/ \
+ and defined? @md.ec[:image] \
+ and not @md.ec[:image].empty?
+ images=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/")
images_external="#{local_gen_image_external}/" + @md.ec[:image].join(" #{local_gen_image_external}/")
-# System_call.new(images_external,remote_images_external,@opt.cmd).rsync
end
+ images_gen=images=images_skin=images_system=local_css=''
+ if @opt.cmd =~/[yhwbxX]/ \
+ and defined? @md.ec[:image] \
+ and not @md.ec[:image].empty?
+ local_css=@f.output_path.css.rel
+ images_system='_sisu/image_sys'
+ if @f.output_path.images.rel.length > 0
+ images_skin=@f.place_file.images.rel + '/' + images_from_skin.join(" #{@f.output_path.images.rel}/")
+ end
+ end
+ begin
+ ##create file structure without copying files?:
+ ##rsync -av -f"+ */" -f"- *" @f.output_path.base.dir remote:./path/.
+ #local_dirs=%{-f"+ */" -f"- *" #{@f.output_path.base.dir}/*}
+ #System_call.new(local_dirs,remote_gen,@opt.cmd).rsync
+ local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css
+ System_call.new(local,remote_rel,@opt.cmd).rsync('--relative',@f.output_path.base.dir)
+ rescue
+ p __LINE__.to_s + ':' + __FILE__
+ local_dirs=%{--include='*/' --exclude='*' #{@f.output_path.base.dir}}
+ System_call.new(local_dirs,remote_gen,@opt.cmd).rsync
+ end
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "#{local_gen} -> #{remote_gen}"
+ if FileTest.file?("#{local_src}/#{src_doc}") \
+ or FileTest.file?("#{local_src}/#{src_doc}.zip")
+ puts "#{local_src}/#{src_doc}* -> #{remote_src}"
+ end
+ else
+ puts 'suspect rsync request, ignored'
+ puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
+ puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
end
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "#{local_gen} -> #{remote_gen}"
- if FileTest.file?("#{local_src}/#{src_doc}") \
- or FileTest.file?("#{local_src}/#{src_doc}.zip")
- puts "#{local_src}/#{src_doc}* -> #{remote_src}"
- end
- else
- puts 'suspect rsync request, ignored'
- puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
- puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
end
end
- end
- def scp_base #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- puts "begin scp_base: #{local} -> #{remote}"
- System_call.new("#{local}/#{@env.path.style}/",remote).scp
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "begin scp_base: #{local} -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def scp_base_all #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- puts "begin scp_base_all: #{local} -> #{remote}"
- System_call.new("#{local}/_sisu/image_sys/",remote).scp
- System_call.new("#{local}/_sisu/image/",remote).scp
- System_call.new("#{local}/#{@env.path.style}/",remote).scp
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "scp_base_all: #{local} -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/_sisu/image/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- end
- end
- end
- def rsync_base #base site
- ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu"
- image_sys="#{@env.path.webserv}/_sisu/image_sys"
- images="#{@env.path.webserv}/_sisu/image"
- self.remote_host_base.each do |remote_conn|
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- remote_conf="#{remote_conn[:name]}/_sisu"
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- System_call.new("#{image_sys}","#{remote_conf}").rsync
- System_call.new("#{images}","#{remote_conf}").rsync
- System_call.new("#{ldest}","#{remote}").rsync
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_base: #{local} -> #{remote}"
- puts "#{local}/_sisu/image -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ def site_base #base site
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu"
+ image_sys="#{@env.path.webserv}/_sisu/image_sys"
+ images="#{@env.path.webserv}/_sisu/image"
+ self.remote_host_base.each do |remote_conn|
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ remote_conf="#{remote_conn[:name]}/_sisu"
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ System_call.new("#{image_sys}","#{remote_conf}").rsync
+ System_call.new("#{images}","#{remote_conf}").rsync
+ System_call.new("#{ldest}","#{remote}").rsync
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "rsync_base: #{local} -> #{remote}"
+ puts "#{local}/_sisu/image -> #{remote}"
+ puts "#{local}/_sisu/image_sys/ -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
end
end
- end
- def rsync_base_sync #base site
- self.remote_host_base.each do |remote_conn|
- local=@source_path
- remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
- if defined? @rc['permission_set']['remote_base_site'] \
- and @rc['permission_set']['remote_base_site'] \
- and @@flag_remote==true \
- and @opt.cmd !~/U/
- delete_extra_files='--delete' # '--delete-after'
- puts "begin rsync_base_sync: #{local} -> #{remote}"
- System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files)
- System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files)
- System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files)
- elsif @opt.cmd =~/U/
- puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
- puts "rsync_base_sync: #{local} -> #{remote}"
- puts "#{local}/_sisu/image_sys/ -> #{remote}"
- puts "#{local}/_sisu/image/ -> #{remote}"
- puts "#{local}/#{@env.path.style}/ -> #{remote}"
- else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ def site_base_sync
+ self.remote_host_base.each do |remote_conn|
+ local=@source_path
+ remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
+ if defined? @rc['permission_set']['remote_base_site'] \
+ and @rc['permission_set']['remote_base_site'] \
+ and @@flag_remote==true \
+ and @opt.cmd !~/U/
+ delete_extra_files='--delete' # '--delete-after'
+ puts "begin rsync_base_sync: #{local} -> #{remote}"
+ System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files)
+ System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files)
+ System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files)
+ elsif @opt.cmd =~/U/
+ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ puts "rsync_base_sync: #{local} -> #{remote}"
+ puts "#{local}/_sisu/image_sys/ -> #{remote}"
+ puts "#{local}/_sisu/image/ -> #{remote}"
+ puts "#{local}/#{@env.path.style}/ -> #{remote}"
+ else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
+ end
end
end
+ self
end
def rsync_sitemaps #sitemap directory
self.remote_host_base.each do |remote_conn|
@@ -3022,81 +3133,6 @@ WOK
end
self
end
- def path_rel_links
- def html_scroll_2
- if @env.output_dir_structure.by_language_code?
- '../../'
- elsif @env.output_dir_structure.by_filetype?
- '../'
- else
- '../'
- end
- end
- def html_seg_2
- if @env.output_dir_structure.by_language_code?
- '../../../'
- elsif @env.output_dir_structure.by_filetype?
- '../../'
- else
- '../../'
- end
- end
- def html_scroll_1
- if @env.output_dir_structure.by_language_code?
- '../'
- elsif @env.output_dir_structure.by_filetype?
- '../'
- else
- '/'
- end
- end
- def html_seg_1
- if @env.output_dir_structure.by_language_code?
- '../../'
- elsif @env.output_dir_structure.by_filetype?
- '../../'
- else
- '/'
- end
- end
- def default_output_css
- if @env.output_dir_structure.by_language_code?
- '../../'
- elsif @env.output_dir_structure.by_filetype?
- '../'
- else
- '../'
- end
- end
- def html_scroll_css
- default_output_css
- end
- def xhtml_css
- default_output_css
- end
- def xml_css
- default_output_css
- end
- def html_seg_css
- if @env.output_dir_structure.by_language_code?
- '../../../'
- elsif @env.output_dir_structure.by_filetype?
- '../../'
- else
- '../'
- end
- end
- def manifest_css
- if @env.output_dir_structure.by_language_code?
- '../../_sisu/css'
- elsif @env.output_dir_structure.by_filetype?
- ''
- else
- '../'
- end
- end
- self
- end
def mkdir #check moved from SiSU_file, existing mkdir
def processing
def dal
@@ -3426,110 +3462,117 @@ WOK
end
def base_filename
def txt
+ ft='.txt'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.txt'
+ @md.fnb + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + @md.fn[:plain]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'plain' + @md.fn[:plain]
+ 'plain' + @md.lang_code_insert + ft
end
end
def html_scroll
- #"#{@md.fnl[:pre]}scroll#{@md.fnl[:mid]}.html#{@md.fnl[:post]}"
+ ft='.html'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.html'
+ @md.fnb + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + @md.fn[:html]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'scroll' + @md.fn[:html]
+ 'scroll' + @md.lang_code_insert + ft
end
end
def html_seg_index
- #"#{@md.fnl[:pre]}index#{@md.fnl[:mid]}.html#{@md.fnl[:post]}"
+ ft='.html'
if @env.output_dir_structure.by_language_code?
- 'toc.html'
+ 'toc' + ft
else
- 'index' + @md.fn[:html]
+ 'index' + @md.lang_code_insert + ft
end
end
def html_segtoc
- #"#{@md.fnl[:pre]}toc#{@md.fnl[:mid]}.html#{@md.fnl[:post]}"
+ ft='.html'
if @env.output_dir_structure.by_language_code?
- 'toc.html'
+ 'toc' + ft
else
- 'toc' + @md.fn[:html]
+ 'toc' + @md.lang_code_insert + ft
end
end
def html_book_index
+ ft='.html'
if @env.output_dir_structure.by_language_code?
- 'book_index.html'
+ 'book_index' + ft
else
- 'book_index.' + @md.fn[:html]
+ 'book_index' + @md.lang_code_insert + ft
end
end
def html_concordance
+ ft='.html'
if @env.output_dir_structure.by_language_code?
- 'concordance.html'
+ 'concordance' + ft
else
- 'concordance' + @md.fn[:html]
+ 'concordance' + @md.lang_code_insert + ft
end
end
def xhtml
+ ft= '.xhtml'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.xhtml'
+ @md.fnb + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + '.' + @md.fn[:xhtml]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'scroll.' + @md.fn[:xhtml]
+ 'scroll' + @md.lang_code_insert + ft
end
end
def epub
+ ft='.epub'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.epub'
+ @md.fnb + ft
else
- @md.fnb + @md.fn[:epub]
+ @md.fnb + @md.lang_code_insert + ft
end
end
def odt
- #"#{@md.fnl[:pre]}#{@md.fnb}#{@md.fnl[:mid]}.odt#{@md.fnl[:post]}"
+ ft='.odt'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.odt'
+ @md.fnb + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + @md.fn[:odf]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'opendocument' + @md.fn[:odf]
+ 'opendocument' + @md.lang_code_insert + ft
end
end
def xml_sax
+ ft='.sax.xml'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.sax.xml'
+ @md.fnb + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + '.' + @md.fn[:sax]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'scroll.' + @md.fn[:sax]
+ 'scroll' + @md.lang_code_insert + ft
end
end
def xml_dom
+ ft='.dom.xml'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.dom.xml'
+ @md.fnb + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + '.' + @md.fn[:dom]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'scroll.' + @md.fn[:dom]
+ 'scroll' + @md.lang_code_insert + ft
end
end
def pdf_p
if @env.output_dir_structure.by_language_code? \
or @env.output_dir_structure.by_filetype?
@md.fnb + '.portrait.'
- else 'portrait.'
+ else 'portrait' + @md.lang_code_insert + '.'
end
end
def pdf_l
if @env.output_dir_structure.by_language_code? \
or @env.output_dir_structure.by_filetype?
@md.fnb + '.landscape.'
- else 'landscape.'
+ else 'landscape' + @md.lang_code_insert + '.'
end
end
def pdf_p_a4
@@ -3563,43 +3606,47 @@ WOK
pdf_l + @md.fn[:pdf_l_legal]
end
def manpage
+ ft='.1'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.1'
+ @md.fnb + ft
else
- @md.fnb + '.' + @md.fn[:manpage]
+ @md.fnb + @md.lang_code_insert + ft
end
end
def hash_digest
+ ft='.txt'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.hash_digest.txt'
+ @md.fnb + '.hash_digest' + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + '.' + @md.fn[:digest]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'digest.' + @md.fn[:digest]
+ 'digest' + @md.lang_code_insert + ft
end
end
def sitemap
+ ft='.xml'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.sitemap.xml'
+ @md.fnb + '.sitemap' + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + '.' + @md.fn[:sitemap]
+ @md.fnb + @md.lang_code_insert + ft
else
- 'sitemap.' + @md.fn[:sitemap]
+ 'sitemap' + @md.lang_code_insert + ft
end
end
def manifest
+ ft='.html'
if @env.output_dir_structure.by_language_code?
- @md.fnb + '.manifest.html'
+ @md.fnb + ft
elsif @env.output_dir_structure.by_filetype?
- @md.fnb + '.' + @md.fn[:manifest]
- else
- 'sisu_' + @md.fn[:manifest]
+ @md.fnb + @md.lang_code_insert + ft
+ else #fix
+ 'sisu_manifest' + @md.lang_code_insert + ft
end
end
def src
@md.fns
end
- def po
+ def po #check
(@fno.empty?) \
? (@md.fn[:po]) \
: (@fno + '.po')
@@ -3699,18 +3746,28 @@ WOK
def rcp
def abc
if @env.output_dir_structure.by_language_code?
- "#{output_path.stub.rcp}/#{@md.opt.lng}/#{ft}"
+ "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}"
elsif @env.output_dir_structure.by_filetype?
- "#{output_path.stub.rcp}/#{ft}"
+ "#{output_path.stub.rcp}/#{@ft}"
else
"#{output_path.stub.rcp}/#{@md.fnb}"
end
end
def ab
if @env.output_dir_structure.by_language_code?
- "#{output_path.stub.rcp}/#{@md.opt.lng}/#{ft}"
+ "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}"
else
- "#{output_path.stub.rcp}/#{ft}"
+ "#{output_path.stub.rcp}/#{@ft}"
+ end
+ end
+ self
+ end
+ def rel_sm
+ def ab
+ if @env.output_dir_structure.by_language_code? \
+ or @env.output_dir_structure.by_filetype?
+ '../' + @ft
+ else '.'
end
end
self
@@ -3718,6 +3775,21 @@ WOK
self
end
def output_path
+ def web_base
+ def dir
+ @env.path.webserv
+ end
+ def url
+ #"#{@env.url.root}"
+ end
+ def rel
+ '.'
+ end
+ def rcp
+ '.'
+ end
+ self
+ end
def stub
def dir
"#{@md.opt.f_pth[:pth_stub]}"
@@ -3762,6 +3834,9 @@ WOK
def rcp
"#{output_path.base.rcp}/pod"
end
+ def rel_sm
+ #"#{output_path.base.rel}/pod"
+ end
self
end
def sisugit
@@ -3799,6 +3874,18 @@ WOK
def rcp
set_path(ft).rcp.ab_src
end
+ def rel_sm
+ if @env.output_dir_structure.by_language_code?
+ ''
+ #"#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}"
+ elsif @env.output_dir_structure.by_filetype?
+ ''
+ #"#{output_path.base.dir}/#{@ft}"
+ else
+ ''
+ #"#{output_path.base.dir}/#{@md.fnb}"
+ end
+ end
self
end
def po
@@ -3818,7 +3905,7 @@ WOK
"#{output_path.base.url}/po4a/#{@md.fnb}/pot"
end
def rcp
- p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot"
+ #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot"
end
self
end
@@ -3862,6 +3949,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def html_scroll
@@ -3880,6 +3970,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def html_seg
@@ -3898,6 +3991,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def html_concordance
@@ -3920,6 +4016,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def xhtml
@@ -3938,6 +4037,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def epub
@@ -3956,6 +4058,9 @@ WOK
def rcp
set_path(ft).rcp.ab
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def odt
@@ -3974,6 +4079,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def xml
@@ -3992,6 +4100,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def xml_sax
@@ -4018,6 +4129,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def hash_digest
@@ -4036,6 +4150,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def manifest
@@ -4072,6 +4189,15 @@ WOK
def rcp
set_path(ft).rcp.ab
end
+ def rel_sm
+ if @env.output_dir_structure.by_language_code?
+ ''
+ elsif @env.output_dir_structure.by_filetype?
+ ''
+ else
+ ''
+ end
+ end
self
end
def manpage
@@ -4090,6 +4216,15 @@ WOK
def rcp
set_path(ft).rcp.ab
end
+ def rel_sm
+ if @env.output_dir_structure.by_language_code?
+ ''
+ elsif @env.output_dir_structure.by_filetype?
+ ''
+ else
+ ''
+ end
+ end
self
end
def sitemaps
@@ -4125,6 +4260,61 @@ WOK
end
self
end
+ #def cgi
+ #end
+ def css
+ @d='_sisu/css'
+ def dir
+ output_path.base.dir + '/' + @d
+ end
+ def url
+ output_path.base.url + '/' + @d
+ end
+ def rel
+ @d
+ #output_path.base.rel + '/' + @d
+ end
+ def rcp
+ output_path.stub.rcp + '/' + @d
+ end
+ self
+ end
+ def images
+ @d='_sisu/image'
+ def dir
+ output_path.base.dir + '/' + @d
+ end
+ def url
+ output_path.base.url + '/' + @d
+ end
+ def rel
+ @d
+ #output_path.base.rel + '/' + @d
+ end
+ def rcp
+ output_path.stub.rcp + '/' + @d
+ end
+ self
+ end
+ def images_external
+ @d='_sisu/image_external'
+ def dir
+ output_path.base.dir + '/' + @d
+ end
+ def url
+ output_path.base.url + '/' + @d
+ end
+ def rel
+ output_path.base.rel + '/' + @d
+ end
+ def rcp
+ output_path.base.rcp + '/' + @d
+ end
+ self
+ end
+ #def css
+ # #"#{@env.path.output}/#{@env.path.style}"
+ #end
self
end
end