class SiSU_Harvest::Source

Public Class Methods

new(opt) click to toggle source
# File lib/sisu/html_harvest.rb, line 63
def initialize(opt)
  @opt=opt
  @env=SiSU_Env::InfoEnv.new
end

Public Instance Methods

cases(opt,env) click to toggle source
# File lib/sisu/html_harvest.rb, line 91
def cases(opt,env)
  case opt.selections.str.inspect
  when/--harvest/i
    css(opt) if @opt.act[:maintenance][:set]==:on
    SiSU_HarvestAuthors::Songsheet.new(opt,env).songsheet
    SiSU_HarvestTopics::Songsheet.new(opt,env).songsheet
    if @opt.act[:rsync][:set]==:on
      require_relative 'remote'                         # remote.rb
      SiSU_Remote::Put.new(opt).rsync_harvest
    end
  else
    help
  end
end
css(opt) click to toggle source
# File lib/sisu/html_harvest.rb, line 83
def css(opt)
  require_relative 'css'                                # css.rb
  css=SiSU_Style::CSS.new
  fn_css=SiSU_Env::CSS_Default.new
  style=File.new("#{@env.path.pwd}/#{fn_css.harvest}",'w')
  style << css.harvest
  style.close
end
help() click to toggle source
# File lib/sisu/html_harvest.rb, line 77
    def help
      puts <<WOK
      harvest --harvest   extracts document index metadata

WOK
    end
read() click to toggle source
# File lib/sisu/html_harvest.rb, line 67
def read
  begin
    harvest_pth=@env.path.webserv + '/' + @opt.base_stub
    FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
    cases(@opt,@env)
  rescue
  ensure
    SiSU_Env::CreateSite.new(@opt).cp_css
  end
end