Class: SiSU_Info_Remote::InfoRemote

Inherits:
SiSU_File_Map::FileMap show all
Defined in:
lib/sisu/se_remotes.rb

Overview

se_filemap.rb

Direct Known Subclasses

SiSU_Env::InfoRemote

Constant Summary collapse

@@flag_remote =
false

Instance Attribute Summary

Attributes inherited from SiSU_File_Map::FileMap

#local_sisu_source

Attributes inherited from SiSU_Info_Env::InfoEnv

#base_markup_dir_stub, #env, #etc, #filename, #flv, #fnb, #fnn, #fnt, #home, #hostname, #processing, #processing_git, #rc, #stub_pwd, #stub_src, #sys, #user, #webserv_host_cgi, #webserv_path, #webserv_port_cgi, #www, #yamlrc_dir

Attributes inherited from SiSU_Env_Call::EnvCall

#ad, #fnb, #fnn, #fnt, #fnv, #fnz, #rc

Instance Method Summary collapse

Methods inherited from SiSU_Info_Env::InfoEnv

#ao, #arch, #asciidoc_ocn?, #bin, #build, #cgi, #cgi_sample_search_form_name, #cjk, #cjk_ja, #cjk_ko, #cjk_zh, #composite_file, #concord_max, #console_web_browser, #console_www_browser, #current_document, #defaults, #digest, #digest_conf?, #dir_url, #docbook_viewer, #encoding, #epub, #epub_bld, #epub_cp_images, #epub_viewer, #feed, #feed_home, #fictionbook_viewer, #file_encoding, #font, #git, #host, #html, #html_minitoc?, #html_navigation?, #html_navigation_bar?, #html_quick_ref?, #html_right_pane?, #html_scroll_1, #html_scroll_2, #html_search_form?, #html_seg_1, #html_seg_2, #html_seg_title_banner?, #html_top_band?, #i18n, #image_external, #image_source, #image_source_include, #image_source_include_local, #image_source_include_remote, #image_source_sisu_includes, #images, #images_epub, #images_external, #images_local, #landscape, #lang_filename, #language, #language_default_set, #length, #links_to_manifest?, #listed?, #local, #locale, #localhost, #lout, #main, #make, #man, #manifest?, #manifest_minitoc?, #manpage, #manpage_generator, #manpage_viewer, #markdown_ocn?, #markup_emphasis, #metadata?, #minitoc?, #mono, #ocn?, #odf, #odf_pth, #odf_viewer, #odt, #odt_bld, #odt_ocn?, #omit_list, #orgmode_ocn?, #output, #output_tell, #papersize, #path, #path_rel_links, #paths, #pattern, #pdf, #pdf_viewer, #pdflatex, #php, #plaintext_ocn?, #plaintext_wrap, #po, #port, #portrait, #postgresql, #pot, #processing_base_tmp, #processing_path, #processing_sisupod, #program, #promo?, #pwd, #rbver, #read_source_file, #read_source_file_array, #read_source_file_string, #remote, #rexml, #rmagick, #root, #root_dir, #rst_ocn?, #sample_data, #sample_search_form_title, #sans, #scripts, #search?, #search_action, #search_fixed?, #search_form, #search_form?, #search_form_static, #segsubtoc?, #serif, #share, #sisupod_gen, #sisupod_gen_v2, #sisupod_gen_v3, #sisupod_v2, #sisupod_v3, #sisupod_v4, #sisurc_path, #sitearch, #size, #source_file_path, #source_file_processing_array, #source_file_with_path, #sql, #sqlite, #src_pod, #src_txt, #stub_dir, #stub_dir_orig, #stub_epub, #stub_md_harvest, #stub_pod, #style, #tex, #texi, #texinfo, #texpdf, #texpdf_hyperlinks, #text_editor, #textile_ocn?, #tidy, #tmp_root_dir, #toc?, #tune, #txt, #type, #url, #usr_dir?, #wc, #web_browser, #webrick, #webrick_port, #webserv, #webserv_base, #webserv_base_cgi, #webserv_cgi, #webserv_dir, #webserv_files_from_db, #webserv_host_base, #webserv_image, #webserv_map_pwd, #webserv_stub_ensure, #widget, #widget_static, #www_browser, #xml_docbook_ocn?, #xml_editor, #xml_fictionbook_ocn?, #xml_scaffold_ocn?, #xml_viewer, #yamlrc

