aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-06-23 02:10:13 -0400
committerRalph Amissah <ralph@amissah.com>2012-06-23 02:10:13 -0400
commitffb99605ef5f4e066b43724fec55077128f8e731 (patch)
tree8f062b5b6d7c934945278980d0893c0f18229a1e
parentv3: 3.3.1 version & changelog "opened" (diff)
v3: hub, some re-arrangement
-rw-r--r--data/doc/sisu/CHANGELOG_v32
-rw-r--r--lib/sisu/v3/hub.rb736
2 files changed, 372 insertions, 366 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 47bf6db2..16d91b9b 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -21,6 +21,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.3.1.orig.tar.xz
sisu_3.3.1-1.dsc
sisu_3.3.1-1.debian.tar.gz
+ * v3: hub, some re-arrangement
+
%% 3.3.0.orig.tar.xz (2012-06-17:24/7)
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.3.0
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.3.0-1
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index f221c9a8..c4eed640 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -57,8 +57,8 @@
=end
module SiSU
- require_relative 'constants' # constants.rb
- require_relative 'sysenv' # sysenv.rb
+ require_relative 'constants' # constants.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Screen
@@pwd_the=Dir.pwd
class OptionLoopFiles
@@ -162,30 +162,30 @@ module SiSU
end
def remote_put_base_site_rsync # -CR
p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
+ require_relative 'remote' # remote.rb
SiSU_Remote::Put.new(@opt).rsync_base
end
def remote_put_base_site_rsync_match # -CCRZ
p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
+ require_relative 'remote' # remote.rb
SiSU_Remote::Put.new(@opt).rsync_base_sync
end
def remote_put_base_site # -Cr
p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
+ require_relative 'remote' # remote.rb
SiSU_Remote::Put.new(@opt).scp_base
end
def remote_put_base_site_all # -CCr
p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
- require_relative 'remote' # remote.rb
+ require_relative 'remote' # remote.rb
SiSU_Remote::Put.new(@opt).scp_base_all
end
- def cgi # -F
- require_relative 'cgi' # cgi.rb
+ def cgi # -F
+ require_relative 'cgi' # cgi.rb
SiSU_CGI::SearchSQL.new(@opt).read
end
- def encoding # -K build character encoding db (uses KirbyBase)
- require_relative 'character_encoding' # character_encoding.rb
+ def encoding # -K build character encoding db (uses KirbyBase)
+ require_relative 'character_encoding' # character_encoding.rb
SiSU_CharacterEncode::Create.new.db
end
def termsheet # -t
@@ -236,389 +236,393 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
@msg,@msgs='',nil
@tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
end
- def requires(req)
- require_relative req
+ def do_loops
+ do_each_file_loop_options
+ do_loop_files_on_given_option_post
end
- def actions
- if @opt.act[:profile][:set]==:on
- require 'profile'
- end
- 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.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
- and @opt.cmd =~/^-/ \
- and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
- flag=SiSU_Env::InfoProcessingFlag.new
- if @opt.cmd =~/[vVM]/ #% version information
- unless @opt.files.empty?
- SiSU_Help::Help.new('env',@opt).sisu_version
- end
+ def do_each_file_loop_options
+ @opt.files.each_with_index do |fno,i|
+ @opt.fno=fno
+ @opt.fns=fno.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst').
+ gsub(/\.ssm$/,'.ssm.sst')
+ @opt.f_pth=@opt.f_pths[i]
+ if @opt.fns !~/\.-sst$/
+ @opt.pth=@opt.f_pths[i][:pth]
+ @opt.lng=@opt.f_pths[i][:lng]
+ else
+ @opt.pth=Dir.pwd
+ @opt.lng='en'
end
- if @opt.act[:license][:set]==:on #% license information
- SiSU_Help::Help.new('license',@opt).help_request
- end
- if @opt.act[:dal][:set]==:on \
- or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C
- path={}
- path[:css]=@@env.path.output + '/_sisu/css'
- path[:xml]=@@env.path.output + '/_sisu/xml'
- path[:xsd]=path[:xml] + '/xsd'
- path[:xsd]=path[:xml] + '/rnc'
- path[:xsd]=path[:xml] + '/rng'
- re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/
- unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line
- # unless ( FileTest.directory?(path[:css]) \
- # and FileTest.directory?(path[:xsd]) )
- # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
- # end
- if @opt.act[:maintenance][:set] ==:on
- $VERBOSE=false #debug $VERBOSE=true
- end
- end
- re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/
- unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line
- # unless ( FileTest.directory?(path[:css]) \
- # and FileTest.directory?(path[:xsd]) )
- # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
- # end
- if @opt.act[:maintenance][:set] ==:on
- $VERBOSE=false #debug $VERBOSE=true
- end
- end
+ unless @opt.pth.nil?
+ @@pwd=@opt.pth
+ Dir.chdir(@opt.pth) #watch
end
- if @opt.act[:site_init][:set]==:on #% --init-site, -C initialize/configure
- requires('conf') #% --init-site, -C initialize/configure
- SiSU_Initialize::Source.new(@opt).read
- if @opt.act[:rsync][:set]==:on
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/RZ/
- SiSU::Operations.new(@opt).remote_put_base_site_rsync_match
- else SiSU::Operations.new(@opt).remote_put_base_site_rsync
- end
- elsif @opt.act[:scp][:set]==:on
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
- and @opt.cmd =~/CCr/
- SiSU::Operations.new(@opt).remote_put_base_site_all
- else SiSU::Operations.new(@opt).remote_put_base_site
- end
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
+ if @opt.act[:dal][:set]==:on #% --dal, -m
+ unless @opt.act[:po4a][:set]==:on # --po4a, -P
+ if @opt.fno =~ /\.ssm$/
+ require_relative 'composite' # composite.rb #pre-processing
+ SiSU_Assemble::Composite.new(@opt).read
+ end
+ require_relative 'dal' # -m dal.rb
+ SiSU_DAL::Source.new(@opt).read
end
end
- if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form
- SiSU::Operations.new(@opt).cgi
- end
- if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick
- SiSU::Operations.new(@opt).webrick
- end
- if @opt.act[:zap][:set]==:on #% --zap -Z wipe previous output clean DUPLICATE
- #requires('zap')
- #SiSU_Zap::Source.new(@opt).read # -Z zap.rb
- end
- if @opt.act[:dal][:set]==:on
- @retry_count= -1
- begin
- path_image='./_sisu/processing/external_document/image'
- path_skin='./_sisu/processing/external_document/skin/doc'
- @get_s,@get_p,@get_pl=[],[],[]
- re_s=/(\S+?\.-sst)$/
- re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/
- re_pl3=/^(\/\S+?\.ss[mt]\.txz)/
- @opt.files.each do |fns|
- if fns =~re_s
- @get_s << @opt.f_pths[0][:url]
- end
- if fns =~re_p3
- @get_p << re_p3.match(fns)[1] if re_p3
- end
- if fns =~re_pl3
- @get_pl << re_pl3.match(fns)[1] if re_p3
- end
- end
- if @get_s.length > 0 #% remote markup file .sst
- require_relative 'remote' # remote.rb
- SiSU_Remote::Get.new(@opt,@get_s).fns
- SiSU::Operations.new.counter
- end
- if @get_p.length > 0 #% remote sisupod
- require_relative 'remote' # remote.rb
- SiSU_Remote::Get.new(@opt,@get_p).sisupod
- end
- rescue
- SiSU_Errors::InfoError.new($!,$@,@opt,@fns).error do
- __LINE__.to_s + ':' + __FILE__
- end
- @retry_count +=1
- retry unless @retry_count > 1
- ensure
- end
+ if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
+ require_relative 'qrcode' # -Q qrcode.rb
+ SiSU_QRcode::Source.new(@opt).read
end
- def each_file_loop_options
- @opt.files.each_with_index do |fno,i|
- @opt.fno=fno
- @opt.fns=fno.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst').
- gsub(/\.ssm$/,'.ssm.sst')
- @opt.f_pth=@opt.f_pths[i]
- if @opt.fns !~/\.-sst$/
- @opt.pth=@opt.f_pths[i][:pth]
- @opt.lng=@opt.f_pths[i][:lng]
- else
- @opt.pth=Dir.pwd
- @opt.lng='en'
- end
- unless @opt.pth.nil?
- @@pwd=@opt.pth
- Dir.chdir(@opt.pth) #watch
- end
- @env=SiSU_Env::InfoEnv.new(@opt.fns)
- if @opt.act[:dal][:set]==:on #% --dal, -m
- unless @opt.act[:po4a][:set]==:on # --po4a, -P
- if @opt.fno =~ /\.ssm$/
- require_relative 'composite' # composite.rb #pre-processing
- SiSU_Assemble::Composite.new(@opt).read
- end
- requires('dal') # -m dal.rb
- SiSU_DAL::Source.new(@opt).read
- end
- end
- if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
- requires('qrcode') # -Q qrcode.rb
- SiSU_QRcode::Source.new(@opt).read
- end
- if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
- requires('digests') # -N digests.rb
- SiSU_DigestView::Source.new(@opt).read
- end
- if @opt.act[:txt][:set]==:on #% --txt, -t -a
- requires('plaintext') # -t -a plaintext.rb
- SiSU_Plaintext::Source.new(@opt).read
- end
- if @opt.act[:html][:set]==:on #% --html, -h
- requires('html') # -h -H html.rb
- SiSU_HTML::Source.new(@opt).read
- end
- if @opt.act[:concordance][:set]==:on #% --concordance, -w
- requires('concordance') # -w concordance.rb
- SiSU_Concordance::Source.new(@opt).read
- end
- if @opt.act[:epub][:set]==:on #% --epub, -e
- requires('epub') # -e epub.rb
- SiSU_EPUB::Source.new(@opt).read
- end
- if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
- requires('odf') # -o odf.rb
- SiSU_ODF::Source.new(@opt).read
- end
- if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
- requires('xhtml') # -b xhtml.rb
- SiSU_XHTML::Source.new(@opt).read
- end
- if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
- requires('xml') # -x xml.rb
- SiSU_XML_SAX::Source.new(@opt).read
- end
- if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -x xml dom type
- requires('xml_dom') # -X xml_dom.rb
- SiSU_XML_DOM::Source.new(@opt).read
- end
- if @opt.act[:pdf][:set]==:on #% --pdf, -p latex/ texpdf
- requires('texpdf') # -p texpdf.rb
- SiSU_TeX::Source.new(@opt).read
- end
- if @opt.act[:manpage][:set]==:on #% --manpage, -i
- requires('manpage') # -i manpage.rb
- SiSU_Manpage::Source.new(@opt).read
- end
- if @opt.act[:texinfo][:set]==:on #% --texinfo, -I
- requires('texinfo') # -I texinfo.rb
- SiSU_TexInfo::Source.new(@opt).read
- end
- if @opt.act[:sqlite_discreet][:set]==:on #% --sqlite, -d DB sqlite
- requires('dbi_discreet') # -d dbi_discreet.rb
- SiSU_DBI_Discreet::SQL.new(@opt).build
- end
- if @opt.act[:manifest][:set]==:on #% --manifest, -y
- requires('manifest') # -y manifest.rb
- SiSU_Manifest::Source.new(@opt).read
- end
+ if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
+ require_relative 'digests' # -N digests.rb
+ SiSU_DigestView::Source.new(@opt).read
+ end
+ if @opt.act[:txt][:set]==:on #% --txt, -t -a
+ require_relative 'plaintext' # -t -a plaintext.rb
+ SiSU_Plaintext::Source.new(@opt).read
+ end
+ if @opt.act[:html][:set]==:on #% --html, -h
+ require_relative 'html' # -h -H html.rb
+ SiSU_HTML::Source.new(@opt).read
+ end
+ if @opt.act[:concordance][:set]==:on #% --concordance, -w
+ require_relative 'concordance' # -w concordance.rb
+ SiSU_Concordance::Source.new(@opt).read
+ end
+ if @opt.act[:epub][:set]==:on #% --epub, -e
+ require_relative 'epub' # -e epub.rb
+ SiSU_EPUB::Source.new(@opt).read
+ end
+ if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
+ require_relative 'odf' # -o odf.rb
+ SiSU_ODF::Source.new(@opt).read
+ end
+ if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
+ require_relative 'xhtml' # -b xhtml.rb
+ SiSU_XHTML::Source.new(@opt).read
+ end
+ if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
+ require_relative 'xml' # -x xml.rb
+ SiSU_XML_SAX::Source.new(@opt).read
+ end
+ if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
+ require_relative 'xml_dom' # -X xml_dom.rb
+ SiSU_XML_DOM::Source.new(@opt).read
+ end
+ if @opt.act[:pdf][:set]==:on #% --pdf, -p latex/ texpdf
+ require_relative 'texpdf' # -p texpdf.rb
+ SiSU_TeX::Source.new(@opt).read
+ end
+ if @opt.act[:manpage][:set]==:on #% --manpage, -i
+ require_relative 'manpage' # -i manpage.rb
+ SiSU_Manpage::Source.new(@opt).read
+ end
+ if @opt.act[:texinfo][:set]==:on #% --texinfo, -I
+ require_relative 'texinfo' # -I texinfo.rb
+ SiSU_TexInfo::Source.new(@opt).read
+ end
+ if @opt.act[:sqlite_discreet][:set]==:on #% --sqlite, -d DB sqlite
+ require_relative 'dbi_discreet' # -d dbi_discreet.rb
+ SiSU_DBI_Discreet::SQL.new(@opt).build
+ end
+ if @opt.act[:manifest][:set]==:on #% --manifest, -y
+ require_relative 'manifest' # -y manifest.rb
+ SiSU_Manifest::Source.new(@opt).read
+ end
+ end
+ end
+ def loop_files_on_given_option_pre_do
+ if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ require_relative 'sisupod_make' # -S sisupod_make.rb
+ begin
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Doc::Source.new(@opt).read
end
+ ensure
+ SiSU_Doc::Source.new(@opt).sisupod_tar_xz
end
- def pre_loop_files_on_given_option_do
- if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
- requires('sisupod_make') # -S sisupod_make.rb
+ end
+ end
+ def do_loop_files_on_given_option_post
+ if @opt.act[:share_source][:set]==:on \
+ or @opt.act[:sisupod][:set]==:on \
+ or @opt.act[:git][:set]==:on
+ begin
+ require_relative 'shared_sisupod_source'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Source::SiSUpodSource.new(@opt).read
+ end
+ if @opt.act[:share_source][:set]==:on
+#REDO
+ require_relative 'share_src' # -s share_src.rb
begin
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Doc::Source.new(@opt).read
- end
ensure
- SiSU_Doc::Source.new(@opt).sisupod_tar_xz
+ OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
+ SiSU_Markup::Source.new(@opt).read
+ end
end
end
- end
- def post_loop_files_on_given_option_do
- if @opt.act[:share_source][:set]==:on \
- or @opt.act[:sisupod][:set]==:on \
- or @opt.act[:git][:set]==:on
+ if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ require_relative 'sisupod_make' # -S sisupod_make.rb
begin
- requires('shared_sisupod_source')
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Source::SiSUpodSource.new(@opt).read
- end
- if @opt.act[:share_source][:set]==:on
-#REDO
- requires('share_src') # -s share_src.rb
- begin
- ensure
- OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
- SiSU_Markup::Source.new(@opt).read
- end
- end
- end
- if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
- requires('sisupod_make') # -S sisupod_make.rb
- begin
- ensure
- OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
- SiSU_Doc::Source.new(@opt).sisupod_tar_xz
- end
- end
- end
- if @opt.act[:git][:set]==:on #% --git, -g sisu git
- requires('git') # -g git.rb
- begin
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Git::Source.new(@opt).read
- end
- ensure
- OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
- SiSU_Git::Source.new(@opt).git_commit
- end
- end
- end
ensure
- path_pod=@env.processing_path.processing_sisupod(@opt).paths
- unless @opt.cmd =~/M/
- FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod])
- #FileUtils::rm_rf("#{path_pod[:fnb]}/*") if FileTest.directory?(path_pod[:fnb])
+ OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
+ SiSU_Doc::Source.new(@opt).sisupod_tar_xz
end
end
end
- if @opt.act[:po4a][:set]==:on #% --po4a, -P
- requires('po4a')
+ if @opt.act[:git][:set]==:on #% --git, -g sisu git
+ require_relative 'git' # -g git.rb
begin
OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Po4a::Source.new(@opt).read # -P po4a.rb
+ SiSU_Git::Source.new(@opt).read
end
ensure
+ OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do
+ SiSU_Git::Source.new(@opt).git_commit
+ end
end
end
- if @opt.act[:images][:set]==:on #% --images, -j
- requires('shared_images')
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Images::Source.new(@opt).read # -j shared_images.rb
- end
+ ensure
+ path_pod=@env.processing_path.processing_sisupod(@opt).paths
+ unless @opt.cmd =~/M/
+ FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod])
+ #FileUtils::rm_rf("#{path_pod[:fnb]}/*") if FileTest.directory?(path_pod[:fnb])
end
- if @opt.cmd =~/T/ #% -T termsheet/standard form
- SiSU_Help::Help.new('termsheet').help_request
- @opt.files.each do |fns|
- if FileTest.file?(fns)
- @opt.fns=fns
- case @opt.fns
- when /\.(termsheet.rb)$/
- SiSU::Operations.new(@opt).termsheet
- else #print "not processed --> ", fns, "\n"
- end
- else SiSU::Operations.new(@opt).not_found
- end
- end
- SiSU::Operations.new.counter
+ end
+ end
+ if @opt.act[:po4a][:set]==:on #% --po4a, -P
+ require_relative 'po4a'
+ begin
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Po4a::Source.new(@opt).read # -P po4a.rb
end
- if @opt.cmd =~/k/ #% -k temporary tests
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- #requires('xml_scaffold')
- #fix
- end
+ ensure
+ end
+ end
+ if @opt.act[:images][:set]==:on #% --images, -j
+ require_relative 'shared_images'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Images::Source.new(@opt).read # -j shared_images.rb
+ end
+ end
+ if @opt.cmd =~/T/ #% -T termsheet/standard form
+ SiSU_Help::Help.new('termsheet').help_request
+ @opt.files.each do |fns|
+ if FileTest.file?(fns)
+ @opt.fns=fns
+ case @opt.fns
+ when /\.(termsheet.rb)$/
+ SiSU::Operations.new(@opt).termsheet
+ else #print "not processed --> ", fns, "\n"
+ end
+ else SiSU::Operations.new(@opt).not_found
end
- if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql
- requires('dbi')
- if @opt.files.length > 0 #switch test to actual commands
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
- end
- else
- SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
- end
+ end
+ SiSU::Operations.new.counter
+ end
+ if @opt.cmd =~/k/ #% -k temporary tests
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ #require_relative 'xml_scaffold'
+ #fix
+ end
+ end
+ if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql
+ require_relative 'dbi'
+ if @opt.files.length > 0 #switch test to actual commands
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
end
- if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite
- requires('dbi')
- if @opt.files.length > 0 #switch test to actual commands
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
- end
- else
- SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
- end
+ else
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ end
+ end
+ if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite
+ require_relative 'dbi'
+ if @opt.files.length > 0 #switch test to actual commands
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ end
+ else
+ SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ end
+ end
+ if @opt.act[:dal][:set]==:on #% --dal, -m embedded content
+ # OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ # require_relative 'embedded'
+ # SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check
+ # end
+ end
+ if @opt.act[:zap][:set]==:on #% --zap, -Z
+ # OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ # require_relative 'zap'
+ # SiSU_Zap::Source.new(@opt).read # -Z zap.rb
+ # end
+ end
+ if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
+ # OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ # require_relative 'sisupod_make'
+ # SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb
+ # end
+ end
+ if @opt.act[:manifest][:set]==:on #% --manifest, -y
+ require_relative 'manifest'
+ OptionLoopFiles.new(@opt).manifest_on_files_translated do
+ SiSU_Manifest::Source.new(@opt).read # -y manifest.rb
+ end
+ end
+ if @opt.act[:sitemap][:set]==:on #% --sitemap, -Y
+ require_relative 'sitemaps'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb
+ end
+ end
+ if @opt.act[:harvest][:set] !=:on
+ if @opt.act[:scp][:set]==:on #% -r copy to remote server
+ require_relative 'remote' # -r remote.rb
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Remote::Put.new(@opt).scp
+ end
+ end
+ if @opt.act[:rsync][:set]==:on #% -R copy to remote server
+ require_relative 'remote' # -R remote.rb
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Remote::Put.new(@opt).rsync
+ end
+ end
+ else
+ end
+ if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y
+ require_relative 'urls'
+ OptionLoopFiles.new(@opt).loop_files_on_given_option do
+ SiSU_Urls::Source.new(@opt).read #% -u -v -V -M
+ end
+ end
+ end
+ def do_initialization
+ @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
+ flag=SiSU_Env::InfoProcessingFlag.new
+ if @opt.cmd =~/[vVM]/ #% version information
+ unless @opt.files.empty?
+ SiSU_Help::Help.new('env',@opt).sisu_version
+ end
+ end
+ if @opt.act[:license][:set]==:on #% license information
+ SiSU_Help::Help.new('license',@opt).help_request
+ end
+ if @opt.act[:dal][:set]==:on \
+ or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C
+ path={}
+ path[:css]=@@env.path.output + '/_sisu/css'
+ path[:xml]=@@env.path.output + '/_sisu/xml'
+ path[:xsd]=path[:xml] + '/xsd'
+ path[:xsd]=path[:xml] + '/rnc'
+ path[:xsd]=path[:xml] + '/rng'
+ re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/
+ unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line
+ # unless ( FileTest.directory?(path[:css]) \
+ # and FileTest.directory?(path[:xsd]) )
+ # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
+ # end
+ if @opt.act[:maintenance][:set] ==:on
+ $VERBOSE=false #debug $VERBOSE=true
end
- if @opt.act[:dal][:set]==:on #% --dal, -m embedded content
- # OptionLoopFiles.new(@opt).loop_files_on_given_option do
- # requires('embedded')
- # SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check
- # end
+ end
+ re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/
+ unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line
+ # unless ( FileTest.directory?(path[:css]) \
+ # and FileTest.directory?(path[:xsd]) )
+ # @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
+ # end
+ if @opt.act[:maintenance][:set] ==:on
+ $VERBOSE=false #debug $VERBOSE=true
end
- if @opt.act[:zap][:set]==:on #% --zap, -Z
- # OptionLoopFiles.new(@opt).loop_files_on_given_option do
- # requires('zap')
- # SiSU_Zap::Source.new(@opt).read # -Z zap.rb
- # end
+ end
+ end
+ if @opt.act[:site_init][:set]==:on #% --init-site, -C initialize/configure
+ require_relative 'conf' #% --init-site, -C initialize/configure
+ SiSU_Initialize::Source.new(@opt).read
+ if @opt.act[:rsync][:set]==:on
+ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
+ and @opt.cmd =~/RZ/
+ SiSU::Operations.new(@opt).remote_put_base_site_rsync_match
+ else SiSU::Operations.new(@opt).remote_put_base_site_rsync
end
- if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod
- # OptionLoopFiles.new(@opt).loop_files_on_given_option do
- # requires('sisupod_make')
- # SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb
- # end
+ elsif @opt.act[:scp][:set]==:on
+ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
+ and @opt.cmd =~/CCr/
+ SiSU::Operations.new(@opt).remote_put_base_site_all
+ else SiSU::Operations.new(@opt).remote_put_base_site
end
- if @opt.act[:manifest][:set]==:on #% --manifest, -y
- requires('manifest')
- OptionLoopFiles.new(@opt).manifest_on_files_translated do
- SiSU_Manifest::Source.new(@opt).read # -y manifest.rb
+ end
+ end
+ if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form
+ SiSU::Operations.new(@opt).cgi
+ end
+ if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick
+ SiSU::Operations.new(@opt).webrick
+ end
+ if @opt.act[:zap][:set]==:on #% --zap -Z wipe previous output clean DUPLICATE
+ #require_relative 'zap'
+ #SiSU_Zap::Source.new(@opt).read # -Z zap.rb
+ end
+ if @opt.act[:dal][:set]==:on
+ @retry_count= -1
+ begin
+ path_image='./_sisu/processing/external_document/image'
+ path_skin='./_sisu/processing/external_document/skin/doc'
+ @get_s,@get_p,@get_pl=[],[],[]
+ re_s=/(\S+?\.-sst)$/
+ re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/
+ re_pl3=/^(\/\S+?\.ss[mt]\.txz)/
+ @opt.files.each do |fns|
+ if fns =~re_s
+ @get_s << @opt.f_pths[0][:url]
+ end
+ if fns =~re_p3
+ @get_p << re_p3.match(fns)[1] if re_p3
+ end
+ if fns =~re_pl3
+ @get_pl << re_pl3.match(fns)[1] if re_p3
end
end
- if @opt.act[:sitemap][:set]==:on #% --sitemap, -Y
- requires('sitemaps')
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb
- end
+ if @get_s.length > 0 #% remote markup file .sst
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Get.new(@opt,@get_s).fns
+ SiSU::Operations.new.counter
end
- if @opt.act[:harvest][:set] !=:on
- if @opt.act[:scp][:set]==:on #% -r copy to remote server
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Remote::Put.new(@opt).scp # -r
- end
- end
- if @opt.act[:rsync][:set]==:on #% -R copy to remote server
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Remote::Put.new(@opt).rsync # -R
- end
- end
- else
+ if @get_p.length > 0 #% remote sisupod
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Get.new(@opt,@get_p).sisupod
end
- if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y
- requires('urls')
- OptionLoopFiles.new(@opt).loop_files_on_given_option do
- SiSU_Urls::Source.new(@opt).read #% -u -v -V -M
- end
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,@opt,@fns).error do
+ __LINE__.to_s + ':' + __FILE__
end
+ @retry_count +=1
+ retry unless @retry_count > 1
+ ensure
end
- if @opt.act[:site_init][:set]==:on #% -C
- requires('conf') # -s conf.rb
- SiSU_Initialize::Source.new(@opt).read
- end
- #pre_loop_files_on_given_option_do
- each_file_loop_options
- post_loop_files_on_given_option_do
+ end
+ if @opt.act[:site_init][:set]==:on #% -C
+ require_relative 'conf' # -s conf.rb
+ SiSU_Initialize::Source.new(@opt).read
+ end
+ end
+ def actions
+ if @opt.act[:profile][:set]==:on
+ require 'profile'
+ end
+ 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.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
+ and @opt.cmd =~/^-/ \
+ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
+ 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 \
@@ -635,18 +639,18 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
elsif @opt.mod.inspect =~/--identify/
require_relative 'sst_identify_markup' # sst_identify_markup.rb
markup_version=SiSU_Markup::MarkupIdentify.new(@opt).markup_version?
- elsif @opt.mod.inspect =~/--about/ #% help instructions
+ elsif @opt.mod.inspect =~/--about/ #% help instructions
if @opt.mod.inspect =~/--about/ \
and not @opt.what.empty?
SiSU_Help::Help.new(@opt.what,'color_off').help_request
else
SiSU_Help::Help.new('list','color_off').help_request
end
- elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
- require_relative 'sitemaps' # sitemaps.rb
+ elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
+ require_relative 'sitemaps' # sitemaps.rb
SiSU_Sitemaps::Source.new(@opt).read
if @opt.act[:rsync][:set]==:on
- require_relative 'remote' # remote.rb
+ require_relative 'remote' # remote.rb
SiSU_Remote::Put.new(@opt).rsync_sitemaps
end
else #% help instructions
@@ -693,15 +697,15 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
require 'jcode'
$KCODE='UTF8'
end
- require_relative 'constants' # constants.rb
- require_relative 'options' # options.rb
- require_relative 'sysenv' # sysenv.rb
+ require_relative 'constants' # constants.rb
+ require_relative 'options' # options.rb
+ require_relative 'sysenv' # sysenv.rb
include SiSU_Env; include SiSU_Screen
- require_relative 'param' # param.rb
+ require_relative 'param' # param.rb
include SiSU_Param
- require_relative 'defaults' # defaults.rb
+ require_relative 'defaults' # defaults.rb
include SiSU_Viz
- require_relative 'help' # help.rb
+ require_relative 'help' # help.rb
include SiSU_Help
require 'uri'
home=ENV['HOME']