Sha256: 9947affd64a1d95b5bad60f384b3fbca1f0180fd00d9d58bc7c588956863e3a6

Contents?: true

Size: 875 Bytes

Versions: 8

Compression:

Stored size: 875 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

module Gemsmith
  module Builders
    # Builds project skeleton Circle CI configuration.
    class CircleCI
      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_circle_ci

        builder.call(configuration.merge(template_path: "%project_name%/.circleci/config.yml.erb"))
               .replace %({{checksum "Gemfile.lock"}}),
                        %({{checksum "Gemfile"}}-{{checksum "#{project_name}.gemspec"}})

        configuration
      end

      private

      attr_reader :configuration, :builder

      def project_name = configuration.project_name
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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