class RubocopRailsConfig::Generators::UpdateGenerator

Public Instance Methods

update_config_file() click to toggle source
# File lib/generators/rubocop_rails_config/update_generator.rb, line 11
def update_config_file
  if old_gem_name_used?
    gsub_file config_file_path, "rubocop-rails:", "rubocop-rails_config:"
  else
    puts "Your config is up-to-date. Nothing to update."
  end
end

Private Instance Methods

config_file_path() click to toggle source
# File lib/generators/rubocop_rails_config/update_generator.rb, line 25
def config_file_path
  ".rubocop.yml"
end
old_gem_name_used?() click to toggle source

rubocop-rails is renamed to rubocop-rails_config

# File lib/generators/rubocop_rails_config/update_generator.rb, line 21
def old_gem_name_used?
  File.foreach(config_file_path).grep(/\s+rubocop-rails:/).any?
end