Class: GitHealthCheck::Cli::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/git-health-check/cli/application.rb

Constant Summary collapse

SUCCESS =
0
ERROR =
1

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Application

Returns a new instance of Application.



9
10
11
12
# File 'lib/git-health-check/cli/application.rb', line 9

def initialize(argv)
  @options = GitHealthCheck::Cli::Options.new(argv)
  @status = SUCCESS
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/git-health-check/cli/application.rb', line 14

def execute
  begin
    cmd = @options.parse
    cmd.execute(self)
  rescue Exception => error
    $stderr.puts "Error: #{error}"
    @status = ERROR
  end
  @status
end

#output(text) ⇒ Object



25
26
27
# File 'lib/git-health-check/cli/application.rb', line 25

def output(text)
  print text
end

#report_successObject



29
30
31
# File 'lib/git-health-check/cli/application.rb', line 29

def report_success
  @status
end