Class: Suspenders::LintGenerator

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

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#add_linters_gemsObject



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

def add_linters_gems
  gem 'rubocop', '~> 0.71.0', require: false, group: :development
  gem 'rubocop-performance', require: false, group: :development
  gem 'rubocop-rails', require: false, group: :development
  gem 'rubocop-rspec', require: false, group: :development
  gem 'slim_lint', require: false, group: :development
  gem 'overcommit', '>= 0.48.1', require: false, group: :development
  gem 'rubycritic', require: false, group: :development

  # FIXME: switch back to bundle install once https://github.com/sds/overcommit/pull/649
  # will be merged
  Bundler.with_clean_env { run "bundle update" }
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