Sha256: 5d081dfd58aa0dc6689a35aeaedca6fb9c1c7ded87af6c3f2afeac30b9d33926

Contents?: true

Size: 938 Bytes

Versions: 10

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

require "refinements/structs"

module Rubysmith
  module Builders
    # Builds project skeleton GitHub templates.
    class GitHub
      using Refinements::Structs

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

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

      def call
        return configuration unless configuration.build_git_hub

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

      private

      attr_reader :configuration, :builder

      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

10 entries across 10 versions & 1 rubygems

Version Path
rubysmith-3.0.1 lib/rubysmith/builders/git_hub.rb
rubysmith-3.0.0 lib/rubysmith/builders/git_hub.rb
rubysmith-2.0.2 lib/rubysmith/builders/git_hub.rb
rubysmith-2.0.1 lib/rubysmith/builders/git_hub.rb
rubysmith-2.0.0 lib/rubysmith/builders/git_hub.rb
rubysmith-1.3.0 lib/rubysmith/builders/git_hub.rb
rubysmith-1.2.0 lib/rubysmith/builders/git_hub.rb
rubysmith-1.1.1 lib/rubysmith/builders/git_hub.rb
rubysmith-1.1.0 lib/rubysmith/builders/git_hub.rb
rubysmith-1.0.0 lib/rubysmith/builders/git_hub.rb