From c6d43f001f7749f33c207d261e5ce7515f98d0de Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Mar 2013 22:53:11 -0500 Subject: v4: share_src, sisu source, permissions, make world readable when shared --- lib/sisu/v4/share_src.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/sisu/v4/share_src.rb b/lib/sisu/v4/share_src.rb index b767de0c..725ded35 100644 --- a/lib/sisu/v4/share_src.rb +++ b/lib/sisu/v4/share_src.rb @@ -82,6 +82,10 @@ module SiSU_Markup v=(@opt.cmd =~/M/) ? 'v' : '' system(%{ rsync -a#{v} #{@path_pod[:fnb]} #{@file.output_path.sisupod.dir} + cd #{@file.output_path.sisupod.dir} + for I in `find -type d` ; do chmod 755 $I ; done + for I in `find -type f` ; do chmod 644 $I ; done + cd - }) else SiSU_Screen::Ansi.new('',"#{@opt.fno} not available").blue_tab if @opt.cmd=~/[MVv]/ -- cgit v1.2.3 From 5ca9a5a24e3b9b90339770ad85e9cbaa539f0957 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Mar 2013 22:55:02 -0500 Subject: v4: manifest, sysenv, manifests sisupod relative link for output_by language --- lib/sisu/v4/manifest.rb | 2 +- lib/sisu/v4/sysenv.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/manifest.rb b/lib/sisu/v4/manifest.rb index d7c4d33a..cb34a3d3 100644 --- a/lib/sisu/v4/manifest.rb +++ b/lib/sisu/v4/manifest.rb @@ -497,7 +497,7 @@ WOK end if FileTest.file?(@f.place_file.sisupod.dir)==true pth=@f.output_path.sisupod.dir - rel=@f.output_path.sisupod.ab_pod + rel=@f.output_path.sisupod.rel_sm url=@f.output_path.sisupod.url id,file='SiSU doc (tar.xz)',@f.base_filename.sisupod summarize_sources(id,file,pth,rel,url) diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index f3191be1..581eb0d5 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -4928,7 +4928,7 @@ WOK if output_dir_structure.dump_or_redirect? '.' elsif output_dir_structure.by_language_code? - "../../#{@ft}/#{@md.opt.lng}" + "../../#{@ft}" else "../#{@ft}" end -- cgit v1.2.3 From 5d7e44a5b73caf2a835bef9c15020134cae34453 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Mar 2013 20:18:52 -0500 Subject: v4: hub, operations, report on absent markup file, if needed by requested action --- lib/sisu/v4/hub.rb | 92 +++++++++++++++++++++++++++----------------------- lib/sisu/v4/options.rb | 30 ++++++++-------- 2 files changed, 66 insertions(+), 56 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index e02fa940..dee13bc1 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -256,7 +256,7 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on attr_accessor :op def initialize(opt) @opt=opt - @@env=SiSU_Env::InfoEnv.new + @@env=@env=SiSU_Env::InfoEnv.new @msg,@msgs='',nil @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } end @@ -343,9 +343,7 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on end if @opt.act[:pdf][:set]==:on \ or @opt.act[:pdf_p][:set]==:on \ - or @opt.act[:pdf_l][:set]==:on - #% --pdf-l - #% --pdf, -p latex/ texpdf + or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf require_relative 'texpdf' # -p texpdf.rb SiSU_TeX::Source.new(@opt).read end @@ -640,56 +638,66 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on if @opt.act[:profile][:set]==:on require 'profile' end + action_on_file_ =(@opt.act[:dal][:set]==:on \ + || @opt.act[:manpage][:set]==:on \ + || @opt.act[:texinfo][:set]==:on \ + || @opt.act[:txt][:set]==:on \ + || @opt.act[:html][:set]==:on \ + || @opt.act[:html_scroll][:set]==:on \ + || @opt.act[:html_seg][:set]==:on \ + || @opt.act[:concordance][:set]==:on \ + || @opt.act[:xhtml][:set]==:on \ + || @opt.act[:epub][:set]==:on \ + || @opt.act[:odt][:set]==:on \ + || @opt.act[:xml_sax][:set]==:on \ + || @opt.act[:xml_dom][:set]==:on \ + || @opt.act[:pdf][:set]==:on \ + || @opt.act[:pdf_p][:set]==:on \ + || @opt.act[:pdf_l][:set]==:on \ + || @opt.act[:psql][:set]==:on \ + || @opt.act[:sqlite][:set]==:on \ + || @opt.act[:sqlite_discrete][:set]==:on \ + || @opt.act[:share_source][:set]==:on \ + || @opt.act[:sisupod][:set]==:on \ + || @opt.act[:qrcode][:set]==:on \ + || @opt.act[:hash_digests][:set]==:on \ + || @opt.act[:manifest][:set]==:on \ + || @opt.act[:rsync][:set]==:on \ + || @opt.act[:scp][:set]==:on \ + || @opt.act[:webrick][:set]==:on \ + || @opt.act[:zap][:set]==:on) \ + ? (:true) + : (:false) if @opt.act[:harvest][:set]==:on require_relative 'harvest' # harvest.rb SiSU_Harvest::Source.new(@opt).read # -h -H html.rb elsif @opt.mod.inspect =~/--convert|--to|--from/ require_relative 'sst_convert_markup' # sst_convert_markup.rb - elsif @opt.act[:dal][:set]==:on \ - or @opt.act[:manpage][:set]==:on \ - or @opt.act[:texinfo][:set]==:on \ - or @opt.act[:txt][:set]==:on \ - or @opt.act[:html][:set]==:on \ - or @opt.act[:html_scroll][:set]==:on \ - or @opt.act[:html_seg][:set]==:on \ - or @opt.act[:concordance][:set]==:on \ - or @opt.act[:xhtml][:set]==:on \ - or @opt.act[:epub][:set]==:on \ - or @opt.act[:odt][:set]==:on \ - or @opt.act[:xml_sax][:set]==:on \ - or @opt.act[:xml_dom][:set]==:on \ - or @opt.act[:pdf][:set]==:on \ - or @opt.act[:pdf_p][:set]==:on \ - or @opt.act[:pdf_l][:set]==:on \ - or @opt.act[:psql][:set]==:on \ - or @opt.act[:sqlite][:set]==:on \ - or @opt.act[:sqlite_discrete][:set]==:on \ - or @opt.act[:share_source][:set]==:on \ - or @opt.act[:sisupod][:set]==:on \ - or @opt.act[:qrcode][:set]==:on \ - or @opt.act[:hash_digests][:set]==:on \ - or @opt.act[:manifest][:set]==:on \ - or @opt.act[:rsync][:set]==:on \ - or @opt.act[:scp][:set]==:on \ - or @opt.act[:webrick][:set]==:on \ - or @opt.act[:zap][:set]==:on \ + elsif action_on_file_ == :true \ or ( @opt.cmd =~/^-/ \ and @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ - or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \ + or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ ) do_initialization - do_loops - @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on - @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? - if defined? @@env.processing_path.processing \ - and @@env.user \ - and FileTest.directory?(@@env.processing_path.processing) \ - and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area - FileUtils::cd(@@env.processing_path.processing_base_tmp) do - FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on + if action_on_file_ == :true \ + and @opt.files.length > 0 + do_loops + @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on + @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? + if defined? @@env.processing_path.processing \ + and @@env.user \ + and FileTest.directory?(@@env.processing_path.processing) \ + and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area + FileUtils::cd(@@env.processing_path.processing_base_tmp) do + FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on + end end + elsif action_on_file_ == :true \ + and @opt.files.length == 0 + STDERR.puts %{requested action requires valid sisu markup file filename (.sst .ssm) or wildcard (that includes a valid filame)} + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) if @opt.cmd =~/[MV]/ end elsif @opt.mod.inspect =~/--query/ require_relative 'sst_identify_markup' # sst_identify_markup.rb diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index 724fd9a9..0608df4e 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -1029,36 +1029,38 @@ module SiSU_Commandline @lng_base end def fno - @fno=fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1] + @fno=(fns.nil? || fns.empty?) \ + ? '' \ + : (fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1]) end def fng - @fng=fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1') + @fng=(fno.nil? || fno.empty?) \ + ? '' \ + : (fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1')) end def fns @fns end def fnl - x=@fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") + @fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") end def what @what end def fnb - unless fns.empty? - fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1] - end + (fns.nil? || fns.empty?) \ + ? '' \ + : (fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1]) end def fnc - @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/ - fnb + '.ssm.sst' - else @fns - end + @fnc=(@fns =~/\.(?:ssm\.sst|ssm)$/) \ + ? fnb + '.ssm.sst' + : @fns end def fncb - @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/ - fnb + '.ssm.sst' - else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') - end + @fncb=(@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/) \ + ? fnb + '.ssm.sst' + : @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') end end end -- cgit v1.2.3 From 7c083c2adb09f2519fcc177753515930d9070486 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Mar 2013 20:22:47 -0500 Subject: v4: sysenv, cosmetic, minor --- lib/sisu/v4/sysenv.rb | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index 581eb0d5..5647efd7 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -1838,21 +1838,17 @@ WOK self end def read_source_file_array(fns) - fns_array=unless fns =~/\.ssm.sst$/ - IO.readlines(fns, mode: 'r:utf-8', cr_newline: true) - else - IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true) - end + fns_array=(fns !~/\.ssm.sst$/) \ + ? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)) + : (IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) end def read_source_file(fns) read_source_file_array(fns) end def read_source_file_string(fns) - fns_str=unless fns =~/\.ssm.sst$/ - IO.read(fns, mode: 'r:utf-8', cr_newline: true) - else - IO.read("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true) - end + fns_str=(fns !~/\.ssm.sst$/) \ + ? (IO.read(fns, mode: 'r:utf-8', cr_newline: true)) + : (IO.read("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) end def source_file_processing_array(fns) sf=read_source_file_string(fns).split(/\s*\n\s*\n/m) -- cgit v1.2.3