Class: Scout::Command::Install

Inherits:
Scout::Command show all
Defined in:
lib/scout/command/install.rb

Constant Summary

Constants inherited from Scout::Command

HTTP_HEADERS

Constants included from HTTP

HTTP::CA_FILE, HTTP::VERIFY_MODE

Instance Attribute Summary

Attributes inherited from Scout::Command

#config_dir, #history, #hostname, #log_path, #server, #server_name

Instance Method Summary collapse

Methods inherited from Scout::Command

#create_pid_file_or_exit, dispatch, #initialize, #level, #log, program_name, #program_name, program_path, #program_path, usage, #usage, user, #user, #verbose?

Methods included from HTTP

#build_http

Constructor Details

This class inherits a constructor from Scout::Command

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
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
# File 'lib/scout/command/install.rb', line 6

def run
  create_pid_file_or_exit

  abort usage unless $stdin.tty? || @args.first
  
  puts <<-END_INTRO.gsub(/^ {8}/, "")
  === Scout Installation Wizard ===
  END_INTRO

  key = @args.first || get_key_from_stdin

  puts "\nAttempting to contact the server..."
  begin
    test_server_connection(key)

    create_cron_script(key) if cron_script_required?

    puts <<-END_SUCCESS.gsub(/^ {10}/, "")
    Success!

    Now, you must setup Scout to run on a scheduled basis.

    #{special_cron_information}

    Run `crontab -e`, pasting the line below into your Crontab file:

    * * * * * #{cron_command(key)}

    For help setting up Scout with crontab, please visit:

      http://server.pingdom.com/help#cron

    END_SUCCESS
  rescue SystemExit
    puts $!.message
    puts <<-END_ERROR.gsub(/^ {10}/, "")

    Failed. 
    For more help, please visit:

    http://server.pingdom.com/help

    END_ERROR
  end
end