Sha256: b0ff946474d66c543c46f4bc11fa4445967f20b6ca0abccabcae92de94dbb0ce

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

module Rubysmith
  module Builders
    module Documentation
      # Builds project skeleton README documentation.
      class Readme < Abstract
        using Refinements::Struct

        def call
          return configuration unless configuration.build_readme

          builder.call(configuration.merge(template_path: "%project_name%/README.#{kind}.erb"))
                 .render
                 .replace(/\n{2,}/, "\n\n")
                 .replace("\n    \n", "\n")

          configuration
        end

        protected

        def kind = configuration.documentation_format
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysmith-6.10.0 lib/rubysmith/builders/documentation/readme.rb
rubysmith-6.9.0 lib/rubysmith/builders/documentation/readme.rb