aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/harvest.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/harvest.rb')
-rw-r--r--lib/sisu/v3/harvest.rb80
1 files changed, 43 insertions, 37 deletions
diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v3/harvest.rb
index aaec9046..47380c2e 100644
--- a/lib/sisu/v3/harvest.rb
+++ b/lib/sisu/v3/harvest.rb
@@ -58,45 +58,51 @@
** Description: system environment, resource control and configuration details
=end
-def help
- puts <<WOK
- harvest --harvest extracts document index metadata
-
+module SiSU_Harvest
+ @@the_idx_topics,@@the_idx_authors={},{}
+ class Source
+ require_relative 'options' # options.rb
+ require_relative 'harvest_topics' # harvest_topics.rb
+ require_relative 'harvest_authors' # harvest_authors.rb
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ def initialize(opt)
+ @opt=opt
+ @env=SiSU_Env::Info_env.new
+ end
+ def read
+ harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}"
+ mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
+ cases(@opt,@env)
+ end
+ def help
+ puts <<WOK
+ harvest --harvest extracts document index metadata
+
WOK
-end
-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
-def cases(opt)
- case opt.mod.inspect
- when/--harvest/i
- css(opt) if opt.cmd.inspect =~/M/
- HARVEST_authors::Songsheet.new(opt).songsheet
- HARVEST_topics::Songsheet.new(opt).songsheet
- if opt.cmd.inspect =~/R/
- require_relative 'remote' # remote.rb
- SiSU_Remote::Put.new(opt).rsync_harvest
end
- else
- help
+ 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
+ def cases(opt,env)
+ case opt.mod.inspect
+ when/--harvest/i
+ css(opt) if opt.cmd.inspect =~/M/
+ HARVEST_authors::Songsheet.new(opt,env).songsheet
+ HARVEST_topics::Songsheet.new(opt,env).songsheet
+ if opt.cmd.inspect =~/R/
+ require_relative 'remote' # remote.rb
+ SiSU_Remote::Put.new(opt).rsync_harvest
+ end
+ else
+ help
+ end
+ end
end
end
-require_relative 'options' # options.rb
-require_relative 'harvest_topics' # harvest_topics.rb
-require_relative 'harvest_authors' # harvest_authors.rb
-require_relative 'sysenv' # sysenv.rb
- include SiSU_Env
-@env=SiSU_Env::Info_env.new
-@@the_idx_topics,@@the_idx_authors={},{}
-argv=$*
-opt=SiSU_commandline::Options.new(argv)
-argv.shift
-harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}"
-mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
-cases(opt)
__END__