From 65e4c0633003a9e3ddbe0aab11909232b61bbdc8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:14:06 -0400 Subject: v3: options, match fix for --glob / --find --- lib/sisu/v3/options.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/sisu/v3/options.rb') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index ac31a896..dbfe5d79 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -116,7 +116,7 @@ module SiSU_commandline end end def sisu_glob_rules(a) - a=if a.inspect =~/"-\S*[fG]/ \ + a=if a.inspect =~/"-[A-Za-z0-9]*[fG]/ \ or a.inspect =~/"--find"|"--glob"/ b,f=[],[] find_flag=false @@ -138,11 +138,9 @@ module SiSU_commandline r.gsub!(/\|#{@lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} z=if find_flag - if f.length > 0 - b + find_select(find_flag,f) - else - find_all(find_flag,b) - end + (f.length > 0) \ + ? (b + find_select(find_flag,f)) + : find_all(find_flag,b) elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ && a.inspect =~/"#{@lang_regx}\/?"/ \ && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/ -- cgit v1.2.3 From af7543c058995af80e25f2f71be3a12699e26564 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:15:22 -0400 Subject: v3: options, (hub), action (opt.act) modified to increase use possibilities --- lib/sisu/v3/options.rb | 347 ++++++++++++++++++++++--------------------------- 1 file changed, 158 insertions(+), 189 deletions(-) (limited to 'lib/sisu/v3/options.rb') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index dbfe5d79..66866dc3 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -375,204 +375,173 @@ module SiSU_commandline def opt_act #note mod line commands have already been converted to command characters, cmd cmd,mod=@cmd,@mod act={} - act[:license]=if cmd =~/L/ \ - or mod.inspect =~/"--license/ - true - else false - end - act[:site_init]=if cmd =~/C/ \ - or mod.inspect =~/"--init-site/ - true - else false - end - act[:verbose]=if cmd =~/v/ \ - or mod.inspect =~/"--verbose"/ - true - else false - end - act[:quiet]=if cmd =~/q/ \ - or mod.inspect =~/"--quiet"/ - true - else false - end + act[:license]=(cmd =~/L/ \ + || mod.inspect =~/"--license/) \ + ? { bool: true } + : { bool: false } + act[:site_init]=(cmd =~/C/ \ + || mod.inspect =~/"--init-site/) \ + ? { bool: true } + : { bool: false } + act[:rc]=if mod.inspect =~/"--rc=/ + x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') + { bool: true, inst: x } + else + { bool: false, inst: '' } + end + act[:verbose]=(cmd =~/v/ \ + || mod.inspect =~/"--verbose"/) \ + ? { bool: true } + : { bool: false } + act[:quiet]=(cmd =~/q/ \ + || mod.inspect =~/"--quiet"/) \ + ? { bool: true } + : { bool: false } act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ - true + { bool: true } elsif mod.inspect =~/"--color-off"/ - true - else true #fix default color + { bool: false } + else { bool: true } #fix default color end # act[:color_toggle]=if cmd =~/c/ \ # or mod.inspect =~/"--color-toggle"/ # true # else false # end - act[:maintenance]=if cmd =~/M/ \ - or mod.inspect =~/"--maintenance|--keep-processing-files"/ - true - else false - end + act[:maintenance]=(cmd =~/M/ \ + || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ + ? { bool: true } + : { bool: false } act[:ocn]=if mod.inspect =~/"--no-ocn"/ - false - else true - end - act[:dal]=if cmd =~/m/ \ - or mod.inspect =~/"--dal"/ - true - else false - end - act[:html]=if cmd =~/h/ \ - or mod.inspect =~/"--html"/ - true - else false - end - act[:concordance]=if cmd =~/w/ \ - or mod.inspect =~/"--concordance"/ - true - else false - end - act[:pdf]=if cmd =~/p/ \ - or mod.inspect =~/"--pdf"/ - true - else false - end - act[:epub]=if cmd =~/e/ \ - or mod.inspect =~/"--epub"/ - true - else false - end - act[:odt]=if cmd =~/o/ \ - or mod.inspect =~/"--odf"/ - true - else false - end - act[:xml_sax]=if cmd =~/x/ \ - or mod.inspect =~/"--xml-sax"/ - true - else false - end - act[:xml_dom]=if cmd =~/X/ \ - or mod.inspect =~/"--xml-dom"/ - true - else false - end - act[:xhtml]=if cmd =~/b/ \ - or mod.inspect =~/"--xhtml"/ - true - else false - end - act[:txt]=if cmd =~/[at]/ \ - or mod.inspect =~/"--txt"/ - true - else false - end - act[:manpage]=if cmd =~/i/ \ - or mod.inspect =~/"--manpage"/ - true - else false - end - act[:texinfo]=if cmd =~/I/ \ - or mod.inspect =~/"--texinfo"/ - true - else false - end - act[:fictionbook]=if cmd =~/f/ \ - or mod.inspect =~/"--fictionbook"/ - true - else false - end - act[:psql]=if cmd =~/D/ \ - or mod.inspect =~/"--pg"|"--pgsql"/ - true - else false - end - act[:sqlite]=if cmd =~/d/ \ - or mod.inspect =~/"--sqlite"/ - true - else false - end - act[:harvest]=if mod.inspect =~/"--harvest"/ - true - else false - end - act[:po4a]=if cmd =~/P/ \ - or mod.inspect =~/"--po4a"|"--pot?"/ - true - else false - end - act[:git]=if cmd =~/g/ \ - or mod.inspect =~/"--git"/ - true - else false - end - act[:hash_digests]=if cmd =~/N/ \ - or mod.inspect =~/"--hash-digests"/ - true - else false - end - act[:sample_search_form]=if cmd =~/F/ \ - or mod.inspect =~/"--sample-search-form"/ - true - else false - end - act[:webrick]=if cmd =~/W/ \ - or mod.inspect =~/"--webrick"/ - true - else false - end - act[:share_source]=if cmd =~/s/ \ - or mod.inspect =~/"--source"/ - true - else false - end - act[:sisupod]=if cmd =~/S/ \ - or mod.inspect =~/"--sisupod"/ - true - else false - end - act[:scp]=if cmd =~/r/ \ - or mod.inspect =~/"--scp"/ - true - else false - end - act[:rsync]=if cmd =~/R/ \ - or mod.inspect =~/"--rsync"/ - true - else false - end - act[:delete_output]=if cmd =~/z/ \ - or mod.inspect =~/"--delete"|"--zap"/ - true - else false - end - act[:urls_all]=if cmd =~/U/ \ - or mod.inspect =~/"--urls-all"/ - true - else false - end - act[:urls_seleted]=if cmd =~/u/ \ - or mod.inspect =~/"--urls"/ - true - else false - end - act[:sitemap]=if cmd =~/Y/ \ - or mod.inspect =~/"--sitemap"/ - true - else false - end - act[:qrcode]=if cmd =~/Q/ \ - or mod.inspect =~/"--qrcode"/ - true - else false - end - act[:manifest]=if cmd =~/y/ \ - or mod.inspect =~/"--manifest"/ - true - else false - end - act[:help]=if mod.inspect =~/"--help/ - true - else false - end + { bool: false } + else { bool: true } + end + act[:dal]=(cmd =~/m/ \ + || mod.inspect =~/"--dal"/) \ + ? { bool: true } + : { bool: false } + act[:html]=(cmd =~/h/ \ + || mod.inspect =~/"--html"/) \ + ? { bool: true } + : { bool: false } + act[:concordance]=(cmd =~/w/ \ + || mod.inspect =~/"--concordance"/) \ + ? { bool: true } + : { bool: false } + act[:pdf]=(cmd =~/p/ \ + || mod.inspect =~/"--pdf"/) \ + ? { bool: true } + : { bool: false } + act[:epub]=(cmd =~/e/ \ + || mod.inspect =~/"--epub"/) \ + ? { bool: true } + : { bool: false } + act[:odt]=(cmd =~/o/ \ + || mod.inspect =~/"--odf"/) \ + ? { bool: true } + : { bool: false } + act[:xml_sax]=(cmd =~/x/ \ + || mod.inspect =~/"--xml-sax"/) \ + ? { bool: true } + : { bool: false } + act[:xml_dom]=(cmd =~/X/ \ + || mod.inspect =~/"--xml-dom"/) \ + ? { bool: true } + : { bool: false } + act[:xhtml]=(cmd =~/b/ \ + || mod.inspect =~/"--xhtml"/) \ + ? { bool: true } + : { bool: false } + act[:txt]=(cmd =~/[at]/ \ + || mod.inspect =~/"--txt"/) \ + ? { bool: true } + : { bool: false } + act[:manpage]=(cmd =~/i/ \ + || mod.inspect =~/"--manpage"/) \ + ? { bool: true } + : { bool: false } + act[:texinfo]=(cmd =~/I/ \ + || mod.inspect =~/"--texinfo"/) \ + ? { bool: true } + : { bool: false } + act[:fictionbook]=(cmd =~/f/ \ + || mod.inspect =~/"--fictionbook"/) \ + ? { bool: true } + : { bool: false } + act[:psql]=(cmd =~/D/ \ + || mod.inspect =~/"--pg"|"--pgsql"/) \ + ? { bool: true } + : { bool: false } + act[:sqlite]=(cmd =~/d/ \ + || mod.inspect =~/"--sqlite"/) \ + ? { bool: true } + : { bool: false } + act[:harvest]=(mod.inspect =~/"--harvest"/) \ + ? { bool: true } + : { bool: false } + act[:po4a]=(cmd =~/P/ \ + || mod.inspect =~/"--po4a"|"--pot?"/) \ + ? { bool: true } + : { bool: false } + act[:git]=(cmd =~/g/ \ + || mod.inspect =~/"--git"/) \ + ? { bool: true } + : { bool: false } + act[:hash_digests]=(cmd =~/N/ \ + || mod.inspect =~/"--hash-digests"/) \ + ? { bool: true } + : { bool: false } + act[:sample_search_form]=(cmd =~/F/ \ + || mod.inspect =~/"--sample-search-form"/) \ + ? { bool: true } + : { bool: false } + act[:webrick]=(cmd =~/W/ \ + || mod.inspect =~/"--webrick"/) \ + ? { bool: true } + : { bool: false } + act[:share_source]=(cmd =~/s/ \ + || mod.inspect =~/"--source"/) \ + ? { bool: true } + : { bool: false } + act[:sisupod]=(cmd =~/S/ \ + || mod.inspect =~/"--sisupod"/) \ + ? { bool: true } + : { bool: false } + act[:scp]=(cmd =~/r/ \ + || mod.inspect =~/"--scp"/) \ + ? { bool: true } + : { bool: false } + act[:rsync]=(cmd =~/R/ \ + || mod.inspect =~/"--rsync"/) \ + ? { bool: true } + : { bool: false } + act[:delete_output]=(cmd =~/z/ \ + || mod.inspect =~/"--delete"|"--zap"/) \ + ? { bool: true } + : { bool: false } + act[:urls_all]=(cmd =~/U/ \ + || mod.inspect =~/"--urls-all"/) \ + ? { bool: true } + : { bool: false } + act[:urls_seleted]=(cmd =~/u/ \ + || mod.inspect =~/"--urls"/) \ + ? { bool: true } + : { bool: false } + act[:sitemap]=(cmd =~/Y/ \ + || mod.inspect =~/"--sitemap"/) \ + ? { bool: true } + : { bool: false } + act[:qrcode]=(cmd =~/Q/ \ + || mod.inspect =~/"--qrcode"/) \ + ? { bool: true } + : { bool: false } + act[:manifest]=(cmd =~/y/ \ + || mod.inspect =~/"--manifest"/) \ + ? { bool: true } + : { bool: false } + act[:help]=(mod.inspect =~/"--help/) \ + ? { bool: true } + : { bool: false } @act=act end def cmd -- cgit v1.2.3 From 705ccf77b4b61dca16137ada741d1765a52ca573 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:16:23 -0400 Subject: v3: hub (affecting options +others) sisupod processing (v2 enabled) --- lib/sisu/v3/options.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sisu/v3/options.rb') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 66866dc3..eeca31ec 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -201,9 +201,9 @@ module SiSU_commandline if x =~/^--\S+/ m << x end - elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.txz|sisupod(\.txz)?)$/ + elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/ if x =~/^(?:https?|file):\/\/\S+/ \ - or x =~/\S+?\.ss[mt]\.txz|sisupod\.txz/ \ + or x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ \ && FileTest.file?(x) x=x.gsub(/^file:\/\//,'') f << x -- cgit v1.2.3