From b50e4a5f40bc64fa1893d249d83c05ecd217de1d Mon Sep 17 00:00:00 2001 From: mms Date: Mon, 6 Jan 2025 22:17:43 +0100 Subject: feat(new): rss + batch --- new/lib/crys/batch_builder.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 new/lib/crys/batch_builder.rb (limited to 'new/lib/crys/batch_builder.rb') diff --git a/new/lib/crys/batch_builder.rb b/new/lib/crys/batch_builder.rb new file mode 100644 index 00000000..61fdcf22 --- /dev/null +++ b/new/lib/crys/batch_builder.rb @@ -0,0 +1,34 @@ +module Crys + class BatchBuilder + def db_path + output_dir = "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/db/pages.yaml" + end + + def output_dir + "#{File.dirname(File.dirname(__FILE__))}/output" + end + + def image_dir + "#{File.dirname(File.dirname(File.expand_path(__FILE__)))}/assets/images" + end + + def builder_class + Crys::Builder + end + + def db + Crys::PagesDbManager.new + end + + def build + db.pages.each do |page| + builder_class.new( + file_path: page.file_path, + output_dir: output_dir, + image_dir: image_dir, + ).build + puts "processed: " + page.filename + end + end + end +end -- cgit v1.2.3