Class: Suspenders::LintGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_linters_gemsObject



10
11
12
13
14
15
16
17
# File 'lib/suspenders/generators/lint_generator.rb', line 10

def add_linters_gems
  gem 'rubocop', require: false, group: :development
  gem 'rubocop-rspec', require: false, group: :development
  gem 'slim_lint', require: false, group: :development
  gem 'overcommit', require: false, group: :development
  gem 'rubycritic', require: false, group: :development
  Bundler.with_clean_env { run "bundle install" }
end

#create_binstubsObject



38
39
40
41
42
43
44
45
# File 'lib/suspenders/generators/lint_generator.rb', line 38

def create_binstubs
  Bundler.with_clean_env do
    run "bundle binstubs rubocop"
    run "bundle binstubs slim_lint"
    run "bundle binstubs overcommit"
    run "bundle binstubs rubycritic"
  end
end

#setup_overcommitObject



28
29
30
31
32
# File 'lib/suspenders/generators/lint_generator.rb', line 28

def setup_overcommit
  run "overcommit --install"
  copy_file "overcommit.yml", ".overcommit.yml", force: true
  run "overcommit --sign"
end

#setup_rubocopObject



19
20
21
22
# File 'lib/suspenders/generators/lint_generator.rb', line 19

def setup_rubocop
  copy_file "rubocop.yml", ".rubocop.yml"
  copy_file "rubocop_todo.yml", ".rubocop_todo.yml"
end

#setup_rubycriticObject



34
35
36
# File 'lib/suspenders/generators/lint_generator.rb', line 34

def setup_rubycritic
  copy_file "reek", ".reek"
end

#setup_slim_lintObject



24
25
26
# File 'lib/suspenders/generators/lint_generator.rb', line 24

def setup_slim_lint
  copy_file "slim-lint.yml", ".slim-lint.yml"
end