Sha256: 76e7ce08b95e89f04ead338d1a2370da4dbbb90d4550cad1a6f95839cd68c48b

Contents?: true

Size: 922 Bytes

Versions: 15

Compression:

Stored size: 922 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.new(
          gem_root,
          comments: DEFAULT_COMMENTS,
          includes: includes
        ).run action: :add
      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
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gemsmith-14.5.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.4.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.3.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.2.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.1.3 lib/gemsmith/generators/pragma.rb
gemsmith-14.1.2 lib/gemsmith/generators/pragma.rb
gemsmith-14.1.1 lib/gemsmith/generators/pragma.rb
gemsmith-14.1.0 lib/gemsmith/generators/pragma.rb
gemsmith-14.0.2 lib/gemsmith/generators/pragma.rb
gemsmith-14.0.1 lib/gemsmith/generators/pragma.rb
gemsmith-14.0.0 lib/gemsmith/generators/pragma.rb
gemsmith-13.8.0 lib/gemsmith/generators/pragma.rb
gemsmith-13.7.2 lib/gemsmith/generators/pragma.rb
gemsmith-13.7.1 lib/gemsmith/generators/pragma.rb
gemsmith-13.7.0 lib/gemsmith/generators/pragma.rb