Class: ManageIQ::Style::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/manageiq/style/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = parse_cli_options) ⇒ CLI

Returns a new instance of CLI.



10
11
12
# File 'lib/manageiq/style/cli.rb', line 10

def initialize(options = parse_cli_options)
  @opts = options
end

Class Method Details

.runObject



6
7
8
# File 'lib/manageiq/style/cli.rb', line 6

def self.run
  new.run
end

Instance Method Details

#installObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/manageiq/style/cli.rb', line 30

def install
  require 'yaml'
  require 'more_core_extensions/all'

  check_for_codeclimate_channel

  update_rubocop_yml
  write_rubocop_cc_yml
  ensure_rubocop_local_yml_exists
  update_codeclimate_yml
  ensure_haml_lint_yml
  update_yamllint

  update_generator
  update_gem_source
end

#parse_cli_optionsObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/manageiq/style/cli.rb', line 14

def parse_cli_options
  require 'optimist'

  Optimist.options do
    usage    "[OPTIONS]"
    synopsis "\nThe ManageIQ community's style configuration utility."
    version  "v#{ManageIQ::Style::VERSION}\n"

    opt :install, "Install or update the style configurations", :default => false, :required => true
  end
end

#runObject



26
27
28
# File 'lib/manageiq/style/cli.rb', line 26

def run
  install if @opts[:install]
end