Sha256: fccb9850d88804420ed1b17a23721d278ad382a2cc8572af4e338043bfffc672

Contents?: true

Size: 843 Bytes

Versions: 4

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

module Rubysmith
  module Builders
    # Builds project skeleton with Caliber style support.
    class Caliber
      using Refinements::Struct

      def self.call(...) = new(...).call

      def initialize configuration, builder: Builder
        @configuration = configuration
        @builder = builder
      end

      def call
        return configuration unless configuration.build_caliber

        builder.call(configuration.merge(template_path: "%project_name%/bin/rubocop.erb"))
               .render
               .permit 0o755

        path = "%project_name%/.config/rubocop/config.yml.erb"
        builder.call(configuration.merge(template_path: path)).render
        configuration
      end

      private

      attr_reader :configuration, :builder
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubysmith-6.6.0 lib/rubysmith/builders/caliber.rb
rubysmith-6.5.0 lib/rubysmith/builders/caliber.rb
rubysmith-6.4.0 lib/rubysmith/builders/caliber.rb
rubysmith-6.3.0 lib/rubysmith/builders/caliber.rb