summaryrefslogtreecommitdiff
path: root/new/lib/crys/batch_builder.rb
diff options
context:
space:
mode:
authormms <git@sapka.me>2025-01-06 22:17:43 +0100
committermms <git@sapka.me>2025-01-06 22:17:43 +0100
commitb50e4a5f40bc64fa1893d249d83c05ecd217de1d (patch)
treed98b5c3a378975d095aa3dad8d1a642c3cf0f3d2 /new/lib/crys/batch_builder.rb
parentbfd8209ad0d80b5027bea8a1a095dadc8bffdc61 (diff)
feat(new): rss + batch
Diffstat (limited to 'new/lib/crys/batch_builder.rb')
-rw-r--r--new/lib/crys/batch_builder.rb34
1 files changed, 34 insertions, 0 deletions
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