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 | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_installation_package.rb | Ruby | bsd-3-clause | 87 | master | 861 | module DockerCookbook
class DockerInstallationPackage < DockerBase
require_relative 'helpers_installation_package'
include DockerHelpers::InstallationPackage
# Resource properties
resource_name :docker_installation_package
property :package_name, String, default: 'docker-engine', desired_state:... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_service_manager_sysvinit_debian.rb | Ruby | bsd-3-clause | 87 | master | 2,239 | module DockerCookbook
class DockerServiceManagerSysvinitDebian < DockerServiceBase
resource_name :docker_service_manager_sysvinit_debian
provides :docker_service_manager, platform: 'debian' do |node|
node['platform_version'].to_f < 8.0
end
provides :docker_service_manager, platform: 'ubuntu' d... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_network.rb | Ruby | bsd-3-clause | 87 | master | 3,877 | module DockerCookbook
class DockerNetwork < DockerBase
require 'docker'
require_relative 'helpers_network'
include DockerHelpers::Network
resource_name :docker_network
property :auxiliary_addresses, [String, Array, nil], coerce: proc { |v| coerce_auxiliary_addresses(v) }
property :container,... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_installation_tarball.rb | Ruby | bsd-3-clause | 87 | master | 1,410 | module DockerCookbook
module DockerHelpers
module InstallationTarball
def docker_bin_prefix
'/usr/bin'
end
def docker_bin
"#{docker_bin_prefix}/docker"
end
def docker_tarball
"#{Chef::Config[:file_cache_path]}/docker-#{version}.tgz"
end
def dock... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_service.rb | Ruby | bsd-3-clause | 87 | master | 3,599 | module DockerCookbook
require_relative 'docker_service_base'
class DockerService < DockerServiceBase
resource_name :docker_service
# register with the resource resolution system
provides :docker_service
# installation type and service_manager
property :install_method, %w(binary script package... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_exec.rb | Ruby | bsd-3-clause | 87 | master | 597 | module DockerCookbook
class DockerExec < DockerBase
resource_name :docker_exec
property :host, [String, nil], default: lazy { default_host }
property :command, Array
property :container, String
property :timeout, Numeric, default: 60
property :container_obj, Docker::Container, desired_state:... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_installation_binary.rb | Ruby | bsd-3-clause | 87 | master | 3,190 | module DockerCookbook
module DockerHelpers
module InstallationBinary
def docker_bin
'/usr/bin/docker'
end
def docker_kernel
node['kernel']['name']
end
def docker_arch
node['kernel']['machine']
end
def default_source
"https://get.docker.c... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_installation_tarball.rb | Ruby | bsd-3-clause | 87 | master | 1,264 | module DockerCookbook
class DockerInstallationTarball < DockerBase
require_relative 'helpers_installation_tarball'
include DockerHelpers::InstallationTarball
#####################
# Resource properties
#####################
resource_name :docker_installation_tarball
property :checksum, ... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_installation_package.rb | Ruby | bsd-3-clause | 87 | master | 2,657 | module DockerCookbook
module DockerHelpers
module InstallationPackage
def el6?
return true if node['platform_family'] == 'rhel' && node['platform_version'].to_i == 6
false
end
def el7?
return true if node['platform_family'] == 'rhel' && node['platform_version'].to_i == 7... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_auth.rb | Ruby | bsd-3-clause | 87 | master | 295 | module DockerCookbook
module DockerHelpers
module Authentication
# https://github.com/docker/docker/blob/4fcb9ac40ce33c4d6e08d5669af6be5e076e2574/registry/auth.go#L231
def parse_registry_host(val)
val.sub(%r{https?://}, '').split('/').first
end
end
end
end |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_network.rb | Ruby | bsd-3-clause | 87 | master | 3,276 | module DockerCookbook
module DockerHelpers
module Network
require 'ipaddr'
###################
# property coersion
###################
def coerce_auxiliary_addresses(v)
ray = []
Array(v).each do |e|
case e
when String, Array, nil
ray ... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_container.rb | Ruby | bsd-3-clause | 87 | master | 16,169 | module DockerCookbook
class DockerContainer < DockerBase
require 'docker'
require 'shellwords'
require_relative 'helpers_container'
include DockerHelpers::Container
resource_name :docker_container
###########################################################
# In Chef 12.5 and later, we n... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/_autoload.rb | Ruby | bsd-3-clause | 87 | master | 357 | begin
gem 'docker-api', '= 1.33.0'
rescue LoadError
unless defined?(ChefSpec)
run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
require 'chef/resource/chef_gem'
docker = Chef::Resource::ChefGem.new('docker-api', run_context)
docker.version '= 1.33.0'
d... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_base.rb | Ruby | bsd-3-clause | 87 | master | 3,002 | module DockerCookbook
class DockerBase < ChefCompat::Resource
require_relative 'helpers_auth'
require_relative 'helpers_base'
include DockerHelpers::Base
#########
# Classes
#########
class UnorderedArray < Array
def ==(other)
# If I (desired env) am a subset of the curren... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_service.rb | Ruby | bsd-3-clause | 87 | master | 9,086 | # Constants
IPV6_ADDR ||= /(
([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|
([0-9a-fA-F]{1,4}:){1,7}:|
([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|
([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|
([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|
([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|
([0-9a-fA-F]{1,4}:){1,2}(:[0-... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/matchers.rb | Ruby | bsd-3-clause | 87 | master | 11,729 | if defined?(ChefSpec)
#####################
# docker_installation
#####################
ChefSpec.define_matcher :docker_installation
def create_docker_installation(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:docker_installation, :create, resource_name)
end
def delete_docker_installation(... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_service_manager_upstart.rb | Ruby | bsd-3-clause | 87 | master | 1,983 | module DockerCookbook
class DockerServiceManagerUpstart < DockerServiceBase
resource_name :docker_service_manager_upstart
provides :docker_service_manager, platform: 'ubuntu'
provides :docker_service_manager, platform: 'linuxmint'
action :start do
create_docker_wait_ready
template "/etc... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_registry.rb | Ruby | bsd-3-clause | 87 | master | 1,044 | module DockerCookbook
class DockerRegistry < DockerBase
require 'docker'
require_relative 'helpers_auth'
resource_name :docker_registry
property :email, [String, nil]
property :password, [String, nil]
property :serveraddress, [String, nil], name_property: true
property :username, [String... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_service_base.rb | Ruby | bsd-3-clause | 87 | master | 4,288 | module DockerCookbook
class DockerServiceBase < DockerBase
################
# Helper Methods
################
require 'docker'
require_relative 'helpers_service'
include DockerHelpers::Service
#####################
# resource properties
#####################
resource_name :do... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_installation_script.rb | Ruby | bsd-3-clause | 87 | master | 1,113 | module DockerCookbook
class DockerInstallationScript < DockerBase
#####################
# Resource properties
#####################
resource_name :docker_installation_script
provides :docker_installation, os: 'linux'
property :repo, %w(main test experimental), default: 'main', desired_state:... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_volume.rb | Ruby | bsd-3-clause | 87 | master | 956 | module DockerCookbook
class DockerVolume < DockerBase
require 'docker'
resource_name :docker_volume
property :driver, String, desired_state: false
property :host, [String, nil], default: lazy { default_host }, desired_state: false
property :opts, [String, Array, nil], desired_state: false
pr... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_container.rb | Ruby | bsd-3-clause | 87 | master | 7,103 | module DockerCookbook
module DockerHelpers
module Container
def coerce_links(v)
case v
when DockerBase::UnorderedArray, nil
v
else
return nil if v.empty?
# Parse docker input of /source:/container_name/dest into source:dest
DockerBase::Unordere... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_image.rb | Ruby | bsd-3-clause | 87 | master | 2,659 | module DockerCookbook
module DockerHelpers
module Image
################
# Helper methods
################
def build_from_directory
i = Docker::Image.build_from_dir(
source,
{
'nocache' => nocache,
'rm' => rm,
},
conn... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_service_manager_systemd.rb | Ruby | bsd-3-clause | 87 | master | 3,579 | module DockerCookbook
class DockerServiceManagerSystemd < DockerServiceBase
resource_name :docker_service_manager_systemd
provides :docker_service_manager, platform: 'fedora'
provides :docker_service_manager, platform: %w(redhat centos scientific oracle) do |node| # ~FC005
node['platform_version']... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_tag.rb | Ruby | bsd-3-clause | 87 | master | 745 | module DockerCookbook
class DockerTag < DockerBase
resource_name :docker_tag
property :target_repo, String, name_property: true
property :target_tag, String
property :to_repo, String
property :to_tag, String
property :force, Boolean, default: false
#########
# Actions
#########
... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_installation_binary.rb | Ruby | bsd-3-clause | 87 | master | 1,005 | module DockerCookbook
class DockerInstallationBinary < DockerBase
require_relative 'helpers_installation_binary'
include DockerHelpers::InstallationBinary
#####################
# Resource properties
#####################
resource_name :docker_installation_binary
property :checksum, Stri... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_service_manager_execute.rb | Ruby | bsd-3-clause | 87 | master | 1,770 | module DockerCookbook
class DockerServiceManagerExecute < DockerServiceBase
resource_name :docker_service_manager_execute
provides :docker_service_manager, os: 'linux'
# Start the service
action :start do
# enable ipv4 forwarding
execute 'enable net.ipv4.conf.all.forwarding' do
c... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/helpers_base.rb | Ruby | bsd-3-clause | 87 | master | 2,986 | module DockerCookbook
module DockerHelpers
module Base
require 'shellwords'
# Misc
def to_snake_case(name)
# ExposedPorts -> _exposed_ports
name = name.gsub(/[A-Z]/) { |x| "_#{x.downcase}" }
# _exposed_ports -> exposed_ports
name = name[1..-1] if name.start_with?... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_image.rb | Ruby | bsd-3-clause | 87 | master | 2,350 | module DockerCookbook
class DockerImage < DockerBase
require 'docker'
require_relative 'helpers_image'
resource_name :docker_image
# Modify the default of read_timeout from 60 to 120
property :read_timeout, default: 120, desired_state: false
# https://docs.docker.com/reference/api/docker_re... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/docker/libraries/docker_service_manager_sysvinit_rhel.rb | Ruby | bsd-3-clause | 87 | master | 2,205 | module DockerCookbook
class DockerServiceManagerSysvinitRhel < DockerServiceBase
resource_name :docker_service_manager_sysvinit_rhel
provides :docker_service_manager, platform: 'amazon'
provides :docker_service_manager, platform: 'suse'
provides :docker_service_manager, platform: %w(redhat centos sci... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/vim/recipes/source_rhel.rb | Ruby | bsd-3-clause | 87 | master | 338 | # vim looks for xsubpp in wrong location RHEL 7+ and Fedora
link '/usr/share/perl5/ExtUtils/xsubpp' do
to '/usr/bin/xsubpp'
only_if { ::File.exist?('/usr/bin/xsubpp') } # if package node attributes don't include perl this won't be here
end if node['platform_version'].to_i >= 7
package 'bzip2' if node['platform_ve... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/vim/recipes/package.rb | Ruby | bsd-3-clause | 87 | master | 979 | #
# Cookbook Name:: vim
# Recipe:: package
#
# Copyright 2013-2015, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/vim/recipes/default.rb | Ruby | bsd-3-clause | 87 | master | 858 | #
# Cookbook Name:: vim
# Recipe:: default
#
# Copyright 2010-2015, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/vim/recipes/source.rb | Ruby | bsd-3-clause | 87 | master | 1,431 | #
# Cookbook Name:: vim
# Recipe:: source
#
# Copyright 2013-2015, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/vim/attributes/source.rb | Ruby | bsd-3-clause | 87 | master | 3,708 | #
# Cookbook Name:: vim
# Attributes:: source
#
# Copyright 2013-2015, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/vim/attributes/default.rb | Ruby | bsd-3-clause | 87 | master | 724 | #
# Cookbook Name:: vim
# Attributes:: default
#
# Copyright 2010-2015, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/magic_shell/libraries/matchers.rb | Ruby | bsd-3-clause | 87 | master | 529 | if defined?(ChefSpec)
def add_magic_shell_alias(name)
ChefSpec::Matchers::ResourceMatcher.new(:magic_shell_alias, :add, name)
end
def remove_magic_shell_alias(name)
ChefSpec::Matchers::ResourceMatcher.new(:magic_shell_alias, :remove, name)
end
def add_magic_shell_environment(name)
ChefSpec::Matc... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/magic_shell/providers/alias.rb | Ruby | bsd-3-clause | 87 | master | 1,599 | #
# Cookbook Name:: magic_shell
# Provider:: alias
#
# Author:: Nathen Harvey <nharvey@customink.com>
# Author:: Seth Vargo <sethvargo@gmail.com>
#
# Copyright 2012-2014, CustomInk, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/magic_shell/providers/environment.rb | Ruby | bsd-3-clause | 87 | master | 1,587 | #
# Cookbook Name:: magic_shell
# Provider:: environment
#
# Author:: Nathen Harvey <nharvey@customink.com>
# Author:: Seth Vargo <sethvargo@gmail.com>
#
# Copyright 2012-2014, CustomInk, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/magic_shell/resources/environment.rb | Ruby | bsd-3-clause | 87 | master | 905 | #
# Cookbook Name:: magic_shell
# Resource:: environment
#
# Author:: Nathen Harvey <nharvey@customink.com>
# Author:: Seth Vargo <sethvargo@gmail.com>
#
# Copyright 2012-2014, CustomInk, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
github | teracyhq/dev | https://github.com/teracyhq/dev | vendor-cookbooks/magic_shell/resources/alias.rb | Ruby | bsd-3-clause | 87 | master | 879 | #
# Cookbook Name:: magic_shell
# Resource:: alias
#
# Author:: Nathen Harvey <nharvey@customink.com>
# Author:: Seth Vargo <sethvargo@gmail.com>
#
# Copyright 2012-2014, CustomInk, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/metadata.rb | Ruby | bsd-3-clause | 87 | master | 1,030 | name 'teracy-dev'
maintainer 'Teracy, Inc.'
maintainer_email 'hoatlevan@gmail.com'
license 'All rights reserved'
description 'Installs/Configures teracy-dev'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.3.0'
issues_url 'https://github.com/t... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/docker.rb | Ruby | bsd-3-clause | 87 | master | 5,944 | #
# Author:: Hoat Le <hoatle@teracy.com>
# Cookbook Name:: teracy-dev
# Recipe:: docker
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/docker_machine.rb | Ruby | bsd-3-clause | 87 | master | 4,491 | #
# Author:: Hoat Le <hoatle@teracy.com>
# Cookbook Name:: teracy-dev
# Recipe:: docker_machine
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of sou... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/env_vars.rb | Ruby | bsd-3-clause | 87 | master | 1,916 | #
# Author:: Hoat Le <hoatlevan@gmail.com>
# Cookbook Name:: teracy-dev
# Recipe:: env_vars
# Description: Configures environment
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/proxy.rb | Ruby | bsd-3-clause | 87 | master | 3,486 | #
# Author:: Hoat Le <hoatle@teracy.com>
# Cookbook Name:: teracy-dev
# Recipe:: proxy
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code ... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/directories.rb | Ruby | bsd-3-clause | 87 | master | 2,027 | #
# Author:: Hoat Le <hoatlevan@gmail.com>
# Cookbook Name:: teracy-dev
# Recipe:: directories
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of sour... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/default.rb | Ruby | bsd-3-clause | 87 | master | 1,957 | #
# Author:: Hoat Le <hoatlevan@gmail.com>
# Cookbook Name:: teracy-dev
# Recipe:: github
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source co... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/inotify.rb | Ruby | bsd-3-clause | 87 | master | 2,332 | #
# Author:: Hoat Le <hoatle@teracy.com>
# Cookbook Name:: teracy-dev
# Recipe:: inotify
# Description: Configures inotify watchers
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are m... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/docker_registry.rb | Ruby | bsd-3-clause | 87 | master | 1,674 | # Author:: Hoat Le <hoatle@teracy.com>
# Cookbook:: teracy-dev
# Recipe:: docker_registry
# Login into the Docker registries
docker_conf = node['docker']
docker_registry_conf = node['docker_registry']
if docker_conf['enabled'] == true
execute 'rm ~/.docker/config.json' do
command 'rm /home/vagrant/.docke... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/recipes/aliases.rb | Ruby | bsd-3-clause | 87 | master | 1,882 | #
# Author:: Hoat Le <hoatlevan@gmail.com>
# Cookbook Name:: teracy-dev
# Recipe:: aliases
#
# Copyright 2013 - current, Teracy, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source c... |
github | teracyhq/dev | https://github.com/teracyhq/dev | main-cookbooks/teracy-dev/libraries/helpers.rb | Ruby | bsd-3-clause | 87 | master | 2,370 | module TeracyDev
module Helpers
def db_empty?(host, username, pwd, db_name)
::Mysql.new(host, username, pwd).select_db(db_name).list_tables().empty?
end
def db_tbl_exists?(host, username, pwd, db_name, tbl)
querySt = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ... |
github | teracyhq/dev | https://github.com/teracyhq/dev | spec/utility_spec.rb | Ruby | bsd-3-clause | 87 | master | 15,178 | require 'json'
require "./lib/utility"
describe "utility" do
describe "overrides" do
context "given an empty obj2" do
it "returns the same obj1" do
obj1 = {
"msg" => "hello"
}
new_obj = overrides(obj1, {})
expect(new_obj).to eql(obj1)
end
end
context... |
github | teracyhq/dev | https://github.com/teracyhq/dev | .chef/config.rb | Ruby | bsd-3-clause | 87 | master | 1,106 | # Configurable Variables (Change these to not depend on environment variables!)
my_orgname = ENV['OPSCODE_ORGNAME']
my_chef_server_url = ENV['KNIFE_CHEF_SERVER']
my_cookbook_copyright = ENV['KNIFE_COOKBOOK_COPYRIGHT']
my_cookbook_license = ENV['KNIFE_COOKBOOK_LICENSE']
my_cookbook_email = ... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | termplot.gemspec | Ruby | mit | 87 | master | 1,166 | require_relative 'lib/termplot/version'
Gem::Specification.new do |spec|
spec.name = "termplot"
spec.version = Termplot::VERSION
spec.authors = ["Martin Nyaga"]
spec.email = ["nyagamartin72@gmail.com"]
spec.summary = %q{Plot time series charts in your terminal}
spec.desc... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | Rakefile | Ruby | mit | 87 | master | 703 | require_relative "./lib/termplot/commands"
require "bundler/gem_tasks"
extend Termplot::Commands
extend Termplot::StdinCommands
SAMPLE_FILES_PATH = "examples"
def termplot_binary
"ruby -Ilib bin/termplot"
end
namespace :test do
task :bin do
exec "ruby", "-Ilib", "bin/termplot", *ARGV[2..-1]
end
task :fi... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/options.rb | Ruby | mit | 87 | master | 5,336 | # frozen_string_literal: true
require "optparse"
require "termplot/character_map"
require "termplot/colors"
require "termplot/producer_options"
require "termplot/shell"
module Termplot
class Options
attr_reader :rows,
:cols,
:full_screen,
:debug,
:... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/message_broker.rb | Ruby | mit | 87 | master | 2,178 | require "forwardable"
module Termplot
class MessageBrokerPool
def initialize
@brokers = []
@mutex = Mutex.new
@on_message_callbacks = []
end
def broker(sender:, receiver:)
mutex.synchronize do
broker = MessageBroker.new(sender: sender, receiver: receiver)
broker.o... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/positioned_widget.rb | Ruby | mit | 87 | master | 212 | require "forwardable"
module Termplot
PositionedWidget = Struct.new(:row, :col, :widget, keyword_init: true) do
extend Forwardable
def_delegators :widget, :window, :errors, :render_to_window
end
end |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/widgets.rb | Ruby | mit | 87 | master | 306 | module Termplot
module Widgets
autoload :BaseWidget, "termplot/widgets/base_widget"
autoload :TimeSeriesWidget, "termplot/widgets/time_series_widget"
autoload :StatisticsWidget, "termplot/widgets/statistics_widget"
autoload :HistogramWidget, "termplot/widgets/histogram_widget"
end
end |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/character_map.rb | Ruby | mit | 87 | master | 1,262 | module Termplot
module CharacterMap
LINE = {
empty: " ",
point: "─",
vert_left: "│",
vert_right: "│",
horz_top: "─",
horz_bot: "─",
bot_left: "└",
top_right: "┐",
top_left: "┌",
bot_right: "┘",
tick_right: "┤",
tick_left:... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/shell.rb | Ruby | mit | 87 | master | 696 | require "io/console"
module Termplot
class Shell
class << self
attr_reader :termios_settings
CURSOR_HIDE = "\e[?25l"
CURSOR_SHOW = "\e[?25h"
CLEAR_SCREEN = "\e[2J"
def init(clear: false)
print CLEAR_SCREEN if clear
# Disable echo on stdout tty, prevents printing c... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/window.rb | Ruby | mit | 87 | master | 2,204 | require "termplot/control_chars"
require "termplot/cursors"
module Termplot
class Window
attr_reader :rows, :cols, :buffer
def initialize(cols:, rows:)
@rows = rows
@cols = cols
@buffer = Array.new(cols * rows) { CharacterMap::DEFAULT[:empty] }
end
def cursor
@cursor ||= Term... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/cli.rb | Ruby | mit | 87 | master | 590 | # frozen_string_literal: true
require "termplot/options"
require "termplot/consumers"
module Termplot
class CLI
def self.run
options = Termplot::Options.new
options.parse_options!
run_consumer(options)
end
private
CONSUMERS = {
file: "Termplot::Consumers::MultiSourceConsu... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/consumers.rb | Ruby | mit | 87 | master | 432 | # frozen_string_literal: true
module Termplot
module Consumers
autoload :BaseConsumer, "termplot/consumers/base_consumer"
autoload :MultiSourceConsumer, "termplot/consumers/multi_source_consumer"
autoload :SingleSourceConsumer, "termplot/consumers/single_source_consumer"
autoload :StdinConsumer, "te... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/producers.rb | Ruby | mit | 87 | master | 242 | module Termplot
module Producers
autoload :BaseProducer, "termplot/producers/base_producer"
autoload :CommandProducer, "termplot/producers/command_producer"
autoload :StdinProducer, "termplot/producers/stdin_producer"
end
end |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/cursors.rb | Ruby | mit | 87 | master | 249 | module Termplot
module Cursors
autoload :VirtualCursor, "termplot/cursors/virtual_cursor"
autoload :ConsoleCursor, "termplot/cursors/console_cursor"
autoload :BufferedConsoleCursor, "termplot/cursors/buffered_console_cursor"
end
end |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/renderer.rb | Ruby | mit | 87 | master | 778 | # frozen_string_literal: true
require "termplot/window"
require "termplot/character_map"
require "termplot/colors"
require "termplot/renderable"
module Termplot
class Renderer
include Renderable
def initialize(cols: 80, rows: 20, debug: false, widgets:)
@window = Window.new(cols: cols, rows: rows)
... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/file_config.rb | Ruby | mit | 87 | master | 829 | # frozen_string_literal: true
require "termplot/dsl/panels"
module Termplot
class FileConfig
attr_reader :options, :rows, :cols, :widget_configs
def initialize(options)
@options = options
@path = options.file
@rows = options.rows
@cols = options.cols
@widget_configs = nil
e... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/renderable.rb | Ruby | mit | 87 | master | 666 | module Termplot
module Renderable
# Included in any module that has the ivars:
# :window
# :errors
# :debug
# And methods:
# #render_tO_window
# Provides rendering to string and stdout
def render
rendered_string = render_to_string
if debug?
rendered_string.e... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/colors.rb | Ruby | mit | 87 | master | 1,291 | module Termplot
class Colors
COLORS = {
black: 0,
light_black: 60,
red: 1,
light_red: 61,
green: 2,
light_green: 62,
yellow: 3,
light_yellow: 63,
blue: 4,
light_blue: 64,
magenta: 5,
... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/commands.rb | Ruby | mit | 87 | master | 503 | module Termplot
module Commands
def random
"echo $RANDOM"
end
def memory
"free | awk 'NR==2 { print ($3/$2) * 100 }'"
end
def cpu
"top -b -n 1 | awk -F',' 'NR==3{ split($4, arr, \" \"); print 100.0 - arr[1] }'"
end
end
module StdinCommands
def sin(n)
<<-CMD.c... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/cursors/virtual_cursor.rb | Ruby | mit | 87 | master | 1,659 | module Termplot
module Cursors
class VirtualCursor
attr_reader :position, :window
def initialize(window)
@window = window
@position = 0
end
def write(char)
@position += 1 if writeable?
end
def writeable?
position < window.buffer.size
end... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/cursors/buffered_console_cursor.rb | Ruby | mit | 87 | master | 1,234 | module Termplot
module Cursors
class BufferedConsoleCursor < VirtualCursor
include Termplot::ControlChars
attr_reader :buffer
def initialize(window, buffer)
super(window)
@buffer = buffer
end
def write(char)
if writeable?
buffer << char
s... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/consumers/single_source_consumer.rb | Ruby | mit | 87 | master | 1,026 | require "termplot/positioned_widget"
require "termplot/widgets"
require "termplot/producers"
module Termplot
module Consumers
class SingleSourceConsumer < BaseConsumer
def positioned_widgets
@positioned_widgets ||= [PositionedWidget.new(row: 0, col: 0, widget: widget)]
end
def register... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/consumers/base_consumer.rb | Ruby | mit | 87 | master | 3,002 | # frozen_string_literal: true
require "termplot/renderer"
require "termplot/message_broker"
require "termplot/shell"
module Termplot
module Consumers
class BaseConsumer
def initialize(options)
@options = options
@broker_pool = MessageBrokerPool.new
@producer_pool = ProducerPool.new... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/consumers/stdin_consumer.rb | Ruby | mit | 87 | master | 208 | require "termplot/producers"
module Termplot
module Consumers
class StdinConsumer < SingleSourceConsumer
def producer_class
Termplot::Producers::StdinProducer
end
end
end
end |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/consumers/command_consumer.rb | Ruby | mit | 87 | master | 277 | require "termplot/positioned_widget"
require "termplot/widgets"
require "termplot/producers"
module Termplot
module Consumers
class CommandConsumer < SingleSourceConsumer
def producer_class
Termplot::Producers::CommandProducer
end
end
end
end |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/consumers/multi_source_consumer.rb | Ruby | mit | 87 | master | 833 | # frozen_string_literal: true
require "termplot/file_config"
require "termplot/producers"
module Termplot
module Consumers
class MultiSourceConsumer < BaseConsumer
def positioned_widgets
@positioned_widgets ||= config.positioned_widgets
end
def register_producers_and_brokers
c... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/dsl/widgets.rb | Ruby | mit | 87 | master | 2,624 | require "termplot/positioned_widget"
require "termplot/widgets"
module Termplot
module WidgetDSL
def timeseries(attrs)
attrs = merge_defaults(attrs)
children.push(TimeSeriesConfig.new(attrs))
end
def statistics(attrs)
attrs = merge_defaults(attrs)
children.push(StatisticsConfig.n... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/dsl/panels.rb | Ruby | mit | 87 | master | 1,681 | require "termplot/commands"
require "termplot/dsl/widgets"
module Termplot
module DSL
class Panel
include Termplot::Commands
include Termplot::WidgetDSL
attr_accessor(
:rows,
:cols,
:start_row,
:start_col
)
def initialize(options, children = [])
... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/utils/ansi_safe_string.rb | Ruby | mit | 87 | master | 1,926 | module Termplot
module Utils
class AnsiSafeString
include Enumerable
# Regex to match ANSI escape sequences.
ANSI_MATCHER = Regexp.new("(\\[?\\033\\[?[;?\\d]*[\\dA-Za-z][\\];]?)")
attr_reader :string
def initialize(string)
@string = string
end
def length
... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/renderers/border_renderer.rb | Ruby | mit | 87 | master | 1,439 | require "termplot/character_map"
module Termplot
module Renderers
class BorderRenderer
attr_reader(
:window,
:border_char_map
)
def initialize(
bordered_window:,
border_char_map: CharacterMap::DEFAULT
)
@window = bordered_window
@border_ch... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/renderers/text_renderer.rb | Ruby | mit | 87 | master | 1,513 | require "termplot/utils/ansi_safe_string"
module Termplot
module Renderers
class TextRenderer
attr_reader(
:window,
:text,
:row,
:errors,
:align
)
def initialize(
bordered_window:,
text:,
row:,
errors:,
align: :cen... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/producers/command_producer.rb | Ruby | mit | 87 | master | 912 | require "tempfile"
require "fileutils"
module Termplot
module Producers
class CommandProducer < BaseProducer
def run
temp_executable = make_executable(options.command)
loop do
n = `#{temp_executable.path}`.chomp
# TODO: Error handling...
produce(n)
... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/producers/base_producer.rb | Ruby | mit | 87 | master | 605 | module Termplot
module Producers
class BaseProducer
def initialize(options)
@options = options
@on_message_handler = -> {}
end
def on_message(&block)
@on_message_handler = block
end
def run
raise "Must be implemented"
end
private
a... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/widgets/base_widget.rb | Ruby | mit | 87 | master | 1,650 | # frozen_string_literal: true
require "termplot/widgets/border"
require "termplot/widgets/dataset"
module Termplot
module Widgets
class BaseWidget
include Renderable
attr_reader(
:cols,
:rows,
:window,
:bordered_window,
:errors,
:title,
:decim... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/widgets/histogram_widget.rb | Ruby | mit | 87 | master | 4,909 | # frozen_string_literal: true
require "termplot/window"
require "termplot/renderable"
require "termplot/window"
require "termplot/character_map"
require "termplot/renderers"
require "termplot/colors"
module Termplot
module Widgets
class HistogramWidget < BaseWidget
DEFAULT_COLOR = "green"
attr_reade... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/widgets/time_series_widget.rb | Ruby | mit | 87 | master | 7,389 | # frozen_string_literal: true
require "termplot/window"
require "termplot/character_map"
require "termplot/colors"
require "termplot/renderable"
require "termplot/renderers"
module Termplot
module Widgets
class TimeSeriesWidget < BaseWidget
DEFAULT_COLOR = "yellow"
DEFAULT_LINE_STYLE = "line"
... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/widgets/statistics_widget.rb | Ruby | mit | 87 | master | 2,703 | # frozen_string_literal: true
require "termplot/window"
require "termplot/renderable"
require "termplot/window"
require "termplot/character_map"
require "termplot/renderers"
module Termplot
module Widgets
class StatisticsWidget < BaseWidget
def render_to_window
errors.clear
window.clear
... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/widgets/statistics.rb | Ruby | mit | 87 | master | 400 | module Termplot
module Widgets
module Statistics
def count
data.count
end
def mean
return 0 if data.empty?
data.sum(0.0) / count
end
def standard_deviation
return 0 if data.empty?
data_mean = mean
variance = data.map { |x| (data_mean ... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | lib/termplot/widgets/dataset.rb | Ruby | mit | 87 | master | 884 | require "termplot/widgets/statistics"
module Termplot
module Widgets
class Dataset
include Enumerable
include Statistics
attr_reader :capacity, :min, :max, :range, :data
def initialize(capacity)
@data = []
@min = 0
@max = 0
@range = 0
@capacity = ... |
github | Martin-Nyaga/termplot | https://github.com/Martin-Nyaga/termplot | examples/sample.rb | Ruby | mit | 87 | master | 641 | col do
row do
cpu_command = "top -b -n 1 | awk -F',' 'NR==3{ split($4, arr, \" \"); print 100.0 - arr[1] }'"
histogram title: "CPU (%)", command: cpu_command, color: "light_cyan"
timeseries title: "CPU (%)", command: cpu_command, color: "light_cyan"
statistics title: "CPU (%)", command: cpu_command
... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | Gemfile | Ruby | mit | 87 | master | 834 | source "https://rubygems.org"
ruby file: ".ruby-version"
# Keep dotenv at top to ensure ENV variables are loaded before other gems initialize
gem "dotenv", require: "dotenv/load", groups: %i[development test]
gem "bootsnap", require: false
gem "importmap-rails"
gem "net-ssh"
gem "pg"
gem "propshaft"
gem "puma"
gem "... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | config/routes.rb | Ruby | mit | 87 | master | 993 | Rails.application.routes.draw do
scope "admin" do
resources :api_keys, only: %i[new create edit update destroy]
resources :configs
resources :clusters do
member do
get :talosconfig
get :kubeconfig
end
end
resources :label_and_taint_rules, only: %i[index new create edit ... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | config/application.rb | Ruby | mit | 87 | master | 2,096 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | config/environments/development.rb | Ruby | mit | 87 | master | 2,103 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Make code changes take effect immediately without server restart.
config.enable_reloading = true
# Do not eager load code on boot.
config.eager... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | config/environments/test.rb | Ruby | mit | 87 | master | 1,978 | # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | config/environments/production.rb | Ruby | mit | 87 | master | 2,798 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot for better performance and memory savings (ignor... |
github | reclaim-the-stack/talos-manager | https://github.com/reclaim-the-stack/talos-manager | app/jobs/label_and_taint_job.rb | Ruby | mit | 87 | master | 2,594 | # Intended to be run after a server is configured. It is expected that the reboot after configuration
# is applied can take a while which is why we keep retrying for some time (and eventually give up).
class LabelAndTaintJob < ApplicationJob
def perform(server_id)
server = Server.find(server_id)
# We may be... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.