aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/hub.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/hub.rb')
-rw-r--r--lib/sisu/v0/hub.rb97
1 files changed, 26 insertions, 71 deletions
diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb
index 4880807d..9fe102e7 100644
--- a/lib/sisu/v0/hub.rb
+++ b/lib/sisu/v0/hub.rb
@@ -129,23 +129,23 @@ module SiSU
pod_output(pod_name)
break
else
- put=fns.gsub(/(.+)?\._sst$/,'\1.ssm')
+ put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
@opt.fns=fns
- if @req !~/(?:urls|remote_put)$/
- if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:[_-]?sst|ssm)$/
+ if @req !~/(?:urls|remote)$/
+ if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing
SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'._sst')
+ @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
end
SiSU_DAL::Source.new(@opt).read # -m
elsif FileTest.file?(env.source_file_with_path)
case @opt.fns
- when /\.(?:[_-]?sst|ssm)$/
+ when /\.(?:(?:-|ssm\.)?sst|ssm)$/
case @req
when /^dal$/
if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing
SiSU_Assemble::Composite.new(@opt).read
- @opt.fns=fns.gsub(/\.ssm$/,'._sst')
+ @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
end
SiSU_DAL::Source.new(@opt).read # -m
when /^concordance$/; SiSU_Concordance::Source.new(@opt).read # -w
@@ -168,6 +168,7 @@ module SiSU
when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x
when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X
when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b
+ when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m (image and other content)
when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y
when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y
when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z
@@ -185,7 +186,7 @@ module SiSU
elsif FileTest.file?(put)
case @req
when /^urls$/; SiSU_urls::Source.new(@opt).read # -u -v -V -M
- when /^remote_put$/
+ when /^remote$/
case @message
when /scp/; SiSU_Remote::Put.new(@opt).scp # -r
when /rsync/; SiSU_Remote::Put.new(@opt).rsync # -R
@@ -195,7 +196,7 @@ module SiSU
@n_do=@n_do+1
tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed")
tell.files_processed unless @opt.cmd =~/q/
- else Operations.new(@opt).not_found
+ else Operations.new(@opt).not_found
end
end
end
@@ -216,22 +217,22 @@ module SiSU
end
def remote_put_base_site_rsync # -CR
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).rsync_base
end
def remote_put_base_site_rsync_match # -CCRZ
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).rsync_base_sync
end
def remote_put_base_site # -Cr
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).scp_base
end
def remote_put_base_site_all # -CCr
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).scp_base_all
end
def cgi # -F
@@ -256,8 +257,6 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
system("sisu_webrick #{port}&\n")
end
- def semantics
- end
def not_found
puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"
end
@@ -393,59 +392,13 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
end
if @get_s.length > 0 #% remote markup file .sst
- require 'open-uri'
- require 'pp'
- require "#{SiSU_lib}/composite"
- @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_skin=/^0~skin\s+(\S+)/
- threads=[]
- for requested_page in @get_s
- threads << Thread.new(requested_page) do |url|
- open(url) do |f|
- raise "#{url} not found" unless f
- re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO
- base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb
- imagedir= base_uri + '/_sisu/image_local' #check on
- doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc'
- #"Got file, and ready to process: #{fnb}.t#{instr}"
- downloaded_file=File.new("#{fnb}.-sst",'w+')
- images=SiSU_Assemble::Remote_image.new.image(imagedir)
- skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir)
- f.collect.each do |r| # work area
- skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin
- images << r.scan(@rgx_image).uniq if r =~@rgx_image
- downloaded_file << r
- end
- if skin and skin.length > 0
- SiSU_Assemble::Remote_image.new.download_doc_skin(skin)
- end
- if images and images.length > 1
- images.flatten!.uniq!
- @msg,@msgs='downloading images:', [ images.join(',') ]
- @tell.call.warn unless @opt.cmd =~/q/
- SiSU_Assemble::Remote_image.new.download_images(images)
- @msg,@msgs='downloading done',nil
- @tell.call.warn unless @opt.cmd =~/q/
- end
- downloaded_file.close
- end
- end
- end
+ require "#{SiSU_lib}/remote"
+ SiSU_Remote::Get.new(@opt,@get_s).fns
Operations.new.counter
end
- threads.each {|thr| thr.join} if threads #and threads.length > 0
if @get_p.length > 0 #% remote sisupod
- require 'net/http'
- for requested_pod in @get_p
- pod_info=Remote_download.new(requested_pod)
- @opt.fns=pod_info.pod.name
- Net::HTTP.start(pod_info.pod.site) do |http|
- resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}")
- open(pod_info.pod.name,'wb') do |file|
- file.write(resp.body)
- end
- end
- end
+ require "#{SiSU_lib}/remote"
+ SiSU_Remote::Get.new(@opt,@get_p).sisupod
end
rescue; SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok
@retry_count +=1
@@ -456,7 +409,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
if @opt.cmd=~/m/; op('dal','dal') #% -m dal
end
- @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'._sst') }
+ @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }
if @opt.cmd =~/S/
op('sisupod_make','sisupod (zip)') #% -S make sisupod
if @opt.fns=~/\.kdi._sst/
@@ -494,7 +447,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
when /\.(termsheet.rb)$/; Operations.new(@opt).termsheet
else #print "not processed --> ", fns, "\n"
end
- else Operations.new(@opt).not_found
+ else Operations.new(@opt).not_found
end
end
Operations.new.counter
@@ -517,13 +470,15 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
if @opt.cmd =~/G/; Operations.new(@opt).cgi #% -G cgi - used to make dbi intecface
end
+ if @opt.cmd=~/m/; op('embedded','Embedded Content') #% -m embedded content
+ end
if @opt.cmd =~/y/; op('manifest','Manifest') #% -y manifest
end
if @opt.cmd =~/Y/; op('sitemaps','Sitemap') #% -Y sitemap
end
- if @opt.cmd =~/r/; op('remote_put','scp') #% -r copy to remote server
+ if @opt.cmd =~/r/; op('remote','scp') #% -r copy to remote server
end
- if @opt.cmd =~/R/; op('remote_put','rsync') #% -R copy to remote server
+ if @opt.cmd =~/R/; op('remote','rsync') #% -R copy to remote server
end
if @opt.cmd =~/[QuUvVM]/; op('urls','urls') #% -Q -u -v -V -M urls
end
@@ -547,7 +502,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
require "#{SiSU_lib}/sitemaps"
SiSU_Sitemaps::Source.new(@opt).read
if @opt.cmd =~/R/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).rsync_sitemaps
end
else #% help instructions
@@ -562,14 +517,14 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
@opt.files.each do |fns|
if FileTest.file?(fns)
@opt.fns=fns
- unless @opt.fns =~ /(?:\.(?:[_-]?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|sisupod(?:\.zip)?)$/
+ unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|sisupod(?:\.zip)?)$/
if @opt.fns=~/\.kdi$/ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/
elsif @opt.fns=~/\.sx[sdn]\.xml$/ and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
elsif @opt.fns=~/\.ssi$/ and @opt.mod.inspect =~/--identify/
else Operations.new(@opt).not_recognised
end
end
- if @opt.fns =~/\._sst$/ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
+ if @opt.fns =~/\.ssm\.sst$/ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
@msg,@msgs='temporary file removed',nil
@tell.call.warn unless @opt.cmd =~/V/
File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER