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 | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/ssh.rb | Ruby | mit | 14,158 | main | 1,529 | class Kamal::Configuration::Ssh
LOGGER = ::Logger.new(STDERR)
include Kamal::Configuration::Validation
attr_reader :ssh_config, :secrets
def initialize(config:)
@ssh_config = config.raw_config.ssh || {}
@secrets = config.secrets
validate! ssh_config
end
def user
ssh_config.fetch("user", ... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/accessory.rb | Ruby | mit | 14,158 | main | 7,048 | class Kamal::Configuration::Accessory
include Kamal::Configuration::Validation
DEFAULT_NETWORK = "kamal"
delegate :argumentize, :optionize, to: Kamal::Utils
attr_reader :name, :env, :proxy, :registry
def initialize(name, config:)
@name, @config, @accessory_config = name.inquiry, config, config.raw_con... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/env.rb | Ruby | mit | 14,158 | main | 1,136 | class Kamal::Configuration::Env
include Kamal::Configuration::Validation
attr_reader :context, :clear, :secrets, :secret_keys
delegate :argumentize, to: Kamal::Utils
def initialize(config:, secrets:, context: "env")
@clear = config.fetch("clear", config.key?("secret") || config.key?("tags") ? {} : config)... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/output.rb | Ruby | mit | 14,158 | main | 748 | class Kamal::Configuration::Output
include Kamal::Configuration::Validation
LOGGER_TYPES = {
"otel" => "Kamal::Output::OtelLogger",
"file" => "Kamal::Output::FileLogger"
}
attr_reader :output_config, :loggers
def initialize(config:)
@config = config
@output_config = config.raw_config.output... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/role.rb | Ruby | mit | 14,158 | main | 5,812 | class Kamal::Configuration::Role
include Kamal::Configuration::Validation
delegate :argumentize, :optionize, to: Kamal::Utils
attr_reader :name, :config, :specialized_env, :specialized_logging, :specialized_proxy
alias to_s name
def initialize(name, config:)
@name, @config = name.inquiry, config
v... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/sshkit.rb | Ruby | mit | 14,158 | main | 506 | class Kamal::Configuration::Sshkit
include Kamal::Configuration::Validation
attr_reader :sshkit_config
def initialize(config:)
@sshkit_config = config.raw_config.sshkit || {}
validate! sshkit_config
end
def max_concurrent_starts
sshkit_config.fetch("max_concurrent_starts", 30)
end
def pool... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/proxy.rb | Ruby | mit | 14,158 | main | 4,398 | class Kamal::Configuration::Proxy
include Kamal::Configuration::Validation
DEFAULT_LOG_REQUEST_HEADERS = [ "Cache-Control", "Last-Modified", "User-Agent" ]
CONTAINER_NAME = "kamal-proxy"
delegate :argumentize, :optionize, to: Kamal::Utils
attr_reader :config, :proxy_config, :role_name, :run, :secrets
def... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/alias.rb | Ruby | mit | 14,158 | main | 390 | class Kamal::Configuration::Alias
include Kamal::Configuration::Validation
attr_reader :name, :command
def initialize(name, config:)
@name, @command = name.inquiry, config.raw_config["aliases"][name]
validate! \
command,
example: validation_yml["aliases"]["uname"],
context: "aliases/#... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/boot.rb | Ruby | mit | 14,158 | main | 535 | class Kamal::Configuration::Boot
include Kamal::Configuration::Validation
attr_reader :boot_config, :host_count
def initialize(config:)
@boot_config = config.raw_config.boot || {}
@host_count = config.all_hosts.count
validate! boot_config
end
def limit
limit = boot_config["limit"]
if l... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator.rb | Ruby | mit | 14,158 | main | 6,701 | class Kamal::Configuration::Validator
attr_reader :config, :example, :context
def initialize(config, example:, context:)
@config = config
@example = example
@context = context
end
def validate!
validate_against_example! config, example
end
private
def validate_against_example!(validat... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/servers.rb | Ruby | mit | 14,158 | main | 596 | class Kamal::Configuration::Servers
include Kamal::Configuration::Validation
attr_reader :config, :servers_config, :roles
def initialize(config:)
@config = config
@servers_config = config.raw_config.servers
validate! servers_config, with: Kamal::Configuration::Validator::Servers
@roles = role_n... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/logging.rb | Ruby | mit | 14,158 | main | 770 | class Kamal::Configuration::Logging
delegate :optionize, :argumentize, to: Kamal::Utils
include Kamal::Configuration::Validation
attr_reader :logging_config
def initialize(logging_config:, context: "logging")
@logging_config = logging_config || {}
validate! @logging_config, context: context
end
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validation.rb | Ruby | mit | 14,158 | main | 763 | require "yaml"
require "active_support/inflector"
module Kamal::Configuration::Validation
extend ActiveSupport::Concern
class_methods do
def validation_doc
@validation_doc ||= File.read(File.join(File.dirname(__FILE__), "docs", "#{validation_config_key}.yml"))
end
def validation_config_key
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/registry.rb | Ruby | mit | 14,158 | main | 816 | class Kamal::Configuration::Registry
include Kamal::Configuration::Validation
def initialize(config:, secrets:, context: "registry")
@registry_config = config["registry"] || {}
@secrets = secrets
validate! registry_config, context: context, with: Kamal::Configuration::Validator::Registry
end
def s... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/builder.rb | Ruby | mit | 14,158 | main | 4,678 | class Kamal::Configuration::Builder
include Kamal::Configuration::Validation
attr_reader :config, :builder_config
delegate :image, :service, to: :config
delegate :server, to: :"config.registry"
def initialize(config:)
@config = config
@builder_config = config.raw_config.builder || {}
@image = co... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/volume.rb | Ruby | mit | 14,158 | main | 700 | class Kamal::Configuration::Volume
attr_reader :host_path, :container_path, :options
delegate :argumentize, to: Kamal::Utils
def initialize(host_path:, container_path:, options: nil)
@host_path = host_path
@container_path = container_path
@options = options
end
def docker_args
argumentize "-... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/proxy/run.rb | Ruby | mit | 14,158 | main | 3,025 | class Kamal::Configuration::Proxy::Run
MINIMUM_VERSION = "v0.9.2"
DEFAULT_HTTP_PORT = 80
DEFAULT_HTTPS_PORT = 443
DEFAULT_LOG_MAX_SIZE = "10m"
attr_reader :config, :run_config
delegate :argumentize, :optionize, to: Kamal::Utils
def initialize(config, run_config:, context: "proxy/run")
@config = conf... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/proxy/boot.rb | Ruby | mit | 14,158 | main | 2,872 | class Kamal::Configuration::Proxy::Boot
attr_reader :config
delegate :argumentize, :optionize, to: Kamal::Utils
def initialize(config:)
@config = config
end
def publish_args(http_port, https_port, bind_ips = nil)
ensure_valid_bind_ips(bind_ips)
(bind_ips || [ nil ]).map do |bind_ip|
bind_... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/servers.rb | Ruby | mit | 14,158 | main | 209 | class Kamal::Configuration::Validator::Servers < Kamal::Configuration::Validator
def validate!
validate_type! config, Array, Hash, NilClass
validate_servers! config if config.is_a?(Array)
end
end |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/env.rb | Ruby | mit | 14,158 | main | 1,402 | class Kamal::Configuration::Validator::Env < Kamal::Configuration::Validator
SPECIAL_KEYS = [ "clear", "secret", "tags" ]
def validate!
if known_keys.any?
validate_complex_env!
else
validate_simple_env!
end
end
private
def validate_simple_env!
validate_hash_of!(config, String... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/builder.rb | Ruby | mit | 14,158 | main | 614 | class Kamal::Configuration::Validator::Builder < Kamal::Configuration::Validator
def validate!
super
if config["cache"] && config["cache"]["type"]
error "Invalid cache type: #{config["cache"]["type"]}" unless [ "gha", "registry" ].include?(config["cache"]["type"])
end
error "Builder arch not s... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/role.rb | Ruby | mit | 14,158 | main | 323 | class Kamal::Configuration::Validator::Role < Kamal::Configuration::Validator
def validate!
validate_type! config, Array, Hash
if config.is_a?(Array)
validate_servers!(config)
else
super
validate_labels!(config["labels"])
validate_docker_options!(config["options"])
end
end
e... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/accessory.rb | Ruby | mit | 14,158 | main | 381 | class Kamal::Configuration::Validator::Accessory < Kamal::Configuration::Validator
def validate!
super
if (config.keys & [ "host", "hosts", "role", "roles", "tag", "tags" ]).size != 1
error "specify one of `host`, `hosts`, `role`, `roles`, `tag` or `tags`"
end
validate_labels!(config["labels"]... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/alias.rb | Ruby | mit | 14,158 | main | 446 | class Kamal::Configuration::Validator::Alias < Kamal::Configuration::Validator
def validate!
super
name = context.delete_prefix("aliases/")
if name !~ /\A[a-z0-9_-]+\z/
error "Invalid alias name: '#{name}'. Must only contain lowercase letters, alphanumeric, hyphens and underscores."
end
i... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/proxy.rb | Ruby | mit | 14,158 | main | 1,529 | class Kamal::Configuration::Validator::Proxy < Kamal::Configuration::Validator
def validate!
unless config.nil?
super
if config["host"].blank? && config["hosts"].blank? && config["ssl"]
error "Must set a host to enable automatic SSL"
end
if (config.keys & [ "host", "hosts" ]).siz... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/validator/registry.rb | Ruby | mit | 14,158 | main | 875 | class Kamal::Configuration::Validator::Registry < Kamal::Configuration::Validator
STRING_OR_ONE_ITEM_ARRAY_KEYS = [ "username", "password" ]
def validate!
validate_against_example! \
config.except(*STRING_OR_ONE_ITEM_ARRAY_KEYS),
example.except(*STRING_OR_ONE_ITEM_ARRAY_KEYS)
validate_string_o... |
github | basecamp/kamal | https://github.com/basecamp/kamal | lib/kamal/configuration/env/tag.rb | Ruby | mit | 14,158 | main | 275 | class Kamal::Configuration::Env::Tag
attr_reader :name, :config, :secrets
def initialize(name, config:, secrets:)
@name = name
@config = config
@secrets = secrets
end
def env
Kamal::Configuration::Env.new(config: config, secrets: secrets)
end
end |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/test_helper.rb | Ruby | mit | 14,158 | main | 3,496 | require "bundler/setup"
require "active_support/test_case"
require "active_support/testing/autorun"
require "active_support/testing/stream"
require "rails/test_unit/line_filtering"
require "pty"
require "debug"
require "mocha/minitest" # using #stubs that can alter returns
require "minitest/autorun" # using #stub that ... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/otel_shipper_test.rb | Ruby | mit | 14,158 | main | 9,115 | require "test_helper"
class OtelShipperTest < ActiveSupport::TestCase
setup do
@tags = Kamal::Tags.new(
performer: "deployer",
service: "myapp",
version: "abc123",
destination: "production"
)
Kamal::OtelShipper.any_instance.stubs(:start_flush_thread)
@shipper = Kamal::OtelShip... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets_test.rb | Ruby | mit | 14,158 | main | 4,774 | require "test_helper"
class SecretsTest < ActiveSupport::TestCase
test "fetch" do
with_test_secrets("secrets" => "SECRET=ABC") do
assert_equal "ABC", Kamal::Secrets.new(secrets_path: ".kamal/secrets")["SECRET"]
end
end
test "synchronized_fetch" do
with_test_secrets("secrets" => "SECRET=ABC") d... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/env_file_test.rb | Ruby | mit | 14,158 | main | 2,072 | require "test_helper"
class EnvFileTest < ActiveSupport::TestCase
test "to_s" do
env = {
"foo" => "bar",
"baz" => "haz"
}
assert_equal "foo=bar\nbaz=haz\n", \
Kamal::EnvFile.new(env).to_s
end
test "to_s won't escape '#'" do
env = {
"foo" => '#$foo',
"bar" => '#{bar... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/utils_test.rb | Ruby | mit | 14,158 | main | 2,133 | require "test_helper"
class UtilsTest < ActiveSupport::TestCase
test "argumentize" do
assert_equal [ "--label", "foo=\"\\`bar\\`\"", "--label", "baz=\"qux\"", "--label", :quux, "--label", "quuz=false" ], \
Kamal::Utils.argumentize("--label", { foo: "`bar`", baz: "qux", quux: nil, quuz: false })
end
te... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/git_test.rb | Ruby | mit | 14,158 | main | 425 | require "test_helper"
class GitTest < ActiveSupport::TestCase
test "uncommitted changes exist" do
Kamal::Git.expects(:`).with("git status --porcelain").returns("M file\n")
assert_equal "M file", Kamal::Git.uncommitted_changes
end
test "uncommitted changes do not exist" do
Kamal::Git.expects(:`).... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/sshkit_dns_retry_test.rb | Ruby | mit | 14,158 | main | 1,490 | require "test_helper"
class SshkitDnsRetryTest < ActiveSupport::TestCase
setup do
SSHKit::Backend::Netssh.configure { |config| config.dns_retries = 2 }
@previous_output = SSHKit.config.output
@log_io = StringIO.new
SSHKit.config.output = Logger.new(@log_io)
end
teardown do
SSHKit.config.outp... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration_test.rb | Ruby | mit | 14,158 | main | 16,613 | require "test_helper"
class ConfigurationTest < ActiveSupport::TestCase
setup do
ENV["RAILS_MASTER_KEY"] = "456"
ENV["VERSION"] = "missing"
@deploy = {
service: "app", image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
builder: { "arch" => "amd64" },
env... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commander_test.rb | Ruby | mit | 14,158 | main | 6,675 | require "test_helper"
class CommanderTest < ActiveSupport::TestCase
setup do
configure_with(:deploy_with_roles)
end
test "lazy configuration" do
assert_equal Kamal::Configuration, @kamal.config.class
end
test "overwriting hosts" do
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @k... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/main_test.rb | Ruby | mit | 14,158 | main | 13,153 | require_relative "integration_test"
class MainTest < IntegrationTest
test "deploy, redeploy, rollback, details and audit" do
first_version = latest_app_version
assert_app_is_down
deploy_output = kamal :deploy, capture: true
assert_app_is_up version: first_version
assert_hooks_ran "pre-connect",... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/integration_test.rb | Ruby | mit | 14,158 | main | 7,427 | require "net/http"
require "test_helper"
class IntegrationTest < ActiveSupport::TestCase
setup do
ENV["TEST_ID"] = SecureRandom.hex
docker_compose "up --build -d"
wait_for_healthy
setup_deployer
deployer_exec("sh -c 'rm -f /tmp/otel/*.json /tmp/kamal-deploy-logs/*'", workdir: "/")
@app = "app... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/proxy_test.rb | Ruby | mit | 14,158 | main | 2,015 | require_relative "integration_test"
class ProxyTest < IntegrationTest
setup do
@app = "app_with_roles"
end
test "boot, reboot, stop, start, restart, logs, remove" do
kamal :proxy, :boot
assert_proxy_running
output = kamal :proxy, :reboot, "-y", "--verbose", capture: true
assert_proxy_runnin... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/app_test.rb | Ruby | mit | 14,158 | main | 4,206 | require_relative "integration_test"
class AppTest < IntegrationTest
test "stop, start, boot, logs, images, containers, exec, remove" do
kamal :deploy
assert_app_is_up
kamal :app, :stop
assert_app_not_found
kamal :app, :start
# kamal app start does not wait
wait_for_app_to_be_up
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/lock_test.rb | Ruby | mit | 14,158 | main | 616 | require_relative "integration_test"
class LockTest < IntegrationTest
test "acquire, release, status" do
kamal :lock, :acquire, "-m 'Integration Tests'"
status = kamal :lock, :status, capture: true
assert_match /Locked by: Deployer at .*\nVersion: #{latest_app_version}\nMessage: Integration Tests/m, stat... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/broken_deploy_test.rb | Ruby | mit | 14,158 | main | 1,183 | require_relative "integration_test"
class BrokenDeployTest < IntegrationTest
test "deploying a bad image" do
@app = "app_with_roles"
first_version = latest_app_version
kamal :deploy
assert_app_is_up version: first_version
assert_container_running host: :vm3, name: "app_with_roles-workers-#{fir... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/accessory_test.rb | Ruby | mit | 14,158 | main | 3,395 | require_relative "integration_test"
class AccessoryTest < IntegrationTest
test "boot, stop, start, restart, logs, remove" do
kamal :accessory, :boot, :busybox
assert_accessory_running :busybox
assert_accessory_volume_mount_options :busybox
assert_accessory_file_mode_and_owner :busybox
assert_acce... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/integration/docker/otel_collector/server.rb | Ruby | mit | 14,158 | main | 606 | require "socket"
require "fileutils"
dir = "/tmp/otel"
FileUtils.mkdir_p(dir)
server = TCPServer.new("0.0.0.0", 4318)
loop do
client = server.accept
request = ""
content_length = 0
while (line = client.gets) && line != "\r\n"
request << line
content_length = $1.to_i if line =~ /^Content-Length:\s*(\... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/gcp_secret_manager_adapter_test.rb | Ruby | mit | 14,158 | main | 6,464 | require "test_helper"
class GcpSecretManagerAdapterTest < SecretAdapterTestCase
test "fetch" do
stub_gcloud_version
stub_authenticated
stub_mypassword
json = JSON.parse(run_command("fetch", "mypassword"))
expected_json = { "default/mypassword"=>"secret123" }
assert_equal expected_json, jso... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/aws_secrets_manager_adapter_test.rb | Ruby | mit | 14,158 | main | 6,577 | require "test_helper"
class AwsSecretsManagerAdapterTest < SecretAdapterTestCase
test "fails when errors are present" do
stub_ticks.with("aws --version 2> /dev/null")
stub_ticks
.with("aws secretsmanager batch-get-secret-value --secret-id-list unknown1 unknown2 --profile default --output json")
.... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/last_pass_adapter_test.rb | Ruby | mit | 14,158 | main | 4,605 | require "test_helper"
class LastPassAdapterTest < SecretAdapterTestCase
setup do
`true` # Ensure $? is 0
end
test "fetch" do
stub_ticks.with("lpass --version 2> /dev/null")
stub_ticks.with("lpass status --color never").returns("Logged in as email@example.com.")
stub_ticks
.with("lpass sho... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/bitwarden_secrets_manager_adapter_test.rb | Ruby | mit | 14,158 | main | 5,299 | require "test_helper"
class BitwardenSecretsManagerAdapterTest < SecretAdapterTestCase
test "fetch with no parameters" do
stub_ticks.with("bws --version 2> /dev/null")
stub_login
error = assert_raises RuntimeError do
run_command("fetch")
end
assert_equal("You must specify what to retrieve ... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/bitwarden_adapter_test.rb | Ruby | mit | 14,158 | main | 10,167 | require "test_helper"
class BitwardenAdapterTest < SecretAdapterTestCase
test "fetch" do
stub_ticks.with("bw --version 2> /dev/null")
stub_unlocked
stub_ticks.with("bw sync").returns("")
stub_mypassword
json = JSON.parse(run_command("fetch", "mypassword"))
expected_json = { "mypassword"=>"... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/one_password_adapter_test.rb | Ruby | mit | 14,158 | main | 8,048 | require "test_helper"
class SecretsOnePasswordAdapterTest < SecretAdapterTestCase
test "fetch" do
stub_ticks.with("op --version 2> /dev/null")
stub_ticks.with("op account get --account myaccount 2> /dev/null")
stub_ticks
.with("op item get myitem --vault \"myvault\" --format \"json\" --account \"m... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/dotenv_inline_command_substitution_test.rb | Ruby | mit | 14,158 | main | 1,296 | require "test_helper"
class SecretsInlineCommandSubstitution < SecretAdapterTestCase
test "inlines kamal secrets commands" do
Kamal::Cli::Main.expects(:start).with { |command| command == [ "secrets", "fetch", "...", "--inline" ] }.returns("results")
substituted = Kamal::Secrets::Dotenv::InlineCommandSubstitu... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/passbolt_adapter_test.rb | Ruby | mit | 14,158 | main | 17,654 | require "test_helper"
class PassboltAdapterTest < SecretAdapterTestCase
setup do
`true` # Ensure $? is 0
end
test "fetch" do
stub_ticks_with("passbolt --version 2> /dev/null", succeed: true)
stub_ticks.with("passbolt verify 2> /dev/null", succeed: true)
stub_ticks
.with("passbolt list res... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/doppler_adapter_test.rb | Ruby | mit | 14,158 | main | 4,838 | require "test_helper"
class DopplerAdapterTest < SecretAdapterTestCase
setup do
`true` # Ensure $? is 0
end
test "fetch" do
stub_ticks_with("doppler --version 2> /dev/null", succeed: true)
stub_ticks.with("doppler me --json 2> /dev/null")
stub_ticks
.with("doppler secrets get SECRET1 FSEC... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/secrets/enpass_adapter_test.rb | Ruby | mit | 14,158 | main | 2,868 | require "test_helper"
class EnpassAdapterTest < SecretAdapterTestCase
test "fetch without CLI installed" do
stub_ticks_with("enpass-cli version 2> /dev/null", succeed: false)
error = assert_raises RuntimeError do
JSON.parse(run_command("fetch", "mynote"))
end
assert_equal "Enpass CLI is not i... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/lock_test.rb | Ruby | mit | 14,158 | main | 971 | require "test_helper"
class CommandsLockTest < ActiveSupport::TestCase
setup do
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ],
builder: { "arch" => "amd64" }
}
end
test "status" do
assert_equal \
"sta... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/registry_test.rb | Ruby | mit | 14,158 | main | 3,241 | require "test_helper"
class CommandsRegistryTest < ActiveSupport::TestCase
setup do
@config = {
service: "app",
image: "dhh/app",
registry: {
"username" => "dhh",
"password" => "secret",
"server" => "hub.docker.com"
},
builder: { "arch" => "amd64" },
se... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/accessory_test.rb | Ruby | mit | 14,158 | main | 7,929 | require "test_helper"
class CommandsAccessoryTest < ActiveSupport::TestCase
setup do
setup_test_secrets("secrets" => "MYSQL_ROOT_PASSWORD=secret123")
@config = {
service: "app",
image: "dhh/app",
registry: { "server" => "private.registry", "username" => "dhh", "password" => "secret" },
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/server_test.rb | Ruby | mit | 14,158 | main | 543 | require "test_helper"
class CommandsServerTest < ActiveSupport::TestCase
setup do
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ],
builder: { "arch" => "amd64" }
}
end
test "ensure run directory" do
assert_eq... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/proxy_test.rb | Ruby | mit | 14,158 | main | 9,695 | require "test_helper"
class CommandsProxyTest < ActiveSupport::TestCase
setup do
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ], builder: { "arch" => "amd64" }
}
ENV["EXAMPLE_API_KEY"] = "456"
end
teardown do
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/builder_test.rb | Ruby | mit | 14,158 | main | 15,634 | require "test_helper"
class CommandsBuilderTest < ActiveSupport::TestCase
setup do
@config = { service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ], builder: { "arch" => "amd64" } }
end
test "target linux/amd64 locally by default" do
builder... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/hook_test.rb | Ruby | mit | 14,158 | main | 1,515 | require "test_helper"
class CommandsHookTest < ActiveSupport::TestCase
include ActiveSupport::Testing::TimeHelpers
setup do
freeze_time
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ],
builder: { "arch" => "amd64"... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/prune_test.rb | Ruby | mit | 14,158 | main | 1,506 | require "test_helper"
class CommandsPruneTest < ActiveSupport::TestCase
setup do
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ],
builder: { "arch" => "amd64" }
}
end
test "dangling images" do
assert_equal \
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/auditor_test.rb | Ruby | mit | 14,158 | main | 1,933 | require "test_helper"
require "active_support/testing/time_helpers"
class CommandsAuditorTest < ActiveSupport::TestCase
include ActiveSupport::Testing::TimeHelpers
setup do
freeze_time
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, builder: ... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/docker_test.rb | Ruby | mit | 14,158 | main | 1,328 | require "test_helper"
class CommandsDockerTest < ActiveSupport::TestCase
setup do
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ], builder: { "arch" => "amd64" }
}
@docker = Kamal::Commands::Docker.new(Kamal::Configurat... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/commands/app_test.rb | Ruby | mit | 14,158 | main | 35,894 | require "test_helper"
class CommandsAppTest < ActiveSupport::TestCase
setup do
setup_test_secrets("secrets" => "RAILS_MASTER_KEY=456")
@config = { service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: { "web" => [ "1.1.1.1" ], "workers" => [ "1.1.1.2" ] }, env... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/accessory_test.rb | Ruby | mit | 14,158 | main | 13,508 | require "test_helper"
class ConfigurationAccessoryTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app",
image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
servers: {
"web" => [ { "1.1.1.1" => "writer" }, { "1.1.1.2" => "reader" } ],
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/ssh_test.rb | Ruby | mit | 14,158 | main | 3,197 | require "test_helper"
class ConfigurationSshTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
builder: { "arch" => "amd64" },
env: { "REDIS_URL" => "redis://x/y" },
servers: [ "1.1.1.1", "... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/volume_test.rb | Ruby | mit | 14,158 | main | 1,458 | require "test_helper"
class ConfigurationVolumeTest < ActiveSupport::TestCase
test "docker args absolute" do
volume = Kamal::Configuration::Volume.new(host_path: "/root/foo/bar", container_path: "/assets")
assert_equal [ "--volume", "/root/foo/bar:/assets" ], volume.docker_args
end
test "docker args rel... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/role_test.rb | Ruby | mit | 14,158 | main | 11,024 | require "test_helper"
class ConfigurationRoleTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" },
servers: [ "1.1.1.1", "1.1.1.2" ],
builder: { "arch" => "amd64" },
env: { "REDIS_URL" => "redis://x... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/builder_test.rb | Ruby | mit | 14,158 | main | 5,530 | require "test_helper"
class ConfigurationBuilderTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" },
builder: { "arch" => "amd64" }, servers: [ "1.1.1.1" ]
}
end
test "local?" do
assert_equal true... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/sshkit_test.rb | Ruby | mit | 14,158 | main | 1,023 | require "test_helper"
class ConfigurationSshkitTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
env: { "REDIS_URL" => "redis://x/y" },
builder: { "arch" => "amd64" },
servers: [ "1.1.1.1"... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/boot_test.rb | Ruby | mit | 14,158 | main | 1,345 | require "test_helper"
class ConfigurationBootTest < ActiveSupport::TestCase
test "no boot config" do
config = config_with_boot(nil)
assert_nil config.boot.limit
assert_nil config.boot.wait
assert_nil config.boot.parallel_roles
end
test "specific limit group strategy" do
config = config_with... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/validation_test.rb | Ruby | mit | 14,158 | main | 7,803 | require "test_helper"
class ConfigurationValidationTest < ActiveSupport::TestCase
test "unknown root key" do
assert_error "unknown key: unknown", unknown: "value"
assert_error "unknown keys: unknown, unknown2", unknown: "value", unknown2: "value"
end
test "wrong root types" do
[ :service, :image, :as... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/proxy_test.rb | Ruby | mit | 14,158 | main | 3,528 | require "test_helper"
class ConfigurationProxyTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" },
builder: { "arch" => "amd64" }, servers: [ "1.1.1.1" ]
}
end
test "ssl with host" do
@deploy[:pro... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/output_test.rb | Ruby | mit | 14,158 | main | 2,176 | require "test_helper"
class ConfigurationOutputTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
builder: { "arch" => "amd64" },
servers: [ "1.1.1.1" ]
}
Kamal::OtelShipper.any_instance.... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/env_test.rb | Ruby | mit | 14,158 | main | 2,173 | require "test_helper"
class ConfigurationEnvTest < ActiveSupport::TestCase
require "test_helper"
test "simple" do
assert_config \
config: { "foo" => "bar", "baz" => "haz" },
clear: { "foo" => "bar", "baz" => "haz" }
end
test "clear" do
assert_config \
config: { "clear" => { "foo" =>... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/env/tags_test.rb | Ruby | mit | 14,158 | main | 4,310 | require "test_helper"
class ConfigurationEnvTagsTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" },
servers: [ { "1.1.1.1" => "odd" }, { "1.1.1.2" => "even" }, { "1.1.1.3" => [ "odd", "three" ] } ],
bui... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/configuration/proxy/boot_test.rb | Ruby | mit | 14,158 | main | 1,363 | require "test_helper"
class ConfigurationProxyBootTest < ActiveSupport::TestCase
setup do
ENV["RAILS_MASTER_KEY"] = "456"
ENV["VERSION"] = "missing"
@deploy = {
service: "app", image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
builder: { "arch" => "amd64" },
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/prune_test.rb | Ruby | mit | 14,158 | main | 1,597 | require_relative "cli_test_case"
class CliPruneTest < CliTestCase
test "all" do
Kamal::Cli::Prune.any_instance.expects(:containers)
Kamal::Cli::Prune.any_instance.expects(:images)
run_command("all")
end
test "images" do
run_command("images").tap do |output|
assert_match "docker image prun... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/lock_test.rb | Ruby | mit | 14,158 | main | 576 | require_relative "cli_test_case"
class CliLockTest < CliTestCase
test "status" do
run_command("status").tap do |output|
assert_match "Running /usr/bin/env stat .kamal/lock-app > /dev/null && cat .kamal/lock-app/details | base64 -d on 1.1.1.1", output
end
end
test "release" do
run_command("rele... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/main_test.rb | Ruby | mit | 14,158 | main | 34,663 | require_relative "cli_test_case"
class CliMainTest < CliTestCase
setup { @original_env = ENV.to_h.dup }
teardown { ENV.clear; ENV.update @original_env }
test "setup" do
invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999", "skip_hooks" => false }
Kamal::Cli::Main.an... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/secrets_test.rb | Ruby | mit | 14,158 | main | 1,080 | require_relative "cli_test_case"
class CliSecretsTest < CliTestCase
test "fetch" do
assert_equal \
'{"foo":"oof","bar":"rab","baz":"zab"}',
run_command("fetch", "foo", "bar", "baz", "--account", "myaccount", "--adapter", "test")
end
test "fetch missing --acount" do
assert_equal \
"No v... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/modify_test.rb | Ruby | mit | 14,158 | main | 1,895 | require_relative "cli_test_case"
class CliModifyTest < CliTestCase
setup do
@events = []
@subscription = ActiveSupport::Notifications.subscribe("modify.kamal", self)
end
teardown do
ActiveSupport::Notifications.unsubscribe(@subscription)
end
def start(name, id, payload)
@events << { type: :... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/accessory_test.rb | Ruby | mit | 14,158 | main | 15,620 | require_relative "cli_test_case"
class CliAccessoryTest < CliTestCase
setup do
setup_test_secrets("secrets" => "MYSQL_ROOT_PASSWORD=secret")
end
teardown do
teardown_test_secrets
end
test "boot" do
Kamal::Cli::Accessory.any_instance.expects(:directories).with("mysql")
Kamal::Cli::Accessory.... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/app_test.rb | Ruby | mit | 14,158 | main | 40,127 | require_relative "cli_test_case"
class CliAppTest < CliTestCase
test "boot" do
stub_running
run_command("boot").tap do |output|
assert_match "docker tag dhh/app:latest dhh/app:latest", output
assert_match /docker run --detach --restart unless-stopped --name app-web-latest --network kamal --hostna... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/cli_test_case.rb | Ruby | mit | 14,158 | main | 2,305 | require "test_helper"
class CliTestCase < ActiveSupport::TestCase
setup do
ENV["VERSION"] = "999"
ENV["RAILS_MASTER_KEY"] = "123"
ENV["MYSQL_ROOT_PASSWORD"] = "secret123"
Object.send(:remove_const, :KAMAL)
Object.const_set(:KAMAL, Kamal::Commander.new)
end
teardown do
ENV.... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/registry_test.rb | Ruby | mit | 14,158 | main | 4,921 | require_relative "cli_test_case"
class CliRegistryTest < CliTestCase
test "setup" do
run_command("setup").tap do |output|
assert_match /docker login -u \[REDACTED\] -p \[REDACTED\] as .*@localhost/, output
assert_match /docker login -u \[REDACTED\] -p \[REDACTED\] on 1.1.1.\d/, output
end
end
... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/server_test.rb | Ruby | mit | 14,158 | main | 5,572 | require_relative "cli_test_case"
class CliServerTest < CliTestCase
test "running a command with exec" do
SSHKit::Backend::Abstract.any_instance.stubs(:capture)
.with("date", verbosity: 1)
.returns("Today")
hosts = "1.1.1.1".."1.1.1.4"
run_command("exec", "date").tap do |output|
hosts.m... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/proxy_test.rb | Ruby | mit | 14,158 | main | 24,585 | require_relative "cli_test_case"
class CliProxyTest < CliTestCase
test "boot" do
run_command("boot").tap do |output|
assert_match "docker login", output
assert_match "mkdir -p .kamal/proxy/apps-config", output
assert_match "echo $(cat .kamal/proxy/options 2> /dev/null || echo \"--publish 80:80 ... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/cli/build_test.rb | Ruby | mit | 14,158 | main | 22,674 | require_relative "cli_test_case"
class CliBuildTest < CliTestCase
test "deliver" do
Kamal::Cli::Build.any_instance.expects(:push)
Kamal::Cli::Build.any_instance.expects(:pull)
run_command("deliver")
end
test "push" do
with_build_directory do |build_directory|
Kamal::Commands::Hook.any_ins... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/output/otel_logger_test.rb | Ruby | mit | 14,158 | main | 4,321 | require "test_helper"
class OutputOtelLoggerTest < ActiveSupport::TestCase
setup do
@tags = Kamal::Tags.new(
performer: "deployer",
service: "myapp",
version: "abc123",
destination: "production"
)
Kamal::OtelShipper.any_instance.stubs(:start_flush_thread)
Kamal::OtelShipper.an... |
github | basecamp/kamal | https://github.com/basecamp/kamal | test/output/file_logger_test.rb | Ruby | mit | 14,158 | main | 2,427 | require "test_helper"
require "tmpdir"
class OutputFileLoggerTest < ActiveSupport::TestCase
setup do
@dir = Dir.mktmpdir
@logger = Kamal::Output::FileLogger.new(path: @dir)
end
teardown do
@logger.close
FileUtils.rm_rf(@dir)
end
test "discards lines before start" do
@logger << "before m... |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | tmuxinator.gemspec | Ruby | mit | 13,546 | master | 2,075 | # coding: utf-8
# frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "tmuxinator/version"
Gem::Specification.new do |s|
s.name = "tmuxinator"
s.version = Tmuxinator::VERSION
s.authors = ["Allen Bargi", "Christop... |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | lib/tmuxinator.rb | Ruby | mit | 13,546 | master | 549 | # frozen_string_literal: true
require "erubi"
require "fileutils"
require "shellwords"
require "thor"
require "thor/version"
require "yaml"
module Tmuxinator
end
require "tmuxinator/tmux_version"
require "tmuxinator/util"
require "tmuxinator/deprecations"
require "tmuxinator/wemux_support"
require "tmuxinator/cli"
r... |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | lib/tmuxinator/pane.rb | Ruby | mit | 13,546 | master | 1,669 | # frozen_string_literal: true
module Tmuxinator
class Pane
attr_reader :commands, :project, :index, :tab, :title
def initialize(index, project, tab, *commands, title: nil)
@commands = commands
@index = index
@project = project
@tab = tab
@title = title.to_s.shellescape unless t... |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | lib/tmuxinator/hooks.rb | Ruby | mit | 13,546 | master | 295 | # frozen_string_literal: true
module Tmuxinator
module Hooks
module_function
def commands_from(project, hook_name)
hook_config = project.yaml[hook_name]
if hook_config.is_a?(Array)
hook_config.join("; ")
else
hook_config
end
end
end
end |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | lib/tmuxinator/project.rb | Ruby | mit | 13,546 | master | 12,014 | # frozen_string_literal: true
module Tmuxinator
class Project
include Tmuxinator::Util
include Tmuxinator::Deprecations
include Tmuxinator::Hooks::Project
RBENVRVM_DEP_MSG = <<-M
DEPRECATION: rbenv/rvm-specific options have been replaced by the
`pre_tab` option and will not be supported in 0... |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | lib/tmuxinator/cli.rb | Ruby | mit | 13,546 | master | 18,230 | # frozen_string_literal: true
require "open3"
module Tmuxinator
class Cli < Thor
# By default, Thor returns exit(0) when an error occurs.
# Please see: https://github.com/tmuxinator/tmuxinator/issues/192
def self.exit_on_failure?
true
end
include Tmuxinator::Util
COMMANDS = {
c... |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | lib/tmuxinator/doctor.rb | Ruby | mit | 13,546 | master | 339 | # frozen_string_literal: true
module Tmuxinator
class Doctor
class << self
def editor?
!ENV["EDITOR"].nil? && !ENV["EDITOR"].empty?
end
def installed?
Kernel.system("type tmux > /dev/null")
end
def shell?
!ENV["SHELL"].nil? && !ENV["SHELL"].empty?
end... |
github | tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator | lib/tmuxinator/config.rb | Ruby | mit | 13,546 | master | 6,711 | # frozen_string_literal: true
module Tmuxinator
class Config
LOCAL_DEFAULTS = ["./.tmuxinator.yml", "./.tmuxinator.yaml"].freeze
NO_LOCAL_FILE_MSG = "Project file at ./.tmuxinator.yml doesn't exist."
NO_PROJECT_FOUND_MSG = "Project could not be found."
TMUX_MASTER_VERSION = Float::INFINITY
class... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.