Sha256: 9c4b67ece18a70b98238c171da14f469cba8baf23d4b2aae3d71d2d79d1a80e8

Contents?: true

Size: 894 Bytes

Versions: 7

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

require "pathname"
require "pragmater"

module Gemsmith
  module Generators
    # Formats pragma comments in source files.
    class Pragma < Base
      def self.comments
        ["# frozen_string_literal: true"]
      end

      # rubocop:disable Metrics/MethodLength
      def whitelist
        %W[
          **/*Gemfile
          **/*Guardfile
          **/*Rakefile
          **/*config.ru
          **/*bin/#{configuration.dig :gem, :name}
          **/*bin/bundle
          **/*bin/rails
          **/*bin/rake
          **/*bin/setup
          **/*bin/update
          **/*bin/yarn
          **/*.gemspec
          **/*.rake
          **/*.rb
        ]
      end

      def run
        Pragmater::Runner.new(
          gem_root,
          comments: self.class.comments,
          whitelist: whitelist
        ).run action: :add
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gemsmith-10.4.2 lib/gemsmith/generators/pragma.rb
gemsmith-10.4.1 lib/gemsmith/generators/pragma.rb
gemsmith-10.4.0 lib/gemsmith/generators/pragma.rb
gemsmith-10.3.0 lib/gemsmith/generators/pragma.rb
gemsmith-10.2.0 lib/gemsmith/generators/pragma.rb
gemsmith-10.1.0 lib/gemsmith/generators/pragma.rb
gemsmith-10.0.0 lib/gemsmith/generators/pragma.rb