Class: RocketFuel::Precheck::Run

Inherits:
Object
  • Object
show all
Includes:
Thor::Base
Defined in:
lib/rocket_fuel/precheck/run.rb

Instance Method Summary collapse

Instance Method Details

#resultsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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/rocket_fuel/precheck/run.rb', line 16

def results
  failed_checks = []
  RocketFuel::Precheck.checks.each do |key, klass|
    check = klass.new
    if check.check?
      CommandLineResultPresenter.new(check).present
      if !check.ok?
        failed_checks << key
      end
    end
  end

  say('')
  say('========================')
  say('')

  if !failed_checks.empty?
    say('***YOU ARE NOT CLEARED FOR INSTALLATION***', :red)
    say('')

    failed_checks.each do |sym|
      if RocketFuel::Precheck.fixes[sym]
        fix = RocketFuel::Precheck.fixes[sym].new
        say("#{fix.title}", :red)
        say('')
        print_wrapped(fix.message, :indent => 2)

        say('')
        print_wrapped("Rocket Fuel can tackle this for you. " +
          "Invoke `rocket_fuel fix #{sym}` to resolve this issue.",
          :indent => 2)
      end
    end
  else
    say('***Congratulations! You\'re cleared to install with Rocket Fuel***', :green)
    say('')
    say('Run `rocket_fuel install` to proceed.')
  end
end