Sha256: d11e464c2e1277d229faecc90ea748e8e898c4fd25843b739de6416ed9675b02

Contents?: true

Size: 887 Bytes

Versions: 8

Compression:

Stored size: 887 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

module Gemsmith
  module Builders
    # Builds project skeleton gem specification for use by RubyGems.
    class Specification
      using Refinements::Struct

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

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

      def call
        config = configuration.merge template_path: "%project_name%/%project_name%.gemspec.erb"

        builder.call(config)
               .render
               .replace("    \n", "")
               .replace("      ", "    ")
               .replace("  \n", "")
               .replace("    spec", "  spec")
               .replace(/\}\s+s/m, "}\n\n  s")

        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/specification.rb
gemsmith-21.5.1 lib/gemsmith/builders/specification.rb
gemsmith-21.5.0 lib/gemsmith/builders/specification.rb
gemsmith-21.4.0 lib/gemsmith/builders/specification.rb
gemsmith-21.3.0 lib/gemsmith/builders/specification.rb
gemsmith-21.2.0 lib/gemsmith/builders/specification.rb
gemsmith-21.1.0 lib/gemsmith/builders/specification.rb
gemsmith-21.0.0 lib/gemsmith/builders/specification.rb