Class: Gemsmith::Generators::Rubocop

Inherits:
Base
  • Object
show all
Defined in:
lib/gemsmith/generators/rubocop.rb

Overview

Generates Rubocop support.

Instance Method Summary collapse

Methods inherited from Base

#initialize, run

Constructor Details

This class inherits a constructor from Gemsmith::Generators::Base

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
# File 'lib/gemsmith/generators/rubocop.rb', line 7

def run
  return unless configuration.dig(:generate, :rubocop)

  cli.uncomment_lines "#{gem_name}/Rakefile", /require.+rubocop.+/
  cli.uncomment_lines "#{gem_name}/Rakefile", /RuboCop.+/
  cli.template "%gem_name%/.rubocop.yml.tt", configuration
  cli.run "rubocop --auto-correct #{gem_name} > /dev/null"
end