Class: SiSU_Harvest::Source

Inherits:
Object
  • Object
show all
Includes:
SiSU_Env
Defined in:
lib/sisu/html_harvest.rb

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ Source

Returns a new instance of Source.



63
64
65
66
# File 'lib/sisu/html_harvest.rb', line 63

def initialize(opt)
  @opt=opt
  @env=SiSU_Env::InfoEnv.new
end

Instance Method Details

#cases(opt, env) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
# 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) ⇒ Object



83
84
85
86
87
88
89
90
# 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

#helpObject



77
78
79
80
81
82
# File 'lib/sisu/html_harvest.rb', line 77

def help
  puts <<WOK
  harvest --harvest   extracts document index metadata

WOK
end

#readObject



67
68
69
70
71
72
73
74
75
76
# 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