aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3dv/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3dv/sysenv.rb')
-rw-r--r--lib/sisu/v3dv/sysenv.rb276
1 files changed, 171 insertions, 105 deletions
diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb
index 95ebf6d9..4383a893 100644
--- a/lib/sisu/v3dv/sysenv.rb
+++ b/lib/sisu/v3dv/sysenv.rb
@@ -2733,7 +2733,7 @@ WOK
and not (@rc['flag']['default'].nil? \
or @rc['flag']['default'].empty?)
@rc['flag']['default']
- else '-NQhewpotbxXyYv'
+ else '-NQhewpotbxXdyYv'
end
end
def cf_1 #processing flag shortcuts
@@ -2749,7 +2749,7 @@ WOK
and not (@rc['flag']['ii'].nil? \
or @rc['flag']['ii'].empty?)
@rc['flag']['ii']
- else '-NQhewpotbxXy'
+ else '-NQhewpotbxXdy'
end
end
def cf_3 #processing flag shortcuts
@@ -2757,7 +2757,7 @@ WOK
and not (@rc['flag']['iii'].nil? \
or @rc['flag']['iii'].empty?)
@rc['flag']['iii']
- else '-NQhewpotbxXyY'
+ else '-NQhewpotbxXdyY'
end
end
def cf_4 #processing flag shortcuts
@@ -2765,7 +2765,7 @@ WOK
and not (@rc['flag']['iv'].nil? \
or @rc['flag']['iv'].empty?)
@rc['flag']['iv']
- else '-NQhewpotbxXDyY --update'
+ else '-NQhewpotbxXdDyY --update'
end
end
def cf_5 #processing flag shortcuts
@@ -2773,7 +2773,7 @@ WOK
and not (@rc['flag']['v'].nil? \
or @rc['flag']['v'].empty?)
@rc['flag']['v']
- else '-NQhewpotbxXDyYv --update'
+ else '-NQhewpotbxXdDyYv --update'
end
end
end
@@ -3795,6 +3795,134 @@ WOK
self
end
end
+ class InfoDb < InfoEnv
+ @@rc=nil
+ def initialize
+ @@pwd ||=Dir.pwd
+ @pwd=Dir.pwd
+ @env=SiSU_Env::InfoEnv.new
+ pt=Pathname.new(@pwd)
+ r=Px[:lng_lst].join('|')
+ u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
+ @pwd_stub=pt.realpath.to_s[u,1]
+ @rc=@@rc ||=GetInit.instance.sisu_yaml.rc
+ @defaults=SiSU_Env::InfoEnv.new.defaults
+ end
+ def share_source?
+ ((defined? @rc['db']['share_source']) \
+ && @rc['db']['share_source']==true) \
+ ? @rc['db']['share_source']
+ : false
+ end
+ def engine
+ def default
+ ((defined? @rc['db']['engine']['default']) \
+ && @rc['db']['engine']['default']=~/postgresql|sqlite/) \
+ ? @rc['db']['engine']['default']
+ : 'sqlite'
+ end
+ self
+ end
+ def psql
+ def user
+ ((defined? @rc['db']['postgresql']['user']) \
+ && @rc['db']['postgresql']['user']=~/\S+/) \
+ ? @rc['db']['postgresql']['user']
+ : @env.user
+ end
+ def db #db_name
+ "#{Db[:name_prefix]}#{@pwd_stub}"
+ end
+ def port #PGPORT
+ ((defined? @rc['db']['postgresql']['port']) \
+ && ( @rc['db']['postgresql']['port'] =~/\d+/ \
+ || @rc['db']['postgresql']['port'].class==Fixnum)) \
+ ? @rc['db']['postgresql']['port']
+ : (@defaults[:postgresql_port])
+ end
+ def password
+ ((defined? @rc['db']['postgresql']['password']) \
+ && @rc['db']['postgresql']['password']=~/\S+/) \
+ ? @rc['db']['postgresql']['password']
+ : ''
+ end
+ def host
+ ((defined? @rc['db']['postgresql']['host']) \
+ && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
+ ? @rc['db']['postgresql']['host']
+ : ''
+ end
+ def dbi
+ (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
+ ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}"
+ : "DBI:Pg:database=#{psql.db};port=#{psql.port}"
+ end
+ def conn_dbi
+ DBI.connect(psql.dbi,psql.user,psql.db)
+ end
+ self
+ end
+ def mysql
+ def db
+ #"#{Db[:name_prefix]}#{@pwd_stub}"
+ end
+ def port
+ '**'
+ end
+ def dbi
+ "dbi:Mysql:database=#{mysql.db};port=#{mysql.port}"
+ end
+ self
+ end
+ def sqlite
+ def db
+ "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
+ end
+ def db_discreet(md)
+ # "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
+ end
+ def dbi
+ "DBI:SQLite3:#{sqlite.db}" #sqlite3 ?
+ end
+ def sqlite3
+ sqlite.db #sqlite3 ?
+ end
+ def conn_dbi
+ DBI.connect(sqlite.dbi)
+ end
+ def conn_sqlite3
+ SQLite3::Database.new(sqlite.sqlite3)
+ end
+ self
+ end
+ end
+ class DbOp <InfoDb
+ def initialize(md)
+ begin
+ @md=md
+ rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
+ ensure
+ end
+ end
+ def sqlite_discreet
+ def db
+ "#{@md.file.output_path.sqlite_discreet.dir}/#{@md.file.base_filename.sqlite_discreet}"
+ end
+ def dbi
+ "DBI:SQLite3:#{sqlite_discreet.db}"
+ end
+ def sqlite3
+ sqlite_discreet.db
+ end
+ def conn_dbi
+ DBI.connect(sqlite_discreet.dbi)
+ end
+ def conn_sqlite3
+ SQLite3::Database.new(sqlite_discreet.sqlite3)
+ end
+ self
+ end
+ end
class FileOp <InfoFile #todo unify with CreateFile
def initialize(md,fno='')
begin
@@ -4055,6 +4183,15 @@ WOK
end
self
end
+ def sqlite_discreet
+ def dir
+ output_path.sqlite_discreet.dir + '/' + base_filename.sqlite_discreet
+ end
+ def rel
+ output_path.sqlite_discreet.rel + '/' + base_filename.sqlite_discreet
+ end
+ self
+ end
def hash_digest
def dir
output_path.hash_digest.dir + '/' + base_filename.hash_digest
@@ -4345,6 +4482,14 @@ WOK
@md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
end
end
+ def sqlite_discreet
+ ft='.sql.db'
+ if output_dir_structure.by_language_code?
+ @md.fnb + ft
+ else
+ @md.fnb + @md.lang_code_insert + ft
+ end
+ end
def hash_digest
ft='.txt'
if output_dir_structure.by_language_code?
@@ -5002,6 +5147,27 @@ WOK
end
self
end
+ def sqlite_discreet
+ def ft
+ 'sql'
+ end
+ def dir
+ set_path(ft).dir.ab
+ end
+ def url
+ set_path(ft).url.ab
+ end
+ def rel
+ set_path(ft).rel.ab
+ end
+ def rcp
+ set_path(ft).rcp.ab
+ end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
+ self
+ end
def hash_digest
def ft
'hashes'
@@ -5339,106 +5505,6 @@ WOK
@@publisher='SiSU scribe'
end
end
- class InfoDb < InfoEnv
- @@rc=nil
- def initialize
- @@pwd ||=Dir.pwd
- @pwd=Dir.pwd
- @env=SiSU_Env::InfoEnv.new
- #m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- #@pwd_stub=@pwd[m,1]
- pt=Pathname.new(@pwd)
- r=Px[:lng_lst].join('|')
- u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
- @pwd_stub=pt.realpath.to_s[u,1]
- @rc=@@rc ||=GetInit.instance.sisu_yaml.rc
- @defaults=SiSU_Env::InfoEnv.new.defaults
- end
- def share_source?
- ((defined? @rc['db']['share_source']) \
- && @rc['db']['share_source']==true) \
- ? @rc['db']['share_source']
- : false
- end
- def engine
- def default
- ((defined? @rc['db']['engine']['default']) \
- && @rc['db']['engine']['default']=~/postgresql|sqlite/) \
- ? @rc['db']['engine']['default']
- : 'sqlite'
- end
- self
- end
- def psql
- def user
- ((defined? @rc['db']['postgresql']['user']) \
- && @rc['db']['postgresql']['user']=~/\S+/) \
- ? @rc['db']['postgresql']['user']
- : @env.user
- end
- def db #db_name
- "#{Db[:name_prefix]}#{@pwd_stub}"
- end
- def port #PGPORT
- ((defined? @rc['db']['postgresql']['port']) \
- && ( @rc['db']['postgresql']['port'] =~/\d+/ \
- || @rc['db']['postgresql']['port'].class==Fixnum)) \
- ? @rc['db']['postgresql']['port']
- : (@defaults[:postgresql_port])
- end
- def password
- ((defined? @rc['db']['postgresql']['password']) \
- && @rc['db']['postgresql']['password']=~/\S+/) \
- ? @rc['db']['postgresql']['password']
- : ''
- end
- def host
- ((defined? @rc['db']['postgresql']['host']) \
- && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
- ? @rc['db']['postgresql']['host']
- : ''
- end
- def dbi
- (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
- ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}"
- : "DBI:Pg:database=#{psql.db};port=#{psql.port}"
- end
- def conn_dbi
- DBI.connect(psql.dbi,psql.user,psql.db)
- end
- self
- end
- def mysql
- def db
- #"#{Db[:name_prefix]}#{@pwd_stub}"
- end
- def port
- '**'
- end
- def dbi
- "dbi:Mysql:database=#{mysql.db};port=#{mysql.port}"
- end
- self
- end
- def sqlite
- def db
- "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
- end
- def dbi
- "DBI:SQLite3:#{sqlite.db}" #sqlite3 ?
- end
- def sqlite3
- sqlite.db #sqlite3 ?
- end
- def conn_dbi
- DBI.connect(sqlite.dbi)
- end
- def conn_sqlite3
- SQLite3::Database.new(sqlite.sqlite3)
- end
- self
- end
- end
class InfoPort < InfoEnv
def initialize
@env=SiSU_Env::InfoEnv.new