Sha256: d51926571a559c515567b3c7c0eb7880f2db6b968b22a3b037d222fdbd5c03b7

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# Headless is no longer needed will be removed later
# require 'headless'
require 'watir'
require 'watir-webdriver-performance'
require 'ostruct'
require 'aws/s3'

def require_all(path)
  Dir.glob(File.dirname(__FILE__) + path + '/*.rb') do |file|
    require File.dirname(__FILE__)  + path + '/' + File.basename(file, File.extname(file))
  end
end

def setup_screenshot_dir
  FileUtils.mkdir_p RAGIOS_HERCULES_SCREENSHOT_DIR
  FileUtils.rm_rf(Dir.glob("#{RAGIOS_HERCULES_SCREENSHOT_DIR}/*"))
end

RAGIOS_HERCULES_SCREENSHOT_DIR = "#{Dir.pwd}/screenshots/tmp"
RAGIOS_HERCULES_ENABLE_SCREENSHOTS = ENV['RAGIOS_HERCULES_ENABLE_SCREENSHOTS'] == 'true' ? true : false

RAGIOS_HERCULES_S3_DIR = ENV["RAGIOS_HERCULES_S3_DIR"]

def file_age(name)
  (Time.now - File.ctime(name))/(24*3600)
end

def clear_screenshots_cache!
  Dir.chdir(RAGIOS_HERCULES_SCREENSHOT_DIR)
  Dir.glob("*.*").each { |filename| File.delete(filename) if file_age(filename) > 1 }
end

if RAGIOS_HERCULES_ENABLE_SCREENSHOTS
  setup_screenshot_dir
  AWS::S3::Base.establish_connection!(
    :access_key_id     => ENV['AWS_ACCESS_KEY_ID'],
    :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
  )
  clear_screenshots_cache!
end

require_all '/uptime_monitor'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uptime_monitor-0.7.0 lib/uptime_monitor.rb