Sha256: 59c12532001070b345ef21fb40a31361960fe03d4edccba694013f9212a86afc

Contents?: true

Size: 889 Bytes

Versions: 30

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

require "refinements/structs"

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

      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

30 entries across 30 versions & 1 rubygems

Version Path
gemsmith-20.7.0 lib/gemsmith/builders/specification.rb
gemsmith-20.6.1 lib/gemsmith/builders/specification.rb
gemsmith-20.6.0 lib/gemsmith/builders/specification.rb
gemsmith-20.5.0 lib/gemsmith/builders/specification.rb
gemsmith-20.4.0 lib/gemsmith/builders/specification.rb
gemsmith-20.3.0 lib/gemsmith/builders/specification.rb
gemsmith-20.2.1 lib/gemsmith/builders/specification.rb
gemsmith-20.2.0 lib/gemsmith/builders/specification.rb
gemsmith-20.1.0 lib/gemsmith/builders/specification.rb
gemsmith-20.0.0 lib/gemsmith/builders/specification.rb
gemsmith-19.8.0 lib/gemsmith/builders/specification.rb
gemsmith-19.7.0 lib/gemsmith/builders/specification.rb
gemsmith-19.6.0 lib/gemsmith/builders/specification.rb
gemsmith-19.5.2 lib/gemsmith/builders/specification.rb
gemsmith-19.5.1 lib/gemsmith/builders/specification.rb
gemsmith-19.5.0 lib/gemsmith/builders/specification.rb
gemsmith-19.4.0 lib/gemsmith/builders/specification.rb
gemsmith-19.3.0 lib/gemsmith/builders/specification.rb
gemsmith-19.2.0 lib/gemsmith/builders/specification.rb
gemsmith-19.1.0 lib/gemsmith/builders/specification.rb