Class: Scout::Command::Install

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

Constant Summary

Constants inherited from Scout::Command

HTTP_HEADERS

Instance Attribute Summary

Attributes inherited from Scout::Command

#config_dir, #history, #log_path, #server

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?

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/es-scout/command/install.rb', line 6

def run
  create_pid_file_or_exit

  abort usage unless $stdin.tty?
  
  puts "  === Scout Installation Wizard ===\n\n  You need the Server Key displayed in the Server Settings tab.\n  It looks like:\n\n    6ecad322-0d17-4cb8-9b2c-a12c4541853f\n\n  Enter the Server Key:\n  END_INTRO\n  key = gets.to_s.strip\n\n  puts \"\\nAttempting to contact the server...\"\n  begin\n    Scout::Server.new(server, key, history, log) do |scout|\n      scout.fetch_plan\n      scout.run_plugins_by_plan\n    end\n\n    puts <<-END_SUCCESS.gsub(/^ {10}/, \"\")\n    Success!\n\n    Now, you must setup Scout to run on a scheduled basis.\n\n    If you are using the system crontab\n    (usually located at /etc/crontab):\n\n    ****** START CRONTAB SAMPLE ******\n    * * * * *  \#{user} \#{program_path} \#{key}\n    ******  END CRONTAB SAMPLE  ******\n\n    If you are using this current user's crontab\n    (using crontab -e to edit):\n\n    ****** START CRONTAB SAMPLE ******\n    * * * * *  \#{program_path} \#{key}\n    ******  END CRONTAB SAMPLE  ******\n\n    For help setting up Scout with crontab, please visit:\n\n      http://scoutapp.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://scoutapp.com/help\n\n    END_ERROR\n  end\nend\n".gsub(/^ {8}/, "")