From 6c38bed1a20b7840a4c8fd9f437229f87b116ffe Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Sun, 6 May 2012 23:55:42 -0400
Subject: v3: hub, options, fixes: dbi: pgsql, sqlite

---
 lib/sisu/v3/db_select.rb |  6 +++---
 lib/sisu/v3/hub.rb       | 18 ++++++++++++++++--
 lib/sisu/v3/options.rb   |  4 ++--
 3 files changed, 21 insertions(+), 7 deletions(-)

(limited to 'lib')

diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb
index ec6c91dc..2d32310d 100644
--- a/lib/sisu/v3/db_select.rb
+++ b/lib/sisu/v3/db_select.rb
@@ -198,9 +198,9 @@ module SiSU_DbSelect
         when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/
         when /^--(?:v\d+|dev)$/
         else
-          help=SiSU_Help::Help.new
-          help.summary
-          help.commands
+          #help=SiSU_Help::Help.new
+          #help.summary
+          #help.commands
         end
         if @opt.cmd =~/M/ \
         and @opt.cmd  =~/d/
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index 34e6e69f..1e86db71 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -620,10 +620,24 @@ p "#{__LINE__}:#{__FILE__}" if @opt =~/M/
             end
           end
           if @opt.act[:psql][:bool]                                              #% --pg, -D DB postgresql
-            op('dbi','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
           if @opt.act[:sqlite][:bool]                                            #% --sqlite, -d DB sqlite
-            op('dbi','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
           end
           if @opt.act[:manifest][:bool]                                          #% --manifest, -y
             OptionLoopFiles.new(@opt).manifest_on_files_translated do
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index 0af13902..82306079 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -675,13 +675,13 @@ module SiSU_Commandline
       : { bool: false, set: :na }
       act[:sqlite]=(cmd =~/d/ \
       || mod.inspect =~/"--sqlite"/) \
-      && (mod.inspect =~/"--createdb"|"--create"|"--recreate"|"--dropall"|"--recreate"|"--import"|"--update"|"--remove"/) \
+      && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
       ? { bool: true, set: :on }
       : { bool: false, set: :na }
       act[:sqlite_discreet]=(cmd =~/d/ \
       || mod.inspect =~/"--sql"|"--sqlite"/) \
       && (mod.inspect =~/"--both"/ \
-      || mod.inspect !~/"--createdb"|"--create"|"--recreate"|"--dropall"|"--recreate"|"--import"|"--update"|"--remove"/) \
+      || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
       ? { bool: true, set: :on }
       : { bool: false, set: :na }
       act[:harvest]=(mod.inspect =~/"--harvest"/) \
-- 
cgit v1.2.3