Sha256: fc7690522bca9b2716125bc3f00ac55b69cce2986d63d8d8abeed7bd569b0484

Contents?: true

Size: 835 Bytes

Versions: 8

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

module Gemsmith
  module Builders
    # Builds project skeleton with Gemfile configuration.
    class Bundler
      using Refinements::Struct

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

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

      def call
        builder.call(configuration.merge(template_path: "%project_name%/Gemfile.erb"))
               .insert_after("source", "\ngemspec\n")
               .replace(/spec\n\n\Z/m, "spec\n")
               .replace(/.+refinements.+/, "")
               .replace(/.+zeitwerk.+/, "")
               .replace("\n\n\n\n", "\n")

        configuration
      end

      private

      attr_reader :configuration, :builder
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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