Class: BoostStyles::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/boost_styles/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_config_fileObject



11
12
13
14
# File 'lib/generators/boost_styles/install_generator.rb', line 11

def create_config_file
  file_method = config_file_exists? ? :prepend : :create
  send :"#{file_method}_file", config_file_path, config_file_content
end

#create_eslint_fileObject



31
32
33
34
35
36
37
# File 'lib/generators/boost_styles/install_generator.rb', line 31

def create_eslint_file
  return unless yes?('Do you want ESLint?')
  return if eslint_file_exists?

  run('yarn add eslint')
  create_file(eslint_file_path, eslint_file_content)
end

#create_haml_lint_fileObject



24
25
26
27
28
29
# File 'lib/generators/boost_styles/install_generator.rb', line 24

def create_haml_lint_file
  return unless yes?('Do you want HAML lint?')
  return if haml_lint_file_exists?

  create_file(haml_lint_file_path, haml_lint_file_content)
end

#create_stylelint_fileObject



16
17
18
19
20
21
22
# File 'lib/generators/boost_styles/install_generator.rb', line 16

def create_stylelint_file
  return unless yes?('Do you want stylelint?')
  return if stylelint_file_exists?

  run('yarn add stylelint stylelint-config-standard')
  create_file(stylelint_file_path, stylelint_file_content)
end


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/generators/boost_styles/install_generator.rb', line 39

def print_instructions
  say <<-TXT.strip_heredoc
    -----------------------------------------
    🎉 All done! 🎉

    Run rubocop in parallel to check the offenses:
      -> rubocop -P
    To fix the offenses, run:
      -> rubocop -a
    To generate todo, run:
      -> rubocop --auto-gen-config

    Run stylelint to check the offenses:
      -> stylelint --color app/assets/stylesheets/
    To fix the offenses, run:
      -> stylelint --color --fix app/assets/stylesheets/

    Run haml_lint to check the offenses:
      -> bundle exec haml-lint app/**/*.html.haml
    To fix the offenses, you need to diy
    -----------------------------------------
  TXT
end