From edd89902036bde18c91031470e19c871a182cf6d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Oct 2013 23:40:45 -0400 Subject: v5: options & downstream, more use of opt.act instead of opt.cmd * opt.act.*.set==:on instead of opt.cmd =~/\S/ --- lib/sisu/v5/db_create.rb | 54 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'lib/sisu/v5/db_create.rb') diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb index e2d1f916..15cf8586 100644 --- a/lib/sisu/v5/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -67,7 +67,7 @@ module SiSU_DbCreate @@dl=nil def initialize(opt,conn,file,sql_type='pg') @opt,@conn,@file,@sql_type=opt,conn,file,sql_type - @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX @comment=(@sql_type=='pg') \ ? (SiSU_DbCreate::Comment.new(@conn,@sql_type)) : nil @@ -84,9 +84,13 @@ module SiSU_DbCreate def create_db @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type=='sqlite') \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Create SQLite db tables in:',%{"#{@file}"}) - : SiSU_Screen::Ansi.new(@opt.cmd,'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) - tell.dark_grey_title_hi if @opt.cmd =~/[vVM]/ + ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create SQLite db tables in:',%{"#{@file}"}) + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + tell.dark_grey_title_hi + end SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub end def output_dir? @@ -97,12 +101,15 @@ module SiSU_DbCreate end def create_table def metadata_and_text - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ currently using sisu dbi module to be populated from document files create tables metadata_and_text data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_metadata_and_text=%{ CREATE TABLE metadata_and_text ( tid BIGINT PRIMARY KEY, @@ -207,11 +214,14 @@ module SiSU_DbCreate @comment.psql.metadata_and_text if @comment end def doc_objects # create doc_objects base - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from documents files create tables doc_objects data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_doc_objects=%{ CREATE TABLE doc_objects ( lid BIGINT PRIMARY KEY, @@ -250,11 +260,14 @@ module SiSU_DbCreate @comment.psql.doc_objects if @comment end def endnotes - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from document files create tables endnotes data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_endnotes=%{ CREATE TABLE endnotes ( nid BIGINT PRIMARY KEY, @@ -273,11 +286,14 @@ module SiSU_DbCreate @comment.psql.endnotes if @comment end def endnotes_asterisk - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from document files create tables endnotes_asterisk data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_endnotes_asterisk=%{ CREATE TABLE endnotes_asterisk ( nid BIGINT PRIMARY KEY, @@ -296,11 +312,14 @@ module SiSU_DbCreate @comment.psql.endnotes_asterisk if @comment end def endnotes_plus - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from document files create tables endnotes_plus data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_endnotes_plus=%{ CREATE TABLE endnotes_plus ( nid BIGINT PRIMARY KEY, @@ -319,12 +338,15 @@ module SiSU_DbCreate @comment.psql.endnotes_plus if @comment end def urls # create doc_objects file links mapping - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ currently using sisu dbi module to be populated from doc_objects files create tables urls data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_urls=%{ CREATE TABLE urls ( metadata_tid BIGINT REFERENCES metadata_and_text, -- cgit v1.2.3