Sha256: 799b8d69616daa8c06b3d2ad976873e1fc9a393f74f887d8507f983b881f331d

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

# 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,
          Builders::Rubocop::Formatter
        ].freeze

        # Order is important.
        MAXIMUM = [
          Builders::Core,
          Builders::Documentation,
          Builders::Git::Setup,
          Builders::Bundler,
          Builders::Rake,
          Builders::Console,
          Builders::Setup,
          Builders::Guard,
          Builders::Reek,
          Builders::RSpec::Context,
          Builders::RSpec::Helper,
          Builders::Pragma,
          Builders::Rubocop::Setup,
          Builders::Rubocop::Formatter,
          Builders::RubyCritic,
          Builders::Git::Commit
        ].freeze

        def self.with_minimum = new(builders: MINIMUM)

        def initialize configuration: Configuration::Loader.call, builders: MAXIMUM
          @configuration = configuration
          @builders = builders
        end

        def call(options) = configuration.merge(**options).then { |config| process config }

        private

        attr_reader :configuration, :builders

        def process(config) = builders.each { |builder| builder.call config }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubysmith-0.11.0 lib/rubysmith/cli/processors/build.rb