Sha256: aa6385bab8956d837c0dd173da8d21a5c87243f0b5f43564b0f393aceba90b9d

Contents?: true

Size: 758 Bytes

Versions: 3

Compression:

Stored size: 758 Bytes

Contents

# frozen_string_literal: true

require "pragmater"
require "refinements/pathname"

module Rubysmith
  module Extensions
    # Ensures project skeleton has pragmas.
    class Pragmater
      include Import[:settings]

      using Refinements::Pathname

      CLIENT = ::Pragmater::Inserter.new(
        settings: ::Pragmater::Configuration::Model[
          comments: ["# frozen_string_literal: true"],
          patterns: %w[**/*.rake **/*.rb *.gemspec exe/* bin/* config.ru *file]
        ]
      ).freeze

      def initialize(client: CLIENT, **)
        @client = client
        super(**)
      end

      def call
        settings.project_root.change_dir { client.call }
        true
      end

      private

      attr_reader :client
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysmith-7.2.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-7.1.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-7.0.0 lib/rubysmith/extensions/pragmater.rb