diff options
Diffstat (limited to 'new/bin/builder.rb')
-rw-r--r-- | new/bin/builder.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/new/bin/builder.rb b/new/bin/builder.rb index 47195b2..d3a273a 100644 --- a/new/bin/builder.rb +++ b/new/bin/builder.rb @@ -12,24 +12,33 @@ OptionParser.new do |opts| opts.on('-fPATH', '--file=PATH', 'File path') do |n| @options[:filepath] = n end + + 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:) + def initialize(file_path:, image_dir:, output_dir:, builder_class:, batch_builder_class:) @file_path = file_path @output_dir = output_dir @builder_class = builder_class + @batch_builder_class = batch_builder_class @image_dir = image_dir end - def run + def run + if file_path == :all + batch_builder_class.new.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 + attr_reader :builder_class, :file_path, :output_dir, :image_dir, :batch_builder_class end end |