lib/rubysmith/extensions/pragmater.rb in rubysmith-6.2.0 vs lib/rubysmith/extensions/pragmater.rb in rubysmith-6.2.1

- old
+ new

@@ -1,20 +1,33 @@ # frozen_string_literal: true require "pragmater" +require "refinements/pathname" module Rubysmith module Extensions # Ensures project skeleton has pragmas. class Pragmater + using Refinements::Pathname + def self.call(...) = new(...).call + def self.custom_configuration + ::Pragmater::Configuration::Model[ + comments: ["# frozen_string_literal: true"], + patterns: %w[**/*.rake **/*.rb *.gemspec exe/* bin/* config.ru *file] + ] + end + def initialize configuration, client: ::Pragmater::Inserter.new @configuration = configuration @client = client end - def call = client.call && configuration + def call + configuration.project_root.change_dir { client.call self.class.custom_configuration } + configuration + end private attr_reader :configuration, :client end