summaryrefslogtreecommitdiff
path: root/new/bin/builder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'new/bin/builder.rb')
-rw-r--r--new/bin/builder.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/new/bin/builder.rb b/new/bin/builder.rb
index d3a273a4..7172cf85 100644
--- a/new/bin/builder.rb
+++ b/new/bin/builder.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
require 'optparse'
-require_relative "../lib/crys"
-require_relative "mixins/splash.rb"
+require_relative '../lib/crys'
+require_relative 'mixins/splash'
Options = Struct.new(:filepath)
@options = Options.new
@@ -13,32 +15,34 @@ OptionParser.new do |opts|
@options[:filepath] = n
end
- opts.on('-a', '--all', 'Process all files') do |v|
+ opts.on('-a', '--all', 'Process all files') do |_v|
@options[:filepath] = :all
end
end.parse!
-
module Crys
class BuilderRunner
-
- def initialize(file_path:, image_dir:, output_dir:, builder_class:, batch_builder_class:)
+ def initialize(file_path:, image_dir:, output_dir:, builder_class:, batch_builder_class:, theme_dir:, pages_db:)
@file_path = file_path
@output_dir = output_dir
@builder_class = builder_class
@batch_builder_class = batch_builder_class
@image_dir = image_dir
+ @theme_dir = theme_dir
+ @pages_db = pages_db
end
def run
if file_path == :all
- batch_builder_class.new.build
+ batch_builder_class.new(pages_db: pages_db, output_dir: output_dir, image_dir: image_dir,
+ builder_class: builder_class).build
else
builder_class.new(file_path: file_path, output_dir: output_dir, image_dir: image_dir).build
end
end
private
- attr_reader :builder_class, :file_path, :output_dir, :image_dir, :batch_builder_class
+
+ attr_reader :builder_class, :file_path, :output_dir, :image_dir, :batch_builder_class, :theme_dir, :pages_db
end
end