Sha256: 5f0a005fcee6d851ea69eca88424035a3310590dba2ce46113101b88158a675c

Contents?: true

Size: 713 Bytes

Versions: 3

Compression:

Stored size: 713 Bytes

Contents

module Makesure
  
  class Verify
    
    attr_reader :name, :cron, :blk
    
    def initialize(name, cron, blk)
      @name = name
      @cron = cron
      @blk  = blk
    end
    
    def run!
      begin
        
        blk.call
        
      rescue Exception => e
        Makesure.warn "Uh oh, something's up"
        Makesure.warn "\t" + e.message
        
        # send an email with the details
        body = ""
        body << "[#{Time.now.to_s}] Verification failure:\n\n"
        body << e.backtrace.join("\n")
        Makesure.send_alert("FAILED verification alert: #{e.message}", body)
        
        return false
      #else
      #ensure
      end
      
      true
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
makesure-0.0.3 lib/makesure/verify.rb
makesure-0.0.2 lib/makesure/verify.rb
makesure-0.0.1 lib/makesure/verify.rb