class PhusionPassenger::PlatformInfo::Depcheck::ConsoleRunner

def add(identifier)

def add(identifier)
	@dep_identifiers << identifier
end

def check_all

def check_all
	old_log_impl = PlatformInfo.log_implementation
	begin
		PlatformInfo.log_implementation = lambda do |message|
			message = PlatformInfo.send(:reindent, message, 10)
			message.sub!(/^          /, '')
			STDOUT.puts "       -> #{message}"
		end
		@missing_dependencies = []
		@dep_identifiers.each do |identifier|
			dep = Depcheck.find(identifier)
			raise "Cannot find depcheck spec #{identifier.inspect}" if !dep
			puts_header "Checking for #{dep.name}..."
			result = dep.check
			result = { :found => false } if !result
			if result[:found] && !result[:error]
				puts_detail "Found: <green>yes</green>"
			else
				if result[:error]
					puts_detail "Found: #{result[:found] ? "<yellow>yes, but there was an error</yellow>" : "<red>no</red>"}"
					puts_detail "Error: <red>#{result[:error]}</red>"
				else
					puts_detail "Found: #{result[:found] ? "<green>yes</green>" : "<red>no</red>"}"
				end
				@missing_dependencies << dep
			end
			result.each_pair do |key, value|
				if key.is_a?(String)
					puts_detail "#{key}: #{value}"
				end
			end
		end
		return @missing_dependencies.empty?
	ensure
		PlatformInfo.log_implementation = old_log_impl
	end
end

def initialize

def initialize
	@stdout = STDOUT
	@dep_identifiers = []
end

def print_installation_instructions_for_missing_dependencies

def print_installation_instructions_for_missing_dependencies
	@missing_dependencies.each do |dep|
		puts " * To install <yellow>#{dep.name}</yellow>:"
		puts "   #{dep.install_instructions}"
		if dep.install_comments
			puts "   #{dep.install_comments}"
		end
		puts
	end
end

def puts(text = nil)

def puts(text = nil)
	if text
		@stdout.puts(Utils::AnsiColors.ansi_colorize(text))
	else
		@stdout.puts
	end
	@stdout.flush
end

def puts_detail(text)

def puts_detail(text)
	puts "      #{text}"
end

def puts_header(text)

def puts_header(text)
	puts " <b>* #{text}</b>"
end