Class: MergetrainCheck::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/mergetrain_check.rb

Class Method Summary collapse

Class Method Details

.run!(args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/mergetrain_check.rb', line 18

def self.run!(args)
  config = Config.new
  parser = ArgsParser.new
  args = ArgsParser.new.parse(args)
  return if args.nil?
  config.merge! args

  if config.auth_token.nil?
    raise MissingConfigError, "auth_token"
  end

  if config.project_id.nil?
    raise MissingConfigError, "project_id"
  end

  checker = Checker.new(config.gitlab_host, config.auth_token, config.project_id)
  traintable = checker.check

  formatter = TraintableFormatter.new 80, true
  puts formatter.format traintable
  config.save!
end