lib/gemsmith/generators/rubocop.rb in gemsmith-14.2.0 vs lib/gemsmith/generators/rubocop.rb in gemsmith-14.3.0

- old
+ new

@@ -3,15 +3,16 @@ module Gemsmith module Generators # Generates Rubocop support. class Rubocop < Base def run - return unless configuration.dig :generate, :rubocop - - cli.uncomment_lines "#{gem_name}/Rakefile", /require.+rubocop.+/ - cli.uncomment_lines "#{gem_name}/Rakefile", /RuboCop.+/ - template "%gem_name%/.rubocop.yml.tt" - cli.run "cd #{gem_name} && bundle exec rubocop --auto-correct > /dev/null" + if configuration.dig :generate, :rubocop + template "%gem_name%/.rubocop.yml.tt" + cli.run "cd #{gem_name} && bundle exec rubocop --auto-correct > /dev/null" + else + cli.gsub_file "#{gem_name}/Rakefile", /require.+rubocop.+\n/, "" + cli.gsub_file "#{gem_name}/Rakefile", /RuboCop.+\n/, "" + end end end end end