aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/options.rb')
-rw-r--r--lib/sisu/v5/options.rb174
1 files changed, 146 insertions, 28 deletions
diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb
index f40f0388..e90fe668 100644
--- a/lib/sisu/v5/options.rb
+++ b/lib/sisu/v5/options.rb
@@ -70,7 +70,7 @@ module SiSU_Commandline
require_relative 'sysenv' # sysenv.rb
require_relative 'param_make' # param_make.rb
class HeaderCommon
- def sisu_document_make_instructions
+ def sisu_document_make_instructions(make_instruct_array=:nil)
@pagenew=
@pagebreak=
@pageline=
@@ -87,7 +87,9 @@ module SiSU_Commandline
@home_button_links=
@links=
nil
- make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read
+ make_instruct_array=make_instruct_array==:nil \
+ ? SiSU_Env::GetInit.new.sisu_document_make.makefile_read
+ : make_instruct_array
@makeset=false
if make_instruct_array
make_instruct_array.each do |para| #% scan document
@@ -282,7 +284,10 @@ module SiSU_Commandline
end
if @cmd =~/[vVM]/ \
&& @cmd !~/-[ku]*v[ku]*$/
- SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown
+ SiSU_Screen::Ansi.new(
+ @cmd,
+ "\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n"
+ ).print_brown
end
end
@@act ? @act=@@act : @@act=@act=opt_act
@@ -331,7 +336,7 @@ module SiSU_Commandline
pod_make_path=fullname + '/sisupod/doc/_sisu'
make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path)
@make_instructions_pod=
- HeaderCommon.new(make_instruct_array).sisu_document_make_instructions
+ HeaderCommon.new.sisu_document_make_instructions(make_instruct_array)
Dir.chdir(pt.realpath)
system("
chdir #{fullname}
@@ -532,6 +537,7 @@ module SiSU_Commandline
mod << s
when /^--(?:epub)$/ then c=c+'e'
when /^--(?:od[ft])$/ then c=c+'o'
+ when /^--docbook$/ then c=c+'d'
when /^--(?:pdf)$/ then c=c+'p'
when /^--pdf-(?:a4|a5|b5|legal|letter)$/ then c=c+'p'
when /^--pdf-(?:p|l|portrait|landscape)$/ then c=c+'L'
@@ -544,13 +550,11 @@ module SiSU_Commandline
when /^--(?:xml-sax)$/ then c=c+'x'
when /^--(?:xml-dom)$/ then c=c+'X'
when /^--(?:images)$/ then c=c+'j'
- when /^--(?:hash-digests)$/ then c=c+'N'
+ when /^--(?:digests?|hash-digests)$/ then c=c+'N'
when /^--(?:po4a|pot?)$/ then c=c+'P'
when /^--(?:termsheet)$/ then c=c+'T'
when /^--(?:manifest)$/ then c=c+'y'
when /^--(?:qrcode)$/ then c=c+'Q'
- when /^--(?:sqlite)$/ then c=c+'d'
- when /^--(?:pg|pg?sql|postgresql)$/ then c=c+'D'
when /^--(?:remote|rsync)$/ then c=c+'R'
when /^--(?:scp)$/ then c=c+'r'
when /^--(?:source)$/ then c=c+'s'
@@ -582,8 +586,7 @@ module SiSU_Commandline
extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \
and cmd !~/[mn]/
'm' #% add ao
- elsif ((cmd =~/[Dd]/ \
- or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
+ elsif ((mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
and cmd !~/[mn]/
'm' #% add ao
@@ -591,18 +594,17 @@ module SiSU_Commandline
end
end
if cmd !~/j/
- extra+=if cmd =~/[bHhwXxyz]/ \
+ extra+=if cmd =~/[bdHhwXxyz]/ \
and cmd !~/[j]/
'j' #% copy images
else ''
end
end
if cmd !~/y/
- extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \
+ extra+=if cmd =~/[abdeHhIiNopQSstwXxz]/ \
and cmd !~/y/
'ym' #% add manifest
- elsif (cmd =~/[Dd]/ \
- or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
+ elsif mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \
and files[0] !~/^remove$/ \
and cmd !~/y/
'ym' #% add manifest
@@ -911,7 +913,8 @@ module SiSU_Commandline
|| mod.inspect =~/"--xml-dom"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xml_docbook_book]=mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/ \
+ act[:xml_docbook_book]=(cmd =~/d/ \
+ || mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:xml_fictionbook]=(cmd =~/f/ \
@@ -962,19 +965,134 @@ module SiSU_Commandline
|| mod.inspect =~/"--texinfo"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:psql]=(cmd =~/D/ \
- || mod.inspect =~/"--pg"|"--pgsql"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:sqlite]=(cmd =~/d/ \
- || mod.inspect =~/"--sqlite"/) \
- && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:sqlite_discrete]=(cmd =~/d/ \
- || mod.inspect =~/"--sql"|"--sqlite"/) \
- && (mod.inspect =~/"--both"/ \
- || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
+ act[:psql]=if mod.inspect =~/"--pg-\S+"/ \
+ or ((mod.inspect =~/"--pg"/) \
+ && (mod.inspect \
+ =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/))
+ act[:psql_createdb]=if mod.inspect \
+ =~/"--pg-createdb"|"--createdb"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ if mod.inspect \
+ =~/"--pg-recreate(?:all)?"|"--recreate(?:all)?"/
+ act[:psql_drop]={ bool: true, set: :on }
+ act[:psql_create]={ bool: true, set: :on }
+ else
+ act[:psql_drop]=if mod.inspect \
+ =~/"--pg-dropall"|"--dropall"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:psql_create]=if mod.inspect \
+ =~/"--pg-create(?:all)?"|"--create(?:all)?"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ end
+ act[:psql_import]=if mod.inspect \
+ =~/"--pg-import"|"--import"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:psql_update]=if mod.inspect \
+ =~/"--pg-update"|"--update"/
+ act[:psql_remove]={ bool: true, set: :on }
+ { bool: true, set: :on }
+ else
+ act[:psql_remove]=if mod.inspect \
+ =~/"--pg-remove"|"--remove"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ act[:psql_createdb]=
+ { bool: false, set: :na }
+ act[:psql_drop]=
+ { bool: false, set: :na }
+ act[:psql_create]=
+ { bool: false, set: :na }
+ act[:psql_import]=
+ { bool: false, set: :na }
+ act[:psql_update]=
+ { bool: false, set: :na }
+ act[:psql_remove]=
+ { bool: false, set: :na }
+ { bool: false, set: :na }
+ end
+ act[:sqlite]=if (mod.inspect =~/"--sqlite-\S+"/) \
+ or ((mod.inspect =~/"--sqlite"/) \
+ && (mod.inspect \
+ =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/))
+ act[:sqlite_createdb]=if mod.inspect \
+ =~/"--sqlite-createdb"|"--createdb"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ if mod.inspect \
+ =~/"--sqlite-recreate(?:all)?"|"--recreate(?:all)?"/
+ act[:sqlite_drop]={ bool: true, set: :on }
+ act[:sqlite_create]={ bool: true, set: :on }
+ else
+ act[:sqlite_create]=if mod.inspect \
+ =~/"--sqlite-create(?:all)?"|"--create(?:all)?"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:sqlite_drop]=if mod.inspect \
+ =~/"--sqlite-dropall"|"--dropall"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ end
+ act[:sqlite_import]=if mod.inspect \
+ =~/"--sqlite-import"|"--import"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:sqlite_update]=if mod.inspect \
+ =~/"--sqlite-update"|"--update"/
+ act[:sqlite_remove]={ bool: true, set: :on }
+ { bool: true, set: :on }
+ else
+ act[:sqlite_remove]=if mod.inspect \
+ =~/"--sqlite-remove"|"--sqlite-remove"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ act[:sqlite_createdb]=
+ { bool: false, set: :na }
+ act[:sqlite_drop]=
+ { bool: false, set: :na }
+ act[:sqlite_create]=
+ { bool: false, set: :na }
+ act[:sqlite_import]=
+ { bool: false, set: :na }
+ act[:sqlite_update]=
+ { bool: false, set: :na }
+ act[:sqlite_remove]=
+ { bool: false, set: :na }
+ { bool: false, set: :na }
+ end
+ act[:sqlite_discrete]=mod.inspect =~/"--sql"|"--sqlite"/ \
+ && (mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:harvest]=(mod.inspect =~/"--harvest"/) \
@@ -989,7 +1107,7 @@ module SiSU_Commandline
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:hash_digests]=(cmd =~/N/ \
- || mod.inspect =~/"--hash-digests"/) \
+ || mod.inspect =~/"--digests?"|"--hash-digests"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:pdf_font_size]=if mod.inspect =~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/