Class: CodeQualityCheck::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- CodeQualityCheck::Generators::InstallGenerator
- Defined in:
- lib/generators/code_quality_check/install_generator.rb
Overview
Define a generator class that inherits from Rails::Generators::Base
Instance Method Summary collapse
-
#copy_required_files ⇒ Object
Define a method that copies the initializer file to the config/initializers directory.
- #install_overcommit ⇒ Object
Instance Method Details
#copy_required_files ⇒ Object
Define a method that copies the initializer file to the config/initializers directory
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/generators/code_quality_check/install_generator.rb', line 18 def copy_required_files # Copy the initializer file to the config/initializers directory template 'overcommit.rb', 'config/initializers/overcommit.rb' # Copy the Overcommit configuration file to the root directory template 'overcommit.yml', '.overcommit.yml' # Copy the RuboCop configuration file to the root directory template 'rubocop.yml', '.rubocop.yml' # Copy the pre-commit hook to the .git/hooks directory template 'pre-commit', '.git/hooks/pre-commit', force: true template 'post-checkout', '.git/hooks/post-checkout', force: true end |
#install_overcommit ⇒ Object
12 13 14 15 |
# File 'lib/generators/code_quality_check/install_generator.rb', line 12 def install_overcommit # Install Overcommit run 'bundle exec overcommit --install' end |