aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/dbi.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-08-20 19:04:47 -0400
committerRalph Amissah <ralph@amissah.com>2014-08-20 19:04:47 -0400
commit29fc7f3c14b36770caad64cb82ec9177384ab61a (patch)
treec2079e8bf5d2944d7bc10b55c1b3fb76dcb07cc0 /lib/sisu/v5/dbi.rb
parentv5 v6: hub options, introduce "error override" --no-stop or --errors-as-warnings (diff)
v5 v6: start making use of --no-stop command
Diffstat (limited to 'lib/sisu/v5/dbi.rb')
-rw-r--r--lib/sisu/v5/dbi.rb25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb
index 8e27f443..df4b3180 100644
--- a/lib/sisu/v5/dbi.rb
+++ b/lib/sisu/v5/dbi.rb
@@ -102,7 +102,12 @@ module SiSU_DBI
end
def read_psql
begin
- require 'pg'
+ begin
+ require 'pg'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pg NOT FOUND (LoadError)')
+ end
@conn=@db.psql.conn_pg
rescue
if @opt.act[:psql_create][:set]==:on
@@ -119,11 +124,23 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet
def read_sqlite
begin
begin
- require 'sqlite3'
+ begin
+ require 'sqlite3'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('sqlite3 NOT FOUND (LoadError)')
+ end
@conn=@db.sqlite.conn_sqlite3
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
- error('sqlite3 NOT FOUND (LoadError)')
+ errmsg='sqlite3 NOT FOUND (LoadError)'
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error(errmsg + ', ' + 'attempt to proceed without sqlite output (as requested)')
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error(errmsg + ', ' + 'STOPPING')
+ exit
+ end
end
end
end