aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/sysenv.rb')
-rw-r--r--lib/sisu/v0/sysenv.rb55
1 files changed, 39 insertions, 16 deletions
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb
index 5d7dc7d8..7e94d8a3 100644
--- a/lib/sisu/v0/sysenv.rb
+++ b/lib/sisu/v0/sysenv.rb
@@ -96,7 +96,7 @@ module SiSU_Env
etc=Config::CONFIG['sysconfdir'] + '/sisu'
share=Config::CONFIG['datadir'] + '/sisu'
data=Config::CONFIG['datadir'] + '/doc/sisu'
- m=/.+\/(\S+)/m
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
@stub_pwd ||=@@pwd[m,1]
prcss_dir='_sisu_processing'
prcss_dir_tmp_root="/tmp/#{prcss_dir}"
@@ -205,7 +205,7 @@ module SiSU_Env
SQLITE_PORT => '**',
}
@@default_dir=DEFAULT_DIR
- m=/.+\/(\S+)/m
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
stub_pwd=@@pwd[m,1]
@@rc_path=["#@@pwd/_sisu","#@@home/.sisu",@@sisu_etc]
@@yamlrc_path=unless stub_pwd =~/^sisupod$/
@@ -610,7 +610,7 @@ module SiSU_Env
def create_pg_db(dbname_stub=nil) #createdb
unless dbname_stub
@pwd ||=Dir.pwd
- m=/.+\/(\S+)/im
+ m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
dbname_stub=@pwd[m,1]
end
program='createdb'
@@ -803,9 +803,10 @@ module SiSU_Env
@fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters
@fixed_websev_root='' # @home
@pwd=@@pwd||=Dir.pwd
- m=/.+\/(\S+)/m
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
@stub_pwd=@@pwd[m,1]
@stub_src=@stub_pwd + '/src'
+ @stub_pod=@stub_pwd + '/pod'
end
def user
@sys.user
@@ -842,6 +843,9 @@ module SiSU_Env
def stub_src
@stub_src
end
+ def stub_pod
+ @stub_pod
+ end
def sisupod
#path.processing
# sisupod
@@ -1210,6 +1214,9 @@ WOK
def stub_src
@stub_src
end
+ def stub_pod
+ @stub_pod
+ end
def etc
defaults[:sisu_etc] #live/dynamic
# @sys.sisu_etc #broken: live/dynamic
@@ -1304,7 +1311,10 @@ WOK
"#{path.webserv}/#@stub_pwd"
end
def output_src #web/webserv output directory... subdirectory into which further subdirectories are made based on file names
- "#{path.webserv}/src"
+ "#{path.output}/src"
+ end
+ def output_pod
+ "#{path.output}/pod"
end
def manpage
"#{path.output}/man"
@@ -1473,7 +1483,7 @@ WOK
end
def root
if defined? @rc['webserv']['url_root'] \
- and @rc['webserv']['url_root'] =~/https?:\/\//
+ and @rc['webserv']['url_root'] =~/https?:\/\//
"#{@rc['webserv']['url_root']}/#@stub_pwd"
elsif defined? @rc['webserv']['url_root'] \
and @rc['webserv']['url_root'] =~/localhost/
@@ -1484,6 +1494,12 @@ WOK
def remote
root
end
+ def src_txt
+ "#{root}/src"
+ end
+ def src_pod
+ "#{root}/pod"
+ end
def webserv_host_base
if defined? @rc['webserv']['host']
case @rc['webserv']['host']
@@ -2155,6 +2171,7 @@ WOK
@env=SiSU_Env::Info_env.new
end
def zap
+p @zap
if @zap !~/\/\//; rm_rf(@zap) if FileTest.directory?(@zap)
else puts 'suspect zap request, ignored'
end
@@ -2285,6 +2302,7 @@ WOK
#remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
local_src=@source_path_src
remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
+ remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
src_txt=@opt.fnc
src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
if (local_gen =~/\S/ \
@@ -2294,16 +2312,18 @@ WOK
and @@flag_remote==true \
and @opt.cmd !~/U/
System_call.new(local_gen,remote_gen).scp
- if FileTest.file?("#{local_src}/#{src_txt}") \
- or FileTest.file?("#{local_src}/#{src_pod}")
- System_call.new("#{local_src}/#{src_txt} #{local_src}/#{src_pod}",remote_src).scp
+ if FileTest.file?("#{local_src}/#{src_txt}")
+ System_call.new("#{local_src}/#{src_txt}",remote_src).scp
+ elsif FileTest.file?("#{local_pod}/#{src_pod}")
+ System_call.new("#{local_src}/#{src_pod}",remote_pod).scp
end
elsif @opt.cmd =~/U/
puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
puts "#{local_gen} -> #{remote_gen}"
- if FileTest.file?("#{local_src}/#{src_doc}") \
- or FileTest.file?("#{local_src}/#{src_doc}.zip")
+ if FileTest.file?("#{local_src}/#{src_doc}")
puts "#{local_src}/#{src_doc}* -> #{remote_src}"
+ elsif FileTest.file?("#{local_pod}/#{src_doc}.zip")
+ puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
end
else
puts 'suspect scp request, ignored'
@@ -2319,7 +2339,9 @@ WOK
remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
remote_images="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image/."
local_src=@source_path_src
+ local_pod=@source_path_pod
remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/."
+ remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/."
src_txt=@opt.fnc
src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip')
if (local_gen =~/\S/ \
@@ -2329,13 +2351,14 @@ WOK
and @@flag_remote==true \
and @opt.cmd !~/U/
System_call.new(local_gen,remote_gen,@opt.cmd).rsync('--delete-after')
- if FileTest.file?("#{local_src}/#{src_txt}") \
- or FileTest.file?("#{local_src}/#{src_pod}")
- System_call.new("#{local_src}/#{src_txt} #{local_src}/#{src_pod}",remote_src,@opt.cmd).rsync
+ if FileTest.file?("#{local_src}/#{src_txt}")
+ System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync
if defined? @md.ec[:image]
images="#{local_gen_image}/" + @md.ec[:image].join(" #{local_gen_image}/")
System_call.new(images,remote_images,@opt.cmd).rsync
end
+ elsif FileTest.file?("#{local_pod}/#{src_pod}")
+ System_call.new("#{local_pod}/#{src_pod}",remote_src,@opt.cmd).rsync
end
elsif @opt.cmd =~/U/
puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
@@ -2521,7 +2544,7 @@ WOK
@@pwd ||=Dir.pwd
@pwd=Dir.pwd
@env=SiSU_Env::Info_env.new
- m=/.+\/(\S+)/m
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
@pwd_stub=@pwd[m,1]
@rc=@@rc ||=Get_init.instance.yamlrc
@defaults=Info_env.new.defaults
@@ -2583,7 +2606,7 @@ WOK
else nil
end
@home,@pwd=ENV['HOME'],ENV['PWD']
- m=/.+\/(\S+)/m
+ m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
@pwd_stub=@pwd[m,1]
@env=SiSU_Env::Info_env.new
end