aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/hub.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
committerRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
commitedd89902036bde18c91031470e19c871a182cf6d (patch)
tree1269e7b1660aa64896fc21768002e837233c2c24 /lib/sisu/v5/hub.rb
parentv4 v5: version & changelog (diff)
v5: options & downstream, more use of opt.act instead of opt.cmd
* opt.act.*.set==:on instead of opt.cmd =~/\S/
Diffstat (limited to 'lib/sisu/v5/hub.rb')
-rw-r--r--lib/sisu/v5/hub.rb78
1 files changed, 45 insertions, 33 deletions
diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb
index fcbaa67a..6893e2ad 100644
--- a/lib/sisu/v5/hub.rb
+++ b/lib/sisu/v5/hub.rb
@@ -154,7 +154,7 @@ module SiSU
end
end
if files_translated_idx.flatten.length > 1
- SiSU_Screen::Ansi.new(@opt.cmd,'Manifest re-run on (currently generated) translated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest re-run on (currently generated) translated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on
files_translated_idx.flatten.each do |i|
@opt.fns=@opt.files[i]
@opt.f_pth=@opt.f_pths[i]
@@ -291,74 +291,74 @@ module SiSU
end
end
if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
- require_relative 'qrcode' # -Q qrcode.rb
+ require_relative 'qrcode' # qrcode.rb
SiSU_QRcode::Source.new(@opt).read
end
if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
- require_relative 'digests' # -N digests.rb
+ require_relative 'digests' # 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
+ require_relative 'plaintext' # plaintext.rb
SiSU_Plaintext::Source.new(@opt).read
end
- if @opt.act[:html][:set]==:on #% --html, -h
- require_relative 'html' # -h -H html.rb
+ if @opt.act[:html][:set]==:on #% --html, -h -H
+ require_relative 'html' # html.rb
SiSU_HTML::Source.new(@opt).read
else
- if @opt.act[:html_seg][:set]==:on #% --html-seg
- require_relative 'html' # -h -H html.rb
+ if @opt.act[:html_seg][:set]==:on #% --html-seg (-h -H)
+ require_relative 'html' # html.rb
SiSU_HTML::Source.new(@opt).read
end
- if @opt.act[:html_scroll][:set]==:on #% --html-scroll
- require_relative 'html' # -h -H html.rb
+ if @opt.act[:html_scroll][:set]==:on #% --html-scroll (-h -H)
+ require_relative 'html' # html.rb
SiSU_HTML::Source.new(@opt).read
end
end
if @opt.act[:concordance][:set]==:on #% --concordance, -w
- require_relative 'concordance' # -w concordance.rb
+ require_relative 'concordance' # concordance.rb
SiSU_Concordance::Source.new(@opt).read
end
if @opt.act[:epub][:set]==:on #% --epub, -e
- require_relative 'epub' # -e epub.rb
+ require_relative 'epub' # epub.rb
SiSU_EPUB::Source.new(@opt).read
end
if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
- require_relative 'odf' # -o odf.rb
+ require_relative 'odf' # odf.rb
SiSU_ODF::Source.new(@opt).read
end
if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
- require_relative 'xhtml' # -b xhtml.rb
+ require_relative 'xhtml' # 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
+ require_relative 'xml' # 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
+ require_relative 'xml_dom' # xml_dom.rb
SiSU_XML_DOM::Source.new(@opt).read
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
- require_relative 'texpdf' # -p texpdf.rb
+ require_relative 'texpdf' # texpdf.rb
SiSU_TeX::Source.new(@opt).read
end
if @opt.act[:manpage][:set]==:on #% --manpage, -i
- require_relative 'manpage' # -i manpage.rb
+ require_relative 'manpage' # manpage.rb
SiSU_Manpage::Source.new(@opt).read
end
if @opt.act[:texinfo][:set]==:on #% --texinfo, -I
- require_relative 'texinfo' # -I texinfo.rb
+ require_relative 'texinfo' # texinfo.rb
SiSU_TexInfo::Source.new(@opt).read
end
if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d DB sqlite
- require_relative 'dbi_discrete' # -d dbi_discrete.rb
+ require_relative 'dbi_discrete' # dbi_discrete.rb
SiSU_DBI_Discrete::SQL.new(@opt).build
end
if @opt.act[:manifest][:set]==:on #% --manifest, -y
- require_relative 'manifest' # -y manifest.rb
+ require_relative 'manifest' # manifest.rb
((@opt.act[:sisupod][:set]==:on \
|| @opt.act[:share_source][:set]==:on) \
&& @opt.files.length < 2 ) \
@@ -388,7 +388,6 @@ module SiSU
SiSU_Source::SiSUpodSource.new(@opt).read
end
if @opt.act[:share_source][:set]==:on
-#REDO
require_relative 'share_src' # -s share_src.rb
begin
ensure
@@ -431,7 +430,7 @@ module SiSU
end
ensure
path_pod=@env.processing_path.processing_sisupod(@opt).paths
- unless @opt.cmd =~/M/
+ unless @opt.act[:maintenance][:set]==:on
FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod])
end
end
@@ -512,13 +511,13 @@ module SiSU
end
end
def do_initialization
- @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
+ @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
SiSU_Env::InfoProcessingFlag.new
- if @opt.act[:version_info][:set]==:on #% version information
+ if @opt.act[:version_info][:set]==:on #% version information
SiSU_Env::InfoAbout.new(@opt).sisu_version
end
if @opt.act[:dal][:set]==:on \
- or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C
+ 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'
@@ -563,10 +562,10 @@ module SiSU
end
end
end
- if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form
+ 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
+ if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick
SiSU::Operations.new(@opt).webrick
end
if @opt.act[:dal][:set]==:on
@@ -668,7 +667,7 @@ module SiSU
SiSU_DBI::SQL.new(@opt).connect
end
elsif action_on_file_ == :true \
- or (
+ or ( #% --->
@opt.cmd =~/^-/ \
and @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
@@ -678,8 +677,18 @@ module SiSU
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 if @opt.cmd =~/[vVM]/
- @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty?
+ if (@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on)
+ @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil
+ end
+ if (@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on \
+ || @opt.act[:urls_selected][:set]==:on \
+ || @opt.act[:urls_all][:set]==:on)
+ @tell.call.print_brown unless @opt.files.join.empty?
+ end
if defined? @@env.processing_path.processing \
and @@env.user \
and FileTest.directory?(@@env.processing_path.processing) \
@@ -691,7 +700,10 @@ module SiSU
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 filename)}
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:fuchsia) if @opt.cmd =~/[MV]/
+ if (@opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on)
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:fuchsia)
+ end
end
elsif @opt.mod.inspect =~/--query/
require_relative 'sst_identify_markup' # sst_identify_markup.rb
@@ -727,7 +739,7 @@ module SiSU
if @opt.fns =~/\.ssm\.sst$/ \
and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
@msg,@msgs='temporary file removed',nil
- @tell.call.warn unless @opt.cmd =~/V/
+ @tell.call.warn unless @opt.act[:quiet][:set]==:on
File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER
end
else #SiSU::Operations.new(fns,'html').not_found