Class: AlertMachine::RailsEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_environment.rb

Constant Summary collapse

ENVIRONMENT_PATH =
"./config/environment.rb"

Class Method Summary collapse

Class Method Details

.bootup(path = ENVIRONMENT_PATH) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rails_environment.rb', line 5

def self.bootup(path = ENVIRONMENT_PATH)
  require path
rescue Exception => e
  puts "Exception: #{e.to_s}"
  puts e.backtrace.join("\n")
  config = AlertMachine.config
  ActionMailer::Base.mail(
    :from => config['from'],
    :to => config['to'],
    :subject => "AlertMachine Failed: Environment could not load."
  ) do |format|
    format.text {
      render :text => <<TXT
      machine: #{`hostname`}
      exception: #{e.to_s}
      #{e.caller.join('\n')}
TXT
    }
  end.deliver
end