Sha256: 7a9d22fb536686338748ce9ca31061bf0956db96f802fd8a792a98a99eea99a3

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require "refinements/struct"

module Rubysmith
  module Builders
    # Builds project skeleton GitHub templates.
    class GitHub < Abstract
      using Refinements::Struct

      def call
        render_funding

        return configuration unless configuration.build_git_hub

        builder.call(with_issue_template).render
        builder.call(with_pull_request_template).render
        configuration
      end

      private

      def render_funding
        return unless configuration.build_funding

        configuration.merge(template_path: "%project_name%/.github/FUNDING.yml.erb")
                     .then { |updated_configuration| builder.call(updated_configuration).render }
      end

      def with_issue_template
        configuration.merge template_path: "%project_name%/.github/ISSUE_TEMPLATE.md.erb"
      end

      def with_pull_request_template
        configuration.merge template_path: "%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysmith-6.10.0 lib/rubysmith/builders/git_hub.rb
rubysmith-6.9.0 lib/rubysmith/builders/git_hub.rb