aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb377
1 files changed, 258 insertions, 119 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index f5d14583..475a8369 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -218,10 +218,10 @@ module SiSU_Env
stub_pwd=@@pwd[m,1]
@@rc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]
@@yamlrc_path=(stub_pwd !~/^sisupod$/) \
- ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) \
+ ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"])
: ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod
@@ad_path=(stub_pwd !~/^sisupod$/) \
- ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]) \
+ ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"])
: ["#{@@home}/.sisu",@@sisu_etc]
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,:yamlrc_path,:ad_path
def initialize
@@ -251,7 +251,7 @@ module SiSU_Env
require @prog
else
@mandatory \
- ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn) \
+ ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn)
: (SiSU_Screen::Ansi.new(@cmd,"#{@prog} load requested").warn)
end
load_prog
@@ -376,27 +376,17 @@ module SiSU_Env
end
if @fns \
and @fns != '' #watch
- #if multilingual
- m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/
- @@fnn ||=@fns[m,1]
- @@fnb ||=@fns[m,2]
- @@fnt ||=@fns[m,3]
- @@flv ||=document_language_versions_found[:f]
- unless @@fns =~/\S+?\.zip/
- @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip'
- elsif @@fnb; @@fnb + '.sst.zip'
- else '' # e.g. termsheet
- end
+ m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/
+ @@fnn ||=@fns[m,1]
+ @@fnb ||=@fns[m,2]
+ @@fnt ||=@fns[m,3]
+ @@flv ||=document_language_versions_found[:f]
+ unless @@fns =~/\S+?\.zip/
+ @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip'
+ elsif @@fnb; @@fnb + '.sst.zip'
+ else '' # e.g. termsheet
end
- #else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/
- # @@fnb ||=@fns[m,1]
- # @@fnt ||=@fns[m,2]
- # unless @@fns =~/\S+?\.zip/
- # @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip'
- # else @@fnb + '.sst.zip'
- # end
- # end
- #end
+ end
end
@fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz
end
@@ -455,31 +445,52 @@ module SiSU_Env
end
def document_language_versions_found #REVISIT
@fn={}
- unless (@fns.nil? \
- or @fns.empty?)
+ filename=(@fns =~/\.ssm\.sst$/) \
+ ? @fns.gsub(/\.ssm\.sst$/,'.ssm')
+ : @fns
+ unless (filename.nil? \
+ or filename.empty?)
if output_dir_structure.by_language_code?
- m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/
- @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]
- else m=/(.+?)\.((?:-|ssm\.)?sst$)/
- @fn[:b]=@fn[:m]=@fns[m,1]
- @fn[:t]=@fns[m,2]
+ m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/
+ @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3]
+ else m=/(.+?)\.(sst|ssm)$/
+ @fn[:b]=@fn[:m]=filename[m,1]
+ @fn[:t]=filename[m,2]
end
end
+ lng_base=Info_env.new.language_default_set
lang=SiSU_Env::Standardise_language.new
langs=lang.codes
x=[]
- if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}"
+ if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}")
+ n=@fn[:m].gsub(/^.+?\//,'')
+ n =n + '.' + @fn[:t]
+ x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n }
end
- x << @fns
+ #x << { f: "#{@fns}", l: lng_base }
langs.each do |l|
lng=SiSU_Env::Standardise_language.new(l)
if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
- x << "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
+ x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code }
elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
- x << "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
+ x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code }
+ end
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code }
+ elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code }
+ end
+ end
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
+ if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code }
+ elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}")
+ x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code }
+ end
end
end
- @fn[:f]=x.uniq!
+ @fn[:f]=x
@fn
end
def published_manifests?(output_base)
@@ -691,14 +702,14 @@ module SiSU_Env
db_name="#{Db[:name_prefix]}#{dbname_stub}"
program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation"
(program_found?(program)) \
- ? system("#{program} #{dbname_name}") \
+ ? system("#{program} #{dbname_name}")
: (puts "\tWARN: #{program} is not available #{program_ref}")
end
def relaxng(cmd='') #trang - convert between different schema languages for XML
program='trang'
program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>"
(program_found?(program)) \
- ? system("#{program} #{@input} #{@output}") \
+ ? system("#{program} #{@input} #{@output}")
: (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/)
end
def qrencode #qrcode - for generating QR code
@@ -708,7 +719,7 @@ module SiSU_Env
found \
? (system(%{
echo "#{@input}" | #{program} -s 3 -o #{@output}
- })) \
+ }))
: (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/)
#found
end
@@ -730,7 +741,7 @@ module SiSU_Env
program=@prog.tidy
program_ref="\n\t\tsee <http://tidy.sourceforge.net/>"
(program_found?(program)) \
- ? system("#{@prog.tidy} -xml #{@input} > #{@output}") \
+ ? system("#{@prog.tidy} -xml #{@input} > #{@output}")
: (puts "\tWARN: #{program} is not installed #{program_ref}")
end
def tex2pdf_engine
@@ -759,11 +770,11 @@ module SiSU_Env
texpdf_cmd=case texpdf
when /xetex/
@input =~/landscape\.tex$/ \
- ? %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n} \
+ ? %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n}
: %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n}
when /xelatex/
@input =~/landscape\.tex$/ \
- ? %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n} \
+ ? %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n}
: %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n}
when /pdftex/; "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n"
when /pdflatex/; "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n"
@@ -776,7 +787,7 @@ module SiSU_Env
program='makeinfo'
program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/"
(program_found?(program)) \
- ? system("#{program} #{@input}\n") \
+ ? system("#{program} #{@input}\n")
: (puts "\tWARN: #{program} is not installed #{program_ref}")
end
def scp
@@ -1016,13 +1027,13 @@ module SiSU_Env
def concord_max
((defined? @rc['processing']['concord_max']) \
&& @rc['processing']['concord_max']) \
- ? @rc['processing']['concord_max'] \
+ ? @rc['processing']['concord_max']
: (defaults[:concord_max])
end
def language_default_set #set directory (default) language
((defined? @rc['default']['language']) \
&& @rc['default']['language'] =~/\S+/) \
- ? @rc['default']['language'] \
+ ? @rc['default']['language']
: 'en'
end
def markup_emphasis
@@ -1047,7 +1058,7 @@ module SiSU_Env
&& (@rc['default']['text_wrap'].to_s=~/\d\d+/) \
&& (@rc['default']['text_wrap'].to_i > 19) \
&& (@rc['default']['text_wrap'].to_i < 201)) \
- ? @rc['default']['text_wrap'].to_i \
+ ? @rc['default']['text_wrap'].to_i
: 78
end
#def by_language?
@@ -1075,24 +1086,80 @@ module SiSU_Env
def stub_pod
@stub_pod
end
- def sisupod
+ def sisupod_v3(opt)
#processing_path.processing
# sisupod
- # sisu
- # content.sst [file content]
- # filename.sst [link to content.sst]
+ # doc/
+ # manifest.txt
+ # en/content.sst [file content]
+ # fr/content.sst
# _sisu
- # conf
- # skin/
- # doc [relevant skin if any other than default]
- # image [all images for specific document gathered here]
+ # skin/
+ # doc [relevant skin if any other than default]
+ # image@ (ln -s ../../image)
+ # audio@ (ln -s ../../audio)
+ # video@ (ln -s ../../video)
+ # image/ [all images for specific document gathered here]
+ # audio/
+ # video/
+ spp="#{processing_path.processing}/sisupod"
+ sppc="#{spp}/doc/_sisu"
+ lng_dirs=[]
+ if FileTest.directory?(spp) \
+ or FileTest.file?(spp)
+ rm_rf(spp)
+ end
+ paths=[]
+ flv=Env_call.new(opt.fns).document_language_versions_found
+ flv[:f].each {|l| lng_dirs << l[:l] }
+ lng_dirs.uniq!
+ lng_dirs.each do |lng|
+ paths << "#{spp}/doc/#{lng}"
+ end
+ paths \
+ << "#{spp}/image" \
+ << "#{sppc}/skin/doc" \
+ << "#{sppc}/skin/dir" \
+ << "#{sppc}/skin/site"
+ #<< "#{spp}/audio" \
+ #<< "#{spp}/video" \
+ paths.each do |x|
+ unless FileTest.directory?(x)
+ mkdir_p(x)
+ end
+ end
+ if FileTest.directory?(sppc)
+ pwd=Dir.pwd
+ Dir.chdir(sppc)
+ system("
+ ln -s ../../image
+ #ln -s ../../audio
+ #ln -s ../../video
+ ")
+ Dir.chdir(pwd)
+ end
+ end
+ def sisupod_v2
+ #processing_path.processing
+ # sisupod
+ # content.sst [file content]
+ # filename.sst [link to content.sst]
+ # _sisu
+ # skin/
+ # doc [relevant skin if any other than default]
+ # image [all images for specific document gathered here]
sisupod_processing_path="#{processing_path.processing}/sisupod"
if FileTest.directory?(sisupod_processing_path) \
or FileTest.file?(sisupod_processing_path)
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"]
+ 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"
+ ]
paths.each {|x| mkdir_p(x) unless FileTest.directory?(x) }
end
def defaults #multiple default directories
@@ -1101,13 +1168,13 @@ module SiSU_Env
def html_seg_title_banner?
((defined? @rc['html']['seg_title_banner']) \
&& @rc['html']['seg_title_banner']==true) \
- ? @rc['html']['seg_title_banner'] \
+ ? @rc['html']['seg_title_banner']
: false
end
def html_quick_ref?
((defined? @rc['html']['quick_ref']) \
&& @rc['html']['quick_ref']==true) \
- ? @rc['html']['quick_ref'] \
+ ? @rc['html']['quick_ref']
: false
end
def html_minitoc?
@@ -1127,13 +1194,13 @@ module SiSU_Env
def odt_ocn?
((defined? @rc['odt']['ocn']) \
&& @rc['odt']['ocn']==true) \
- ? @rc['odt']['ocn'] \
+ ? @rc['odt']['ocn']
: false
end
def plaintext_ocn?
((defined? @rc['plaintext']['ocn']) \
&& @rc['plaintext']['ocn']==true) \
- ? @rc['plaintext']['ocn'] \
+ ? @rc['plaintext']['ocn']
: false
end
def widget #needs (md) #move
@@ -1222,7 +1289,7 @@ module SiSU_Env
db=if rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? rc['search']['sisu']['db'] \
+ ? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
@@ -1279,7 +1346,7 @@ WOK
db=if rc['search']['sisu']['flag']==true \
and rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? rc['search']['sisu']['db'] \
+ ? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
@@ -1376,7 +1443,7 @@ WOK
and rc['search']['sisu']['flag']==true
db=if rc['search']['sisu']['db']=~/\S+/
(rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
- ? rc['search']['sisu']['db'] \
+ ? rc['search']['sisu']['db']
: "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}"
else nil
end
@@ -1449,7 +1516,7 @@ WOK
def texpdf
(defined? @rc['default']['texpdf_font']) \
&& (@rc['default']['texpdf_font']=~/\S{3,}/) \
- ? @rc['default']['texpdf_font'] \
+ ? @rc['default']['texpdf_font']
: 'Liberation Sans' #'Liberation Sans' #'Liberation Serif'
end
self
@@ -1601,7 +1668,7 @@ WOK
end
def man #check use
(defined? @rc['webserv']['man']) \
- ? "#{webserv}/#{@rc['webserv']['man']}" \
+ ? "#{webserv}/#{@rc['webserv']['man']}"
: defaults[:webserv_man]
end
def webserv_path #testing, check need, remove
@@ -1658,7 +1725,7 @@ WOK
end
def feed
(defined? @rc['webserv']['feed']) \
- ? ("#{public_output}/#{@rc['webserv']['feed']}") \
+ ? ("#{public_output}/#{@rc['webserv']['feed']}")
: (defaults[:webserv_feed])
end
def feed_home
@@ -1670,12 +1737,12 @@ WOK
end
def cgi
(defined? @rc['webserv']['cgi']) \
- ? "#{@rc['webserv']['cgi']}" \
+ ? "#{@rc['webserv']['cgi']}"
: (defaults[:webserv_cgi])
end
def php
(defined? @rc['webserv']['php']) \
- ? "#{public_output}/#{@rc['webserv']['php']}" \
+ ? "#{public_output}/#{@rc['webserv']['php']}"
: (defaults[:webserv_php])
end
# programs
@@ -1764,7 +1831,7 @@ WOK
end
def stub_dir
(usr_dir?) \
- ? ("#{root_dir}/#{user}/#{stub_pwd}") \
+ ? ("#{root_dir}/#{user}/#{stub_pwd}")
: ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path]
end
def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc)
@@ -1822,7 +1889,7 @@ WOK
and not @rc['git']['dir'].nil? \
and not @rc['git']['dir'].empty?
x=(@rc['git']['dir'] =~/^(?:~|home)$/) \
- ? home + '/' + 'sisu:' \
+ ? home + '/' + 'sisu:'
: @rc['git']['dir'] + '/' + 'sisu:'
else defaults[:processing_git]
end
@@ -2223,7 +2290,7 @@ WOK
def pdf_viewer
((defined? @rc['program_select']['pdf_viewer']) \
&& @rc['program_select']['pdf_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['pdf_viewer'] \
+ ? @rc['program_select']['pdf_viewer']
: 'pdf-viewer' #'evince'
end
def web_browser
@@ -2255,13 +2322,13 @@ WOK
def epub_viewer
((defined? @rc['program_select']['epub_viewer']) \
&& @rc['program_select']['epub_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['epub_viewer'] \
+ ? @rc['program_select']['epub_viewer']
: 'ebook-viewer' #'calibre' 'fbreader'
end
def xml_viewer
((defined? @rc['program_select']['xml_viewer']) \
&& @rc['program_select']['xml_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['xml_viewer'] \
+ ? @rc['program_select']['xml_viewer']
: text_editor
end
def xml_editor
@@ -2270,7 +2337,7 @@ WOK
def odf_viewer
((defined? @rc['program_select']['odf_viewer']) \
&& @rc['program_select']['odf_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['odf_viewer'] \
+ ? @rc['program_select']['odf_viewer']
: 'lowriter' #'odf-viewer','oowriter'
end
def manpage_viewer
@@ -2279,13 +2346,13 @@ WOK
def manpage_generator
((defined? @rc['program_select']['man']) \
&& @rc['program_select']['man'] =~/\S\S+/) \
- ? @rc['program_select']['man'] \
+ ? @rc['program_select']['man']
: 'nroff -man' #'nroff -man' #'groff -man -Tascii'
end
def texinfo
((defined? @rc['program_select']['info_viewer']) \
&& @rc['program_select']['info_viewer'] =~/\S\S+/) \
- ? @rc['program_select']['info_viewer'] \
+ ? @rc['program_select']['info_viewer']
: 'pinfo -f' #'pinfo -f' 'info' 'tkinfo'
end
def file_encoding
@@ -2348,7 +2415,7 @@ WOK
x=if output_dir_structure.by_language_code?
(( defined? @rc['default']['language_file']) \
&& @rc['default']['language_file'] != nil) \
- ? @rc['default']['language_file'] \
+ ? @rc['default']['language_file']
: 1
else 0
end
@@ -2370,13 +2437,14 @@ WOK
if defined? @rc['program_set']['file_encoding']; is=@rc['program_set']['encoding']
end
if is.nil? \
- or is==true; is='encoding'
+ or is==true
+ is='encoding'
end
is
end
def papersize # paper settings, default overidden in param if set within document
(defined? @rc['default']['papersize']) \
- ? @rc['default']['papersize'].downcase \
+ ? @rc['default']['papersize'].downcase
: (defaults[:papersize].downcase)
end
def odf_structure
@@ -2385,6 +2453,40 @@ WOK
system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{processing_path.odf_pth}")
end
def sisupod_gen(fns_pod)
+ sisupod_gen_v3(fns_pod)
+ end
+ def sisupod_gen_v3(fns_pod)
+ pwd=Dir.pwd
+ sisupod_processing_path="#{processing_path.processing}/sisupod"
+ if FileTest.directory?(sisupod_processing_path) \
+ or FileTest.file?(sisupod_processing_path)
+ rm_rf(sisupod_processing_path)
+ end
+ unless FileTest.directory?(sisupod_processing_path)
+ mkdir_p(sisupod_processing_path)
+ end
+ f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}")
+ "#{Dir.pwd}/#{fns_pod}"
+ elsif FileTest.file?(fns_pod)
+ fns_pod
+ end
+ if f_pod \
+ && FileTest.file?(f_pod)
+ tree=(SiSU_Env::System_call.new.program_found?('tree')) \
+ ? "tree #{processing_path.processing}/sisupod"
+ : ''
+ if FileTest.directory?(processing_path.processing)
+ Dir.chdir(processing_path.processing)
+ system(%{tar xJf #{f_pod}})
+ Dir.chdir(pwd)
+ end
+ #system(tree) #enable if (/[vVM]/)
+ else
+ SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/
+ end
+ sisupod_processing_path
+ end
+ def sisupod_gen_v2(fns_pod)
pwd=Dir.pwd
sisupod_processing_path="#{processing_path.processing}/sisupod"
if FileTest.directory?(sisupod_processing_path) \
@@ -2473,7 +2575,7 @@ WOK
super()
@opt=opt #,opt.fns,opt.cmd
@env=(@opt.fns && !(@opt.fns.empty?) \
- ? (SiSU_Env::Info_env.new(@opt.fns)) \
+ ? (SiSU_Env::Info_env.new(@opt.fns))
: (SiSU_Env::Info_env.new('dummy.sst')))
if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get
end
@@ -2573,22 +2675,22 @@ WOK
else '*' + filetypes # one relevant file type
end
@source_path=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/#{@fnb}" \
+ ? "#{@env.path.output}/#{@fnb}"
: @env.path.output)
@source_path_epub=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/epub" \
+ ? "#{@env.path.output}/epub"
: @env.path.output_epub)
@source_path_src=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/src" \
+ ? "#{@env.path.output}/src"
: @env.path.output_src)
@source_path_pod=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/pod" \
+ ? "#{@env.path.output}/pod"
: @env.path.output_pod)
@source_path_harvest=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/manifest" \
+ ? "#{@env.path.output}/manifest"
: @env.path.output_harvest)
@local_sisu_source=(@filetypes =~/\S/) \
- ? "#{@source_path}/#{@filetypes}" \
+ ? "#{@source_path}/#{@filetypes}"
: @source_path
end
end
@@ -2609,7 +2711,7 @@ WOK
def zap
def main_output
(@zap !~/\/\//) \
- ? (rm_rf(@zap) if FileTest.directory?(@zap)) \
+ ? (rm_rf(@zap) if FileTest.directory?(@zap))
: (puts 'suspect zap request, ignored')
end
def site_map
@@ -2687,32 +2789,32 @@ WOK
def rhost
def r1
(defined? SiSU_Env::Info_remote_host.new.remote_host[0][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[0][:name]) \
+ ? (SiSU_Env::Info_remote_host.new.remote_host[0][:name])
: nil
end
def r2
(defined? SiSU_Env::Info_remote_host.new.remote_host[1][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[1][:name]) \
+ ? (SiSU_Env::Info_remote_host.new.remote_host[1][:name])
: nil
end
def r3
(defined? SiSU_Env::Info_remote_host.new.remote_host[2][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[2][:name]) \
+ ? (SiSU_Env::Info_remote_host.new.remote_host[2][:name])
: nil
end
def r4
(defined? SiSU_Env::Info_remote_host.new.remote_host[3][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[3][:name]) \
+ ? (SiSU_Env::Info_remote_host.new.remote_host[3][:name])
: nil
end
def r5
(defined? SiSU_Env::Info_remote_host.new.remote_host[4][:name]) \
- ? (SiSU_Env::Info_remote_host.new.remote_host[4][:name]) \
+ ? (SiSU_Env::Info_remote_host.new.remote_host[4][:name])
: nil
end
def r6
(defined? SiSU_Env::Info_remote_host.new.remote_host[5][:name]) \
- ? (@ls + SiSU_Env::Info_remote_host.new.remote_host[5][:name]) \
+ ? (@ls + SiSU_Env::Info_remote_host.new.remote_host[5][:name])
: nil
end
self
@@ -3706,18 +3808,18 @@ WOK
end
def po #check
(@fno.empty?) \
- ? (@md.fn[:po]) \
+ ? (@md.fn[:po])
: (@fno + '.po')
end
def pot
(@fno.empty?) \
- ? (@md.fn[:pot]) \
+ ? (@md.fn[:pot])
: (@fno + '.pot')
end
def sisupod
- if @md.fns =~/\.ssm\.sst$/; @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.zip')
- else @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.zip')
- end
+ (@md.fns =~/\.ssm\.sst$/) \
+ ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz')
+ : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz')
end
self
end
@@ -3747,6 +3849,9 @@ WOK
"#{output_path.base.dir}/#{@ft}"
end
end
+ def ab_pod
+ "#{output_path.base.dir}/#{@ft}"
+ end
self
end
def url
@@ -3773,6 +3878,9 @@ WOK
"#{output_path.base.url}/#{@ft}"
end
end
+ def ab_pod
+ "#{output_path.base.url}/#{@ft}"
+ end
self
end
def rel
@@ -3794,13 +3902,53 @@ WOK
end
def ab_src
if @env.output_dir_structure.by_language_code?
- "../../#{@ft}/#{@md.opt.lng}"
+ "#{@ft}/#{@md.opt.lng}"
+ else
+ "#{@ft}"
+ end
+ end
+ def ab_pod
+ if @env.output_dir_structure.by_language_code?
+ "#{@ft}"
else
"#{@ft}"
end
end
self
end
+ def rel_sm
+ def abc
+ if @env.output_dir_structure.by_language_code?
+ "#{@md.opt.lng}/#{@ft}"
+ elsif @env.output_dir_structure.by_filetype?
+ "#{@ft}"
+ else
+ "#{@md.fnb}"
+ end
+ end
+ def ab
+ if @env.output_dir_structure.by_language_code?
+ "#{@md.opt.lng}/#{@ft}"
+ else
+ "#{@ft}"
+ end
+ end
+ def ab_src
+ if @env.output_dir_structure.by_language_code?
+ "#{@ft}/#{@md.opt.lng}"
+ else
+ "#{@ft}"
+ end
+ end
+ def ab_pod
+ if @env.output_dir_structure.by_language_code?
+ "../../#{@ft}/#{@md.opt.lng}"
+ else
+ "../#{@ft}"
+ end
+ end
+ self
+ end
def rcp
def abc
if @env.output_dir_structure.by_language_code?
@@ -3914,16 +4062,7 @@ WOK
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
+ set_path(ft).rel_sm.ab_src
end
self
end
@@ -3932,19 +4071,19 @@ WOK
Gt[:src] + '/' + Gt[:pod]
end
def dir
- set_path(ft).dir.ab_src
+ set_path(ft).dir.ab_pod
end
def url
- set_path(ft).url.ab_src
+ set_path(ft).url.ab_pod
end
def rel
- set_path(ft).rel.ab_src
+ set_path(ft).rel.ab_pod
end
def rcp
- set_path(ft).rcp.ab_src
+ set_path(ft).rcp.ab_pod
end
def rel_sm
- #"#{output_path.base.rel}/pod"
+ set_path(ft).rel_sm.ab_pod
end
self
end
@@ -4528,14 +4667,14 @@ WOK
def share_source?
((defined? @rc['db']['share_source']) \
&& @rc['db']['share_source']==true) \
- ? @rc['db']['share_source'] \
+ ? @rc['db']['share_source']
: false
end
def engine
def default
((defined? @rc['db']['engine']['default']) \
&& @rc['db']['engine']['default']=~/postgresql|sqlite/) \
- ? @rc['db']['engine']['default'] \
+ ? @rc['db']['engine']['default']
: 'sqlite'
end
self
@@ -4544,7 +4683,7 @@ WOK
def user
((defined? @rc['db']['postgresql']['user']) \
&& @rc['db']['postgresql']['user']=~/\S+/) \
- ? @rc['db']['postgresql']['user'] \
+ ? @rc['db']['postgresql']['user']
: @env.user
end
def db #db_name
@@ -4554,24 +4693,24 @@ WOK
((defined? @rc['db']['postgresql']['port']) \
&& ( @rc['db']['postgresql']['port'] =~/\d+/ \
|| @rc['db']['postgresql']['port'].class==Fixnum)) \
- ? @rc['db']['postgresql']['port'] \
+ ? @rc['db']['postgresql']['port']
: (@defaults[:postgresql_port])
end
def password
((defined? @rc['db']['postgresql']['password']) \
&& @rc['db']['postgresql']['password']=~/\S+/) \
- ? @rc['db']['postgresql']['password'] \
+ ? @rc['db']['postgresql']['password']
: ''
end
def host
((defined? @rc['db']['postgresql']['host']) \
&& @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
- ? @rc['db']['postgresql']['host'] \
+ ? @rc['db']['postgresql']['host']
: ''
end
def dbi
(psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
- ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" \
+ ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}"
: "DBI:Pg:database=#{psql.db};port=#{psql.port}"
end
def conn_dbi