lib/rubysmith/cli/processors/build.rb in rubysmith-0.9.1 vs lib/rubysmith/cli/processors/build.rb in rubysmith-0.10.0

- old
+ new

@@ -1,12 +1,16 @@ # frozen_string_literal: true +require "refinements/structs" + module Rubysmith module CLI module Processors # Handles the Command Line Interface (CLI) for building of a project skeleton. class Build + using Refinements::Structs + # Order is important. MINIMUM = [ Builders::Core, Builders::Bundler, Builders::Pragma, @@ -35,24 +39,21 @@ def self.with_minimum new builders: MINIMUM end - def initialize builders: MAXIMUM + def initialize configuration: Configuration::Loader.call, builders: MAXIMUM + @configuration = configuration @builders = builders end - def call options - Realm[**options].then { |realm| process realm } - end + def call(options) = configuration.merge(**options).then { |config| process config } private - attr_reader :builders + attr_reader :configuration, :builders - def process realm - builders.each { |builder| builder.call realm } - end + def process(config) = builders.each { |builder| builder.call config } end end end end