class TablexiDev::Generators::RubocopGenerator
Public Instance Methods
add_gem()
click to toggle source
# File lib/generators/tablexi_dev/rubocop_generator.rb, line 17 def add_gem # Prevent us from adding the same gem directive multiple times # if the Gemfile already has 'rubocop' in a format other # than the exact format we expect. content = File.read("Gemfile") gem "rubocop", group: %i[development test], require: false unless content.include?("rubocop") end
copy_files()
click to toggle source
# File lib/generators/tablexi_dev/rubocop_generator.rb, line 13 def copy_files install_rubocop_config_files end
Private Instance Methods
install_rubocop_config_files()
click to toggle source
# File lib/generators/tablexi_dev/rubocop_generator.rb, line 27 def install_rubocop_config_files copy_file "dot_rubocop.yml", ".rubocop.yml" copy_file "dot_rubocop-txi.yml", ".rubocop-txi.yml" # Create a .rubocop_todo file, which may be generated # by the `rubocop --auto-gen-config` command create_file ".rubocop_todo.yml" unless File.exist?(".rubocop_todo.yml") # Create a file for where individual project-overrides # should be stored, and not be clobbered by the txi rules unless File.exist?(".rubocop-project_overrides.yml") # rubocop:disable Style/GuardClause copy_file "dot_rubocop-project_overrides.yml", ".rubocop-project_overrides.yml" end end