aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-04-20 21:10:04 -0400
committerRalph Amissah <ralph@amissah.com>2011-04-20 21:10:04 -0400
commit0f740e9c185b6aaed05e193828545ce7664fdbec (patch)
treed27e2672ad3a816c743ad65ac3de85e1eb237f46 /lib/sisu/v3/sysenv.rb
parentdebian/changelog (3.0.6-1) (diff)
parentv2 v3: sisu-mode.el, header notes copyright assignment to FSF (GNU EMACS) (diff)
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb110
1 files changed, 69 insertions, 41 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 7cc2a327..6f69296a 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -191,7 +191,6 @@ module SiSU_Env
PROCESSING_TUNE => 'tune',
PROCESSING_LATEX => 'tex',
PROCESSING_TEXINFO => 'texinfo',
- PROCESSING_LOUT => 'lout',
PROCESSING_SQLITE => 'sqlite',
PROCESSING_POSTGRESQL=> 'postgresql',
PROCESSING_ENCODING => 'encoding',
@@ -225,7 +224,8 @@ module SiSU_Env
: ["#{@@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
- @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=@@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path
+ @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=\
+ @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path
#note rbver is duplicated in Info_version
end
end
@@ -890,7 +890,6 @@ module SiSU_Env
@fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters
@fixed_websev_root='' # @home
@pwd=@@pwd=Dir.pwd
-# @pwd=@@pwd||=Dir.pwd
m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
@stub_pwd=@@pwd[m,1]
@stub_txt= @stub_pwd + '/txt'
@@ -903,6 +902,23 @@ module SiSU_Env
@stub_src= @stub_pwd + '/src'
@stub_pod= @stub_pwd + '/pod'
@stub_md= @stub_pwd + '/sisu_site_metadata'
+ pt=Pathname.new(Dir.pwd)
+ stub=if output_dir_structure.by_language_code?
+ stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(en|fr|es)$)/
+ lng=pt.split[-1].to_s
+ lng_part='/' + lng
+ base=pt.split[0].split[-1].to_s
+ else
+ lng_part='/' + 'en' #fix default language
+ base=pt.split[-1].to_s
+ end
+ base + lng_part
+ elsif output_dir_structure.by_filetype?
+ pt.split[-1].to_s
+ elsif output_dir_structure.by_filename?
+ ''
+ end
+ @stub_set_manifest=stub + '/manifest'
end
def user
@sys.user
@@ -969,8 +985,8 @@ module SiSU_Env
def stub_pwd #200412
@stub_pwd
end
- def stub_md_harvest
- @stub_md
+ def stub_md_harvest #watch
+ @stub_set_manifest
end
def stub_src
@stub_src
@@ -1388,6 +1404,9 @@ WOK
def stub_manifest
@stub_manifest
end
+ def stub_set_manifest
+ @stub_set_manifest
+ end
def stub_src
@stub_src
end
@@ -1395,7 +1414,7 @@ WOK
@stub_pod
end
def stub_md_harvest
- @stub_md
+ @stub_set_manifest
end
def etc
defaults[:sisu_etc] #live/dynamic
@@ -1654,8 +1673,15 @@ WOK
end
pth
end
+ def odf_pth
+ pth="#{processing}/odf/#{@fns}"
+ pth
+ end
def odf
- pth="#{processing}/odf"
+ odt
+ end
+ def odt
+ pth=odf_pth + '/odt'
mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
@@ -1808,15 +1834,15 @@ WOK
end
def webrick_port
if @md \
- and @md.cmd.inspect=~/-F/ \
- and @md.mod.inspect=~/port=(\d+)/
+ and @md.opt.cmd.inspect=~/-F/ \
+ and @md.opt.mod.inspect=~/port=(\d+)/
$1
else
if defined? @rc['webserv_cgi']['port']
if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.mod \
- and not @md.mod.nil? \
- and @md.mod.inspect=~/webrick/)
+ and (defined? @md.opt.mod \
+ and not @md.opt.mod.nil? \
+ and @md.opt.mod.inspect=~/webrick/)
defaults[:webserv_port_cgi]
elsif not @rc['webserv_cgi']['port'].nil?
@rc['webserv_cgi']['port']
@@ -1828,15 +1854,16 @@ WOK
end
def webserv_port_cgi
if @md \
- and @md.cmd.inspect=~/-F/ \
- and @md.mod.inspect=~/port=(\d+)/
+ and defined? @md.opt \
+ and @md.opt.cmd.inspect=~/-F/ \
+ and @md.opt.mod.inspect=~/port=(\d+)/
$1
else
if defined? @rc['webserv_cgi']['port']
if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.mod \
- and not @md.mod.nil? \
- and @md.mod.inspect=~/webrick/)
+ and (defined? @md.opt.mod \
+ and not @md.opt.mod.nil? \
+ and @md.opt.mod.inspect=~/webrick/)
defaults[:webserv_port_cgi]
elsif not @rc['webserv_cgi']['port'].nil?
@rc['webserv_cgi']['port']
@@ -2196,8 +2223,9 @@ WOK
: (defaults[:papersize].downcase)
end
def odf_structure
- rm_rf("#{processing_path.processing}/odf")
- system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{processing_path.processing}")
+ rm_rf(processing_path.processing_path.odf_pth)
+ mkdir_p(processing_path.processing_path.odf_pth)
+ system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{processing_path.odf_pth}")
end
def sisupod_gen(fns_pod)
pwd=Dir.pwd
@@ -2296,44 +2324,44 @@ WOK
if @md \
and defined? @md.fn \
and @md.fn # used for by_language_code?
- if @md.cmd =~ /[hH]/
+ if @md.opt.cmd =~ /[hH]/
ft << @md.fn[:html]
end
- if @md.cmd =~ /w/ \
- and @md.cmd !~ /[hH]/
+ if @md.opt.cmd =~ /w/ \
+ and @md.opt.cmd !~ /[hH]/
ft << @md.fn[:concordance]
end
- if @md.cmd =~ /y/ \
- and @md.cmd !~ /[hH]/
+ if @md.opt.cmd =~ /y/ \
+ and @md.opt.cmd !~ /[hH]/
ft << @md.fn[:manifest]
end
- if @md.cmd =~ /[at]/; ft << @md.fn[:plain]
+ if @md.opt.cmd =~ /[at]/; ft << @md.fn[:plain]
end
- if @md.cmd =~ /b/; ft << @md.fn[:xhtml]
+ if @md.opt.cmd =~ /b/; ft << @md.fn[:xhtml]
end
- if @md.cmd =~ /e/; ft << @md.fn[:epub]
+ if @md.opt.cmd =~ /e/; ft << @md.fn[:epub]
end
- if @md.cmd =~ /g/; ft << @md.fn[:wiki]
+ if @md.opt.cmd =~ /g/; ft << @md.fn[:wiki]
end
- if @md.cmd =~ /i/; ft << @md.fn[:manpage]
+ if @md.opt.cmd =~ /i/; ft << @md.fn[:manpage]
end
- if @md.cmd =~ /N/; ft << @md.fn[:digest]
+ if @md.opt.cmd =~ /N/; ft << @md.fn[:digest]
end
- if @md.cmd =~ /o/; ft << @md.fn[:odf]
+ if @md.opt.cmd =~ /o/; ft << @md.fn[:odf]
end
- if @md.cmd =~ /O/; ft << @md.fn[:oai_pmh]
+ if @md.opt.cmd =~ /O/; ft << @md.fn[:oai_pmh]
end
- if @md.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]
+ if @md.opt.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]
end
- if @md.cmd =~ /s/; ft << @md.fns
+ if @md.opt.cmd =~ /s/; ft << @md.fns
end
- if @md.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi'
+ if @md.opt.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi'
end
- if @md.cmd =~ /x/; ft << @md.fn[:sax]
+ if @md.opt.cmd =~ /x/; ft << @md.fn[:sax]
end
- if @md.cmd =~ /X/; ft << @md.fn[:dom]
+ if @md.opt.cmd =~ /X/; ft << @md.fn[:dom]
end
- if @md.cmd =~ /G/; ft << @md.fn[:pot]
+ if @md.opt.cmd =~ /G/; ft << @md.fn[:pot]
end
@fnb=@md.fnb
else # still needed where/when param is not parsed
@@ -2400,7 +2428,7 @@ WOK
? "#{@env.path.output}/pod" \
: @env.path.output_pod)
@source_path_harvest=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/sisu_site_metadata" \
+ ? "#{@env.path.output}/manifest" \
: @env.path.output_harvest)
@local_sisu_source=(@filetypes =~/\S/) \
? "#{@source_path}/#{@filetypes}" \
@@ -3417,7 +3445,7 @@ WOK
@env.processing_path.git + '/' + @md.fnb + '/' + ft
end
def md_harvest
- "#{output_path.base}/sisu_site_metadata"
+ manifest
end
def txt
ft='txt'
@@ -3736,7 +3764,7 @@ WOK
skin_path << "#{@env.processing_path.processing}/external_document/skin"
skin=true
if @pwd_stub =~/^sisupod$/ \
- and @md.mod.inspect !~/--trust/
+ and @md.opt.mod.inspect !~/--trust/
skin=false #security only run skins on sisupod if --trust flag is provided
end
doc_skin,dir_skin=nil,nil