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 |
|---|---|---|---|---|---|---|---|---|
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/redirect_to_test.rb | test/redirect_to_test.rb | # frozen_string_literal: true
require 'test_helper'
class Machine;
def self.human_name; 'Machine'; end
end
class MachinesController < InheritedResources::Base
def create
create!{ complex_url(:create, true, true) }
end
def update
update!{ complex_url(:update, false, false) }
end
def destroy
d... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/nested_belongs_to_with_shallow_test.rb | test/nested_belongs_to_with_shallow_test.rb | # frozen_string_literal: true
require 'test_helper'
class Dresser
end
class Shelf
end
class Plate
end
class PlatesController < InheritedResources::Base
belongs_to :dresser, :shelf, shallow: true
end
class NestedBelongsToWithShallowTest < ActionController::TestCase
tests PlatesController
def setup
draw_r... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/defaults_test.rb | test/defaults_test.rb | # frozen_string_literal: true
require 'test_helper'
class Malarz
def self.human_name; 'Painter'; end
def to_param
self.slug
end
end
class PaintersController < InheritedResources::Base
defaults instance_name: 'malarz', collection_name: 'malarze',
resource_class: Malarz, route_prefix: nil,
... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/optional_belongs_to_test.rb | test/optional_belongs_to_test.rb | # frozen_string_literal: true
require 'test_helper'
class Brands; end
class Category; end
class Product
def self.human_name; 'Product'; end
end
class ProductsController < InheritedResources::Base
belongs_to :brand, :category, polymorphic: true, optional: true
end
class OptionalTest < ActionController::TestCase
... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/base_test.rb | test/base_test.rb | # frozen_string_literal: true
require 'test_helper'
class User
extend ActiveModel::Naming
end
class AccountsController < InheritedResources::Base
end
class UsersController < AccountsController
respond_to :html, :xml
respond_to :js, only: [:create, :update, :destroy]
attr_reader :scopes_applied
def self.na... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/multiple_nested_optional_belongs_to_test.rb | test/multiple_nested_optional_belongs_to_test.rb | # frozen_string_literal: true
require 'test_helper'
class Student; end
class Manager; end
class Employee; end
class Project
def self.human_name; "Project"; end
end
class ProjectsController < InheritedResources::Base
belongs_to :student, :manager, :employee, optional: true
end
class MultipleNestedOptionalTest < ... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/association_chain_test.rb | test/association_chain_test.rb | # frozen_string_literal: true
require 'test_helper'
class Pet
extend ActiveModel::Naming
end
class Puppet
extend ActiveModel::Naming
end
class PetsController < InheritedResources::Base
attr_accessor :current_user
def edit
@pet = 'new pet'
edit!
end
protected
def collection
@pets ||= ... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/nested_model_with_shallow_test.rb | test/nested_model_with_shallow_test.rb | # frozen_string_literal: true
require 'test_helper'
class Subfaculty
end
class Speciality
end
module Plan
class Group
end
class Education
end
end
class GroupsController < InheritedResources::Base
defaults resource_class: Plan::Group, finder: :find_by_slug
belongs_to :subfaculty, shallow: true do
be... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/parent_controller_test.rb | test/parent_controller_test.rb | # frozen_string_literal: true
require 'test_helper'
def force_parent_controller(value)
InheritedResources.send(:remove_const, :Base)
InheritedResources.parent_controller = value
load File.join(__dir__, '..', 'app', 'controllers', 'inherited_resources', 'base.rb')
end
class ParentControllerTest < ActionControlle... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/changelog_test.rb | test/changelog_test.rb | # frozen_string_literal: true
require 'test_helper'
class ChangelogTest < ActiveSupport::TestCase
def setup
path = File.join(File.dirname(__dir__), "CHANGELOG.md")
@changelog = File.read(path)
end
def test_has_definitions_for_all_implicit_links
implicit_link_names = @changelog.scan(/\[([^\]]+)\]\[\]... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/url_helpers_test.rb | test/url_helpers_test.rb | # frozen_string_literal: true
require 'test_helper'
class ModelBase
extend ActiveModel::Naming
include ActiveModel::Conversion
end
class Universe < ModelBase
end
class UniversesController < InheritedResources::Base
defaults singleton: true, route_instance_name: 'universum'
end
class House < ModelBase
end
class... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | true |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/nested_singleton_test.rb | test/nested_singleton_test.rb | # frozen_string_literal: true
require 'test_helper'
# This test file is instead to test the how controller flow and actions
# using a belongs_to association. This is done using mocks a la rspec.
#
class Party
extend ActiveModel::Naming
end
class Venue
extend ActiveModel::Naming
end
class Address
extend ActiveM... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/customized_base_test.rb | test/customized_base_test.rb | # frozen_string_literal: true
require 'test_helper'
class Car
extend ActiveModel::Naming
end
class CarsController < InheritedResources::Base
respond_to :html
protected
def collection
@cars ||= Car.get_all
end
def build_resource
@car ||= Car.create_new(params[:car])
end
def re... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/tasks/gemfile_test.rb | test/tasks/gemfile_test.rb | # frozen_string_literal: true
require "minitest"
class GemfilesTest < Minitest::Test
def test_gemfile_is_up_to_date
gemfile = ENV["BUNDLE_GEMFILE"] || "Gemfile"
current_lockfile = File.read("#{gemfile}.lock")
new_lockfile = Bundler.with_original_env do
`bundle lock --print`
end
msg = "Ple... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/tasks/gemspec_test.rb | test/tasks/gemspec_test.rb | # frozen_string_literal: true
require "minitest"
require "open3"
require "inherited_resources/version"
class GemspecTest < Minitest::Test
def setup
@build = Open3.capture3("gem build inherited_resources.gemspec")
end
def teardown
File.delete("inherited_resources-#{InheritedResources::VERSION}.gem")
en... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/test/autoload/engine.rb | test/autoload/engine.rb | # frozen_string_literal: true
module MyTestNamespace
class Engine; end
end
| ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources.rb | lib/inherited_resources.rb | # frozen_string_literal: true
# This is here because responders don't require it.
require 'rails/engine'
require 'responders'
require_relative 'inherited_resources/engine'
require_relative 'inherited_resources/blank_slate'
require_relative 'inherited_resources/responder'
module InheritedResources
ACTIONS = [ :inde... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/polymorphic_helpers.rb | lib/inherited_resources/polymorphic_helpers.rb | # frozen_string_literal: true
module InheritedResources
# = polymorphic associations
#
# In some cases you have a resource that belongs to two different resources
# but not at the same time. For example, let's suppose you have File, Message
# and Task as resources and they are all commentable.
#
# Polym... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/actions.rb | lib/inherited_resources/actions.rb | # frozen_string_literal: true
module InheritedResources
# Holds all default actions for InheritedResources.
module Actions
# GET /resources
def index(options={}, &block)
respond_with(*with_chain(collection), options, &block)
end
alias :index! :index
# GET /resources/1
def show(optio... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/version.rb | lib/inherited_resources/version.rb | # frozen_string_literal: true
module InheritedResources
VERSION = '2.1.0'.freeze
end
| ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/belongs_to_helpers.rb | lib/inherited_resources/belongs_to_helpers.rb | # frozen_string_literal: true
module InheritedResources
# = belongs_to
#
# Let's suppose that we have some tasks that belongs to projects. To specify
# this association in your controllers, just do:
#
# class TasksController < InheritedResources::Base
# belongs_to :project
# end
#
# bel... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/base_helpers.rb | lib/inherited_resources/base_helpers.rb | # frozen_string_literal: true
# Whenever base is required load the dumb responder since it's used inside actions.
require_relative 'blank_slate'
module InheritedResources
# Base helpers for InheritedResource work. Some methods here can be overwritten
# and you will need to do that to customize your controllers fr... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/class_methods.rb | lib/inherited_resources/class_methods.rb | # frozen_string_literal: true
module InheritedResources
module ClassMethods
protected
# Used to overwrite the default assumptions InheritedResources do. Whenever
# this method is called, it should be on the top of your controller, since
# almost other methods depends on the values given to <<... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/singleton_helpers.rb | lib/inherited_resources/singleton_helpers.rb | # frozen_string_literal: true
module InheritedResources
# = singleton
#
# Singletons are usually used in associations which are related through has_one
# and belongs_to. You declare those associations like this:
#
# class ManagersController < InheritedResources::Base
# belongs_to :project, :single... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/responder.rb | lib/inherited_resources/responder.rb | # frozen_string_literal: true
module InheritedResources
class Responder < ActionController::Responder
include Responders::FlashResponder
self.error_status = :unprocessable_entity
self.redirect_status = :see_other
end
end
| ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/dsl.rb | lib/inherited_resources/dsl.rb | # frozen_string_literal: true
module InheritedResources
# Allows controllers to write actions using a class method DSL.
#
# class MyController < InheritedResources::Base
# create! do |success, failure|
# success.html { render :text => "It works!" }
# end
# end
#
module DSL
def s... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/shallow_helpers.rb | lib/inherited_resources/shallow_helpers.rb | # frozen_string_literal: true
module InheritedResources
# Shallow provides a functionality that goes on pair with Rails' shallow.
# It is very similar to "optional" but it actually finds all the parents
# resources instead of leaving them blank. Consider the following example:
#
# belongs_to :post, :shallo... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/blank_slate.rb | lib/inherited_resources/blank_slate.rb | # frozen_string_literal: true
module InheritedResources
# An object from BlankSlate simply discards all messages sent to it.
class BlankSlate
instance_methods.each do |m|
undef_method m unless /^(__|object_id)/.match?(m)
end
def method_missing(*args)
nil
end
end
end
| ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/url_helpers.rb | lib/inherited_resources/url_helpers.rb | # frozen_string_literal: true
module InheritedResources
# = URLHelpers
#
# When you use InheritedResources it creates some UrlHelpers for you.
# And they handle everything for you.
#
# # /posts/1/comments
# resource_url # => /posts/1/comments/#{@comment.to_param}
# resource_url(comment) # =... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/inherited_resources/engine.rb | lib/inherited_resources/engine.rb | # frozen_string_literal: true
module InheritedResources
class Railtie < ::Rails::Engine
config.inherited_resources = InheritedResources
if config.respond_to?(:app_generators)
config.app_generators.scaffold_controller = :inherited_resources_controller
else
config.generators.scaffold_controlle... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
activeadmin/inherited_resources | https://github.com/activeadmin/inherited_resources/blob/09afed6e7121c1dab5419e81d49809b399e68810/lib/generators/rails/inherited_resources_controller_generator.rb | lib/generators/rails/inherited_resources_controller_generator.rb | # frozen_string_literal: true
require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
module Rails
module Generators
class InheritedResourcesControllerGenerator < ScaffoldControllerGenerator
def self.source_root
@source_root ||= File.expand_path("templates", File.dirname... | ruby | MIT | 09afed6e7121c1dab5419e81d49809b399e68810 | 2026-01-04T15:53:12.830781Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/application_job.rb | app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
retry_on StandardError, attempts: 0
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/cleanup_closed_pr_projects_job.rb | app/jobs/cleanup_closed_pr_projects_job.rb | class CleanupClosedPrProjectsJob < ApplicationJob
queue_as :default
def perform
ProjectFork.includes(:child_project, :parent_project).find_each do |project_fork|
begin
parent_project = project_fork.parent_project
client = Git::Client.from_project(parent_project)
pr_status = clien... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/services/add_domain_job.rb | app/jobs/services/add_domain_job.rb | class Services::AddDomainJob < ApplicationJob
def perform(service, user)
cluster = service.cluster
runner = Cli::RunAndLog.new(cluster)
connection = K8::Connection.new(cluster, user)
kubectl = K8::Kubectl.new(connection, runner)
ingress_yaml = K8::Stateless::Ingress.new(service).to_yaml
kubect... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/add_ons/install_job.rb | app/jobs/add_ons/install_job.rb | class AddOns::InstallJob < ApplicationJob
def perform(add_on, user)
needs_restart = add_on.installed?
connection = K8::Connection.new(add_on, user, allow_anonymous: true)
AddOns::InstallHelmChart.execute(connection:)
if needs_restart
service = K8::Helm::Service.create_from_add_on(connection)
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/add_ons/uninstall_job.rb | app/jobs/add_ons/uninstall_job.rb | class AddOns::UninstallJob < ApplicationJob
def perform(add_on, user_id)
user = User.find(user_id)
connection = K8::Connection.new(add_on, user)
AddOns::UninstallHelmChart.execute(connection:)
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/clusters/install_job.rb | app/jobs/clusters/install_job.rb | class Clusters::InstallJob < ApplicationJob
queue_as :default
def perform(cluster, user)
Clusters::Install.call(cluster, user)
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/clusters/destroy_build_cloud_job.rb | app/jobs/clusters/destroy_build_cloud_job.rb | module Clusters
class DestroyBuildCloudJob < ApplicationJob
queue_as :default
def perform(cluster)
Rails.logger.info("Starting build cloud removal for cluster #{cluster.name}")
build_cloud = cluster.build_cloud
build_cloud.update(error_message: nil)
return unless build_cloud
b... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/clusters/install_build_cloud_job.rb | app/jobs/clusters/install_build_cloud_job.rb | module Clusters
class InstallBuildCloudJob < ApplicationJob
queue_as :default
def perform(build_cloud, user)
Clusters::InstallBuildCloud.execute(build_cloud:, user:)
rescue StandardError => e
build_cloud.update(error_message: e.message, status: :failed)
end
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/clusters/destroy_job.rb | app/jobs/clusters/destroy_job.rb | class Clusters::DestroyJob < ApplicationJob
queue_as :default
def perform(cluster, user)
cluster.destroying!
cluster.projects.each do |project|
Projects::DestroyJob.perform_now(project, user)
end
cluster.destroy!
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/inbound_webhooks/github_job.rb | app/jobs/inbound_webhooks/github_job.rb | module InboundWebhooks
class GithubJob < ApplicationJob
queue_as :default
def perform(inbound_webhook, current_user: nil)
inbound_webhook.processing!
# Process webhook
# Determine the project
# Trigger a docker build & docker deploy if auto deploy is on for the project
body = J... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/inbound_webhooks/incineration_job.rb | app/jobs/inbound_webhooks/incineration_job.rb | module InboundWebhooks
class IncinerationJob < ApplicationJob
queue_as :default
discard_on ActiveRecord::RecordNotFound
def perform(inbound_webhook)
inbound_webhook.destroy!
end
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/inbound_webhooks/gitlab_job.rb | app/jobs/inbound_webhooks/gitlab_job.rb | module InboundWebhooks
class GitlabJob < ApplicationJob
queue_as :default
def perform(inbound_webhook, current_user: nil)
inbound_webhook.processing!
# Process webhook
# Determine the project
# Trigger a docker build & docker deploy if auto deploy is on for the project
body = J... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/scheduled/fetch_metrics_job.rb | app/jobs/scheduled/fetch_metrics_job.rb | class Scheduled::FetchMetricsJob < ApplicationJob
queue_as :default
def perform
Cluster.running.each do |cluster|
connection = K8::Connection.new(cluster, nil, allow_anonymous: true)
nodes = K8::Metrics::Metrics.call(connection)
rescue => e
Rails.logger.error("Error fetching metrics for c... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/scheduled/check_health_job.rb | app/jobs/scheduled/check_health_job.rb | class Scheduled::CheckHealthJob < ApplicationJob
queue_as :default
def perform
Service.web_service.where('healthcheck_url IS NOT NULL').each do |service|
# url = File.join("http://#{service.name}-service.#{service.project.namespace}.svc.cluster.local", service.healthcheck_url)
# K8::Client.from_pro... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/scheduled/flush_metrics_job.rb | app/jobs/scheduled/flush_metrics_job.rb | class Scheduled::FlushMetricsJob < ApplicationJob
queue_as :default
def perform
Metric.where("created_at < ?", 1.week.ago).destroy_all
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/scheduled/cancel_hanging_builds_job.rb | app/jobs/scheduled/cancel_hanging_builds_job.rb | class Scheduled::CancelHangingBuildsJob < ApplicationJob
queue_as :default
def perform
Build.where(status: :in_progress).where(created_at: ..1.hour.ago).each do |build|
build.failed!
end
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/scheduled/check_for_new_commits_job.rb | app/jobs/scheduled/check_for_new_commits_job.rb | module Scheduled
class CheckForNewCommitsJob < ApplicationJob
queue_as :default
def perform
# Find all projects with autodeploy enabled and enqueue individual jobs
Project.where(autodeploy: true).find_each do |project|
next unless project.git?
Projects::CheckForNewCommitsJob.perf... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/projects/deployment_job.rb | app/jobs/projects/deployment_job.rb | require "base64"
require "json"
class Projects::DeploymentJob < ApplicationJob
DEPLOYABLE_RESOURCES = %w[ConfigMap Secrets Deployment CronJob Service Ingress Pv Pvc]
class DeploymentFailure < StandardError; end
def perform(deployment, user)
@logger = deployment
@marked_resources = []
project = deplo... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/projects/build_job.rb | app/jobs/projects/build_job.rb | # frozen_string_literal: true
require 'shellwords'
class Projects::BuildJob < ApplicationJob
queue_as :default
class BuildFailure < StandardError; end
def perform(build, user)
project = build.project
build.in_progress!
# If its a container registry deploy, we don't need to build the docker image
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/projects/destroy_job.rb | app/jobs/projects/destroy_job.rb | class Projects::DestroyJob < ApplicationJob
def perform(project, user)
project.destroying!
if project.managed_namespace
delete_namespace(project, user)
end
# Delete the github webhook for the project IF there are no more projects that refer to that repository
# TODO: This might have overlap... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/jobs/projects/check_for_new_commits_job.rb | app/jobs/projects/check_for_new_commits_job.rb | module Projects
class CheckForNewCommitsJob < ApplicationJob
queue_as :default
def perform(project)
return unless project.git?
check_project_for_updates(project)
rescue => e
Rails.logger.error("Failed to check for updates on project #{project.id}: #{e.message}")
end
private
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/infer_json_schema_service.rb | app/services/infer_json_schema_service.rb | class InferJsonSchemaService
def initialize(data)
@data = data
@schema = nil
end
def infer
@schema ||= infer_schema(@data)
end
private
def infer_schema(value)
case value
when Hash
{
"type" => "object",
"properties" => value.transform_values { |v| infer_schema(v) ... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/favicon_service.rb | app/services/favicon_service.rb | class FaviconService
GOOGLE_FAVICON_URL = "https://www.google.com/s2/favicons"
DUCKDUCKGO_FAVICON_URL = "https://icons.duckduckgo.com/ip3"
def initialize(domain)
@domain = clean_domain(domain)
end
def fetch_url(size: 64, provider: :duckduckgo)
return nil if @domain.blank?
case provider
when... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/docker_cli.rb | app/services/docker_cli.rb | class DockerCli
class AuthenticationError < StandardError; end
def self.with_registry_auth(registry_url:, username:, password:, &block)
normalized_registry = normalize_registry_url(registry_url)
# Login to registry
login_success = login(normalized_registry, username, password)
unless login_success... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/cli.rb | app/services/cli.rb | module Cli
class CommandFailedError < StandardError; end
class RunAndReturnOutput
def call(command, envs: {})
command = envs.map { |k, v| "#{k}=#{v}" }.join(" ") + " #{command}"
output = `#{command.strip}`
raise CommandFailedError, "Command `#{command}` failed with exit code #{$?.exitstatus}" ... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/ldap/authenticator.rb | app/services/ldap/authenticator.rb | # app/services/ldap/authenticator.rb
require 'net/ldap'
module LDAP
class Authenticator
Result = Struct.new(
:success?,
:email,
:name,
:user_dn,
:entry,
:groups,
:error_message,
keyword_init: true
)
def initialize(ldap_configuration, logger: Rails.logger)
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/kubectl.rb | app/services/k8/kubectl.rb | # frozen_string_literal: true
class K8::Kubectl
include K8::Kubeconfig
attr_reader :kubeconfig, :runner
def initialize(connection, runner = Cli::RunAndReturnOutput.new)
@_kubeconfig = connection.kubeconfig
@kubeconfig = @_kubeconfig.is_a?(String) ? JSON.parse(@_kubeconfig) : @_kubeconfig
if @kubecon... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/namespace.rb | app/services/k8/namespace.rb | class K8::Namespace < K8::Base
attr_accessor :nameable
def initialize(nameable)
@nameable = nameable
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/kubeconfig.rb | app/services/k8/kubeconfig.rb | module K8
module Kubeconfig
def with_kube_config
Tempfile.open([ 'kubeconfig', '.yaml' ]) do |kubeconfig_file|
kubeconfig_hash = kubeconfig.is_a?(String) ? JSON.parse(kubeconfig) : kubeconfig
kubeconfig_file.write(kubeconfig_hash.to_yaml)
kubeconfig_file.flush
yield kubeconfi... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/base.rb | app/services/k8/base.rb | # frozen_string_literal: true
class K8::Base
attr_reader :connection
def connect(connection)
@connection = connection
self
end
def connected?
connection.present?
end
def template_path
class_path_parts = self.class.name.split('::').map(&:underscore)
# Generate the file name dynamical... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/connection.rb | app/services/k8/connection.rb | class K8::Connection
attr_reader :clusterable, :user, :allow_anonymous
def initialize(clusterable, user, allow_anonymous: false)
@clusterable = clusterable
@user = user
@allow_anonymous = allow_anonymous
end
def cluster
klass = clusterable.class.name
if klass == "Cluster"
clusterable
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/build_cloud_manager.rb | app/services/k8/build_cloud_manager.rb | class K8::BuildCloudManager
include K8::Kubeconfig
include StorageHelper
# Only referenced in the migration for now.
BUILDKIT_BUILDER_DEFAULT_NAMESPACE = 'canine-k8s-builder'
attr_reader :connection, :build_cloud
def self.install(build_cloud, connection)
if build_cloud.pending? || build_cloud.failed?
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/client.rb | app/services/k8/client.rb | module K8
class Client
attr_reader :client
delegate(
:get_persistent_volume_claims,
:get_services,
:get_pods,
:get_pod_log,
:delete_pod,
:get_endpoints,
:get_namespaces,
:delete_namespace,
:get_events,
to: :client
)
def initialize(connectio... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/add_ons/ingress.rb | app/services/k8/add_ons/ingress.rb | class K8::AddOns::Ingress < K8::Base
attr_reader :add_on, :endpoint, :port, :domains
def initialize(add_on, endpoint, port, domains)
@endpoint = endpoint
@port = port
@add_on = add_on
@domains = domains
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/secrets/registry_secret.rb | app/services/k8/secrets/registry_secret.rb | class K8::Secrets::RegistrySecret < K8::Base
attr_accessor :project, :docker_config_json
def initialize(project, docker_config_json)
@project = project
@docker_config_json = docker_config_json
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/metrics/api.rb | app/services/k8/metrics/api.rb | module K8::Metrics::Api
class Node
extend StorageHelper
def self.ls(connection, with_namespaces: true)
cluster = connection.cluster
# Here, run kubectl top nodes
kubectl = K8::Kubectl.new(connection)
response = kubectl.call("top nodes")
parsed_data = parse_output(response)
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/metrics/metrics.rb | app/services/k8/metrics/metrics.rb |
include StorageHelper
class K8::Metrics::Metrics
def self.call(connection)
nodes = K8::Metrics::Api::Node.ls(connection)
metrics = []
nodes.each do |node|
tags = [ "node:#{node.name}" ]
metrics << {
metric_type: :cpu,
tags:,
metadata: { cpu: node.cpu_cores, total_cpu:... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/helm/redis.rb | app/services/k8/helm/redis.rb | class K8::Helm::Redis < K8::Helm::Service
def name
"redis"
end
def service_basename
add_on.name.include?("redis") ? add_on.name : "#{add_on.name}-redis"
end
def service_name
"#{service_basename}-master"
end
def internal_url
service = client.get_services(namespace: add_on.name).find do |... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/helm/clickhouse.rb | app/services/k8/helm/clickhouse.rb | class K8::Helm::Clickhouse < K8::Helm::Service
def name
add_on.name
end
def username
"default"
end
def password
output = K8::Kubectl.new(
connection,
Cli::RunAndReturnOutput.new,
).call("get secret --namespace #{add_on.name} #{service_name} -o jsonpath='{.data.admin-password}' | ... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/helm/postgresql.rb | app/services/k8/helm/postgresql.rb | class K8::Helm::Postgresql < K8::Helm::Service
def name
add_on.name
end
def service_name
basename = add_on.name.ends_with?("postgresql") ? add_on.name : "#{add_on.name}-postgresql"
basename
end
def internal_url
service = client.get_services(namespace: add_on.name).find do |service|
ser... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/helm/client.rb | app/services/k8/helm/client.rb | class K8::Helm::Client
DEFAULT_TIMEOUT = "1000s"
CHARTS = YAML.load_file(Rails.root.join('resources', 'helm', 'charts.yml'))
include K8::Kubeconfig
attr_reader :kubeconfig, :runner
def initialize(runner)
@runner = runner
end
def self.connect(connection, runner)
client = new(runner)
client.co... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/helm/service.rb | app/services/k8/helm/service.rb | class K8::Helm::Service
attr_reader :add_on, :client, :connection, :kubectl
def self.create_from_add_on(connection)
add_on = connection.add_on
if add_on.chart_type == "redis"
K8::Helm::Redis.new(connection)
elsif add_on.chart_type == "postgresql"
K8::Helm::Postgresql.new(connection)
els... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/command.rb | app/services/k8/stateless/command.rb | class K8::Stateless::Command < K8::Base
attr_accessor :project, :type, :command
def initialize(project, type, command)
@project = project
@type = type
@command = command
end
def name
"#{project.name}-#{type}"
end
def namespace
project.name
end
def delete_if_exists!
return if ... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/ingress.rb | app/services/k8/stateless/ingress.rb | class K8::Stateless::Ingress < K8::Base
attr_accessor :service, :project, :domains, :cluster
def initialize(service)
@service = service
@project = service.project
@cluster = @project.cluster
end
def name
"#{@service.name}-ingress"
end
def certificate_status
return nil unless @service.... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/pod.rb | app/services/k8/stateless/pod.rb | class K8::Stateless::Pod < K8::Base
attr_accessor :project, :id, :name
def initialize(project)
@project = project
@id = SecureRandom.uuid[0..7]
end
def name
"#{project.name}-run-#{id}"
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/config_map.rb | app/services/k8/stateless/config_map.rb | class K8::Stateless::ConfigMap < K8::Base
attr_reader :project
delegate :name, to: :project
def initialize(project)
@project = project
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/cron_job.rb | app/services/k8/stateless/cron_job.rb | class K8::Stateless::CronJob < K8::Base
JobRun = Struct.new(:name, :status, :started_at, :finished_at, :duration, keyword_init: true)
attr_accessor :service, :project
delegate :name, to: :service
def initialize(service)
@service = service
@project = service.project
end
def run_history
jobs = f... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/pvc.rb | app/services/k8/stateless/pvc.rb | class K8::Stateless::Pvc < K8::Base
attr_accessor :volume, :project
delegate :name, to: :volume
def initialize(volume)
@volume = volume
@project = volume.project
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/pv.rb | app/services/k8/stateless/pv.rb | class K8::Stateless::Pv < K8::Base
attr_accessor :volume, :project
delegate :name, to: :volume
def initialize(volume)
@volume = volume
@project = volume.project
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/service.rb | app/services/k8/stateless/service.rb | class K8::Stateless::Service < K8::Base
attr_accessor :project, :service, :name
def initialize(service)
@service = service
@project = service.project
end
def internal_url
"#{name}.#{project.namespace}.svc.cluster.local:80"
end
def name
"#{service.name}-service"
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/deployment.rb | app/services/k8/stateless/deployment.rb | class K8::Stateless::Deployment < K8::Base
attr_accessor :service, :project, :environment_variables
delegate :name, to: :service
def initialize(service)
@service = service
@project = service.project
@environment_variables = @project.environment_variables
end
def restart
kubectl.call("rollout... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/stateless/secrets.rb | app/services/k8/stateless/secrets.rb | class K8::Stateless::Secrets < K8::Base
attr_reader :project
delegate :name, to: :project
def initialize(project)
@project = project
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/k8/shared/acme_issuer.rb | app/services/k8/shared/acme_issuer.rb | class K8::Shared::AcmeIssuer < K8::Base
attr_accessor :email, :namespace
def initialize(email, namespace: Clusters::Install::DEFAULT_NAMESPACE)
@email = email
@namespace = namespace
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/git/client.rb | app/services/git/client.rb | class Git::Client
def self.from_provider(provider:, repository_url:)
if provider.github?
Git::Github::Client.new(access_token: provider.access_token, repository_url:, api_base_url: provider.api_base_url)
elsif provider.gitlab?
Git::Gitlab::Client.new(access_token: provider.access_token, repository... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/git/github/client.rb | app/services/git/github/client.rb | class Git::Github::Client < Git::Client
WEBHOOK_SECRET = ENV["OMNIAUTH_GITHUB_WEBHOOK_SECRET"]
attr_accessor :client, :repository_url
def self.from_project(project)
provider = project.project_credential_provider.provider
new(
access_token: provider.access_token,
repository_url: project.repos... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/git/gitlab/client.rb | app/services/git/gitlab/client.rb | class Git::Gitlab::Client < Git::Client
GITLAB_WEBHOOK_SECRET = ENV["GITLAB_WEBHOOK_SECRET"]
attr_accessor :access_token, :repository_url, :api_base_url
def self.from_project(project)
provider = project.project_credential_provider.provider
raise "Project is not a GitLab project" unless provider.gitlab?
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/git/common/pull_request.rb | app/services/git/common/pull_request.rb | class Git::Common::PullRequest < Struct.new(
:id,
:title,
:number,
:user,
:url,
:branch,
:created_at,
:updated_at,
)
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/git/common/file.rb | app/services/git/common/file.rb | class Git::Common::File < Struct.new(:path, :content, :branch); end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/git/common/commit.rb | app/services/git/common/commit.rb | class Git::Common::Commit < Struct.new(
:sha,
:message,
:author_name,
:author_email,
:authored_at,
:committer_name,
:committer_email,
:committed_at,
:url,
keyword_init: true
)
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/builders/docker.rb | app/services/builders/docker.rb | # frozen_string_literal: true
require 'open3'
module Builders
class Docker < Builders::Base
# Build and push the Docker image
def build_image(repository_path)
if project.build_configuration.buildpacks?
Builders::Frontends::BuildpackBuilder.new(build).build_with_buildpacks(repository_path)
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/builders/cloud.rb | app/services/builders/cloud.rb | class Builders::Cloud < Builders::Docker; end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/builders/base.rb | app/services/builders/base.rb | class Builders::Base
attr_reader :build
def initialize(build)
@build = build
end
def project
build.project
end
# Login to the Docker registry
def login_to_registry
provider = project.build_provider
base_url = provider.registry_base_url
docker_login_command = [ "docker", "login", bas... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/builders/build_cloud.rb | app/services/builders/build_cloud.rb | # frozen_string_literal: true
require 'tempfile'
require 'ostruct'
module Builders
class BuildCloud < Builders::Base
include K8::Kubeconfig
attr_reader :build_cloud_manager
def initialize(build, build_cloud_manager)
super(build)
@build_cloud_manager = build_cloud_manager
end
def se... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/builders/frontends/dockerfile_builder.rb | app/services/builders/frontends/dockerfile_builder.rb | class Builders::Frontends::DockerfileBuilder
attr_accessor :build, :project
def initialize(build)
@build = build
@project = build.project
end
def build_with_dockerfile(repository_path)
docker_build_command = construct_buildx_command(repository_path)
# Create a new instance of RunAndLog with t... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/builders/frontends/buildpack_builder.rb | app/services/builders/frontends/buildpack_builder.rb | # frozen_string_literal: true
class Builders::Frontends::BuildpackBuilder
attr_accessor :build, :project
def initialize(build)
@build = build
@project = build.project
end
# Build image using Cloud Native Buildpacks
def build_with_buildpacks(repository_path)
build_config = build.project.build_co... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/saml/authenticator.rb | app/services/saml/authenticator.rb | # app/services/saml/authenticator.rb
module SAML
class Authenticator
Result = Struct.new(
:success?,
:email,
:name,
:uid,
:groups,
:error_message,
keyword_init: true
)
def initialize(saml_configuration, account:, logger: Rails.logger)
@config = saml_configu... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/canine_config/definition.rb | app/services/canine_config/definition.rb | class CanineConfig::Definition
attr_reader :definition
def self.parse(yaml_content, base_project, pull_request)
context = build_context(base_project, pull_request)
# Use safe variable substitution instead of ERB to prevent code execution
parsed_content = if yaml_content.include?('<%')
safe_templ... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/services/oidc/authenticator.rb | app/services/oidc/authenticator.rb | # app/services/oidc/authenticator.rb
module OIDC
class Authenticator
Result = Struct.new(
:success?,
:email,
:name,
:uid,
:groups,
:id_token,
:access_token,
:error_message,
keyword_init: true
)
def initialize(oidc_configuration, logger: Rails.logger)
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/app/helpers/add_ons_helper.rb | app/helpers/add_ons_helper.rb | module AddOnsHelper
def add_on_layout(add_on, &block)
render layout: 'add_ons/layout', locals: { add_on: }, &block
end
def flatten_hash(hash, parent_key = '', result = {})
(hash || {}).each do |key, value|
new_key = parent_key.empty? ? key.to_s : "#{parent_key}.#{key}"
if value.is_a?(Hash)
... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.