Sha256: faddb47b31a24de3ed0f38702782065c4970734d5a1c12c6a4b373ca841cc7fc

Contents?: true

Size: 887 Bytes

Versions: 38

Compression:

Stored size: 887 Bytes

Contents

# frozen_string_literal: true

require "refinements/structs"

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

        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

38 entries across 38 versions & 1 rubygems

Version Path
gemsmith-20.7.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.6.1 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.6.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.5.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.4.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.3.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.2.1 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.2.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.1.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-20.0.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.8.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.7.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.6.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.5.2 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.5.1 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.5.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.4.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.3.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.2.0 lib/gemsmith/builders/documentation/readme.rb
gemsmith-19.1.0 lib/gemsmith/builders/documentation/readme.rb