Methods inherited from SiSU_Env_Call::EnvCall

#by?, #by_filename?, #by_filetype?, #by_language_code?, #default_language?, #document_language_versions_found, #dump?, #filename, #lang, #mono_multi_lingual?, #multilingual?, #output_dir_structure, #published_manifests?, #redirect?

Constructor Details

#initialize(opt) ⇒ InfoRemote

Returns a new instance of InfoRemote.



158
159
160
161
162
# File 'lib/sisu/se_remotes.rb', line 158

def initialize(opt)
  super(opt) #
  @opt=opt
  @rc=GetInit.new.sisu_yaml.rc
end

Instance Method Details

#documentObject



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/sisu/se_remotes.rb', line 173

def document
  self.remote_host_base.each do |remote_conn|
    local_gen=@source_path
    remote_gen=case @opt.cmd
    when /u/
      remote_conn[:name] + '/' \
        + @env.path.base_markup_dir_stub + '/.'             #creates remote directory tree, this is not the usual function of u
    when /[abhHNopwxXy]/
      remote_conn[:name] + '/' \
        + @env.path.base_markup_dir_stub + '/' \
        + @fnb + '/.'
    else
      remote_conn[:name] + '/' \
        + @env.path.base_markup_dir_stub \
        + '/.'
    end
    local_epub=@source_path_epub
    local_src=@source_path_src
    local_pod=@source_path_pod
    remote_epub=
      remote_conn[:name] + '/' + @env.path.stub_epub + '/.'
    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.txz')
    if (local_gen =~/\S/ \
    and local_gen !~/\/\//) \
    and (remote_gen =~/\S/ \
    and remote_gen !~/\/\//) \
    and @@flag_remote==true \
    and @opt.cmd !~/U/
      SiSU_Env::SystemCall.new(local_gen,remote_gen).scp
      if FileTest.file?("#{local_src}/#{src_txt}")
        SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp
      end
      if FileTest.file?("#{local_pod}/#{src_pod}")
        SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp
      end
      if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub")
        SiSU_Env::SystemCall.new(
          "#{local_epub}/#{@opt.fnb}.epub",
          remote_epub,@opt.cmd
        ).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}")
        puts "#{local_src}/#{src_doc}* -> #{remote_src}"
      end
      if FileTest.file?("#{local_pod}/#{src_doc}.txz")
        puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
      end
    else
      puts 'suspect scp request, ignored'
      puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
      puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
    end
  end
end

#remote_host_baseObject



166
167
168
169
170
171
# File 'lib/sisu/se_remotes.rb', line 166

def remote_host_base
  remote_host_base_general.each do |remote_conn|
    @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/
  end
  remote_host_base_general
end

#remote_host_base_generalObject



163
164
165
# File 'lib/sisu/se_remotes.rb', line 163

def remote_host_base_general
  SiSU_Env::InfoRemoteHost.new.remote_host
end

#rsyncObject



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/sisu/se_remotes.rb', line 281

def rsync
  def document
    f=(@opt.act[:ao][:set]==:on) \
    ? SiSU_Env::FileOp.new(@md)
    : nil
    if f
      self.remote_host_base.each do |remote_conn|
        local_gen=@source_path
        #local_gen_image="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image"
        #local_gen_image_external="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external"
        remote_gen=
          remote_conn[:name] + '/' \
            + @env.path.base_markup_dir_stub + '/.'
        remote_rel=
          remote_conn[:name] + '/' \
            + f.output_path.stub.rcp
        @opt.fnc
        if (local_gen =~/\S/ \
        and local_gen !~/\/\//) \
        and (remote_gen =~/\S/ \
        and remote_gen !~/\/\//) \
        and @@flag_remote==true \
        and @opt.cmd !~/U/
#             SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync
          #delete_extra_files='--delete' # '--delete-after'
          inp=[]
          if (@opt.act[:html][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.html_scroll.dir)
            inp \
              << f.output_path.html_seg.rel \
              << f.place_file.html_scroll.rel
          end
          if (@opt.act[:concordance][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.html_concordance.dir)
            inp << f.place_file.html_concordance.rel
          end
          if (@opt.act[:epub][:set]==:on \
          || @opt.cmd =~/^-R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.epub.dir)
            inp << f.place_file.epub.rel
          end
          if (@opt.act[:odt][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.odt.dir)
            inp << f.place_file.odt.rel
          end
          if (@opt.act[:xhtml][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.xhtml.dir)
            inp << f.place_file.xhtml.rel
          end
          if (@opt.act[:xml_sax][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.xml_sax.dir)
            inp << f.place_file.xml_sax.rel
          end
          if (@opt.act[:xml_dom][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.xml_dom.dir)
            inp << f.place_file.xml_dom.rel
          end
          if (@opt.act[:xml_scaffold_structure_sisu][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.xml_scaffold_structure_sisu.dir)
            inp << f.place_file.xml_scaffold_structure_sisu.rel
          end
          if (@opt.act[:xml_scaffold_structure_collapse][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.xml_scaffold_structure_collapse.dir)
            inp << f.place_file.xml_scaffold_structure_collapse.rel
          end
          if (@opt.act[:txt][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.txt.dir)
            inp << f.place_file.txt.rel
          end
          if (@opt.act[:manpage][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \
          && FileTest.file?(f.place_file.manpage.dir)
            inp << f.place_file.manpage.rel
          end
          if (@opt.act[:texinfo][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \
          && FileTest.file?(f.place_file.info.dir)
            inp << f.place_file.info.rel
          end
          if (@opt.act[:hash_digests][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.hash_digest.dir)
            inp << f.place_file.hash_digest.rel
          end
          if (@opt.act[:share_source][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.src.dir)
            inp << f.place_file.src.rel
          end
          if (@opt.act[:sisupod][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.sisupod.dir)
            inp << f.place_file.sisupod.rel
          end
          if (@opt.act[:pdf][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/)
            inp <<=(@opt.dir_structure_by == :filename) \
            ? (f.output_path.pdf.rel + '/*.pdf')
            : (f.output_path.pdf.rel + '/' + @opt.fnb + '*.pdf')
          end
          if (@opt.act[:sqlite_discrete][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.sqlite_discrete.dir)
            inp << f.place_file.sqlite_discrete.rel
          end
          if (@opt.act[:qrcode][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.qrcode_md.dir)
            inp \
              << f.place_file.qrcode_md.rel \
              << f.place_file.qrcode_title.rel
          end
          if (@opt.act[:manifest][:set]==:on \
          || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
          && FileTest.file?(f.place_file.manifest.dir)
            inp << f.place_file.manifest.rel
          end
          local_gen=if inp.length > 0
            inp.join(' ')
          else ''
          end
          local_css,images,images_system='','',''
          images=images_skin=images_system=local_css=''
          if @opt.cmd =~/[hwbxX]/ \
          && (defined? @md.ec[:image]) \
          && (@md.ec[:image].length > 0)
            images=
              f.place_file.images.rel + '/' \
                + @md.ec[:image].join(" #{f.output_path.images.rel}/")
          end
          if @opt.cmd =~/[yhwbxX]/ \
          && (defined? @md.ec[:image]) \
          && (@md.ec[:image].length > 0)
            local_css=f.output_path.css.rel
            images_system='_sisu/image_sys'
          end
          begin
            ##create file structure without copying files?:
            ##rsync -av -f"+ */" -f"- *" f.output_path.base.dir remote:./path/.
            #local_dirs=%{-f"+ */" -f"- *" #{f.output_path.base.dir}/*}
            #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync
            local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css
            SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).
              rsync('--relative',f.output_path.base.dir)
          rescue
            p __LINE__.to_s + ':' + __FILE__
            local_dirs=%{--include='*/' --exclude='*' #{f.output_path.base.dir}}
            SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync
          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}.txz")
            puts "#{local_src}/#{src_doc}* -> #{remote_src}"
          end
        else
          puts 'suspect rsync request, ignored'
          puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
          puts "permission not granted #{__FILE__} #{__LINE__}" \
            if @opt.cmd =~/M/
        end
      end
    end
  end
  def site_harvest
    self.remote_host_base.each do |remote_conn|
      local=@source_path_harvest
      l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}"
      lng='en'
      if @env.output_dir_structure.by? == :language
        ldest=lng + '/manifest'
        files=
          ldest + '/authors.html' + ' ' \
            + ldest + '/topics.html'
      elsif @env.output_dir_structure.by? == :filetype
        ldest="manifest"
        files=
          ldest + '/authors.' + lng + '.html' + ' ' \
            + ldest + '/topics.' + lng + '.html'
      elsif @env.output_dir_structure.by? == :filename
        files=
          l_rel + '/authors.' + lng + '.html' + ' ' \
            + l_rel + '/topics.' + lng + '.html'
      end
      remote="#{remote_conn[:name]}/#{@opt.base_stub}"
      if @opt.act[:harvest][:set] \
      && @opt.act[:rsync][:set]
        (@env.output_dir_structure.by? == :filename) \
        ? (SiSU_Env::SystemCall.new(files,remote).rsync)
        : (SiSU_Env::SystemCall.new(ldest,remote).
            rsync('--relative',l_rel))
      elsif @opt.cmd =~/U/
        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
        puts "rsync_harvest: #{local} -> #{remote}"
      else
        puts "permission not granted #{__FILE__} #{__LINE__}" \
          if @opt.cmd =~/M/
      end
    end
  end
  def site_base                    #base site
    ldest='_sisu/*'
    l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}"
    image_sys="#{@env.path.webserv}/_sisu/image_sys"
    self.remote_host_base.each do |remote_conn|
      remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}"
      remote_conf="#{remote_conn[:name]}/_sisu"
        SiSU_Env::SystemCall.new(image_sys,remote_conf).rsync
        SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel)
    end
  end
  def site_base_sync
    self.remote_host_base.each do |remote_conn|
      local=@source_path
      remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/."
      if defined? @rc['permission_set']['remote_base_site'] \
      and @rc['permission_set']['remote_base_site'] \
      and @@flag_remote==true \
      and @opt.cmd !~/U/
        delete_extra_files='--delete' # '--delete-after'
        puts "begin rsync_base_sync: #{local} -> #{remote}"
        SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).
          rsync(delete_extra_files)
        SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).
          rsync(delete_extra_files)
        SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).
          rsync(delete_extra_files)
      elsif @opt.cmd =~/U/
        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
        puts "rsync_base_sync: #{local} -> #{remote}"
        puts "#{local}/_sisu/image_sys/ -> #{remote}"
        puts "#{local}/_sisu/image/ -> #{remote}"
        puts "#{local}/#{@env.path.style}/ -> #{remote}"
      else
        puts "permission not granted #{__FILE__} #{__LINE__}" \
          if @opt.cmd =~/M/
      end
    end
  end
  self
end

#rsync_sitemapsObject

sitemap directory



532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/sisu/se_remotes.rb', line 532

def rsync_sitemaps                 #sitemap directory
  self.remote_host_base.each do |remote_conn|
    local=
      @source_path + '/sitemapindex.xml'
    remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/."
    if @@flag_remote
      delete_extra_files='--delete' # '--delete-after'
      SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files)
    elsif @opt.cmd =~/U/
      puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
      puts "rsync_sitemaps: #{local} -> #{remote}"
    else
      puts "permission not granted #{__FILE__} #{__LINE__}" \
        if @opt.cmd =~/M/
    end
  end
end

#scpObject

sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/sisu/se_remotes.rb', line 172

def scp                            #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built
  def document
    self.remote_host_base.each do |remote_conn|
      local_gen=@source_path
      remote_gen=case @opt.cmd
      when /u/
        remote_conn[:name] + '/' \
          + @env.path.base_markup_dir_stub + '/.'             #creates remote directory tree, this is not the usual function of u
      when /[abhHNopwxXy]/
        remote_conn[:name] + '/' \
          + @env.path.base_markup_dir_stub + '/' \
          + @fnb + '/.'
      else
        remote_conn[:name] + '/' \
          + @env.path.base_markup_dir_stub \
          + '/.'
      end
      local_epub=@source_path_epub
      local_src=@source_path_src
      local_pod=@source_path_pod
      remote_epub=
        remote_conn[:name] + '/' + @env.path.stub_epub + '/.'
      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.txz')
      if (local_gen =~/\S/ \
      and local_gen !~/\/\//) \
      and (remote_gen =~/\S/ \
      and remote_gen !~/\/\//) \
      and @@flag_remote==true \
      and @opt.cmd !~/U/
        SiSU_Env::SystemCall.new(local_gen,remote_gen).scp
        if FileTest.file?("#{local_src}/#{src_txt}")
          SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp
        end
        if FileTest.file?("#{local_pod}/#{src_pod}")
          SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp
        end
        if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub")
          SiSU_Env::SystemCall.new(
            "#{local_epub}/#{@opt.fnb}.epub",
            remote_epub,@opt.cmd
          ).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}")
          puts "#{local_src}/#{src_doc}* -> #{remote_src}"
        end
        if FileTest.file?("#{local_pod}/#{src_doc}.txz")
          puts "#{local_pod}/#{src_doc}* -> #{remote_pod}"
        end
      else
        puts 'suspect scp request, ignored'
        puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}"
        puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
      end
    end
  end
  def site_base                    #base site
    self.remote_host_base.each do |remote_conn|
      local=@source_path
      remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/."
      if defined? @rc['permission_set']['remote_base_site'] \
      and @rc['permission_set']['remote_base_site'] \
      and @@flag_remote==true \
      and @opt.cmd !~/U/
        puts "begin scp_base: #{local} -> #{remote}"
        SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp
      elsif @opt.cmd =~/U/
        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
        puts "begin scp_base: #{local} -> #{remote}"
        puts "#{local}/#{@env.path.style}/ -> #{remote}"
      else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
      end
    end
  end
  def site_base_all                #base site
    self.remote_host_base.each do |remote_conn|
      local=@source_path
      remote=
        remote_conn[:name] + '/' \
          + @env.path.base_markup_dir_stub + '/.'
      if defined? @rc['permission_set']['remote_base_site'] \
      and @rc['permission_set']['remote_base_site'] \
      and @@flag_remote==true \
      and @opt.cmd !~/U/
        puts "begin scp_base_all: #{local} -> #{remote}"
        SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp
        SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp
        SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp
      elsif @opt.cmd =~/U/
        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
        puts "scp_base_all: #{local} -> #{remote}"
        puts "#{local}/_sisu/image_sys/ -> #{remote}"
        puts "#{local}/_sisu/image/ -> #{remote}"
        puts "#{local}/#{@env.path.style}/ -> #{remote}"
      else
        puts "permission not granted #{__FILE__} #{__LINE__}" \
          if @opt.cmd =~/M/
      end
    end
  end
  self
end

#site_baseObject

base site



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/sisu/se_remotes.rb', line 235

def site_base                    #base site
  self.remote_host_base.each do |remote_conn|
    local=@source_path
    remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/."
    if defined? @rc['permission_set']['remote_base_site'] \
    and @rc['permission_set']['remote_base_site'] \
    and @@flag_remote==true \
    and @opt.cmd !~/U/
      puts "begin scp_base: #{local} -> #{remote}"
      SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp
    elsif @opt.cmd =~/U/
      puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
      puts "begin scp_base: #{local} -> #{remote}"
      puts "#{local}/#{@env.path.style}/ -> #{remote}"
    else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
    end
  end
end

#site_base_allObject

base site



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/sisu/se_remotes.rb', line 253

def site_base_all                #base site
  self.remote_host_base.each do |remote_conn|
    local=@source_path
    remote=
      remote_conn[:name] + '/' \
        + @env.path.base_markup_dir_stub + '/.'
    if defined? @rc['permission_set']['remote_base_site'] \
    and @rc['permission_set']['remote_base_site'] \
    and @@flag_remote==true \
    and @opt.cmd !~/U/
      puts "begin scp_base_all: #{local} -> #{remote}"
      SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp
      SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp
      SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp
    elsif @opt.cmd =~/U/
      puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
      puts "scp_base_all: #{local} -> #{remote}"
      puts "#{local}/_sisu/image_sys/ -> #{remote}"
      puts "#{local}/_sisu/image/ -> #{remote}"
      puts "#{local}/#{@env.path.style}/ -> #{remote}"
    else
      puts "permission not granted #{__FILE__} #{__LINE__}" \
        if @opt.cmd =~/M/
    end
  end
end

#site_base_syncObject



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/sisu/se_remotes.rb', line 502

def site_base_sync
  self.remote_host_base.each do |remote_conn|
    local=@source_path
    remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/."
    if defined? @rc['permission_set']['remote_base_site'] \
    and @rc['permission_set']['remote_base_site'] \
    and @@flag_remote==true \
    and @opt.cmd !~/U/
      delete_extra_files='--delete' # '--delete-after'
      puts "begin rsync_base_sync: #{local} -> #{remote}"
      SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).
        rsync(delete_extra_files)
      SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).
        rsync(delete_extra_files)
      SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).
        rsync(delete_extra_files)
    elsif @opt.cmd =~/U/
      puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
      puts "rsync_base_sync: #{local} -> #{remote}"
      puts "#{local}/_sisu/image_sys/ -> #{remote}"
      puts "#{local}/_sisu/image/ -> #{remote}"
      puts "#{local}/#{@env.path.style}/ -> #{remote}"
    else
      puts "permission not granted #{__FILE__} #{__LINE__}" \
        if @opt.cmd =~/M/
    end
  end
end

#site_harvestObject



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/sisu/se_remotes.rb', line 455

def site_harvest
  self.remote_host_base.each do |remote_conn|
    local=@source_path_harvest
    l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}"
    lng='en'
    if @env.output_dir_structure.by? == :language
      ldest=lng + '/manifest'
      files=
        ldest + '/authors.html' + ' ' \
          + ldest + '/topics.html'
    elsif @env.output_dir_structure.by? == :filetype
      ldest="manifest"
      files=
        ldest + '/authors.' + lng + '.html' + ' ' \
          + ldest + '/topics.' + lng + '.html'
    elsif @env.output_dir_structure.by? == :filename
      files=
        l_rel + '/authors.' + lng + '.html' + ' ' \
          + l_rel + '/topics.' + lng + '.html'
    end
    remote="#{remote_conn[:name]}/#{@opt.base_stub}"
    if @opt.act[:harvest][:set] \
    && @opt.act[:rsync][:set]
      (@env.output_dir_structure.by? == :filename) \
      ? (SiSU_Env::SystemCall.new(files,remote).rsync)
      : (SiSU_Env::SystemCall.new(ldest,remote).
          rsync('--relative',l_rel))
    elsif @opt.cmd =~/U/
      puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/
      puts "rsync_harvest: #{local} -> #{remote}"
    else
      puts "permission not granted #{__FILE__} #{__LINE__}" \
        if @opt.cmd =~/M/
    end
  end
end