source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/helpers/application_helper.rb | Ruby | mit | 87 | master | 5,552 | module ApplicationHelper
# rubocop:disable Layout/LineLength
def sorted_talos_versions
# ["v1.8.1", "v1.8.2", "v1.9.0", ...]
available_versions = TalosImageFactory.available_versions
alpha_beta_versions, regular_versions = available_versions.partition do |version|
version.include?("beta") || versi... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/talos_image_factory_schematics_controller.rb | Ruby | mit | 87 | master | 1,510 | class TalosImageFactorySchematicsController < ApplicationController
def index
@talos_image_factory_schematics = TalosImageFactorySchematic.order(:id).all
end
def new
@talos_image_factory_schematic = TalosImageFactorySchematic.new
end
def create
talos_image_factory_schematic_params = params.expec... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/talos_image_factory_settings_controller.rb | Ruby | mit | 87 | master | 572 | class TalosImageFactorySettingsController < ApplicationController
def update
@talos_image_factory_setting = TalosImageFactorySetting.singleton
talos_image_factory_setting_params = params.require(:talos_image_factory_setting).permit(
:version,
:talos_image_factory_schematic_id,
)
if @talo... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/api_keys_controller.rb | Ruby | mit | 87 | master | 914 | class ApiKeysController < ApplicationController
def new
@api_key = ApiKey.new(provider: params[:provider])
end
def create
api_key_params = params.require(:api_key).permit(:provider, :name, :secret)
@api_key = ApiKey.new(api_key_params)
if @api_key.save
redirect_to settings_path, notice: "... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/machine_configs_controller.rb | Ruby | mit | 87 | master | 1,394 | class MachineConfigsController < ApplicationController
def show
machine_config = MachineConfig.find(params[:id])
headers["Content-Type"] = "text/yaml"
render plain: machine_config.generate_config
end
def new
@server = Server.find(params.require(:server_id))
@machine_config = MachineConfig.ne... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/application_controller.rb | Ruby | mit | 87 | master | 368 | class ApplicationController < ActionController::Base
default_form_builder ApplicationFormBuilder
before_action :require_authentication
private
def require_authentication
return if ENV["BASIC_AUTH_PASSWORD"].blank?
authenticate_or_request_with_http_basic do |_username, password|
password == ENV... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/servers_controller.rb | Ruby | mit | 87 | master | 4,418 | # frozen_string_literal: true
class ServersController < ApplicationController
def index
@servers = Server.all
.includes(:config, :cluster)
.order(cluster_id: :asc, name: :asc)
end
def edit
@server = Server.find(params[:id])
end
def update
@server = Server.find(params[:id])
serv... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/clusters_controller.rb | Ruby | mit | 87 | master | 2,208 | class ClustersController < ApplicationController
def index
@clusters = Cluster.all
end
def new
@cluster = Cluster.new
end
def edit
@cluster = Cluster.find(params[:id])
end
def create
cluster_params = params.require(:cluster).permit(:name, :endpoint, :secrets, :hetzner_vswitch_id)
@... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/configs_controller.rb | Ruby | mit | 87 | master | 2,939 | class ConfigsController < ApplicationController
skip_before_action :require_authentication, only: :show
def index
@configs = Config.all
end
def show
ip = request.remote_ip
server = Server.find_by_ip!(ip)
if server.machine_config
# Render config before updating in case it would fail for ... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/controllers/label_and_taint_rules_controller.rb | Ruby | mit | 87 | master | 1,278 | class LabelAndTaintRulesController < ApplicationController
def index
@label_and_taint_rules = LabelAndTaintRule.order(:id).all
end
def new
@label_and_taint_rule = LabelAndTaintRule.new
end
def create
label_and_taint_rule_params = params.expect(label_and_taint_rule: %i[match labels taints])
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/api/hetzner_cloud.rb | Ruby | mit | 87 | master | 3,282 | # Wrapper around the Hetzner Cloud API.
# Documentation at: https://docs.hetzner.cloud
class HetznerCloud
HttpError = Class.new(StandardError)
BASE_URL = "https://api.hetzner.cloud/v1".freeze
# Syncs current Hetzner Cloud API state to ActiveRecord models
def self.sync_to_activerecord
server_attributes =
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/api/hetzner_robot.rb | Ruby | mit | 87 | master | 5,800 | # Wrapper around the Hetzner "webservice" API (used for interacting with their bare metal Robots service)
# Documentation at: https://robot.hetzner.com/doc/webservice/en.html
class HetznerRobot
HttpError = Class.new(StandardError)
# Syncs current Hetzner API state to ActiveRecord models
def self.sync_to_activer... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/api/talos_image_factory.rb | Ruby | mit | 87 | master | 1,343 | # frozen_string_literal: true
# API docs: https://github.com/siderolabs/image-factory?tab=readme-ov-file#http-frontend-api
module TalosImageFactory
HttpError = Class.new(StandardError)
BASE_URL = "https://factory.talos.dev"
def self.available_versions
Rails.cache.fetch("talos_image_factory/available_versi... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/form_builders/application_form_builder.rb | Ruby | mit | 87 | master | 3,754 | # Avoid errors getting wrapped in an extra div
ActionView::Base.field_error_proc = proc do |html_tag, _instance|
html_tag.html_safe
end
class ApplicationFormBuilder < ActionView::Helpers::FormBuilder
INPUT_CLASSES = "w-full p-3 mb-5 rounded border border-gray-300 text-gray-900 disabled:text-gray-500".freeze
def... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/cluster.rb | Ruby | mit | 87 | master | 2,689 | require "open3"
class Cluster < ApplicationRecord
NoControlPlaneError = Class.new(StandardError)
has_many :servers, dependent: :nullify
belongs_to :hetzner_vswitch, optional: true
encrypts :secrets
before_validation :generate_default_secret, on: :create
validates_presence_of :name
validates_presence_... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/server.rb | Ruby | mit | 87 | master | 6,839 | # frozen_string_literal: true
class Server < ApplicationRecord
belongs_to :cluster, optional: true
belongs_to :api_key
belongs_to :talos_image_factory_schematic, optional: true
has_one :machine_config, dependent: :destroy
has_one :config, through: :machine_config
attr_accessor :sync # set to true to sync... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/label_and_taint_rule.rb | Ruby | mit | 87 | master | 4,042 | class LabelAndTaintRule < ApplicationRecord
validates_presence_of :match
validate :at_least_one_label_or_taint
validate :validate_labels
validate :validate_taints
def labels_as_array
labels.to_s.split(",")
end
def taints_as_array
taints.to_s.split(",")
end
private
def at_least_one_label_... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/talos_image_factory_schematic.rb | Ruby | mit | 87 | master | 1,526 | class TalosImageFactorySchematic < ApplicationRecord
validates_presence_of :name
validates_uniqueness_of :name
validates_presence_of :body
validate :validate_and_normalize_and_post_body, if: :body_changed?
validates_presence_of :schematic_id # must be validated after body is validated and posted
has_one :t... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/api_key.rb | Ruby | mit | 87 | master | 787 | class ApiKey < ApplicationRecord
has_many :servers, dependent: :delete_all
validates_presence_of :provider, :name, :secret
validates_inclusion_of :provider, in: %w[hetzner_cloud hetzner_robot]
validates_uniqueness_of :name, case_sensitive: false
validate :validate_credentials
encrypts :secret
def clie... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/talos_image_factory_setting.rb | Ruby | mit | 87 | master | 465 | # frozen_string_literal: true
# This is used as a singleton model for storing default bootstrap image settings.
class TalosImageFactorySetting < ApplicationRecord
def self.singleton
first_or_create!
end
belongs_to :talos_image_factory_schematic, optional: true
attribute :version, :string, default: "v1.1... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/machine_config.rb | Ruby | mit | 87 | master | 6,404 | # Represents an application of Config on a Server, including hostname and private_ip
require "open3"
require "resolv"
class MachineConfig < ApplicationRecord
class InvalidConfigError < StandardError
attr_reader :output
def initialize(message, output)
super message
@output = output
end
end... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/config.rb | Ruby | mit | 87 | master | 1,710 | class Config < ApplicationRecord
validates_uniqueness_of :name
validates_presence_of :install_image
validates_presence_of :kubernetes_version
validate :validate_talos_config
has_many :machine_configs
private
def validate_talos_config
begin
YAML.safe_load(patch)
rescue Psych::SyntaxError =... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/kubectl.rb | Ruby | mit | 87 | master | 691 | require "open3"
# Wrapper around the kubectl command line tool to interact with Kubernetes clusters
class Kubectl
def initialize(config_string)
@config_string = config_string
end
def run(command)
command = "kubectl --kubeconfig=#{config_file.path} #{command}"
Rails.logger.info "[Kubectl] Running co... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/talosctl.rb | Ruby | mit | 87 | master | 1,715 | require "open3"
# Wrapper around the talosctl command line tool to interact with already bootstrapped Talos clusters
class Talosctl
ConnectionRefusedError = Class.new(StandardError)
def initialize(config_string)
@config_string = config_string
end
def kubernetes_version
success, stdout, _stderr = run... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/server/hetzner_cloud.rb | Ruby | mit | 87 | master | 1,813 | class Server::HetznerCloud < Server
def bootstrap_metadata
return @bootstrap_metadata if defined?(@bootstrap_metadata)
key_data = [ENV.fetch("SSH_PRIVATE_KEY")]
session = Net::SSH.start(ip, "root", key_data:, non_interactive: true, verify_host_key: :never, timeout: 2)
hostname = session.exec!("hostna... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/models/server/hetzner_dedicated.rb | Ruby | mit | 87 | master | 1,745 | class Server::HetznerDedicated < Server
def bootstrap_metadata
return @bootstrap_metadata if defined?(@bootstrap_metadata)
key_data = [ENV.fetch("SSH_PRIVATE_KEY")]
session = Net::SSH.start(ip, "root", key_data:, non_interactive: true, verify_host_key: :never, timeout: 2)
hostname = session.exec!("ho... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/spec_helper.rb | Ruby | mit | 87 | master | 4,591 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require ... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/rails_helper.rb | Ruby | mit | 87 | master | 3,324 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require "spec_helper"
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
requ... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/requests/servers_controller_spec.rb | Ruby | mit | 87 | master | 6,769 | RSpec.describe "ServersController" do
describe "GET /admin/index" do
it "returns http success" do
get "/admin/servers"
expect(response).to have_http_status 200
end
end
describe "POST /admin/servers/sync" do
it "syncs servers with the provider and redirects back to index" do
lsblk_ou... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/models/cluster_spec.rb | Ruby | mit | 87 | master | 595 | RSpec.describe Cluster do
it "validates that endpoint is a valid URL" do
cluster = Cluster.new(endpoint: "example.com")
cluster.validate
expect(cluster.errors[:endpoint]).to include "must start with https://"
expect(cluster.errors[:endpoint]).to include "must end with an explicit port, eg. :6443"
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/models/server_spec.rb | Ruby | mit | 87 | master | 4,513 | RSpec.describe Server do
it "validates uniqueness of name but only if it changed (to allow other attributes to be updated while duplicates exists)" do
api_key = api_keys(:hetzner_cloud)
common_attributes = {
name: "unique-worker-1",
ipv6: "::1",
product: "P",
status: "running",
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/models/machine_config_spec.rb | Ruby | mit | 87 | master | 9,135 | RSpec.describe MachineConfig do
it "validates format of ephemeral_disk_identifier" do
machine_config = MachineConfig.new
machine_config.validate
expect(machine_config.errors[:ephemeral_disk_identifier]).to be_empty
machine_config.ephemeral_disk_identifier = "wwid:1234567890abcdef"
machine_config.... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/models/config_spec.rb | Ruby | mit | 87 | master | 1,105 | RSpec.describe Config do
it "validates talos config" do
invalid_nameservers_patch = <<~YAML
machine:
install:
extraKernelArgs:
- cpufreq.default_governor=performance
network:
hostname: ${hostname}
interfaces:
- interface: enp1s0
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/models/label_and_taint_rule_spec.rb | Ruby | mit | 87 | master | 4,682 | RSpec.describe LabelAndTaintRule do
it "must have at least one label or taint" do
message = "must have at least one label or taint"
latr = LabelAndTaintRule.new
latr.validate
expect(latr.errors[:labels]).to include message
latr.taints = "key=value:NoSchedule"
latr.validate
expect(latr.... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | spec/jobs/label_and_taint_job_spec.rb | Ruby | mit | 87 | master | 2,056 | RSpec.describe LabelAndTaintJob do
it "applies labels and taints to a server via kubectl and updates label_and_taint_job_completed_at" do
LabelAndTaintRule.create!(
match: "worker",
labels: "node-role.kubernetes.io/worker=",
)
LabelAndTaintRule.create!(
match: "database",
labels: "... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/schema.rb | Ruby | mit | 87 | master | 5,628 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230223114725_create_clusters.rb | Ruby | mit | 87 | master | 244 | class CreateClusters < ActiveRecord::Migration[7.0]
def change
create_table :clusters do |t|
t.string :name, null: false
t.string :endpoint, null: false
t.text :secrets, null: false
t.timestamps
end
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230223091006_create_secrets.rb | Ruby | mit | 87 | master | 204 | class CreateSecrets < ActiveRecord::Migration[7.0]
def change
create_table :secrets do |t|
t.string :name, null: false
t.text :secrets, null: false
t.timestamps
end
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230223140331_associate_clusters_to_servers_and_vswitches.rb | Ruby | mit | 87 | master | 293 | class AssociateClustersToServersAndVswitches < ActiveRecord::Migration[7.0]
def change
change_table :hetzner_servers do |t|
t.references :cluster, foreign_key: true
end
change_table :clusters do |t|
t.references :hetzner_vswitch, foreign_key: true
end
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20251001101556_change_talos_image_factory_settings_schematic_id_into_reference.rb | Ruby | mit | 87 | master | 692 | class ChangeTalosImageFactorySettingsSchematicIdIntoReference < ActiveRecord::Migration[8.0]
def up
add_reference :talos_image_factory_settings, :talos_image_factory_schematic, foreign_key: true
setting = TalosImageFactorySetting.singleton
schematic_id = setting.try(:schematic_id)
talos_image_factory... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230214084313_create_configs.rb | Ruby | mit | 87 | master | 247 | class CreateConfigs < ActiveRecord::Migration[7.0]
def change
create_table :configs do |t|
t.string :name, null: false
t.text :config, null: false
t.timestamps
end
add_index :configs, :name, unique: true
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230220093804_create_hetzner_servers.rb | Ruby | mit | 87 | master | 446 | class CreateHetznerServers < ActiveRecord::Migration[7.0]
def change
create_table :hetzner_servers do |t|
t.string :name
t.string :ip, null: false
t.string :ipv6, null: false
t.string :product, null: false
t.string :data_center, null: false
t.string :status, null: false
t... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230412153422_add_install_disk_to_servers.rb | Ruby | mit | 87 | master | 559 | class AddInstallDiskToServers < ActiveRecord::Migration[7.0]
def change
add_column :servers, :bootstrap_disk, :string
Server::HetznerCloud.update_all(bootstrap_disk: "/dev/sda")
Server::HetznerDedicated.update_all(bootstrap_disk: "/dev/nvme0n1")
add_column :machine_configs, :install_disk, :string, nu... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20250702112740_create_talos_image_factory_settings.rb | Ruby | mit | 87 | master | 240 | class CreateTalosImageFactorySettings < ActiveRecord::Migration[7.2]
def change
create_table :talos_image_factory_settings do |t|
t.string :version, null: false
t.string :schematic_id
t.timestamps
end
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230213195207_create_servers.rb | Ruby | mit | 87 | master | 398 | class CreateServers < ActiveRecord::Migration[7.0]
def change
create_table :servers do |t|
t.string :state, null: false, default: "pending"
t.string :public_ip, null: false
t.string :smbios_uuid, null: false
t.string :private_ip
t.string :hostname
t.belongs_to :config
t.... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230223101439_add_columns_for_generative_configs.rb | Ruby | mit | 87 | master | 1,000 | class AddColumnsForGenerativeConfigs < ActiveRecord::Migration[7.0]
def change
change_table :configs do |t|
t.references :secret, foreign_key: true
t.column :cluster_name, :string
t.column :cluster_endpoint, :string
t.column :install_disk, :string, null: false, default: "/dev/nvme0n1"
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20250724070230_change_taints_and_labels_to_regular_strings.rb | Ruby | mit | 87 | master | 1,170 | class ChangeTaintsAndLabelsToRegularStrings < ActiveRecord::Migration[8.0]
def up
existing = ApplicationRecord.connection
.query("SELECT id,array_to_string(labels, ','),array_to_string(taints, ',') FROM label_and_taint_rules")
remove_column :label_and_taint_rules, :labels
remove_column :label_and_t... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20250630141348_create_api_keys.rb | Ruby | mit | 87 | master | 290 | class CreateApiKeys < ActiveRecord::Migration[7.2]
def change
create_table :api_keys do |t|
t.string :provider, null: false
t.string :name, null: false
t.string :secret, null: false
t.timestamps
end
add_index :api_keys, :name, unique: true
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20250630185032_backfill_api_keys_from_env.rb | Ruby | mit | 87 | master | 1,519 | class BackfillApiKeysFromEnv < ActiveRecord::Migration[7.2]
def up
add_reference :servers, :api_key, null: true, foreign_key: true
if ENV["HETZNER_WEBSERVICE_USER"].present? && ENV["HETZNER_WEBSERVICE_PASSWORD"].present?
api_key = ApiKey.new(
provider: "hetzner_robot",
name: ENV["HETZNE... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20250724112843_create_talos_factory_schematics.rb | Ruby | mit | 87 | master | 351 | class CreateTalosFactorySchematics < ActiveRecord::Migration[8.0]
def change
create_table :talos_image_factory_schematics do |t|
t.string :name, null: false
t.string :body, null: false
t.string :schematic_id, null: false
t.timestamps
end
add_index :talos_image_factory_schematics,... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20250723092356_create_label_and_taint_rules.rb | Ruby | mit | 87 | master | 319 | class CreateLabelAndTaintRules < ActiveRecord::Migration[8.0]
def change
create_table :label_and_taint_rules do |t|
t.string :match, null: false
t.string :labels, array: true, null: false, default: []
t.string :taints, array: true, null: false, default: []
t.timestamps
end
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230221094652_add_config_timestamps_to_hetzner_servers.rb | Ruby | mit | 87 | master | 239 | class AddConfigTimestampsToHetznerServers < ActiveRecord::Migration[7.0]
def change
add_column :hetzner_servers, :last_configured_at, :datetime
add_column :hetzner_servers, :last_request_for_configuration_at, :datetime
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230220093844_create_hetzner_vswitches.rb | Ruby | mit | 87 | master | 223 | class CreateHetznerVswitches < ActiveRecord::Migration[7.0]
def change
create_table :hetzner_vswitches do |t|
t.string :name, null: false
t.integer :vlan, null: false
t.timestamps
end
end
end |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230221092950_merge_servers.rb | Ruby | mit | 87 | master | 583 | class MergeServers < ActiveRecord::Migration[7.0]
def up
add_column :hetzner_servers, :private_ip, :string
add_column :hetzner_servers, :config_id, :integer
add_column :hetzner_servers, :uuid, :string
add_index :hetzner_servers, :config_id
add_foreign_key :hetzner_servers, :configs
add_index ... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230221101003_create_machine_configs.rb | Ruby | mit | 87 | master | 621 | class CreateMachineConfigs < ActiveRecord::Migration[7.0]
def change
create_table :machine_configs do |t|
t.references :config, null: false, foreign_key: true
t.references :hetzner_server, null: false, foreign_key: true
t.string :hostname, null: false
t.string :private_ip, null: false
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | db/migrate/20230223115816_remove_superfluous_columns_from_configs.rb | Ruby | mit | 87 | master | 259 | class RemoveSuperfluousColumnsFromConfigs < ActiveRecord::Migration[7.0]
def change
remove_column :configs, :cluster_name, :string
remove_column :configs, :cluster_endpoint, :string
rename_column :configs, :talos_image, :install_image
end
end |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | hubtime.gemspec | Ruby | mit | 87 | master | 1,020 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "hubtime/version"
Gem::Specification.new do |s|
s.name = "hubtime"
s.version = Hubtime::VERSION
s.summary = "Visualization of your Github activity over the past year via Github API."
s.email = "contact@plataform... |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | lib/hubtime.rb | Ruby | mit | 87 | master | 426 | require 'active_support'
require 'active_support/all'
require 'terminal-table'
require 'fileutils'
require 'yaml'
require 'erubis'
require 'hashie'
Hashie::Mash # for some reason, there are load issue later if i don't do this
require 'octokit'
require 'hubtime/version'
require 'hubtime/hub_config'
require 'hubtime/ca... |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | lib/hubtime/github.rb | Ruby | mit | 87 | master | 2,154 | # -*- encoding : utf-8 -*-
Octokit.user_agent = "Hubtime : Octokit Ruby Gem #{Octokit::VERSION}"
module Hubtime
class GithubService
def self.owner
@owner ||= self.new
end
attr_reader :client, :cacher
def initialize
@client = Octokit::Client.new(:login => HubConfig.user, :password => HubC... |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | lib/hubtime/cacher.rb | Ruby | mit | 87 | master | 1,426 | # -*- encoding : utf-8 -*-
require 'hashie'
module Hubtime
class Cacher
def self.clear(type)
dir = nil
case type
when "all"
dir = File.join(File.expand_path("."), "data")
when "cache", "charts"
dir = File.join(File.expand_path("."), "data", type)
else
dir = F... |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | lib/hubtime/commit.rb | Ruby | mit | 87 | master | 1,650 | # -*- encoding : utf-8 -*-
module Hubtime
class Commit
attr_reader :repo_name, :sha, :additions, :deletions, :committer, :time
def initialize(hash, repo_name = nil, committer = nil)
@repo_name = repo_name # or figure it out
@sha = hash["sha"]
@additions = hash["stats"]["additions"].to_i
... |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | lib/hubtime/repo.rb | Ruby | mit | 87 | master | 5,118 | # -*- encoding : utf-8 -*-
require 'hashie'
require 'thread'
module Hubtime
class Repo
attr_reader :cacher, :mutex, :thread_count
attr_reader :repo_name, :username, :start_time, :end_time
def initialize(repo_name, username, start_time, end_time)
@repo_name = repo_name
@username = username
... |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | lib/hubtime/activity.rb | Ruby | mit | 87 | master | 13,600 | # -*- encoding : utf-8 -*-
module Hubtime
class Activity
class Period
attr_reader :example, :label, :compiled, :children
attr_reader :total_stats, :repo_stats, :user_stats
def initialize(label, example_time=nil)
@example = example_time
@label = label
@children = {}
... |
github | bleonard/hubtime | https://github.com/bleonard/hubtime | lib/hubtime/hub_config.rb | Ruby | mit | 87 | master | 2,363 | # -*- encoding : utf-8 -*-
require 'openssl'
require 'digest/sha2'
module Hubtime
class HubConfig
def self.instance
@config ||= HubConfig.new
end
def self.auth(user, password)
store(user, password)
end
def self.store(user, password)
instance.store(user, password)
end
... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | cocoapods-downloader.gemspec | Ruby | mit | 88 | master | 718 | # -*- encoding: utf-8 -*-
$:.unshift File.expand_path('../lib', __FILE__)
require 'cocoapods-downloader/gem_version'
Gem::Specification.new do |s|
s.name = "cocoapods-downloader"
s.version = Pod::Downloader::VERSION
s.license = "MIT"
s.email = ["eloy.de.enige@gmail.com", "fabiopelosin@gmail.com"]
s.... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | Rakefile | Ruby | mit | 88 | master | 3,212 | # Bootstrap
#-----------------------------------------------------------------------------#
desc 'Initializes your working copy to run the specs'
task :bootstrap do
if system('which bundle')
title 'Installing gems'
`bundle install`
else
$stderr.puts "\033[0;31m" \
"[!] Please install the bundler ... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | Gemfile | Ruby | mit | 88 | master | 344 | source 'https://rubygems.org'
gemspec
group :development do
gem 'bacon'
gem 'kicker'
gem 'mocha-on-bacon'
gem 'prettybacon'
gem 'rake'
gem 'rexml', '~> 3.2.5'
gem 'vcr'
gem 'webmock', '< 1.9'
# Ruby 1.8.7
gem 'mime-types', '< 2.0'
gem 'rubocop'
gem 'codeclimate-test-reporter', :require => ni... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/remote_file_spec.rb | Ruby | mit | 88 | master | 8,442 | require File.expand_path('../spec_helper', __FILE__)
require 'cocoapods-downloader/remote_file'
module Pod
module Downloader
class MockRemoteFile < RemoteFile
def download_file(full_filename)
uri = URI.parse(url)
FileUtils.cp(uri.path, full_filename)
end
end
describe 'RemoteF... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/git_spec.rb | Ruby | mit | 88 | master | 13,772 | require File.expand_path('../spec_helper', __FILE__)
module Pod
module Downloader
describe 'Git' do
def fixture_url(name)
'file://' + fixture(name).to_s
end
before do
tmp_folder.rmtree if tmp_folder.exist?
end
describe 'In general' do
it 'checks out a speci... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/subversion_spec.rb | Ruby | mit | 88 | master | 4,885 | require File.expand_path('../spec_helper', __FILE__)
module Pod
module Downloader
describe 'Subversion' do
before do
tmp_folder.rmtree if tmp_folder.exist?
end
it 'checks out a specific revision' do
options = { :svn => "file://#{fixture('subversion-repo')}", :revision => '1' }
... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/scp_spec.rb | Ruby | mit | 88 | master | 2,886 | require File.expand_path('../spec_helper', __FILE__)
module Pod
module Downloader
describe 'SCP' do
before do
tmp_folder.rmtree if tmp_folder.exist?
@fixtures_path = fixture('scp').to_s
end
it 'download file and unzip it over SCP (using mock)' do
options = { :scp => "sc... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/base_spec.rb | Ruby | mit | 88 | master | 1,164 | require File.expand_path('../spec_helper', __FILE__)
module Pod
module Downloader
describe Base do
it 'checks for unrecognized options on initialization' do
options = { :unrecognized => 'value' }
e = lambda { Base.new('path', 'url', options) }.should.raise DownloaderError
e.message.... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/http_spec.rb | Ruby | mit | 88 | master | 5,131 | require File.expand_path('../spec_helper', __FILE__)
module Pod
module Downloader
describe 'HTTP' do
mock_user_agent = 'mock_user_agent'.freeze
before do
tmp_folder.rmtree if tmp_folder.exist?
@fixtures_url = 'file://' + fixture('http').to_s
Http.stubs(:user_agent_string).retu... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/spec_helper.rb | Ruby | mit | 88 | master | 1,713 | #-- Set up coverage analysis -------------------------------------------------#
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.configure do |config|
config.logger.level = Logger::WARN
end
CodeClimate::TestReporter.start
#-- Requirements -------------------------------------------------------------#... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/cocoapods-downloaders_spec.rb | Ruby | mit | 88 | master | 2,504 | require File.expand_path('../spec_helper', __FILE__)
module Pod
module Downloader
describe Downloader do
before do
@subject = Downloader
end
describe '::downloader_class_by_key' do
it 'returns the concrete classes by key' do
result = @subject.downloader_class_by_key
... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | spec/mercurial_spec.rb | Ruby | mit | 88 | master | 5,148 | require File.expand_path('../spec_helper', __FILE__)
module Pod
module Downloader
describe 'Mercurial' do
before do
tmp_folder.rmtree if tmp_folder.exist?
end
it 'checks out a specific revision' do
options = { :hg => fixture('mercurial-repo'), :revision => '46198bb3af96' }
... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader.rb | Ruby | mit | 88 | master | 2,910 | module Pod
module Downloader
require 'cocoapods-downloader/gem_version'
require 'cocoapods-downloader/api'
require 'cocoapods-downloader/api_exposable'
require 'cocoapods-downloader/base'
autoload :Git, 'cocoapods-downloader/git'
autoload :Http, 'cocoapods-downloader/http'
... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/http.rb | Ruby | mit | 88 | master | 880 | require 'cocoapods-downloader/remote_file'
module Pod
module Downloader
class Http < RemoteFile
USER_AGENT_HEADER = 'User-Agent'.freeze
private
executable :curl
def download_file(full_filename)
parameters = ['-f', '-L', '-o', full_filename, url, '--create-dirs', '--netrc-option... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/scp.rb | Ruby | mit | 88 | master | 512 | require 'uri'
require 'cocoapods-downloader/remote_file'
module Pod
module Downloader
class Scp < RemoteFile
DEFAULT_PORT = 22
private
executable :scp
def download_file(full_filename)
scp! '-P', port, '-q', source, full_filename
end
def source
"#{uri.user ?... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/api.rb | Ruby | mit | 88 | master | 1,908 | module Pod
module Downloader
# The Downloader::Hooks module allows to adapt the Downloader to
# the UI of other gems.
#
module API
# Executes
# @return [String] the output of the command.
#
def execute_command(executable, command, raise_on_failure = false)
require 'shel... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/mercurial.rb | Ruby | mit | 88 | master | 1,435 | module Pod
module Downloader
class Mercurial < Base
def self.options
[:revision, :tag, :branch]
end
def options_specific?
!(options[:revision] || options[:tag]).nil?
end
def checkout_options
Dir.chdir(target_path) do
options = {}
options[... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/api_exposable.rb | Ruby | mit | 88 | master | 622 | module Pod
module Downloader
module APIExposable
def expose_api(mod = nil, &block)
if mod.nil?
if block.nil?
raise "Either a module or a block that's used to create a module is required."
else
mod = Module.new(&block)
end
elsif mod && blo... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/subversion.rb | Ruby | mit | 88 | master | 1,732 | module Pod
module Downloader
class Subversion < Base
def self.options
[:revision, :tag, :folder, :externals, :checkout]
end
def options_specific?
!(options[:revision] || options[:tag]).nil?
end
def checkout_options
Dir.chdir(target_path) do
options... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/base.rb | Ruby | mit | 88 | master | 5,359 | require 'shellwords'
class Pathname
# @return [String] a version of the path that is escaped to be safe to use in
# a shell.
def shellescape
to_s.shellescape
end
end
module Pod
module Downloader
# The base class defines the common behaviour of the downloaders.
#
# @abstract Subclass ... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/git.rb | Ruby | mit | 88 | master | 5,320 | module Pod
module Downloader
# Concreted Downloader class that provides support for specifications with
# git sources.
#
class Git < Base
def self.options
[:commit, :tag, :branch, :submodules]
end
def options_specific?
!(options[:commit] || options[:tag]).nil?
... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | lib/cocoapods-downloader/remote_file.rb | Ruby | mit | 88 | master | 4,921 | require 'fileutils'
require 'uri'
require 'zlib'
module Pod
module Downloader
class RemoteFile < Base
def self.options
[:type, :flatten, :sha1, :sha256, :headers]
end
class UnsupportedFileTypeError < StandardError; end
private
executable :unzip
executable :tar
... |
github | CocoaPods/cocoapods-downloader | https://github.com/CocoaPods/cocoapods-downloader | examples/downloading_a_git_repo.rb | Ruby | mit | 88 | master | 250 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require 'cocoapods-downloader'
path = ''
options = {}
downloader = Pod::Downloader.for_target(path, options)
downloader.cache_root = ''
downloader.max_cache_size = 500
downloader.download |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | Gemfile | Ruby | mit | 87 | master | 279 | source 'https://rubygems.org'
gemspec
gem 'xmpp4r-hipchat', github: 'bartoszkopinski/xmpp4r-hipchat', branch: 'master'
gem 'slack-api'
platforms :rbx do
gem 'racc'
gem 'rubysl', '~> 2.0'
gem 'psych'
end
platforms :mri do
gem 'coveralls', require: false
end
gem 'pry' |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | hipbot.gemspec | Ruby | mit | 87 | master | 1,279 | # encoding: utf-8
require File.expand_path('../lib/hipbot/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Bartosz Kopiński", "Tomasz Pewiński"]
gem.email = ["bartosz.kopinski@netguru.pl", "pewniak747@gmail.com"]
gem.description = "Hipbot is a XMPP bot for HipChat, written in R... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot.rb | Ruby | mit | 87 | master | 1,344 | require 'active_support/concern'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/string/inflections'
require 'ostruct'
require 'json'
require 'eventmachine'
require 'em-... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/room.rb | Ruby | mit | 87 | master | 712 | module Hipbot
class Room
include Cache
attr_cache :users
def on_join user
self.users << user
end
def on_leave user
if user.myself?
self.destroy
else
self.users.delete(user)
end
end
def set_topic topic
Hipbot.set_topic(self, topic)
end
... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/reaction_factory.rb | Ruby | mit | 87 | master | 1,003 | module Hipbot
class ReactionFactory < Struct.new(:reactable)
attr_reader :current_description
private :reactable, :current_description
def build(options_stack, block)
options = get_options(options_stack)
block ||= options.delete(:block)
@current_description = nil
Reaction.new(reac... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/match.rb | Ruby | mit | 87 | master | 1,477 | module Hipbot
class Match < Struct.new(:reaction, :message)
include Cache
def matches?
matches_scope? && matches_place? && matches_regexp? && matches_sender? && matches_condition?
end
def invoke
Response.new(reaction, message).invoke(reaction_parameters)
end
protected
def r... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/helpers.rb | Ruby | mit | 87 | master | 284 | require 'hipbot/helpers/http'
module Hipbot
module Helpers
[:get, :post, :put, :delete].each do |method|
define_method method do |url, query = {}, &block|
Http::Request.new(url, query, method).call(&block)
end
module_function method
end
end
end |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/response.rb | Ruby | mit | 87 | master | 836 | module Hipbot
class Response < Struct.new(:reaction, :message)
include Helpers
delegate :sender, :room, to: :message
delegate :bot, to: Hipbot
def initialize *_
super
Hipbot.logger.info("RESPONSE WITH #{reaction}")
end
def invoke arguments
handle_errors do
instance... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/configurable.rb | Ruby | mit | 87 | master | 430 | module Hipbot
module Configurable
extend ActiveSupport::Concern
attr_accessor :configuration
delegate *Configuration::OPTIONS, to: :configuration
included do
extend ClassMethods
end
def initialize
self.configuration ||= Configuration.new
end
module ClassMethods
de... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/message.rb | Ruby | mit | 87 | master | 844 | # encoding: utf-8
module Hipbot
class Message < Struct.new(:raw_body, :room, :sender)
include Cache
attr_accessor :body
MENTION_REGEXP = /@(\p{Word}++):?/.freeze
def initialize *args
super
Hipbot.logger.info("MESSAGE from #{sender} in ##{room}")
self.raw_body = raw_body.force_enco... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/reactable.rb | Ruby | mit | 87 | master | 892 | module Hipbot
module Reactable
include Cache
attr_cache :reactions, :default_reactions, :presence_reactions, :options_stack
attr_cache :reaction_factory do
ReactionFactory.new(self)
end
def on_presence *params, &block
scope *params do
presence_reactions << to_reaction(block)
... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/plugin.rb | Ruby | mit | 87 | master | 578 | require "singleton"
module Hipbot
module Plugin
extend ActiveSupport::Concern
included do
extend Reactable
extend ClassMethods
include Singleton
include Helpers
attr_accessor :response
delegate :sender, :recipients, :body, :room, :reply, to: :response
delegate :b... |
github | pewniak747/hipbot | https://github.com/pewniak747/hipbot | lib/hipbot/configuration.rb | Ruby | mit | 87 | master | 1,097 | module Hipbot
class Configuration
OPTIONS = [
:adapter, :case_insensitive, :exception_handler, :helpers, :join, :join_on_invite,
:logger, :password, :plugins, :preloader, :rooms, :status, :storage, :teams, :user
]
attr_accessor *OPTIONS
def initialize
self.class.class_eval do
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.