aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/hub.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/hub.rb')
-rw-r--r--lib/sisu/v3/hub.rb93
1 files changed, 51 insertions, 42 deletions
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index 149a5727..5f256314 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -63,7 +63,7 @@ module SiSU
include SiSU_Screen
@@pwd_the=Dir.pwd
class Op
- @@env=SiSU_Env::Info_env.new
+ @@env=SiSU_Env::InfoEnv.new
def initialize(opt,req,message)
@opt,@req,@message=opt,req,message
@n_do=0
@@ -129,11 +129,11 @@ module SiSU
end
if not @opt.files.empty?
@opt.files.each_with_index do |fns,i|
- env=SiSU_Env::Info_env.new(fns)
+ env=SiSU_Env::InfoEnv.new(fns)
if fns =~ /sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz|\.ssp)$/
require_relative 'remote' # remote.rb #check
pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.txz|\.ssp)$/
- SiSU_Remote::Remote_download.new(fns).pod.name
+ SiSU_Remote::RemoteDownload.new(fns).pod.name
else
re_p=/(\S+?\.ss[mt](?:\.txz)?)$/
re_p.match(fns).captures.join
@@ -145,7 +145,7 @@ module SiSU
elsif fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/
require_relative 'remote' # remote.rb #check
pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.zip|\.ssp)$/
- SiSU_Remote::Remote_download.new(fns).pod.name
+ SiSU_Remote::RemoteDownload.new(fns).pod.name
else
re_p=/(\S+?\.ss[mt](?:\.zip)?)$/
re_p.match(fns).captures.join
@@ -171,12 +171,12 @@ module SiSU
@@pwd=@opt.pth
end
Dir.chdir(@opt.pth) #watch
- env=SiSU_Env::Info_env.new(fns)
+ env=SiSU_Env::InfoEnv.new(fns)
if @req !~/(?:urls|remote)$/
if @opt.cmd.inspect =~/-P/\
and @req =~ /^po4a$/
require_relative 'composite' # composite.rb #pre-processing
- SiSU_po4a::Source.new(@opt).read # -P po4a.rb
+ SiSU_Po4a::Source.new(@opt).read # -P po4a.rb
elsif @req=~/^dal$/ \
and FileTest.file?(@opt.fns) \
and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
@@ -201,14 +201,14 @@ module SiSU
when /^concordance$/; SiSU_Concordance::Source.new(@opt).read # -w concordance.rb
when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s share_src.rb
when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb
-# when /^source_kdissert$/; SiSU_Kdi_source::Source.new(@opt).read # -S share_src_kdissert.rb
- when /^digests$/; SiSU_Digest_view::Source.new(@opt).read # -N digests.rb
+# when /^source_kdissert$/; SiSU_KdiSource::Source.new(@opt).read # -S share_src_kdissert.rb
+ when /^digests$/; SiSU_DigestView::Source.new(@opt).read # -N digests.rb
when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -t -a plaintext.rb
- when /^po4a$/; SiSU_po4a::Source.new(@opt).read # -P po4a.rb
+ when /^po4a$/; SiSU_Po4a::Source.new(@opt).read # -P po4a.rb
#when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g
when /^epub$/; SiSU_EPUB::Source.new(@opt).read # -e epub.rb
when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o odf.rb
- when /^xml_md_oai_pmh_dc$/; SiSU_XML_metadata::OAI_PMH.new(@opt).read # -O
+ when /^xml_md_oai_pmh_dc$/; SiSU_XML_Metadata::OAI_PMH.new(@opt).read # -O
when /^texpdf$/; SiSU_TeX::Source.new(@opt).read # -p texpdf.rb
when /^manpage$/; SiSU_Manpage::Source.new(@opt).read # -i manpage.rb
when /^texinfo$/; SiSU_TexInfo::Source.new(@opt).read # -I texinfo.rb
@@ -216,14 +216,16 @@ module SiSU
when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b xhtml.rb
when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x xml.rb
when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X xml_dom.rb
+ when /^shared_images$/; SiSU_Images::Source.new(@opt).read # -j shared_images.rb
#when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f
- when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -k xml_scaffold.rb
+ when /^xml_scaffold$/; SiSU_XML_Scaffold::Source.new(@opt).read # -k xml_scaffold.rb
when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check
when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y manifest.rb
when /^qrcode$/; SiSU_QRcode::Source.new(@opt).read # -Q qrcode.rb
when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb
when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z zap.rb
- when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d dbi.rb
+ when /^dbi$/; SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb
+ when /^dbi_discreet$/; SiSU_DBI_Discreet::SQL.new(@opt).build # -d dbi_discreet.rb
end
@n_do=@n_do+1
SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/
@@ -233,13 +235,13 @@ module SiSU
else
if @req !~/^conf$/ \
and @opt.fns !~/http:\/\//
- Operations.new(@opt).not_found
+ SiSU::Operations.new(@opt).not_found
end
end
elsif FileTest.file?(put)
if @opt.mod.inspect !~/harvest/ #decide whether should permit harvest in single operation
case @req
- when /^urls$/; SiSU_urls::Source.new(@opt).read # -u -v -V -M
+ when /^urls$/; SiSU_Urls::Source.new(@opt).read # -u -v -V -M
when /^remote$/
case @message
when /scp/; SiSU_Remote::Put.new(@opt).scp # -r
@@ -250,14 +252,14 @@ module SiSU
@n_do=@n_do+1
SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/
end
- else Operations.new(@opt).not_found
+ else SiSU::Operations.new(@opt).not_found
end
end
end
- elsif @req =~/^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d
+ elsif @req =~/^dbi$/; SiSU_DBI::SQL.new(@opt).connect # -D -d
elsif @req=~/^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S
end
- Operations.new.counter
+ SiSU::Operations.new.counter
end
end
class Operations
@@ -291,11 +293,11 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
def cgi # -F
require_relative 'cgi' # cgi.rb
- SiSU_CGI::SiSU_search.new(@opt).read
+ SiSU_CGI::SearchSQL.new(@opt).read
end
def encoding # -K build character encoding db (uses KirbyBase)
require_relative 'character_encoding' # character_encoding.rb
- SiSU_character_encode::Create.new.db
+ SiSU_CharacterEncode::Create.new.db
end
def termsheet # -t
system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n")
@@ -338,7 +340,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
class Processing
require 'fileutils'
include FileUtils
- @@env=SiSU_Env::Info_env.new
+ @@env=SiSU_Env::InfoEnv.new
attr_accessor :op
def initialize(opt)
@opt=opt
@@ -346,7 +348,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
@tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
end
def op(req,msg)
- Op.new(@opt,req,msg).select if req and msg
+ SiSU::Op.new(@opt,req,msg).select if req and msg
end
def actions
if @opt.cmd =~/E/ # re-assign character
@@ -357,15 +359,15 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
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 =~/([abCcDdeFGgHhIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
+ 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::Info_processing_flag.new
+ flag=SiSU_Env::InfoProcessingFlag.new
if @opt.cmd =~/[vVM]/ #% version information
- if @opt.cmd =~/V/ \
- and @opt.files.empty? #% environment
+ if (@opt.cmd =~/V/) \
+ && (@opt.files.empty?) #% environment
SiSU_Help::Help.new('env',@opt).environment
else SiSU_Help::Help.new('env',@opt).sisu_version
end
@@ -407,22 +409,22 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @opt.cmd =~/R/
if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
and @opt.cmd =~/RZ/
- Operations.new(@opt).remote_put_base_site_rsync_match
- else Operations.new(@opt).remote_put_base_site_rsync
+ SiSU::Operations.new(@opt).remote_put_base_site_rsync_match
+ else SiSU::Operations.new(@opt).remote_put_base_site_rsync
end
elsif @opt.cmd =~/r/
if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
and @opt.cmd =~/CCr/
- Operations.new(@opt).remote_put_base_site_all
- else Operations.new(@opt).remote_put_base_site
+ SiSU::Operations.new(@opt).remote_put_base_site_all
+ else SiSU::Operations.new(@opt).remote_put_base_site
end
end
end
if @opt.act[:sample_search_form][:bool] #% --sample-search-form, -F cgi sample search form
- Operations.new(@opt).cgi
+ SiSU::Operations.new(@opt).cgi
end
if @opt.act[:webrick][:bool] #% --webrick, -W webrick
- Operations.new(@opt).webrick
+ SiSU::Operations.new(@opt).webrick
end
if @opt.cmd =~/Z/ #% -Z wipe previous output clean
op('zap','Zap, deletions')
@@ -463,14 +465,14 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @get_s.length > 0 #% remote markup file .sst
require_relative 'remote' # remote.rb
SiSU_Remote::Get.new(@opt,@get_s).fns
- Operations.new.counter
+ 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::Info_error.new($!,$@,@opt,@fns).error #ok
+ SiSU_Errors::InfoError.new($!,$@,@opt,@fns).error #ok
@retry_count +=1
retry unless @retry_count > 1
ensure
@@ -518,6 +520,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @opt.act[:xhtml][:bool] #% --xhtml, -b xhtml
op('xhtml','xhtml sax')
end
+ if @opt.act[:images][:bool] #% --images, -j
+ op('shared_images','images')
+ end
if @opt.act[:concordance][:bool] #% --concordance, -w
op('concordance','Concordance')
end
@@ -536,13 +541,14 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if FileTest.file?(fns)
@opt.fns=fns
case @opt.fns
- when /\.(termsheet.rb)$/; Operations.new(@opt).termsheet
+ when /\.(termsheet.rb)$/
+ SiSU::Operations.new(@opt).termsheet
else #print "not processed --> ", fns, "\n"
end
- else Operations.new(@opt).not_found
+ else SiSU::Operations.new(@opt).not_found
end
end
- Operations.new.counter
+ SiSU::Operations.new.counter
end
if @opt.cmd =~/k/ #% -T temporary tests
op('xml_scaffold','XML scaffold')
@@ -559,6 +565,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @opt.act[:psql][:bool] #% --pg, -D DB postgresql
op('dbi','postgresql')
end
+ if @opt.act[:sqlite_discreet][:bool] #% --sqlite, -d DB sqlite
+ op('dbi_discreet','sqlite')
+ end
if @opt.act[:sqlite][:bool] #% --sqlite, -d DB sqlite
op('dbi','sqlite')
end
@@ -593,10 +602,10 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
elsif @opt.mod.inspect =~/--query/
require_relative 'sst_identify_markup' # sst_identify_markup.rb
- puts SiSU_Markup::Markup_history.new(@opt).query
+ puts SiSU_Markup::MarkupHistory.new(@opt).query
elsif @opt.mod.inspect =~/--identify/
require_relative 'sst_identify_markup' # sst_identify_markup.rb
- markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
+ markup_version=SiSU_Markup::MarkupIdentify.new(@opt).markup_version?
elsif @opt.mod.inspect =~/--about/ #% help instructions
if @opt.mod.inspect =~/--about/ \
and not @opt.what.empty?
@@ -632,7 +641,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
elsif @opt.fns=~/\.ssi$/ \
and @opt.mod.inspect =~/--identify/
- else Operations.new(@opt).not_recognised
+ else SiSU::Operations.new(@opt).not_recognised
end
end
if @opt.fns =~/\.ssm\.sst$/ \
@@ -641,7 +650,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
@tell.call.warn unless @opt.cmd =~/V/
File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER
end
- else #Operations.new(fns,'html').not_found
+ else #SiSU::Operations.new(fns,'html').not_found
end
end
end
@@ -664,8 +673,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
require 'uri'
home=ENV['HOME']
argv=$*
- @opt=SiSU_commandline::Options.new(argv)
- Processing.new(@opt).actions
+ @opt=SiSU_Commandline::Options.new(argv)
+ SiSU::Processing.new(@opt).actions
rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt,$!,$@,nil).rescue #fix
ensure
Dir.chdir(@@pwd_the)