Sha256: a0d5bcd57e2f5f57450a105552179106fcc1aff5cc0051b775102252dc3d8591
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require "thor" require "dddr" require "terminal-table" require "yaml" require "toml-rb" require "fileutils" require "ostruct" require "sucker_punch" require 'resend' require_relative "harbr/version" require_relative "harbr/container" require_relative "harbr/job" require_relative "harbr/next/job" # Harbr module for managing containers, jobs, ports, and 2s module Harbr DEFAULT_DIRECTORY = "/var/harbr/containers" DEFAULT_DIRECTORY_DATA_DIR = "#{DEFAULT_DIRECTORY}/.data" class Error < StandardError; end def self.notifiable begin yield if block_given? send_notification("Harbr: #{name} deployed successfully","<p>harbr: #{version} of #{name} deployed successfully</p>") rescue => e html_content = "<p>Error: #{e.message}</p> <p>#{e.backtrace.join('<br>')}</p> <p>harbr: #{version} of #{name} failed to deploy</p>" Harbr.send_notification("Harbr: #{name} failed to deploy",html_content) end end def self.send_notification(subject, body) begin Resend.api_key = ENV['RESEND_API_KEY'] params = { from: ENV['RESEND_FROM'], to: ENV['RESEND_TO'], subject: subject, html: body } Resend::Emails.send(params) rescue => e puts "Error sending notification: #{e.message}" return end end end Dddr.configure do |config| config.data_dir = Harbr::DEFAULT_DIRECTORY_DATA_DIR end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
harbr-0.1.32 | lib/harbr.rb |
harbr-0.1.31 | lib/harbr.rb |