Class: RubocopRules::CLI::Commands
- Inherits:
-
Thor
- Object
- Thor
- RubocopRules::CLI::Commands
- Includes:
- Thor::Actions
- Defined in:
- lib/rubocop_rules/cli.rb
Overview
CLI for initializing a project with RubocopRules, and keeping it up to date
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
14 15 16 |
# File 'lib/rubocop_rules/cli.rb', line 14 def self.source_root File.(File.join(File.dirname(__FILE__), '../..')) end |
Instance Method Details
#init ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rubocop_rules/cli.rb', line 27 def init puts 'Copying config... ' copy_file 'templates/.rubosync.yml', '.rubosync.yml' copy_file 'templates/.rubocop.yml', '.rubocop.yml' copy_file 'spec/lint_spec.rb', 'spec/lint_spec.rb' ensure_rubosync_config rubosync_common print 'Generating rubocop_todo...' generate_todo puts 'Adding rubocop_todo to configuration... ' insert_into_file '.rubocop.yml', ' - .rubocop_todo.yml', after: " - .rubocop_common.yml\n" end |
#update ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rubocop_rules/cli.rb', line 44 def update puts 'Recreating configuration...' ensure_rubosync_config remove_file '.rubocop_common.yml' rubosync_common puts 'Regenerating rubocop_todo...' remove_file '.rubocop_todo.yml' comment_lines '.rubocop.yml', /\.rubocop_todo\.yml/ generate_todo(silent: true) uncomment_lines '.rubocop.yml', /\.rubocop_todo\.yml/ clean_up_rubocop_config end |
#version ⇒ Object
22 23 24 |
# File 'lib/rubocop_rules/cli.rb', line 22 def version puts RubocopRules::VERSION end |