Sha256: 27573d963a569e723369d76e514b64d01fde7abed2e4986417d465369c846714
Contents?: true
Size: 1.3 KB
Versions: 20
Compression:
Stored size: 1.3 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" # 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.send_notification(subject, body) 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}" end def self.notifiable(name, version) 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>" send_notification("Harbr: #{name} failed to deploy", html_content) end end Dddr.configure do |config| config.data_dir = Harbr::DEFAULT_DIRECTORY_DATA_DIR end
Version data entries
20 entries across 20 versions & 1 rubygems