Sha256: 1c35a1677f5355b775e270fe99badc2c1e0dd0ab92f8b3dcbf612c77f0fafafa

Contents?: true

Size: 783 Bytes

Versions: 17

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

require "refinements/structs"

module Rubysmith
  module Builders
    # Builds project skeleton GitHub CI template.
    class GitHubCI
      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_ci

        builder.call(configuration_with_template).render.replace(/\n\n\Z/, "\n")
        configuration
      end

      private

      attr_reader :configuration, :builder

      def configuration_with_template
        configuration.merge template_path: "%project_name%/.github/workflows/ci.yml.erb"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rubysmith-5.9.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.8.1 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.8.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.7.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.6.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.5.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.4.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.3.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.2.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.1.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-5.0.1 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-4.9.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-4.8.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-4.7.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-4.6.1 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-4.6.0 lib/rubysmith/builders/git_hub_ci.rb
rubysmith-4.5.0 lib/rubysmith/builders/git_hub_ci.rb