Sha256: 63fd8eac6f0c49f9b8b6a54e33337e97726fb5d612b54d6d060a9eabb498ef25

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

#!/usr/bin/env ruby -wKU

module Scout
  class Command
    class Install < Command
      def run
        create_pid_file_or_exit

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

        You need the 40-character alphanumeric key displayed on the account page.

        Enter the Key:
        END_INTRO
        key = gets.to_s.strip

        puts "\nAttempting to contact the server..."
        begin
          Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy, @roles, @hostname) do |scout|
            scout.fetch_plan
            scout.run_plugins_by_plan
          end

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

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

          If you are using the system crontab
          (usually located at /etc/crontab):

          ****** START CRONTAB SAMPLE ******
          * * * * *  #{user} #{program_path} #{key}
          ******  END CRONTAB SAMPLE  ******

          If you are using this current user's crontab
          (using crontab -e to edit):

          ****** START CRONTAB SAMPLE ******
          * * * * *  #{program_path} #{key}
          ******  END CRONTAB SAMPLE  ******

          For help setting up Scout with crontab, please visit:

            http://scoutapp.com/help#cron

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

          Failed. 
          For more help, please visit:

          http://scoutapp.com/help

          END_ERROR
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scout-5.6.8 lib/scout/command/install.rb
scout-5.6.8.pre lib/scout/command/install.rb
scout-5.6.7 lib/scout/command/install.rb
scout-5.6.7.pre lib/scout/command/install.rb