repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/health_checks/registry.rb | lib/portus/health_checks/registry.rb | # frozen_string_literal: true
module Portus
module HealthChecks
# Registry offers health check support for the configured Docker
# registry. Note that this will also fail if the registry is up and running
# but there's something wrong with the configuration (e.g. SSL problem).
class Registry
de... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/health_checks/ldap.rb | lib/portus/health_checks/ldap.rb | # frozen_string_literal: true
require "portus/http_helpers"
require "portus/ldap/adapter"
require "portus/ldap/errors"
module Portus
module HealthChecks
# LDAP offers health check support for LDAP servers.
class LDAP
extend ::Portus::LDAP::Adapter
extend ::Portus::LDAP::Errors
def self.na... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/health_checks/clair.rb | lib/portus/health_checks/clair.rb | # frozen_string_literal: true
require "portus/http_helpers"
module Portus
module HealthChecks
# Clair offers health check support for CoreOS Clair.
class Clair
extend ::Portus::HttpHelpers
def self.name
"clair"
end
def self.ready
server = APP_CONFIG["security"]["cla... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/background/sync.rb | lib/portus/background/sync.rb | # frozen_string_literal: true
require "portus/errors"
module Portus
module Background
# Sync synchronizes the contents from the registry into the DB.
class Sync
def initialize
@executed = false
end
# Returns how many seconds has to pass between each loop for this
# synchroni... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/background/registry.rb | lib/portus/background/registry.rb | # frozen_string_literal: true
module Portus
module Background
# Registry represents a task that syncs pending registry events into Portus.
class Registry
# Returns how many seconds has to pass between each loop for this
# background service.
def sleep_value
2
end
# Retu... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/background/ldap.rb | lib/portus/background/ldap.rb | # frozen_string_literal: true
require "portus/errors"
module Portus
module Background
# LDAP keeps track of some tasks to be done on the background for LDAP
# maintenance.
class LDAP
# The number of days in which we should force a recheck.
FORCE_CHECK_IN_DAYS = 7
def sleep_value
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/background/security_scanning.rb | lib/portus/background/security_scanning.rb | # frozen_string_literal: true
require "portus/security"
module Portus
module Background
# SecurityScanning represents a task for checking vulnerabilities of tags that
# have not been scanned yet.
class SecurityScanning
# Returns how many seconds has to pass between each loop for this
# backg... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/background/garbage_collector.rb | lib/portus/background/garbage_collector.rb | # frozen_string_literal: true
module Portus
module Background
# GarbageCollector cleans up the registry from old tags. The behavior of
# this task depends on the `delete.garbage_collector` configuration option.
class GarbageCollector
def initialize
@tags = nil
end
def sleep_val... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/ldap/errors.rb | lib/portus/ldap/errors.rb | # frozen_string_literal: true
module Portus
module LDAP
# Error to be raised when there's something wrong around the library (not
# the LDAP server itself, that should be already handled by Net::LDAP).
class Error < StandardError; end
# Errors contains some utility methods for error handling.
mo... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/ldap/adapter.rb | lib/portus/ldap/adapter.rb | # frozen_string_literal: true
module Portus
module LDAP
# Adapter implements a set of methods relevant for the LDAP adapter. That
# is, it contains a method that returns the adapter to be used, and another
# one containing the options to be used within this adapter.
module Adapter
# Returns the... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/ldap/login.rb | lib/portus/ldap/login.rb | # frozen_string_literal: true
module Portus
module LDAP
# Login contains a set of methods for logging the given user into Portus. At
# this point, we assume that LDAP binding worked, and so we want to
# register/login this user into Portus.
module Login
# Fetch the user assumed from `cfg` and l... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/ldap/search.rb | lib/portus/ldap/search.rb | # frozen_string_literal: true
require "portus/ldap/adapter"
require "portus/ldap/configuration"
require "portus/ldap/connection"
module Portus
module LDAP
# Search implements methods that only perform search actions towards the
# configured LDAP server.
class Search
include ::Portus::LDAP::Adapter... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/ldap/authenticatable.rb | lib/portus/ldap/authenticatable.rb | # frozen_string_literal: true
require "net/ldap"
require "devise/strategies/authenticatable"
require "portus/ldap/configuration"
require "portus/ldap/connection"
require "portus/ldap/errors"
require "portus/ldap/login"
module Portus
module LDAP
# Authenticatable implements Devise's authenticatable for LDAP ser... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/ldap/configuration.rb | lib/portus/ldap/configuration.rb | # frozen_string_literal: true
module Portus
module LDAP
# Configuration holds the parameters that are passed between the different
# components of LDAP support.
class Configuration
attr_reader :username, :password, :reason
def initialize(params)
@username = params.fetch(:user, {})[:u... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/ldap/connection.rb | lib/portus/ldap/connection.rb | # frozen_string_literal: true
require "portus/ldap/adapter"
module Portus
module LDAP
# Connection holds a set of methods which are responsible for binding to the
# LDAP server by considering the given configuration.
module Connection
# Bind to the LDAP server with the given configuration by using... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/security_backends/zypper.rb | lib/portus/security_backends/zypper.rb | # frozen_string_literal: true
# :nocov:
require "portus/security_backends/base"
module Portus
module SecurityBackend
# NOTE: support for this is experimental since this functionality has not
# been merged into master yet in zypper-docker.
class Zypper < ::Portus::SecurityBackend::Base
# Returns th... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/security_backends/dummy.rb | lib/portus/security_backends/dummy.rb | # frozen_string_literal: true
# :nocov:
require "portus/security_backends/base"
module Portus
module SecurityBackend
# Dummy implements a backend that simply returns fixture data. This backend
# is meant to be used only for development/testing purposes.
class Dummy < ::Portus::SecurityBackend::Base
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/security_backends/base.rb | lib/portus/security_backends/base.rb | # frozen_string_literal: true
require "portus/http_helpers"
module Portus
module SecurityBackend
# Base implements basic functionality that each security backend should
# have. All security backends should subclass this one.
class Base
include ::Portus::HttpHelpers
def initialize(repo, tag)... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/lib/portus/security_backends/clair.rb | lib/portus/security_backends/clair.rb | # frozen_string_literal: true
require "portus/security_backends/base"
# Docker images contain quite some empty blobs, and trying to upload them will
# fail.
EMPTY_LAYER_SHA = "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
module Portus
module SecurityBackend
# Clair implements all se... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/application.rb | config/application.rb | # frozen_string_literal: true
require_relative "boot"
require "rails/all"
bundler_groups = Rails.groups | [:db]
if Rails.env.test? || Rails.env.development? || ENV["INCLUDE_ASSETS_GROUP"] == "yes"
bundler_groups << :assets
end
Bundler.require(*bundler_groups)
module Portus
# Application implements the Rails app... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/environment.rb | config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/puma.rb | config/puma.rb | #!/usr/bin/env puma
# frozen_string_literal: true
# Set CConfig straight.
ENV["CCONFIG_PREFIX"] = "PORTUS"
# Workers and connections.
threads 1, ENV.fetch("PORTUS_PUMA_MAX_THREADS") { 4 }.to_i
workers ENV.fetch("PORTUS_PUMA_WORKERS") { 4 }.to_i
# We can bind in three different ways:
#
# 1. TCP and SSL. For this, yo... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
%i[root teams namespaces admin registry_api repositories users].each { |f| draw f }
mount API::RootAPI => "/"
mount GrapeSwaggerRails::Engine, at: "/documentation" unless Rails.env.production?
# Error pages.
%w[401 404 422 500].each do |code|
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/boot.rb | config/boot.rb | # frozen_string_literal: true
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += %i[password reset_password_token authenticity_token]
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/ldap_authenticatable.rb | config/initializers/ldap_authenticatable.rb | # frozen_string_literal: true
require "portus/ldap/authenticatable"
Warden::Strategies.add(:ldap_authenticatable, ::Portus::LDAP::Authenticatable)
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/version.rb | config/initializers/version.rb | # frozen_string_literal: true
# Version module
# Makes the app version available to the application itself
# Needs the git executable for all git operations
module Version
# Returns true if the version can be extracted by using git, false
# otherwise.
def self.git?
# Check that the ".git" directory at least ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/rails.rb | config/initializers/rails.rb | # frozen_string_literal: true
# Default values for Rails config values. Introduced when migrating from Rails 4
# to 5.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = true
# Enable origin-checking CSRF mitigation. Previous versions had fal... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/01_database.rb | config/initializers/01_database.rb | # frozen_string_literal: true
require "fileutils"
require "portus/db"
def link!(name)
link = Rails.root.join("db", "schema.rb")
target = Rails.root.join("db", "schema.#{name}.rb")
FileUtils.ln_s(target, link, force: true)
Rails.logger.tagged(:schema) { Rails.logger.info "Selected the schema for #{name}" }
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/portus_user.rb | config/initializers/portus_user.rb | # frozen_string_literal: true
# This file updates the password of the portus hidden user if this
# exists and the secret is given.
portus_exists = false
begin
portus_exists = User.exists?(username: "portus")
rescue StandardError
# We will ignore any error and skip this initializer. This is done this way
# becau... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/session_store.rb | config/initializers/session_store.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: "_portus_session"
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/mailer_url_options.rb | config/initializers/mailer_url_options.rb | # frozen_string_literal: true
# If you're on staging/production, then you must be using SSL. Moreover, if
# you're on development mode and you have set PORTUS_USE_SSL, then SSL will also
# be required. Otherwise, we will fallback to regular HTTP.
protocol = if !Rails.env.development? || !ENV["PORTUS_USE_SSL"].nil?
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/devise.rb | config/initializers/devise.rb | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/swagger.rb | config/initializers/swagger.rb | # frozen_string_literal: true
unless Rails.env.production?
protocol = ::APP_CONFIG.enabled?("check_ssl_usage") ? "https://" : "http://"
port = if ENV["PORTUS_PUMA_HOST"]
val = ENV["PORTUS_PUMA_HOST"].split(":")
":#{val.last}" if val.size == 2
end
GrapeSwaggerRails.options.url ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/registry.rb | config/initializers/registry.rb | # frozen_string_literal: true
# Creates a new registry with the given parameters. This method assumes that the
# database is ready and that there is no registry setup already.
def create_registry!(params)
svc = ::Registries::CreateService.new(nil, params)
svc.execute
return unless svc.valid?
Rails.logger.tagg... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_con... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/inflections.rb | config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflect... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/activity.rb | config/initializers/activity.rb | # frozen_string_literal: true
# Re-opening from the `public_activity` gem due to a regression when upgrading
# to Rails 5.x. See: https://github.com/chaps-io/public_activity/issues/321.
module ::PublicActivity
class Activity
serialize :parameters, Hash
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/gravatar_image_tag.rb | config/initializers/gravatar_image_tag.rb | # frozen_string_literal: true
GravatarImageTag.configure do |config|
config.default_image = :identicon
config.include_size_attributes = true
config.rating = "G"
config.size = 40
config.secure = true
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/cookies_serializer.rb | config/initializers/cookies_serializer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/assets.rb | config/initializers/assets.rb | # frozen_string_literal: true
Rails.application.config.assets.version = "1.0"
Rails.application.config.assets.precompile += %w[*.woff2]
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/mail.rb | config/initializers/mail.rb | # frozen_string_literal: true
require "portus/mail"
unless Rails.env.test?
# In some weird cases APP_CONFIG is not even there. In these cases, just go
# back to sendmail.
if defined?(APP_CONFIG)
# Check that emails have the proper format.
mail = ::Portus::Mail::Utils.new(APP_CONFIG["email"])
mail.ch... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/environment_check.rb | config/initializers/environment_check.rb | # frozen_string_literal: true
# This file checks for important environment variables. Some of them have to be
# set in order for Portus to work in certain scenarios (e.g. secret key base on
# production), others are strong recommendations.
# Checks that the secret value has been set either in `config/secrets.yml` or ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/ruby.rb | config/initializers/ruby.rb | # frozen_string_literal: true
##
# Checks the ruby requirements.
raise StandardError, "Please, use Ruby 2.4" unless defined?(RUBY_ENGINE)
raise StandardError, "Only MRI is supported" unless RUBY_ENGINE == "ruby"
supported = Gem::Version.new(File.read(Rails.root.join(".ruby-version")))
current = Gem::Version.new(RU... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/draw_def.rb | config/initializers/draw_def.rb | # frozen_string_literal: true
# Code taken from Gitlab's routing_draw.rb file.
def draw(routes_module)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_module}.rb")))
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish
# to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers i... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/checks.rb | config/initializers/checks.rb | # frozen_string_literal: true
# Clear the cache
Rails.cache.write("portus-checks", nil)
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/initializers/devise/oauth.rb | config/initializers/devise/oauth.rb | # frozen_string_literal: true
# In order to provide a new backend, you have to:
#
# 1. Add support for it on the `lib` directory or add the gem on the Gemfile.
# 2. Add a method called "#{backend}_fetch_options" on this file that returns
# the specific options to be passed to omniauth for this backend.
# 3. Add it ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes/users.rb | config/routes/users.rb | # frozen_string_literal: true
devise_for :users, controllers: { registrations: "auth/registrations",
sessions: "auth/sessions",
passwords: "passwords",
omniauth_callbacks: "auth/omniauth_callba... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes/namespaces.rb | config/routes/namespaces.rb | # frozen_string_literal: true
resources :namespaces, only: %i[index show] do
resources :webhooks do
resources :headers, only: %i[create destroy], controller: :webhook_headers
resources :deliveries, only: [:update], controller: :webhook_deliveries
member do
put "toggle_enabled"
end
end
end
ge... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes/registry_api.rb | config/routes/registry_api.rb | # frozen_string_literal: true
namespace :v2, module: "api/v2", defaults: { format: :json } do
root to: "ping#ping", as: :ping
resource :token, only: [:show]
resource :webhooks, only: [] do
resources :events, only: [:create]
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes/teams.rb | config/routes/teams.rb | # frozen_string_literal: true
resources :teams, only: %i[index show] do
member do
get "typeahead/:query" => "teams#typeahead", as: "typeahead",
:defaults => { format: "json" }
end
end
get "/teams/typeahead/:query" => "teams#all_with_query",
as: "teams_typeahead", :defaults => { format: "json" }
re... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes/repositories.rb | config/routes/repositories.rb | # frozen_string_literal: true
resources :repositories, only: %i[index show destroy] do
get :team, action: :team_repositories, on: :collection
get :other, action: :other_repositories, on: :collection
post :toggle_star, on: :member
resources :comments, only: %i[create destroy]
end
resources :tags, only: %i[show... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes/root.rb | config/routes/root.rb | # frozen_string_literal: true
resources :errors, only: [:show]
resource :dashboard, only: [:index]
resources :search, only: [:index]
resources :explore, only: [:index]
resources :help, only: [:index]
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/routes/admin.rb | config/routes/admin.rb | # frozen_string_literal: true
namespace :admin do
resources :activities, only: [:index]
resources :registries, except: %i[show destroy]
resources :users do
put "toggle_admin", on: :member
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "s... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/environments/development.rb | config/environments/development.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/environments/staging.rb | config/environments/staging.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/config/environments/production.rb | config/environments/production.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/cli_spec.rb | spec/cli_spec.rb | require File.dirname(__FILE__) + "/helpers.rb"
require "sensu/cli"
describe "Sensu::CLI" do
include Helpers
it "can provide default configuration options" do
expect(File).to receive(:exist?) { true }
expect(Dir).to receive(:exist?) { true }
options = Sensu::CLI.read
expected = {
:config_fil... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/helpers.rb | spec/helpers.rb | require "rspec"
require "eventmachine"
require "em-http-request"
require "securerandom"
require "sensu/json"
require "webmock/rspec"
WebMock.allow_net_connect!
module Helpers
def setup_options
@options = {
:config_file => File.join(File.dirname(__FILE__), "config.json"),
:config_dirs => [File.join(F... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/daemon_spec.rb | spec/daemon_spec.rb | require File.dirname(__FILE__) + '/helpers.rb'
require 'sensu/daemon'
describe 'Sensu::Daemon' do
include Helpers
before do
class Test
include Sensu::Daemon
end
@daemon = Test.new(:log_level => :fatal)
end
it 'can create a pid file' do
@daemon.setup_process(:pid_file => '/tmp/sensu.pid'... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/utilities_spec.rb | spec/utilities_spec.rb | require File.dirname(__FILE__) + "/helpers.rb"
require "sensu/utilities"
describe "Sensu::Utilities" do
include Helpers
include Sensu::Utilities
it "can determine that we are testing" do
expect(testing?).to be(true)
end
it "can retry a block call until it returns true" do
async_wrapper do
ti... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/extensions/mutators/syntax.rb | spec/extensions/mutators/syntax.rb | module Sensu
module Extension
class Syntax < Mutator
def name
'syntax'
end
def description
'will raise a script error'
end
def run(event)
yield('boom', 0)
end
end
end
end
end
| ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/extensions/mutators/opentsdb.rb | spec/extensions/mutators/opentsdb.rb | module Sensu
module Extension
class OpenTSDB < Mutator
def name
'opentsdb'
end
def description
'converts graphite plain text format to opentsdb'
end
def run(event)
metrics = Array.new
event[:check][:output].each_line do |line|
name, value, ... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/extensions/mutators/settings.rb | spec/extensions/mutators/settings.rb | module Sensu
module Extension
class Settings < Mutator
def name
'settings'
end
def description
'tests the loaded settings hash'
end
def run(event)
yield(settings.has_key?(:handlers).to_s, 0)
end
end
end
end
| ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/extensions/mutators/fail.rb | spec/extensions/mutators/fail.rb | module Sensu
module Extension
class Fail < Mutator
def name
'fail'
end
def description
'fails to do anything'
end
def run(event)
yield('fail', 2)
end
end
end
end
| ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/extensions/bridges/file.rb | spec/extensions/bridges/file.rb | module Sensu
module Extension
class LatestEventFile < Bridge
def name
'latest_event_file'
end
def description
'writes the latest event data to /tmp/sensu_event_bridge.json'
end
def run(event, &block)
update_file = Proc.new do
event_json = Sensu::JS... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/extensions/checks/sensu_cpu_time.rb | spec/extensions/checks/sensu_cpu_time.rb | module Sensu
module Extension
class SensuCPUTime < Check
def name
'sensu_cpu_time'
end
def description
'returns json formatted sensu cpu time metrics'
end
def definition
{
:type => 'metric',
:name => name,
:subscribers => ['test... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/extensions/checks/sensu_gc_metrics.rb | spec/extensions/checks/sensu_gc_metrics.rb | module Sensu
module Extension
class SensuGCMetrics < Check
def name
'sensu_gc_metrics'
end
def description
'returns json formatted sensu ruby garbage collection metrics'
end
def definition
{
:type => 'metric',
:name => name,
:st... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/api/process_spec.rb | spec/api/process_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/api/process"
require "sensu/server/process"
describe "Sensu::API::Process" do
include Helpers
before do
async_wrapper do
client = client_template
client[:timestamp] = epoch
client[:redact] = ["supersecret"]
c... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | true |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/api/validators/client_spec.rb | spec/api/validators/client_spec.rb | require "sensu/api/validators/client"
describe "Sensu::API::Validators::Client" do
before do
@validator = Sensu::API::Validators::Client.new
end
it "can validate a client definition" do
client = {
:name => "i-424242",
:address => "127.0.0.1",
:subscriptions => ["test"]
}
expect... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/api/utilities/filter_response_content_spec.rb | spec/api/utilities/filter_response_content_spec.rb | require "sensu/api/utilities/filter_response_content"
describe "Sensu::API::Utilities::FilterResponseContent" do
include Sensu::API::Utilities::FilterResponseContent
it "can create a nested hash from a dot notation key and value" do
hash = dot_notation_to_hash("rspec.foo.bar", 42)
expect(hash).to eq({:rsp... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/mutators/tag.rb | spec/mutators/tag.rb | #!/usr/bin/env ruby
require "rubygems"
require "sensu/json"
event = Sensu::JSON.load(STDIN.read)
event.merge!(:mutated => true)
puts Sensu::JSON.dump(event)
| ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/server/socket_spec.rb | spec/server/socket_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/server/socket"
describe "Sensu::Server::Socket" do
include Helpers
before do
@event_data = Sensu::JSON.dump(event_template)
end
it "can send data to a listening socket" do
async_wrapper do
EM::start_server("127.0.0.1"... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/server/tessen_spec.rb | spec/server/tessen_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/server/tessen"
require "sensu/settings"
require "sensu/logger"
require "sensu/redis"
describe "Sensu::Server::Tessen" do
include Helpers
before do
async_wrapper do
@tessen = Sensu::Server::Tessen.new(
:settings => Sens... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/server/handle_spec.rb | spec/server/handle_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/server/process"
describe "Sensu::Server::Handle" do
include Helpers
before do
@server = Sensu::Server::Process.new(options)
settings = Sensu::Settings.get(options)
@handlers = settings[:handlers]
@event_id = event_templ... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/server/filter_spec.rb | spec/server/filter_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/server/process"
describe "Sensu::Server::Filter" do
include Helpers
before do
@server = Sensu::Server::Process.new(options)
@handler = {}
@event = event_template
end
it "can determine if handler handles a silenced event... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/server/mutate_spec.rb | spec/server/mutate_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/server/process"
describe "Sensu::Server::Mutate" do
include Helpers
before do
@server = Sensu::Server::Process.new(options)
@event = event_template
end
it "can mutate event data" do
async_wrapper do
handler = {
... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/server/process_spec.rb | spec/server/process_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/server/process"
describe "Sensu::Server::Process" do
include Helpers
before do
@server = Sensu::Server::Process.new(options)
@event = event_template
end
it "can connect to redis" do
async_wrapper do
@server.setup_... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | true |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/client/socket_spec.rb | spec/client/socket_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/client/socket"
describe Sensu::Client::Socket do
include Helpers
subject { described_class.new(nil) }
let(:logger) { double("Logger") }
let(:transport) { double("Transport") }
let(:settings) do
{
:client => client_temp... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/client/http_socket_spec.rb | spec/client/http_socket_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/client/process"
describe "Sensu::Client::HTTPSocket" do
include Helpers
before do
@client = Sensu::Client::Process.new(options)
end
it "can provide basic version and transport information" do
async_wrapper do
@client.... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/client/process_spec.rb | spec/client/process_spec.rb | require File.join(File.dirname(__FILE__), "..", "helpers.rb")
require "sensu/client/process"
describe "Sensu::Client::Process" do
include Helpers
before do
@client = Sensu::Client::Process.new(options)
end
it "can connect to the transport" do
async_wrapper do
@client.setup_transport do |transp... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/profilers/ruby_profiler.rb | spec/profilers/ruby_profiler.rb | require 'ruby-prof'
module Sensu
module Extension
class RubyProfiler < Generic
def name
'ruby_profiler'
end
def description
'uses ruby-prof to profile sensu'
end
def post_init
RubyProf.start
end
def report_path
'/tmp/ruby_profiler.' + :... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/spec/profilers/gc_profiler.rb | spec/profilers/gc_profiler.rb | module Sensu
module Extension
class GCProfiler < Generic
def name
'gc_profiler'
end
def description
'creates a ruby garbage collection report'
end
def post_init
GC::Profiler.enable
@reported = false
@timer = EM::PeriodicTimer.new(60) do
... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu.rb | lib/sensu.rb | module Sensu
# A monitoring framework that aims to be simple, malleable, & scalable.
end
| ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/sandbox.rb | lib/sensu/sandbox.rb | module Sensu
module Sandbox
# Evaluate a Ruby expression within the context of a simple
# "sandbox", a Proc in a module method. As of Ruby 2.3.0,
# `$SAFE` no longer supports levels > 1, so its use has been
# removed from this method. A single value is provided to the
# "sandbox".
#
# @par... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/daemon.rb | lib/sensu/daemon.rb | require "rubygems"
gem "eventmachine", "1.2.7"
gem "sensu-json", "2.1.1"
gem "sensu-logger", "1.2.2"
gem "sensu-settings", "10.17.0"
gem "sensu-extension", "1.5.2"
gem "sensu-extensions", "1.11.0"
gem "sensu-transport", "8.3.0"
gem "sensu-spawn", "2.5.0"
gem "sensu-redis", "2.4.0"
require "time"
require "uri"
if RU... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/utilities.rb | lib/sensu/utilities.rb | gem "parse-cron", "0.1.4"
require "securerandom"
require "sensu/sandbox"
require "parse-cron"
require "socket"
module Sensu
module Utilities
EVAL_PREFIX = "eval:".freeze
NANOSECOND_RESOLUTION = 9.freeze
# Determine if Sensu is being tested, using the process name.
# Sensu is being test if the proce... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/constants.rb | lib/sensu/constants.rb | module Sensu
unless defined?(Sensu::VERSION)
# Sensu release version.
VERSION = "1.9.0".freeze
# Sensu release information.
RELEASE_INFO = {
:version => VERSION
}
# Sensu check severities.
SEVERITIES = %w[ok warning critical unknown].freeze
# Process signals that trigger a Sen... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/cli.rb | lib/sensu/cli.rb | require "optparse"
require "sensu/logger/constants"
module Sensu
class CLI
# Parse CLI arguments using Ruby stdlib `optparse`. This method
# provides Sensu with process options (eg. log file), and can
# provide users with information, such as the Sensu version.
#
# @param arguments [Array] to par... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/http_handler.rb | lib/sensu/api/http_handler.rb | require "sensu/utilities"
require "sensu/api/routes"
require "sensu/api/utilities/filter_response_content"
gem "em-http-server", "0.1.8"
require "em-http-server"
require "base64"
module Sensu
module API
class HTTPHandler < EM::HttpServer::Server
include Routes
include Utilities::FilterResponseConte... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/routes.rb | lib/sensu/api/routes.rb | require "sensu/api/routes/settings"
require "sensu/api/routes/info"
require "sensu/api/routes/health"
require "sensu/api/routes/clients"
require "sensu/api/routes/checks"
require "sensu/api/routes/request"
require "sensu/api/routes/events"
require "sensu/api/routes/resolve"
require "sensu/api/routes/aggregates"
require... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/process.rb | lib/sensu/api/process.rb | require "sensu/daemon"
require "sensu/api/http_handler"
module Sensu
module API
class Process
include Daemon
# Create an instance of the Sensu API process, setup the Redis
# and Transport connections, start the API HTTP server, set up
# API process signal traps (for stopping), within the... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/validators/invalid.rb | lib/sensu/api/validators/invalid.rb | module Sensu
module API
module Validators
# The error class for validation.
class Invalid < RuntimeError; end
end
end
end
| ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/validators/client.rb | lib/sensu/api/validators/client.rb | require "sensu/api/validators/invalid"
require "sensu/settings/rules"
require "sensu/settings/validators/client"
module Sensu
module API
module Validators
class Client
# Include Sensu Settings rules and client validator.
include Sensu::Settings::Rules
include Sensu::Settings::Valida... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/validators/check.rb | lib/sensu/api/validators/check.rb | require "sensu/api/validators/invalid"
require "sensu/settings/rules"
require "sensu/settings/validators/check"
module Sensu
module API
module Validators
class Check
# Include Sensu Settings rules and check validator.
include Sensu::Settings::Rules
include Sensu::Settings::Validator... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/routes/events.rb | lib/sensu/api/routes/events.rb | require "sensu/api/utilities/resolve_event"
module Sensu
module API
module Routes
module Events
include Utilities::ResolveEvent
EVENTS_URI = /^\/(?:events|incidents)$/
EVENTS_CLIENT_URI = /^\/(?:events|incidents)\/([\w\.-]+)$/
EVENT_URI = /^\/(?:events|incidents)\/([\w\.-]+... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
sensu/sensu | https://github.com/sensu/sensu/blob/1cb846745469489b0644a303c34cd32adc3f4100/lib/sensu/api/routes/resolve.rb | lib/sensu/api/routes/resolve.rb | require "sensu/api/utilities/resolve_event"
module Sensu
module API
module Routes
module Resolve
include Utilities::ResolveEvent
RESOLVE_URI = /^\/resolve$/
# POST /resolve
def post_resolve
rules = {
:client => {:type => String, :nil_ok => false},
... | ruby | MIT | 1cb846745469489b0644a303c34cd32adc3f4100 | 2026-01-04T15:52:31.810392Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.