Class: Rolemodel::EditorsGenerator

Inherits:
GeneratorBase
  • Object
show all
Includes:
VSCodeHelpers
Defined in:
lib/generators/rolemodel/editors/editors_generator.rb

Overview

Add standard editorconfig and any extensions to enable it

Instance Method Summary collapse

Instance Method Details

#add_editorconfigObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/rolemodel/editors/editors_generator.rb', line 14

def add_editorconfig
  # Bring over the .editorconfig file for whitespace, etc.
  copy_file '.editorconfig'

  # Configuration for VSCode to recommend the EditorConfig extension.
  ensure_extensions_config

  # Presumably in the future, we might add ESLint, Rubocop, etc.
  # extensions. We might eventually also split this out, if there are
  # extensions for RubyMine or other editors, but in theory, we might
  # want to bring over config files for any RM-supported editors.
  inject_into_file '.vscode/extensions.json', after: '"recommendations": [' do
    "\n    \"EditorConfig.EditorConfig\","
  end
end