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 | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/lib/bookbinder/preprocessing/link_to_site_gen_dir_spec.rb | Ruby | apache-2.0 | 45 | main | 3,461 | require_relative '../../../../lib/bookbinder/local_filesystem_accessor'
require_relative '../../../../lib/bookbinder/subnav/navigation_entries_from_markdown_root'
require_relative '../../../../lib/bookbinder/preprocessing/link_to_site_gen_dir'
require_relative '../../../../lib/bookbinder/subnav/subnav_generator'
requir... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/lib/bookbinder/preprocessing/preprocessor_spec.rb | Ruby | apache-2.0 | 45 | main | 1,541 | require_relative '../../../../lib/bookbinder/preprocessing/preprocessor'
module Bookbinder
module Preprocessing
describe Preprocessor do
it "applies processes to applicable objects" do
objs = [
Object.new,
Object.new,
Object.new,
Object.new,
]
... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/lib/bookbinder/preprocessing/dita_html_preprocessor_spec.rb | Ruby | apache-2.0 | 45 | main | 8,320 | require_relative '../../../../lib/bookbinder/config/section_config'
require_relative '../../../../lib/bookbinder/preprocessing/dita_html_preprocessor'
require_relative '../../../../lib/bookbinder/values/output_locations'
require_relative '../../../../lib/bookbinder/values/section'
require_relative '../../../../lib/book... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/fake_filesystem_accessor_spec.rb | Ruby | apache-2.0 | 45 | main | 3,456 | require 'pathname'
require_relative 'fake_filesystem_accessor'
describe FakeFilesystemAccessor do
it 'knows if a file exists' do
fs = FakeFilesystemAccessor.new({ 'foo' => { 'bar' => { 'baz.html' => 'hi' }}})
expect(fs.file_exist?('/foo/bar/baz.html')).to be true
expect(fs.file_exist?(Pathname('/foo/bar... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/git_repo.rb | Ruby | apache-2.0 | 45 | main | 1,175 | module Bookbinder
module GitRepo
def init_repo(at_dir: nil,
branch: nil,
commit_message: "I love commits!",
contents: nil,
file: nil)
FileUtils.mkdir_p(File.join(at_dir, File.dirname(file)))
`#{<<-SCRIPT}`
cd #{at_dir};
git init;
... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/use_fixture_repo.rb | Ruby | apache-2.0 | 45 | main | 795 | require_relative '../fixtures/repo_fixture'
require_relative 'tmp_dirs'
def use_fixture_repo(repo_name = 'book')
include_context 'tmp_dirs'
around do |spec|
# temp_library = tmp_subdir 'repositories'
Dir.mktmpdir('repositories') do |temp_library|
FileUtils.cp_r File.join(Bookbinder::RepoFixture.repo... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/middleman.rb | Ruby | apache-2.0 | 45 | main | 2,176 | require 'middleman-core/logger'
module Bookbinder
module SpecHelperMethods
def generate_middleman_with(index_page)
dir = tmp_subdir 'master_middleman'
source_dir = File.join(dir, 'source')
FileUtils.mkdir source_dir
FileUtils.cp File.join('spec', 'fixtures', index_page), File.join(source_... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/redirection.rb | Ruby | apache-2.0 | 45 | main | 740 | module Bookbinder
module Redirection
def capture_stdout(&block)
real_stdout = $stdout
$stdout = StringIO.new
block.call
$stdout.rewind
$stdout.read
ensure
$stdout = real_stdout
end
def capture_stderr(&block)
real_stderr = $stderr
$stderr = StringIO.new
... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/book_fixture.rb | Ruby | apache-2.0 | 45 | main | 4,059 | require 'nokogiri'
require 'ostruct'
module Bookbinder
class BookFixture
attr_reader :name, :section_source
def initialize(book_name, section_source)
@name = book_name
@section_source = section_source
end
def html_files_for_dita_section(dita_section)
topics(dita_section).map { |to... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/tmp_dirs.rb | Ruby | apache-2.0 | 45 | main | 229 | require 'pathname'
require 'tmpdir'
shared_context 'tmp_dirs' do
def tmp_subdir(name)
tmpdir.join(name).tap do |dir|
FileUtils.mkdir_p dir
end
end
def tmpdir
@tmpdir ||= Pathname(Dir.mktmpdir)
end
end |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/fake_filesystem_accessor.rb | Ruby | apache-2.0 | 45 | main | 3,750 | require 'pathname'
class FakeFilesystemAccessor
NotFaked = Class.new(Exception)
NotFound = Class.new(Exception)
def initialize(files = {})
@files = { full_path: '', children: process(files) }
end
def file_exist?(path)
entry_from_path(path)
true
rescue NotFound
false
end
def is_file?(... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/matchers.rb | Ruby | apache-2.0 | 45 | main | 510 | RSpec::Matchers.define :have_output do |regexp|
raise ArgumentError, "Must provide a regexp" if regexp.nil?
chain(:in_red) do
@color = Regexp.escape("\e[31m")
end
chain(:in_yellow) do
@color = Regexp.escape("\e[33m")
end
chain(:in_bold_white) do
@color = Regexp.escape("\e[1;39;49m")
end
matc... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/dev_null.rb | Ruby | apache-2.0 | 45 | main | 233 | module DevNull
class Stream
def puts(*args)
end
def <<(*args)
end
end
def self.get_streams
{
out: Stream.new,
err: Stream.new,
success: Stream.new,
warn: Stream.new
}
end
end |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/environment_setups.rb | Ruby | apache-2.0 | 45 | main | 550 | require_relative '../helpers/dita_ot_installer'
def around_in_dita_ot_env(environment)
around do |example|
old_env = environment.clone
dita_ot_installer = Bookbinder::DitaOTInstaller.new
environment.update(
'PATH_TO_DITA_OT_LIBRARY' => dita_ot_installer.install_dita.to_s,
'JAVA_HOME' => d... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/application.rb | Ruby | apache-2.0 | 45 | main | 1,674 | require_relative '../helpers/redirection'
require_relative '../../lib/bookbinder/commands/collection'
require_relative '../helpers/use_fixture_repo'
require_relative '../helpers/git_fake'
require_relative '../helpers/dev_null'
require 'pathname'
require 'tmpdir'
module Bookbinder
class Application
include Redire... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/dita_ot_installer.rb | Ruby | apache-2.0 | 45 | main | 1,781 | require 'net/http'
module Bookbinder
class DitaOTInstaller
UnpackingError = Class.new(RuntimeError)
def install_dita
tar('-jxf', download(AntDownload.new))
dita_ot = DitaOTDownload.new
tar('-zxf', download(dita_ot))
spec_root.join("utilities", dita_ot.dir)
end
def download(r... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/helpers/git_fake.rb | Ruby | apache-2.0 | 45 | main | 1,306 | module Bookbinder
class GitFake
def initialize
@git_urls = []
end
def clone(url, name, path: nil, checkout: 'master')
local_repo_dir = File.expand_path('../../fixtures/repositories', __FILE__)
destination = File.join("#{path}", name)
FileUtils.mkdir_p(destination)
FileUtils... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/master_middleman/proof_spec.rb | Ruby | apache-2.0 | 45 | main | 1,852 | require 'yaml'
require 'nokogiri'
require_relative '../helpers/use_fixture_repo'
require_relative '../helpers/redirection'
describe 'binding with the proof flag' do
include Bookbinder::Redirection
use_fixture_repo
before do
config = YAML.load(File.read('./config.yml'))
config.delete('cred_repo')
c... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/master_middleman/quicklinks_renderer_spec.rb | Ruby | apache-2.0 | 45 | main | 2,200 | require 'ostruct'
require_relative '../../master_middleman/quicklinks_renderer'
describe QuicklinksRenderer do
let(:vars) { OpenStruct.new( somevar: 'SomeVar' ) }
let(:quicklinks_renderer) { QuicklinksRenderer.new(vars) }
describe '#header' do
it 'renders the quicklinks' do
expected_html = <<EOT
<div ... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/master_middleman/archive_drop_down_menu_spec.rb | Ruby | apache-2.0 | 45 | main | 2,884 | require_relative '../../master_middleman/archive_drop_down_menu'
module Bookbinder
describe ArchiveDropDownMenu do
it "uses the root menu when at the root path" do
menu = ArchiveDropDownMenu.new(
{ '.' => ['v2',
{'v1.1' => 'great/place'},
{'v1.0' => 'notso/greatp... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/javascripts/support/jasmine_helper.rb | Ruby | apache-2.0 | 45 | main | 524 | #Use this file to set/override Jasmine configuration options
#You can remove it if you don't need it.
#This file is loaded *after* jasmine.yml is interpreted.
#
#Example: using a different boot file.
#Jasmine.configure do |config|
# config.boot_dir = '/absolute/path/to/boot_dir'
# config.boot_files = lambda { ['/ab... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/binding_a_book_remotely_spec.rb | Ruby | apache-2.0 | 45 | main | 1,270 | require 'tmpdir'
require 'yaml'
require_relative '../helpers/git_repo'
require_relative '../helpers/redirection'
describe 'binding a book remotely' do
include Bookbinder::GitRepo
include Bookbinder::Redirection
let(:gem_root) { File.expand_path('../../../', __FILE__) }
it 'includes content from a remote sect... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/archive_menu_spec.rb | Ruby | apache-2.0 | 45 | main | 3,438 | require_relative '../../lib/bookbinder/cli'
require_relative '../../lib/bookbinder/ingest/git_accessor'
require_relative '../helpers/middleman'
require_relative '../helpers/use_fixture_repo'
module Bookbinder
describe "a book with archive menus" do
extend SpecHelperMethods
use_fixture_repo('archive-menu-boo... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/bind_with_dita_spec.rb | Ruby | apache-2.0 | 45 | main | 5,648 | require_relative '../helpers/environment_setups'
require_relative '../helpers/book_fixture'
require_relative '../helpers/application'
require_relative '../helpers/git_fake'
module Bookbinder
describe 'binding a book with DITA sections' do
around_in_dita_ot_env(ENV)
context 'from local' do
it 'process... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/creating_a_pdf_spec.rb | Ruby | apache-2.0 | 45 | main | 1,526 | require 'json'
require 'yaml'
require_relative '../helpers/environment_setups'
require_relative '../helpers/use_fixture_repo'
require_relative '../helpers/redirection'
describe 'binding a book locally' do
include Bookbinder::Redirection
use_fixture_repo('dita-book')
around_in_dita_ot_env(ENV)
let(:pdf_conf... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/binding_a_book_locally_spec.rb | Ruby | apache-2.0 | 45 | main | 6,728 | require 'json'
require 'yaml'
require 'nokogiri'
require_relative '../helpers/use_fixture_repo'
require_relative '../helpers/redirection'
describe 'binding a book locally' do
include Bookbinder::Redirection
use_fixture_repo
before do
config = YAML.load(File.read('./config.yml'))
config.delete('cred_re... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/generating_app_components_spec.rb | Ruby | apache-2.0 | 45 | main | 1,742 | require 'yaml'
require_relative '../helpers/redirection'
require_relative '../helpers/use_fixture_repo'
module Bookbinder
describe 'bind local' do
use_fixture_repo
before do
config = YAML.load(File.read('./config.yml'))
config.delete('cred_repo')
File.write('./config.yml', config.to_yaml)
... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/watching_a_book_spec.rb | Ruby | apache-2.0 | 45 | main | 660 | require_relative '../../lib/bookbinder/commands/collection'
require_relative '../helpers/redirection'
require_relative '../helpers/dev_null'
require_relative '../helpers/use_fixture_repo'
describe "watching a book" do
include Bookbinder::Redirection
use_fixture_repo
it "invokes middleman" do
File.write('./m... |
github | pivotal-cf/bookbinder | https://github.com/pivotal-cf/bookbinder | spec/acceptance/version_number_spec.rb | Ruby | apache-2.0 | 45 | main | 337 | describe 'calling bookbinder with --version' do
let(:gem_root) { File.expand_path('../../../', __FILE__) }
let(:version) { Gem::Specification::load(File.join gem_root, "bookbinder.gemspec").version }
it 'outputs the version' do
expect(`#{gem_root}/install_bin/bookbinder --version`).to eq("bookbinder #{versio... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | kb8or.rb | Ruby | mit | 45 | master | 2,427 | #!/usr/bin/env ruby
# Tool to allow easy deployments on kb8
# by automating kubectl and managing versions
require 'methadone'
require 'yaml'
require 'pathname'
KB8_HOME = File.dirname(Pathname.new(__FILE__).realdirpath)
Dir.glob(File.join(KB8_HOME, 'libs/*.rb')) { |f| require f }
class Kb8or
include Methadone::Ma... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | Rakefile | Ruby | mit | 45 | master | 258 | #!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('./kb8or.rb', __FILE__)
#Blog::Application.load_tasks |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/container_version_finder.rb | Ruby | mit | 45 | master | 1,506 | require 'methadone'
class ContainerVersionFinder
include Methadone::Main
include Methadone::CLILogging
attr_accessor :versions_by_image_name,
:files_by_image_name
# Object to get container versions from glob path:
# E.g.
# ../artefacts/*_container_version
# allow access by file name sa... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_volumes.rb | Ruby | mit | 45 | master | 436 | require_relative 'kb8_utils'
class Kb8Volumes
attr_accessor :secrets
def initialize(volume_data)
unless volume_data.class == Array
raise 'Invalid volume, expecting Volumes'
end
@secrets = []
volume_data.each do |volume|
if volume.has_key?('secret')
@secrets << volume['secret']... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/file_secrets.rb | Ruby | mit | 45 | master | 1,698 | require_relative 'kb8_resource'
require_relative 'kb8_utils'
class FileSecrets
attr_accessor :name,
:secrets,
:path
class Secret
attr_accessor :name,
:base64_data
def initialize(file)
@base64_data = Base64.strict_encode64(Kb8Utils.load(file))
... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/settings.rb | Ruby | mit | 45 | master | 2,460 | require_relative 'kb8_utils'
class Settings
# TODO: Split this out into separate expected schema settings files...?
FILE_DEFAULTS = 'defaults.yaml'
# Simply add attributes to add further settings!
attr_accessor :container_version_glob_path,
:defaults,
:default_env_name,
... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_controller.rb | Ruby | mit | 45 | master | 9,342 | require 'methadone'
require_relative 'kb8_resource'
require_relative 'kb8_container_spec'
require_relative 'kb8_pod'
class Kb8Controller < Kb8Resource
include Methadone::Main
include Methadone::CLILogging
DEPLOYMENT_LABEL = 'kb8_deploy_id'
ORIGINAL_NAME = 'kb8_deploy_name'
attr_accessor :selectors,
... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/deployment_unit.rb | Ruby | mit | 45 | master | 5,002 | require 'methadone'
require_relative 'file_secrets'
require_relative 'multi_template'
class Kb8DeployUnit
attr_accessor :context,
:only_deploy,
:resources,
:changed_resources
include Methadone::Main
include Methadone::CLILogging
def initialize(data, context, d... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/multi_template.rb | Ruby | mit | 45 | master | 3,540 | require 'methadone'
require_relative 'kb8_resource'
class MultiTemplate
include Methadone::Main
include Methadone::CLILogging
attr_accessor :dir,
:kb8_data,
:template_file,
:items,
:template_data,
:template_name,
:v... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/replace_obj_vars.rb | Ruby | mit | 45 | master | 3,975 | require_relative 'kb8_utils'
require_relative 'kb8_file_data'
class ReplaceObjVars
# Class to replace any string references in an object with values from a hash
REGEXP_SPECIFIC_VAR = '\${\W*(%s)\W*}'
REGEXP_VAR = REGEXP_SPECIFIC_VAR % '.*?'
FILE_INCLUDE = 'file://'
INCLUDE_KEYS = %w(Fn::FileIncludePaths Fil... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/runner.rb | Ruby | mit | 45 | master | 1,165 | require 'open3'
class Runner
attr_accessor :status,
:stdout,
:stderr,
:output,
:outputted,
:screen
def initialize(cmd, output, input)
@output = output
# see: http://stackoverflow.com/a/1162850/83386
Open3.popen3(cmd) do... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/context.rb | Ruby | mit | 45 | master | 3,843 | require_relative 'kb8_utils'
require_relative 'replace_obj_vars'
class Context
attr_reader :always_deploy,
:container_version_finder,
:deployment_home,
:env_name,
:settings,
:vars,
:overridden_vars
include Methadone::Main
inclu... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_pod.rb | Ruby | mit | 45 | master | 9,467 | require 'methadone'
require 'json'
require_relative 'kb8_controller'
require_relative 'kb8_run'
class Kb8Pod < Kb8Resource
include Methadone::Main
include Methadone::CLILogging
PHASE_PENDING = 'Pending'
PHASE_RUNNING = 'Running'
PHASE_SUCCEEDED = 'Succeeded'
PHASE_FAILED = 'Failed'
PHASE_UNKNOWN... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_utils.rb | Ruby | mit | 45 | master | 774 | require 'yaml'
require 'methadone'
require_relative 'kb8_run'
class Kb8Utils
def self.load_yaml(file_path)
begin
data = YAML.load(Kb8Utils.load(file_path))
rescue Exception
# do some logging
raise $!, "Error parsing YAML file: #{file_path}: #{$!}", $!.backtrace
end
data
end
def... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/safe_runner.rb | Ruby | mit | 45 | master | 570 | require 'open3'
class SafeRunner
attr_accessor :status,
:stdout,
:stderr,
:output,
:outputted,
:screen
def initialize(cmd, output, input)
@output = output
$stdout.sync = true
@stdout, @stderr, @status = Open3.capture3(c... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/tunnel.rb | Ruby | mit | 45 | master | 1,257 | require 'methadone'
require_relative 'kb8_run'
require 'uri'
class Tunnel
attr_accessor :tunnel
SSH_SOCKET = '/tmp/kb8or-ctrl-socket'
CLIENT_PORT = 8080
include Methadone::Main
include Methadone::CLILogging
def initialize(tunnel,
tunnel_options,
context)
@tunnel = ... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_resource.rb | Ruby | mit | 45 | master | 5,255 | require_relative 'kb8_utils'
require 'digest'
require_relative 'file_secrets'
class Kb8Resource
include Methadone::Main
include Methadone::CLILogging
KB8_MD5_KEY = 'kb8_md5'
RESOURCE_POD = 'Pod'
RESOURCE_RC = 'ReplicationController'
RESOURCE_NAMESPACE = 'Namespace'
KB8_DIRTY_KEY = 'kb8_failing'
attr... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_run.rb | Ruby | mit | 45 | master | 8,407 | require 'methadone'
require 'open3'
require 'json'
require_relative 'runner'
require_relative 'safe_runner'
class Kb8Run
include Methadone::Main
include Methadone::CLILogging
API_VERSION = 'v1'
MISSING_DATA_RETRIES = 3
LEGACY_CONTEXT_NAME = 'kb8or-context'
NAMESPACE_FLAG='--namespace=%s'
CMD_KUBECTL = ... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/deploy.rb | Ruby | mit | 45 | master | 2,787 | require_relative 'tunnel'
require_relative 'kb8_utils'
require 'uri'
class Deploy
attr_accessor :deploy_units,
:context,
:tunnel
YAML_DEPLOY_PATH = 'path'
SSH_SOCKET = '/tmp/kb8or-ctrl-socket'
include Methadone::Main
include Methadone::CLILogging
def initialize(deploy_fi... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_context.rb | Ruby | mit | 45 | master | 1,486 | require_relative 'kb8_utils'
require_relative 'kb8_run'
class Kb8Context
attr_accessor :cluster,
:name,
:namespace,
:user
CMD_CONFIG_VIEW = "#{Kb8Run::CMD_KUBECTL} config view -o yaml"
def initialize(context)
context_setting = nil
case context.class.to_s... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_file_data.rb | Ruby | mit | 45 | master | 1,462 | require_relative 'kb8_utils'
require 'base64'
class Kb8FileData
FILE_DATA_KEY = 'Fn::FileData'
ENC_BASE64 = 'base64'
attr_accessor :base64_encode,
:files,
:name,
:vars_data
def initialize(file_data_def, replace_obj_context)
@vars_data = replace_obj_context... |
github | UKHomeOffice/kb8or | https://github.com/UKHomeOffice/kb8or | libs/kb8_container_spec.rb | Ruby | mit | 45 | master | 2,596 | require 'methadone'
class Kb8ContainerSpec
include Methadone::Main
include Methadone::CLILogging
REGISTRY = '(\S+:[\d]+|\S+\.\S+)'
VERSION = ':(.*)'
IMAGE = '([a-z0-9_].+)'
NAMESPACE = '([a-zA-Z0-9\-\_]+)'
attr_accessor :name,
:version,
:image_name,
:yam... |
github | freeats/freeats | https://github.com/freeats/freeats | Gemfile | Ruby | mit | 45 | main | 2,001 | # frozen_string_literal: true
source "https://rubygems.org"
ruby file: ".ruby-version"
gem "action_policy"
gem "active_record_union"
gem "acts_as_tenant"
gem "addressable"
gem "aws-sdk-s3", require: false
gem "blazer"
gem "bootsnap", require: false
gem "cssbundling-rails"
gem "datagrid"
gem "dry-initializer"
gem "dr... |
github | freeats/freeats | https://github.com/freeats/freeats | db/dev_seeds.rb | Ruby | mit | 45 | main | 1,706 | # frozen_string_literal: true
require "factory_bot"
require "faker"
FactoryBot.find_definitions
module DevSeeds
class << self
include FactoryBot::Syntax::Methods
end
def self.seed
show_help if ARGV - ["-h", "--help"] != ARGV || ARGV.empty?
ARGV.each do |argument|
public_send(:"create_#{argu... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240321153227_create_email_messages.rb | Ruby | mit | 45 | main | 1,285 | # frozen_string_literal: true
class CreateEmailMessages < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
execute <<~SQL
CREATE TYPE public.email_message_sent_via AS ENUM (
'gmail',
'internal_sequence',
'internal_compose',
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241129084054_add_email_templates.rb | Ruby | mit | 45 | main | 283 | # frozen_string_literal: true
class AddEmailTemplates < ActiveRecord::Migration[7.1]
def change
create_table :email_templates do |t|
t.string :name, null: false
t.string :subject, null: false
t.timestamps
t.index :name, unique: true
end
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240602141416_add_placement_removed_event_to_event_types.rb | Ruby | mit | 45 | main | 236 | # frozen_string_literal: true
class AddPlacementRemovedEventToEventTypes < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE event_type ADD VALUE 'placement_removed' AFTER 'placement_changed';
SQL
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240415070643_add_availability_to_placement_status_type.rb | Ruby | mit | 45 | main | 210 | # frozen_string_literal: true
class AddAvailabilityToPlacementStatusType < ActiveRecord::Migration[7.1]
def up
execute "ALTER TYPE placement_status ADD VALUE 'availability' BEFORE 'location';"
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20250609103428_create_enabled_features.rb | Ruby | mit | 45 | main | 423 | # frozen_string_literal: true
class CreateEnabledFeatures < ActiveRecord::Migration[7.1]
def change
create_enum :feature_name, %w[
emails
]
create_table :enabled_features do |t|
t.belongs_to :tenant, null: false, foreign_key: true
t.enum(:name, enum_type: :feature_name, null: false)
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240321063622_create_members.rb | Ruby | mit | 45 | main | 591 | # frozen_string_literal: true
class CreateMembers < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
execute <<~SQL
CREATE TYPE member_access_level AS
ENUM ('inactive', 'interviewer', 'employee', 'hiring_manager', 'admin');
SQL
end
dir.... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240315094556_create_candidate_links.rb | Ruby | mit | 45 | main | 432 | # frozen_string_literal: true
class CreateCandidateLinks < ActiveRecord::Migration[7.1]
def change
create_table :candidate_links do |t|
t.references :candidate, foreign_key: true, null: false, index: false
t.column :url, :string, null: false
t.column :status, :candidate_contact_status, null: fa... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240416104851_add_placement_events_to_event_type.rb | Ruby | mit | 45 | main | 308 | # frozen_string_literal: true
class AddPlacementEventsToEventType < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE event_type ADD VALUE 'placement_added' BEFORE 'position_added';
ALTER TYPE event_type ADD VALUE 'placement_changed' BEFORE 'position_added';
SQL
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240913152510_remove_interviewer_and_hiring_manager_roles.rb | Ruby | mit | 45 | main | 1,263 | # frozen_string_literal: true
class RemoveInterviewerAndHiringManagerRoles < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
CREATE TYPE member_access_level_new AS ENUM (
'inactive',
'employee',
'admin'
);
UPDATE members
SET access_level = 'employee'
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240410042127_add_position_stage_types_to_event_type.rb | Ruby | mit | 45 | main | 330 | # frozen_string_literal: true
class AddPositionStageTypesToEventType < ActiveRecord::Migration[7.1]
def up
execute "ALTER TYPE event_type ADD VALUE 'position_stage_added' BEFORE 'scorecard_template_added';"
execute "ALTER TYPE event_type ADD VALUE 'position_stage_changed' BEFORE 'scorecard_template_added';"
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241015130608_create_recurring_tasks.solid_queue.rb | Ruby | mit | 45 | main | 591 | # frozen_string_literal: true
# This migration comes from solid_queue (originally 20240719134516)
class CreateRecurringTasks < ActiveRecord::Migration[7.1]
def change
create_table :solid_queue_recurring_tasks do |t|
t.string :key, null: false, index: { unique: true }
t.string :schedule, null: false
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240319154220_create_positions.rb | Ruby | mit | 45 | main | 1,033 | # frozen_string_literal: true
class CreatePositions < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
execute <<~SQL
CREATE TYPE public.position_status AS ENUM (
'draft',
'active',
'passive',
'closed'
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240917131723_rename_position_status_passive_to_on_hold.rb | Ruby | mit | 45 | main | 335 | # frozen_string_literal: true
class RenamePositionStatusPassiveToOnHold < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE position_status RENAME VALUE 'passive' TO 'on_hold';
SQL
end
def down
execute <<~SQL
ALTER TYPE position_status RENAME VALUE 'on_hold' TO 'passive';
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240416053719_add_unique_on_member_id_address_in_member_email_addresses.rb | Ruby | mit | 45 | main | 202 | # frozen_string_literal: true
class AddUniqueOnMemberIdAddressInMemberEmailAddresses < ActiveRecord::Migration[7.1]
def change
add_index :member_email_addresses, :address, unique: true
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241105130512_create_disqualify_reasons.rb | Ruby | mit | 45 | main | 457 | # frozen_string_literal: true
class CreateDisqualifyReasons < ActiveRecord::Migration[7.1]
def change
create_table :disqualify_reasons do |t|
t.string :title, null: false
t.string :description, null: false, default: ""
t.belongs_to :tenant, index: false
t.timestamps
end
add_inde... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240501075335_create_tasks.rb | Ruby | mit | 45 | main | 987 | # frozen_string_literal: true
class CreateTasks < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
create_enum :task_status, %i[open closed]
create_enum :repeat_interval_type, %i[never daily weekly monthly yearly]
end
dir.down do
execute <<~SQL
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240920135234_add_scorecard_template_removed_to_event_type.rb | Ruby | mit | 45 | main | 254 | # frozen_string_literal: true
class AddScorecardTemplateRemovedToEventType < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE event_type ADD VALUE 'scorecard_template_removed' AFTER 'scorecard_template_added';
SQL
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240318051606_create_notes.rb | Ruby | mit | 45 | main | 271 | # frozen_string_literal: true
class CreateNotes < ActiveRecord::Migration[7.1]
def change
create_table :notes do |t|
t.text :text, null: false, default: ""
t.references :note_thread, null: false, foreign_key: true
t.timestamps
end
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240325063100_create_account_identities.rb | Ruby | mit | 45 | main | 349 | # frozen_string_literal: true
class CreateAccountIdentities < ActiveRecord::Migration[7.1]
def change
create_table :account_identities do |t|
t.references :account, foreign_key: { on_delete: :cascade }
t.string :provider, null: false
t.string :uid, null: false
t.index %i[provider uid], un... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20250221083833_add_list_index_to_disqualify_reasons.rb | Ruby | mit | 45 | main | 1,226 | # frozen_string_literal: true
class AddListIndexToDisqualifyReasons < ActiveRecord::Migration[7.1]
def change
add_column :disqualify_reasons, :list_index, :integer
add_column :disqualify_reasons, :deleted, :boolean, default: false, null: false
# Fill in list_index for existing disqualify reasons using S... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241015101251_create_friendly_id_slugs.rb | Ruby | mit | 45 | main | 813 | # frozen_string_literal: true
MIGRATION_CLASS =
if ActiveRecord::VERSION::MAJOR >= 5
ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"]
else
ActiveRecord::Migration
end
class CreateFriendlyIdSlugs < MIGRATION_CLASS
def change
create_table :friendly_id_slugs ... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240327132812_change_member_access_level_order.rb | Ruby | mit | 45 | main | 517 | # frozen_string_literal: true
class ChangeMemberAccessLevelOrder < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE member_access_level RENAME TO old_member_access_level;
CREATE TYPE member_access_level AS
ENUM ('inactive', 'interviewer', 'hiring_manager', 'employee', 'admin');
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241204053019_add_email_template_index_on_tenant_and_name.rb | Ruby | mit | 45 | main | 296 | # frozen_string_literal: true
class AddEmailTemplateIndexOnTenantAndName < ActiveRecord::Migration[7.1]
def change
remove_index :email_templates, column: :name
remove_index :email_templates, column: :tenant_id
add_index :email_templates, %i[tenant_id name], unique: true
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240409052033_add_scorecard_template_types_to_event_types.rb | Ruby | mit | 45 | main | 275 | # frozen_string_literal: true
class AddScorecardTemplateTypesToEventTypes < ActiveRecord::Migration[7.1]
def up
execute "ALTER TYPE event_type ADD VALUE 'scorecard_template_added';"
execute "ALTER TYPE event_type ADD VALUE 'scorecard_template_updated';"
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240411061423_create_position_hiring_managers_table.rb | Ruby | mit | 45 | main | 432 | # frozen_string_literal: true
class CreatePositionHiringManagersTable < ActiveRecord::Migration[7.1]
def change
create_table :positions_hiring_managers, id: false do |t|
t.references :position, foreign_key: true, null: false, index: false
t.references :hiring_manager, foreign_key: { to_table: :member... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240403070728_create_member_email_addresses.rb | Ruby | mit | 45 | main | 442 | # frozen_string_literal: true
class CreateMemberEmailAddresses < ActiveRecord::Migration[7.1]
def change
create_table :member_email_addresses do |t|
t.references :member, null: false, foreign_key: true
t.citext :address, null: false
t.string :token, null: false, default: ""
t.string :refr... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240405103259_create_events.rb | Ruby | mit | 45 | main | 1,010 | # frozen_string_literal: true
class CreateEvents < ActiveRecord::Migration[7.1]
def change
reversible do |dir|
dir.up do
execute <<~SQL
CREATE TYPE public.event_type AS ENUM (
'position_added',
'position_changed',
'position_recruiter_assigned',
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240602141415_add_interview_invitation_event_types.rb | Ruby | mit | 45 | main | 340 | # frozen_string_literal: true
class AddInterviewInvitationEventTypes < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE event_type ADD VALUE 'candidate_interview_scheduled' AFTER 'candidate_changed';
ALTER TYPE event_type ADD VALUE 'candidate_interview_resolved' AFTER 'candidate_changed'... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240418121526_add_scorecard_events_to_event_type.rb | Ruby | mit | 45 | main | 328 | # frozen_string_literal: true
class AddScorecardEventsToEventType < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE event_type ADD VALUE 'scorecard_added' BEFORE 'scorecard_template_added';
ALTER TYPE event_type ADD VALUE 'scorecard_updated' BEFORE 'scorecard_template_added';
SQL
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241015125238_create_recurring_executions.solid_queue.rb | Ruby | mit | 45 | main | 592 | # frozen_string_literal: true
# This migration comes from solid_queue (originally 20240218110712)
class CreateRecurringExecutions < ActiveRecord::Migration[7.1]
def change
create_table :solid_queue_recurring_executions do |t|
t.references :job, index: { unique: true }, null: false
t.string :task_key,... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241203142925_add_uniq_index_on_candidate_sources_for_tenant_id_and_name.rb | Ruby | mit | 45 | main | 459 | # frozen_string_literal: true
class AddUniqIndexOnCandidateSourcesForTenantIdAndName < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def up
execute <<~SQL
CREATE UNIQUE INDEX CONCURRENTLY index_candidate_sources_on_tenant_id_and_name
ON candidate_sources USING btree (tenant_id, name);;
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241102110106_add_not_null_to_tenant_id_in_all_tables.rb | Ruby | mit | 45 | main | 1,480 | # frozen_string_literal: true
class AddNotNullToTenantIdInAllTables < ActiveRecord::Migration[7.1]
def change
change_column_null(:positions, :tenant_id, false)
change_column_null(:scorecards, :tenant_id, false)
change_column_null(:events, :tenant_id, false)
change_column_null(:email_threads, :tenant_... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240904065325_add_missing_columns_to_candidate_links.rb | Ruby | mit | 45 | main | 454 | # frozen_string_literal: true
class AddMissingColumnsToCandidateLinks < ActiveRecord::Migration[7.1]
def change
add_column :candidate_links, :added_at, :datetime, null: false, default: -> { "clock_timestamp()" }
add_column :candidate_links, :created_via, :enum, enum_type: :candidate_contact_created_via, null... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240425094431_alter_position_and_delay_in_days_must_be_valid_constraint.rb | Ruby | mit | 45 | main | 564 | # frozen_string_literal: true
class AlterPositionAndDelayInDaysMustBeValidConstraint < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TABLE sequence_template_stages
ADD CONSTRAINT position_and_delay_in_days_must_be_valid
CHECK (
(position = 1 AND delay_in_days IS NULL) OR
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20250225065941_add_transactional_email_sent_to_events.rb | Ruby | mit | 45 | main | 214 | # frozen_string_literal: true
class AddTransactionalEmailSentToEvents < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE event_type ADD VALUE 'transactional_email_sent';
SQL
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240321153228_add_reference_to_member_for_position.rb | Ruby | mit | 45 | main | 201 | # frozen_string_literal: true
class AddReferenceToMemberForPosition < ActiveRecord::Migration[7.1]
def change
add_reference :positions, :recruiter, foreign_key: { to_table: :members }
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241015130851_add_name_to_processes.solid_queue.rb | Ruby | mit | 45 | main | 232 | # frozen_string_literal: true
# This migration comes from solid_queue (originally 20240811173327)
class AddNameToProcesses < ActiveRecord::Migration[7.1]
def change
add_column :solid_queue_processes, :name, :string
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240318034734_create_candidate_source.rb | Ruby | mit | 45 | main | 218 | # frozen_string_literal: true
class CreateCandidateSource < ActiveRecord::Migration[7.1]
def change
create_table :candidate_sources do |t|
t.string :name, null: false
t.timestamps
end
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240504075807_add_note_events_to_event_type.rb | Ruby | mit | 45 | main | 295 | # frozen_string_literal: true
class AddNoteEventsToEventType < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
ALTER TYPE event_type ADD VALUE 'note_added' BEFORE 'placement_added';
ALTER TYPE event_type ADD VALUE 'note_removed' BEFORE 'placement_added';
SQL
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240602141417_add_association_to_member_for_scorecard.rb | Ruby | mit | 45 | main | 287 | # frozen_string_literal: true
class AddAssociationToMemberForScorecard < ActiveRecord::Migration[7.1]
def change
remove_column :scorecards, :interviewer, :string
add_reference :scorecards, :interviewer, foreign_key: { to_table: :members }, null: false, index: false
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240502094848_add_sequence_events_to_event_type.rb | Ruby | mit | 45 | main | 1,258 | # frozen_string_literal: true
class AddSequenceEventsToEventType < ActiveRecord::Migration[7.1]
def up
execute <<~SQL
CREATE TYPE public.new_event_type AS ENUM (
'active_storage_attachment_added',
'active_storage_attachment_removed',
'candidate_added',
'candidate_changed',
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241008103850_rename_position_status_enum_active_to_open.rb | Ruby | mit | 45 | main | 1,607 | # frozen_string_literal: true
class RenamePositionStatusEnumActiveToOpen < ActiveRecord::Migration[7.1]
def up
execute <<-SQL
CREATE TYPE new_position_status AS ENUM (
'draft',
'open',
'on_hold',
'closed');
SQL
add_column :positions, :new_status, :enum,
... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240930100900_rename_employee_to_member_in_access_level_on_members.rb | Ruby | mit | 45 | main | 1,590 | # frozen_string_literal: true
class RenameEmployeeToMemberInAccessLevelOnMembers < ActiveRecord::Migration[7.1]
def up
execute <<-SQL
CREATE TYPE public.member_access_level_new AS ENUM (
'inactive',
'member',
'admin'
);
SQL
add_column :members, :access_level_new, :mem... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20241018092829_remove_account_identities.rb | Ruby | mit | 45 | main | 347 | # frozen_string_literal: true
class RemoveAccountIdentities < ActiveRecord::Migration[7.1]
def change
drop_table :account_identities do |t|
t.references :account, foreign_key: { on_delete: :cascade }
t.string :provider, null: false
t.string :uid, null: false
t.index %i[provider uid], uniq... |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240318045509_create_note_threads.rb | Ruby | mit | 45 | main | 288 | # frozen_string_literal: true
class CreateNoteThreads < ActiveRecord::Migration[7.1]
def change
create_table :note_threads do |t|
t.references :notable, polymorphic: true, null: false
t.boolean :hidden, default: false, null: false
t.timestamps
end
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240404155739_create_note_reactions.rb | Ruby | mit | 45 | main | 244 | # frozen_string_literal: true
class CreateNoteReactions < ActiveRecord::Migration[7.1]
def change
create_join_table :members, :notes, table_name: :note_reactions do |t|
t.index %i[note_id member_id], unique: true
end
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | db/migrate/20240328064406_remove_index_from_candidate_email_addresses.rb | Ruby | mit | 45 | main | 500 | # frozen_string_literal: true
class RemoveIndexFromCandidateEmailAddresses < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def up
execute <<~SQL
DROP INDEX CONCURRENTLY index_candidate_email_addresses_on_candidate_id_and_list_index;
SQL
end
def down
execute <<~SQL
CREATE UNIQU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.