Class: Hound::Tools::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/hound/tools/cli.rb

Constant Summary collapse

INSTRUCTIONS =
<<-EOS

   **** WARNING!!! ****

  1. All Rubocop offenses are initially ignored! (see .rubocop_todo.yml and/or README)
    - tweak .rubocop_todo.yml and regenerate with `bundle exec hound-tools`

  2. Fixing all offenses at once is discouraged unless:
    - you are the only person actively working on the project (or starting out)
    - you have accepted ALL the pull requests FIRST
    - you have merged ALL the local and remote branches and you are NOT
    currently maintaining multiple branches

  Issues? Go here: https://github.com/e2/hound-tools/issues
EOS

Instance Method Summary collapse

Instance Method Details

#checkObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/hound/tools/cli.rb', line 58

def check
  # TODO: add an "update" action?
  # TODO: only merge if necessary (files outdated)
  MergedYml.new.generate

  options = {
    hound_yml_file: '.hound.yml',
    hound_ci_style_file: '.hound/defaults.yml',
    debug: false,
    glob_pattern: '**/*.rb'
  }

  Runner.new(options).run
end

#initObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/hound/tools/cli.rb', line 32

def init
  HoundYml.new.generate
  HoundDefaults.new.generate
  HoundOverrides.new.generate
  RubocopYml.new.generate

  # TODO: help setup Rakefile?

  Kernel.system('bundle exec rubocop --auto-gen')

  MergedYml.new.generate

  $stdout.puts INSTRUCTIONS

  unless Kernel.system("bundle show hound-tools > #{IO::NULL}")
    $stderr.puts <<-EOS
    Add hound-tools to your Gemfile like so:

        gem 'hound-tools', require: false

    EOS
  end
end