Sha256: 2585f29848ce9d56ef62d6bb414ffc352f5c2e7f6e1fbbb97c9f5a05481f9889

Contents?: true

Size: 1017 Bytes

Versions: 14

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

require "pathname"
require "pragmater"

module Gemsmith
  module Generators
    # Formats pragma comments in source files.
    class Pragma < Base
      DEFAULT_COMMENTS = ["# frozen_string_literal: true"].freeze

      def run
        Pragmater::Runner.for(**attributes).call
      end

      # rubocop:disable Metrics/MethodLength
      def includes
        %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
      # rubocop:enable Metrics/MethodLength

      private

      def attributes
        {
          action: :insert,
          root_dir: gem_root,
          comments: DEFAULT_COMMENTS,
          includes: includes
        }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gemsmith-15.5.0 lib/gemsmith/generators/pragma.rb
gemsmith-15.4.0 lib/gemsmith/generators/pragma.rb
gemsmith-15.3.0 lib/gemsmith/generators/pragma.rb
gemsmith-15.2.0 lib/gemsmith/generators/pragma.rb
gemsmith-15.1.1 lib/gemsmith/generators/pragma.rb
gemsmith-15.1.0 lib/gemsmith/generators/pragma.rb
gemsmith-15.0.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.11.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.10.1 lib/gemsmith/generators/pragma.rb
gemsmith-14.10.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.9.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.8.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.7.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.6.0 lib/gemsmith/generators/pragma.rb