Sha256: bea46694c799800009a72a87fee9d704e83681faf3b8961fc8911a405a43f868

Contents?: true

Size: 885 Bytes

Versions: 8

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

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

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

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

        def call
          return configuration unless configuration.build_readme

          builder.call(configuration.merge(template_path: "%project_name%/README.#{kind}.erb"))
                 .replace("Rubysmith", "Gemsmith")
                 .replace("rubysmith", "gemsmith")

          configuration
        end

        private

        attr_reader :configuration, :builder

        def kind = configuration.documentation_format
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gemsmith-21.6.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-21.5.1 lib/gemsmith/builders/documentation/readme.rb
gemsmith-21.5.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-21.4.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-21.3.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-21.2.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-21.1.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-21.0.0 lib/gemsmith/builders/documentation/readme.rb