Sha256: 7e716b28c95328e34753001ac54e711df28a4b4ea51813c0470e25ca01a11c84

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

require 'thor'

require 'rocket_fuel/precheck/command_line_result_presenter'

require 'rocket_fuel/precheck/command_line_tool_check'
require 'rocket_fuel/precheck/rvm_check'
require 'rocket_fuel/precheck/rbenv_check'
require 'rocket_fuel/precheck/macports_check'

require 'rocket_fuel/fix'

module RocketFuel
  module Precheck
    class Run
      include Thor::Base
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rocket_fuel-0.0.2 lib/rocket_fuel/precheck/run.rb
rocket_fuel-0.0.1 lib/rocket_fuel/precheck/run.rb