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 "  === Scout Installation Wizard ===\n  END_INTRO\n\n  key = @args.first || get_key_from_stdin\n\n  puts \"\\nAttempting to contact the server...\"\n  begin\n    test_server_connection(key)\n\n    create_cron_script(key) if cron_script_required?\n\n    puts <<-END_SUCCESS.gsub(/^ {10}/, \"\")\n    Success!\n\n    Now, you must setup Scout to run on a scheduled basis.\n\n    \#{special_cron_information}\n\n    Run `crontab -e`, pasting the line below into your Crontab file:\n\n    * * * * * \#{cron_command(key)}\n\n    For help setting up Scout with crontab, please visit:\n\n      http://server.pingdom.com/help#cron\n\n    END_SUCCESS\n  rescue SystemExit\n    puts $!.message\n    puts <<-END_ERROR.gsub(/^ {10}/, \"\")\n\n    Failed. \n    For more help, please visit:\n\n    http://server.pingdom.com/help\n\n    END_ERROR\n  end\nend\n".gsub(/^ {8}/, "")