def run
abort usage unless $stdin.tty?
puts "=== Scout Installation Wizard ===\n\nYou need the Client Key displayed in the Client Settings tab.\nIt looks like:\n\n6ecad322-0d17-4cb8-9b2c-a12c4541853f\n\nEnter the Client Key:\n".gsub(/^ {8}/, "")
key = gets.to_s.strip
puts "\nAttempting to contact the server..."
begin
Scout::Server.new(server, key, history, log) { |scout| scout.test }
puts "Success!\n\nNow, you must setup Scout to run on a scheduled basis.\n\nIf you are using the system crontab\n(usually located at /etc/crontab):\n\n****** START CRONTAB SAMPLE ******\n*/30 * * * * \#{user} \#{program_path} \#{key}\n****** END CRONTAB SAMPLE ******\n\nIf you are using this current user's crontab\n(using crontab -e to edit):\n\n****** START CRONTAB SAMPLE ******\n*/30 * * * * \#{program_path} \#{key}\n****** END CRONTAB SAMPLE ******\n\nFor help setting up Scout with crontab, please visit:\n\nhttp://scoutapp.com/help#cron\n\n".gsub(/^ {10}/, "")
rescue SystemExit
puts "\nCould not contact server. The client key may be incorrect.\nFor more help, please visit:\n\nhttp://scoutapp.com/help\n\n".gsub(/^ {10}/, "")
end
end