aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/hub.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-10-13 17:46:02 +0100
committerRalph Amissah <ralph@amissah.com>2007-10-13 17:46:02 +0100
commit84666b3df30387047addad97e12d0f4dfeab20b8 (patch)
tree9081bd43fee17b814181b8d225b9a42d402c2e96 /lib/sisu/v0/hub.rb
parentstart version marking interim releases (diff)
remote, (put, get) in single file; embedded content, posted locally and remotely using rsync
Diffstat (limited to 'lib/sisu/v0/hub.rb')
-rw-r--r--lib/sisu/v0/hub.rb77
1 files changed, 16 insertions, 61 deletions
diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb
index 4880807d..db0bb2a2 100644
--- a/lib/sisu/v0/hub.rb
+++ b/lib/sisu/v0/hub.rb
@@ -131,7 +131,7 @@ module SiSU
else
put=fns.gsub(/(.+)?\._sst$/,'\1.ssm')
@opt.fns=fns
- if @req !~/(?:urls|remote_put)$/
+ if @req !~/(?:urls|remote)$/
if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:[_-]?sst|ssm)$/
if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing
SiSU_Assemble::Composite.new(@opt).read
@@ -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
@@ -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
@@ -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