Add bin and edit workflow
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s

This commit is contained in:
2026-09-16 13:11:16 -06:00
parent c8ac4fcae5
commit 4cee170d66
17576 changed files with 895740 additions and 2 deletions
@@ -0,0 +1,54 @@
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
module Metrics
# Represents a configuration for the metrics library.
class Config
DEFAULT_PATH = ENV.fetch("METRICS_CONFIG_DEFAULT_PATH", "config/metrics.rb")
# Load the configuration from the given path.
# @parameter path [String] The path to the configuration file.
# @returns [Config] The loaded configuration.
def self.load(path)
config = self.new
if File.exist?(path)
config.instance_eval(File.read(path), path)
end
return config
end
# Load the default configuration.
# @returns [Config] The default configuration.
def self.default
@default ||= self.load(DEFAULT_PATH)
end
# Prepare the backend, e.g. by loading additional libraries or instrumentation.
def prepare
end
# Require a specific metrics backend implementation.
def require_backend(env = ENV)
if backend = env["METRICS_BACKEND"]
begin
if require(backend)
Metrics.extend(Backend::Interface)
return true
end
rescue LoadError => error
warn "Unable to load metrics backend: #{backend.inspect}!"
end
end
return false
end
# Load the default configuration.
DEFAULT = self.default
end
end