Sha256: 4a51fe478aa9919740b7dab0cc6bc74900dfec57914f3952bc6a5a9378f34585

Contents?: true

Size: 760 Bytes

Versions: 3

Compression:

Stored size: 760 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
        Makesure.log "Everything is copacetic"
        
      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.6 lib/makesure/verify.rb
makesure-0.0.5 lib/makesure/verify.rb
makesure-0.0.4 lib/makesure/verify.rb