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
gollum/gollum
https://github.com/gollum/gollum
test/test_allow_editing.rb
Ruby
mit
14,262
master
2,905
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) context "Precious::Views::Editing" do include Rack::Test::Methods setup do @path = cloned_testpath('examples/revert.git') Precious::App.set(:gollum_path, @path) Precious::App.set(:wiki_options, {allow_editi...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_latest_changes_view.rb
Ruby
mit
14,262
master
3,720
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require File.expand_path '../../lib/gollum/views/latest_changes', __FILE__ context 'Precious::Views::LatestChanges' do include Rack::Test::Methods def app Precious::App end setup do @path = cloned_test...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_unicode.rb
Ruby
mit
14,262
master
2,663
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), "helper")) def utf8(str) str.respond_to?(:force_encoding) ? str.force_encoding('utf-8') : str end context "Unicode Support" do setup do @path = cloned_testpath("examples/revert.git") @wiki = Gollum::Wiki.new(@path) end ...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_history_view.rb
Ruby
mit
14,262
master
286
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require File.expand_path '../../lib/gollum/views/history', __FILE__ context "Precious::Views::History" do setup do @history = Precious::Views::History.new end # No tests yet end
github
gollum/gollum
https://github.com/gollum/gollum
test/test_migrate.rb
Ruby
mit
14,262
master
2,218
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) def load_script(**args) settings = { :run_silent => true, :no_dry_run => true, :prefer_relative => true, :hyphenate => false, :page_file_dir => nil, }.merge(args) settings.each do |setting, val| ...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_compare.rb
Ruby
mit
14,262
master
2,021
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require File.expand_path '../../lib/gollum/views/commit', __FILE__ def get_commit_diff(sha1) commit = @wiki.repo.commit(sha1) @wiki.repo.diff(commit.parent.id, sha1) end context "Precious::Views::Compare" do setup do...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_template_cascade.rb
Ruby
mit
14,262
master
1,486
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) context "Precious::Views::TemplateCascade" do include Rack::Test::Methods setup do @path = cloned_testpath('examples/lotr.git') Precious::App.set(:gollum_path, @path) Precious::App.set( :wiki_options,...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_app.rb
Ruby
mit
14,262
master
40,493
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), "helper")) context "Frontend" do include Rack::Test::Methods setup do @path = cloned_testpath("examples/revert.git") @wiki = Gollum::Wiki.new(@path) Precious::App.set(:gollum_path, @path) Precious::App.set(:wiki_o...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_overview_view.rb
Ruby
mit
14,262
master
4,627
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require File.expand_path '../../lib/gollum/views/overview', __FILE__ FakePageResult = Struct.new(:path) do def name File.basename(path, File.extname(path)).gsub("-", " ") end alias filename name def escaped_url_...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_page_view.rb
Ruby
mit
14,262
master
7,281
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require File.expand_path '../../lib/gollum/views/page', __FILE__ context "Precious::Views::Page" do setup do @path = cloned_testpath('examples/empty.git') @wiki = Gollum::Wiki.new(@path) end teardown do ...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_app_helpers.rb
Ruby
mit
14,262
master
1,787
require File.expand_path(File.join(File.dirname(__FILE__), "helper")) context 'Precious::Helpers' do include Precious::Helpers test 'remove trailing and leading slashes' do ['/wiki', '/wiki/', 'wiki/', '//wiki//'].each do |param| assert_equal 'wiki', remove_leading_and_trailing_slashes(param) end ...
github
gollum/gollum
https://github.com/gollum/gollum
test/test_rss_view.rb
Ruby
mit
14,262
master
3,374
require_relative "helper" context "Precious::Views::RSS" do # Simplistically mimics a `Gollum::Git::Actor` object. # MockAuthor = Struct.new(:name, :email) # Simplistically mimics a `Gollum::Git::Commit` object. # MockChange = Class.new do def author MockAuthor.new("committer name", "email@examp...
github
gollum/gollum
https://github.com/gollum/gollum
test/capybara_helper.rb
Ruby
mit
14,262
master
1,683
require_relative 'helper' require 'selenium-webdriver' require 'capybara/dsl' Selenium::WebDriver::Chrome.path = ENV['CHROME_PATH'] if ENV['CHROME_PATH'] CAPYBARA_DRIVER = if ENV['CI'] :selenium_chrome_headless else ENV.fetch('CAPYBARA_DRIVER', :selenium_chrome).to_sym end Capybara.default_driver = CA...
github
gollum/gollum
https://github.com/gollum/gollum
test/helper.rb
Ruby
mit
14,262
master
2,488
require 'rubygems' require 'rack/test' require 'shoulda' require 'minitest/autorun' require 'minitest/reporters' require 'minitest/spec' require 'mocha/minitest' require 'fileutils' require 'tmpdir' # Silence locale validation warning require 'i18n' I18n.enforce_available_locales = false Minitest::Reporters.use! [ ...
github
gollum/gollum
https://github.com/gollum/gollum
test/integration/test_page.rb
Ruby
mit
14,262
master
2,063
require_relative "../capybara_helper" context "viewing a wiki page" do include Capybara::DSL setup do @path = cloned_testpath "examples/lotr.git" @wiki = Gollum::Wiki.new @path Precious::App.set :gollum_path, @path Precious::App.set :wiki_options, {} Capybara.app = Precious::App end tea...
github
gollum/gollum
https://github.com/gollum/gollum
test/integration/test_app.rb
Ruby
mit
14,262
master
636
require_relative "../capybara_helper" context "pages" do include Capybara::DSL setup do @path = cloned_testpath "examples/lotr.git" @wiki = Gollum::Wiki.new @path Precious::App.set :gollum_path, @path Precious::App.set :wiki_options, {} Capybara.app = Precious::App end test 'last modif...
github
gollum/gollum
https://github.com/gollum/gollum
test/integration/test_js_errors.rb
Ruby
mit
14,262
master
3,441
require_relative '../capybara_helper' def expected_errors Regexp.union([ %r{Refused to apply style from 'http:.*/gollum/create/custom.css'}, %r{.*/gollum/create/math.config.js - Failed to load resource: the server responded with a status of 403}, %r{Refused to execute script from .*/gollum/create/math.co...
github
gollum/gollum
https://github.com/gollum/gollum
test/integration/test_editor.rb
Ruby
mit
14,262
master
1,852
require_relative "../capybara_helper" context "editor interface" do include Capybara::DSL setup do @path = cloned_testpath "examples/lotr.git" @wiki = Gollum::Wiki.new @path Precious::App.set :gollum_path, @path Precious::App.set :wiki_options, {} Capybara.app = Precious::App end teardo...
github
gollum/gollum
https://github.com/gollum/gollum
test/integration/test_localization.rb
Ruby
mit
14,262
master
1,344
require_relative '../capybara_helper' context 'Localized frontend' do include Capybara::DSL setup do @path = cloned_testpath "examples/lotr.git" @wiki = Gollum::Wiki.new(@path) Precious::App.set :gollum_path, @path Precious::App.set :wiki_options, {math: :katex} Capybara.app = Precious::App ...
github
gollum/gollum
https://github.com/gollum/gollum
test/integration/test_search.rb
Ruby
mit
14,262
master
1,270
require_relative "../capybara_helper" context "search" do include Capybara::DSL setup do @path = cloned_testpath "examples/lotr.git" @wiki = Gollum::Wiki.new @path Precious::App.set :gollum_path, @path Precious::App.set :wiki_options, {} Capybara.app = Precious::App end teardown do ...
github
gollum/gollum
https://github.com/gollum/gollum
test/gollum/views/test_locale_helper.rb
Ruby
mit
14,262
master
6,129
require_relative "../../helper" require_relative "../../../lib/gollum/views/helpers" describe Precious::Views::LocaleHelpers do class TestClass < Mustache include Precious::Views::LocaleHelpers def author "J.R.R." end def location "Bloemfontein" end end def setup I18n.avail...
github
basecamp/kamal
https://github.com/basecamp/kamal
kamal.gemspec
Ruby
mit
14,158
main
1,143
require_relative "lib/kamal/version" Gem::Specification.new do |spec| spec.name = "kamal" spec.version = Kamal::VERSION spec.authors = [ "David Heinemeier Hansson" ] spec.email = "dhh@hey.com" spec.homepage = "https://github.com/basecamp/kamal" spec.summary = "Deploy web apps in...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal.rb
Ruby
mit
14,158
main
359
module Kamal class ConfigurationError < StandardError; end end require "active_support" require "zeitwerk" require "yaml" require "tmpdir" require "pathname" require "uri" loader = Zeitwerk::Loader.for_gem loader.ignore(File.join(__dir__, "kamal", "sshkit_with_ext.rb")) loader.setup loader.eager_load_namespace(Kama...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets.rb
Ruby
mit
14,158
main
1,314
require "dotenv" class Kamal::Secrets Kamal::Secrets::Dotenv::InlineCommandSubstitution.install! def initialize(destination: nil, secrets_path:) @destination = destination @secrets_path = secrets_path @mutex = Mutex.new end def [](key) synchronized_fetch(key) rescue KeyError if secrets_...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/sshkit_with_ext.rb
Ruby
mit
14,158
main
7,785
require "sshkit" require "sshkit/dsl" require "net/scp" require "active_support/core_ext/hash/deep_merge" require "json" require "resolv" require "concurrent/atomic/semaphore" class SSHKit::Backend::Abstract def capture_with_info(*args, **kwargs) capture(*args, **kwargs, verbosity: Logger::INFO) end def cap...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/tags.rb
Ruby
mit
14,158
main
875
require "time" class Kamal::Tags attr_reader :config, :tags class << self def from_config(config, **extra) new(**default_tags(config), **extra) end def default_tags(config) { recorded_at: Time.now.utc.iso8601, performer: Kamal::Git.email.presence || `whoami`.chomp, destina...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commander.rb
Ruby
mit
14,158
main
5,556
require "active_support/core_ext/enumerable" require "active_support/core_ext/module/delegation" require "active_support/core_ext/object/blank" require "active_support/broadcast_logger" require "active_support/notifications" class Kamal::Commander attr_accessor :verbosity, :holding_lock, :connected, :logging attr_...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/otel_shipper.rb
Ruby
mit
14,158
main
5,002
require "active_support/core_ext/numeric/time" require "net/http" require "json" require "securerandom" require "uri" class Kamal::OtelShipper BATCH_SIZE = 100 FLUSH_INTERVAL = 5.seconds OTEL_ATTRIBUTE_KEYS = { service: "service.namespace", version: "kamal.deploy_version", performer: "kamal.performe...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/git.rb
Ruby
mit
14,158
main
698
module Kamal::Git extend self def used? system("git rev-parse") end def user_name `git config user.name`.strip end def email `git config user.email`.strip end def revision `git rev-parse HEAD`.strip end def uncommitted_changes `git status --porcelain`.strip end def root...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/configuration.rb
Ruby
mit
14,158
main
12,306
require "active_support/ordered_options" require "active_support/core_ext/string/inquiry" require "active_support/core_ext/module/delegation" require "active_support/core_ext/hash/keys" require "erb" require "net/ssh/proxy/jump" class Kamal::Configuration HOOKS_OUTPUT_LEVELS = [ :quiet, :verbose ].freeze delegate...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/env_file.rb
Ruby
mit
14,158
main
1,233
# Encode an env hash as a string where secret values have been looked up and all values escaped for Docker. class Kamal::EnvFile def initialize(env) @env = env end def to_s env_file = StringIO.new.tap do |contents| @env.each do |key, value| contents << docker_env_file_line(key, value) ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/docker.rb
Ruby
mit
14,158
main
708
require "tempfile" require "open3" module Kamal::Docker extend self BUILD_CHECK_TAG = "kamal-local-build-check" def included_files Tempfile.create do |dockerfile| dockerfile.write(<<~DOCKERFILE) FROM busybox COPY . app WORKDIR app CMD find . -type f | sed "s|^\./||" ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/utils.rb
Ruby
mit
14,158
main
3,346
require "active_support/core_ext/object/try" module Kamal::Utils extend self DOLLAR_SIGN_WITHOUT_SHELL_EXPANSION_REGEX = /\$(?!{[^\}]*\})/ # Return a list of escaped shell arguments using the same named argument against the passed attributes (hash or array). def argumentize(argument, attributes, sensitive: f...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli.rb
Ruby
mit
14,158
main
284
module Kamal::Cli class BootError < StandardError; end class HookError < StandardError; end class LockError < StandardError; end class DependencyError < StandardError; end end # SSHKit uses instance eval, so we need a global const for ergonomics KAMAL = Kamal::Commander.new
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/output/file_logger.rb
Ruby
mit
14,158
main
1,254
class Kamal::Output::FileLogger < Kamal::Output::BaseLogger attr_reader :path def self.build(settings:, config:) raise ArgumentError, "file path is required" unless settings["path"] new(path: settings["path"]) end def initialize(path:) @path = Pathname.new(path) super() end def <<(message...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/output/base_logger.rb
Ruby
mit
14,158
main
713
require "logger" class Kamal::Output::BaseLogger < ::Logger def initialize super(nil) @subscription = ActiveSupport::Notifications.subscribe("modify.kamal", self) end def start(name, id, payload) @started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) on_start(payload) end def finish(...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/output/otel_logger.rb
Ruby
mit
14,158
main
2,182
class Kamal::Output::OtelLogger < Kamal::Output::BaseLogger def self.build(settings:, config:) raise ArgumentError, "OTel endpoint is required" unless settings["endpoint"] new( endpoint: settings["endpoint"], tags: Kamal::Tags.from_config(config).except(:service_version, :recorded_at), servi...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/output/formatter.rb
Ruby
mit
14,158
main
983
class Kamal::Output::Formatter < SSHKit::Formatter::Pretty def initialize(output, logger) @logger = logger super(output) end def log_command_start(command) with_command_context(command) { super } end def log_command_data(command, stream_type, stream_data) with_command_context(command, iostre...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/utils/sensitive.rb
Ruby
mit
14,158
main
512
require "active_support/core_ext/module/delegation" require "sshkit" class Kamal::Utils::Sensitive # So SSHKit knows to redact these values. include SSHKit::Redaction attr_reader :unredacted, :redaction delegate :to_s, to: :unredacted delegate :inspect, to: :redaction def initialize(value, redaction: "[R...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/accessory.rb
Ruby
mit
14,158
main
3,071
class Kamal::Commands::Accessory < Kamal::Commands::Base include Proxy attr_reader :accessory_config delegate :service_name, :image, :hosts, :port, :files, :directories, :cmd, :network_args, :publish_args, :env_args, :volume_args, :label_args, :option_args, :secrets_io, :secrets_path, :env_...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/hook.rb
Ruby
mit
14,158
main
397
class Kamal::Commands::Hook < Kamal::Commands::Base def run(hook) [ hook_file(hook) ] end def env(secrets: false, **details) tags(**details).env.tap do |env| env.merge!(config.secrets.to_h) if secrets end end def hook_exists?(hook) Pathname.new(hook_file(hook)).exist? end private ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app.rb
Ruby
mit
14,158
main
3,540
class Kamal::Commands::App < Kamal::Commands::Base include Assets, Containers, ErrorPages, Execution, Images, Logging, Proxy ACTIVE_DOCKER_STATUSES = [ :running, :restarting ] attr_reader :role, :host delegate :container_name, to: :role def initialize(config, role: nil, host: nil) super(config) @r...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/lock.rb
Ruby
mit
14,158
main
1,402
require "active_support/duration" require "time" require "base64" class Kamal::Commands::Lock < Kamal::Commands::Base def acquire(message, version) combine \ [ :mkdir, lock_dir ], write_lock_details(message, version) end def release combine \ [ :rm, lock_details_file ], [ :rm, "-...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/auditor.rb
Ruby
mit
14,158
main
918
class Kamal::Commands::Auditor < Kamal::Commands::Base attr_reader :details delegate :escape_shell_value, to: Kamal::Utils def initialize(config, **details) super(config) @details = details end # Runs remotely def record(line, **details) combine \ make_run_directory, append([ :echo...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/docker.rb
Ruby
mit
14,158
main
1,156
class Kamal::Commands::Docker < Kamal::Commands::Base # Install Docker using the https://github.com/docker/docker-install convenience script. def install pipe get_docker, :sh end # Checks the Docker client version. Fails if Docker is not installed. def installed? docker "-v" end # Checks the Doc...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/proxy.rb
Ruby
mit
14,158
main
4,080
class Kamal::Commands::Proxy < Kamal::Commands::Base delegate :argumentize, :optionize, to: Kamal::Utils attr_reader :proxy_run_config def initialize(config, host:) super(config) @proxy_run_config = config.proxy_run(host) end def run if proxy_run_config docker \ :run, "--na...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/registry.rb
Ruby
mit
14,158
main
996
class Kamal::Commands::Registry < Kamal::Commands::Base def login(registry_config: nil) registry_config ||= config.registry return if registry_config.local? docker :login, registry_config.server, "-u", sensitive(Kamal::Utils.escape_shell_value(registry_config.username)), "-p", sensitiv...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/base.rb
Ruby
mit
14,158
main
3,504
module Kamal::Commands class Base delegate :sensitive, :argumentize, to: Kamal::Utils DOCKER_HEALTH_STATUS_FORMAT = "'{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}'" attr_accessor :config def initialize(config) @config = config end def run_over_ssh(*com...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder.rb
Ruby
mit
14,158
main
1,061
require "active_support/core_ext/string/filters" class Kamal::Commands::Builder < Kamal::Commands::Base delegate \ :create, :remove, :dev, :push, :clean, :pull, :info, :inspect_builder, :validate_image, :first_mirror, :login_to_registry_locally?, :push_env, to: :target delegate \ :local?, :remote?...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/prune.rb
Ruby
mit
14,158
main
1,389
require "active_support/duration" require "active_support/core_ext/numeric/time" class Kamal::Commands::Prune < Kamal::Commands::Base def dangling_images docker :image, :prune, "--force", "--filter", "label=service=#{config.service}" end def tagged_images pipe \ docker(:image, :ls, *service_filter...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/server.rb
Ruby
mit
14,158
main
309
class Kamal::Commands::Server < Kamal::Commands::Base def ensure_run_directory make_directory config.run_directory end def remove_app_directory remove_directory config.app_directory end def app_directory_count pipe \ [ :ls, config.apps_directory ], [ :wc, "-l" ] end end
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app/proxy.rb
Ruby
mit
14,158
main
799
module Kamal::Commands::App::Proxy delegate :container_name, to: :"config.proxy_boot", prefix: :proxy def deploy(target:) proxy_exec :deploy, role.container_prefix, *role.proxy.deploy_command_args(target: target) end def remove proxy_exec :remove, role.container_prefix end def live proxy_exec...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app/execution.rb
Ruby
mit
14,158
main
1,195
module Kamal::Commands::App::Execution def execute_in_existing_container(*command, interactive: false, env:) docker :exec, (docker_interactive_args if interactive), *argumentize("--env", env), container_name, *command end def execute_in_new_container(*command, interactive: false, deta...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app/logging.rb
Ruby
mit
14,158
main
999
module Kamal::Commands::App::Logging def logs(container_id: nil, timestamps: true, since: nil, lines: nil, grep: nil, grep_options: nil) pipe \ container_id_command(container_id), "xargs docker logs#{" --timestamps" if timestamps}#{" --since #{since}" if since}#{" --tail #{lines}" if lines} 2>&1", ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app/assets.rb
Ruby
mit
14,158
main
1,838
module Kamal::Commands::App::Assets def extract_assets asset_container = "#{role.container_prefix}-assets" combine \ make_directory(role.asset_extracted_directory), [ *docker(:container, :rm, asset_container, "2> /dev/null"), "|| true" ], docker(:container, :create, "--name", asset_containe...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app/containers.rb
Ruby
mit
14,158
main
845
module Kamal::Commands::App::Containers DOCKER_HEALTH_LOG_FORMAT = "'{{json .State.Health}}'" def list_containers docker :container, :ls, "--all", *container_filter_args end def list_container_names [ *list_containers, "--format", "'{{ .Names }}'" ] end def remove_container(version:) pipe ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app/images.rb
Ruby
mit
14,158
main
289
module Kamal::Commands::App::Images def list_images docker :image, :ls, config.repository end def remove_images docker :image, :prune, "--all", "--force", *image_filter_args end def tag_latest_image docker :tag, config.absolute_image, config.latest_image end end
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/app/error_pages.rb
Ruby
mit
14,158
main
336
module Kamal::Commands::App::ErrorPages def create_error_pages_directory make_directory(config.proxy_boot.error_pages_directory) end def clean_up_error_pages [ :find, config.proxy_boot.error_pages_directory, "-mindepth", "1", "-maxdepth", "1", "!", "-name", KAMAL.config.version, "-exec", "rm", "-rf", "{}...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder/clone.rb
Ruby
mit
14,158
main
879
module Kamal::Commands::Builder::Clone def clone git :clone, escaped_root, "--recurse-submodules", path: config.builder.clone_directory.shellescape end def clone_reset_steps [ git(:remote, "set-url", :origin, escaped_root, path: escaped_build_directory), git(:fetch, :origin, path: escaped_bui...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder/cloud.rb
Ruby
mit
14,158
main
485
class Kamal::Commands::Builder::Cloud < Kamal::Commands::Builder::Base # Expects `driver` to be of format "cloud docker-org-name/builder-name" def create docker :buildx, :create, "--driver", driver end def remove docker :buildx, :rm, builder_name end private def builder_name driver.gsub...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder/hybrid.rb
Ruby
mit
14,158
main
634
class Kamal::Commands::Builder::Hybrid < Kamal::Commands::Builder::Remote def create combine \ create_local_buildx, create_remote_context, append_remote_buildx end private def builder_name "kamal-hybrid-#{driver}-#{remote_builder_name_suffix}" end def create_local_buildx ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder/pack.rb
Ruby
mit
14,158
main
1,296
class Kamal::Commands::Builder::Pack < Kamal::Commands::Builder::Base def push(export_action = "registry", tag_as_dirty: false, no_cache: false) combine \ build(tag_as_dirty: tag_as_dirty, no_cache: no_cache), export(export_action) end def remove;end def info pack :builder, :inspect, pack_...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder/base.rb
Ruby
mit
14,158
main
3,543
class Kamal::Commands::Builder::Base < Kamal::Commands::Base class BuilderError < StandardError; end ENDPOINT_DOCKER_HOST_INSPECT = "'{{.Endpoints.docker.Host}}'" delegate :argumentize, to: Kamal::Utils delegate \ :args, :secrets, :dockerfile, :target, :arches, :local_arches, :remote_arches, :remote, ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder/remote.rb
Ruby
mit
14,158
main
1,677
class Kamal::Commands::Builder::Remote < Kamal::Commands::Builder::Base def create chain \ create_remote_context, create_buildx end def remove chain \ remove_remote_context, remove_buildx end def info chain \ docker(:context, :ls), docker(:buildx, :ls) end ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/builder/local.rb
Ruby
mit
14,158
main
461
class Kamal::Commands::Builder::Local < Kamal::Commands::Builder::Base def create return if docker_driver? docker :buildx, :create, "--name", builder_name, "--driver=#{driver}", *driver_options end def remove docker :buildx, :rm, builder_name unless docker_driver? end private def builder_na...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commands/accessory/proxy.rb
Ruby
mit
14,158
main
395
module Kamal::Commands::Accessory::Proxy delegate :container_name, to: :"config.proxy_boot", prefix: :proxy def deploy(target:) proxy_exec :deploy, service_name, *proxy.deploy_command_args(target: target) end def remove proxy_exec :remove, service_name end private def proxy_exec(*command) ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters.rb
Ruby
mit
14,158
main
579
require "active_support/core_ext/string/inflections" module Kamal::Secrets::Adapters def self.lookup(name) name = "one_password" if name.downcase == "1password" name = "last_pass" if name.downcase == "lastpass" name = "gcp_secret_manager" if name.downcase == "gcp" name = "bitwarden_secrets_manager" if...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/doppler.rb
Ruby
mit
14,158
main
1,538
class Kamal::Secrets::Adapters::Doppler < Kamal::Secrets::Adapters::Base def requires_account? false end private def login(*) unless loggedin? `doppler login -y` raise RuntimeError, "Failed to login to Doppler" unless $?.success? end end def loggedin? `doppler m...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/enpass.rb
Ruby
mit
14,158
main
2,401
## # Enpass is different from most password managers, in a way that it's offline and doesn't need an account. # # Usage # # Fetch all password from FooBar item # `kamal secrets fetch --adapter enpass --from /Users/YOUR_USERNAME/Library/Containers/in.sinew.Enpass-Desktop/Data/Documents/Vaults/primary FooBar` # # Fetch o...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/base.rb
Ruby
mit
14,158
main
728
class Kamal::Secrets::Adapters::Base delegate :optionize, to: Kamal::Utils def fetch(secrets, account: nil, from: nil) raise RuntimeError, "Missing required option '--account'" if requires_account? && account.blank? check_dependencies! session = login(account) fetch_secrets(secrets, from: from, a...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/test.rb
Ruby
mit
14,158
main
390
class Kamal::Secrets::Adapters::Test < Kamal::Secrets::Adapters::Base private def login(account) true end def fetch_secrets(secrets, from:, account:, session:) prefixed_secrets(secrets, from: from).to_h do |secret| [ secret, secret.gsub("LPAREN", "(").gsub("RPAREN", ")").reverse ] ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/aws_secrets_manager.rb
Ruby
mit
14,158
main
1,590
class Kamal::Secrets::Adapters::AwsSecretsManager < Kamal::Secrets::Adapters::Base def requires_account? false end private def login(_account) nil end def fetch_secrets(secrets, from:, account: nil, session:) {}.tap do |results| get_from_secrets_manager(prefixed_secrets(secre...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/last_pass.rb
Ruby
mit
14,158
main
1,199
class Kamal::Secrets::Adapters::LastPass < Kamal::Secrets::Adapters::Base private def login(account) unless loggedin?(account) `lpass login #{account.shellescape}` raise RuntimeError, "Failed to login to LastPass" unless $?.success? end end def loggedin?(account) `lpass ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/bitwarden.rb
Ruby
mit
14,158
main
2,808
class Kamal::Secrets::Adapters::Bitwarden < Kamal::Secrets::Adapters::Base private def login(account) status = run_command("status") if status["status"] == "unauthenticated" run_command("login #{account.shellescape}", raw: true) status = run_command("status") end if statu...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/one_password.rb
Ruby
mit
14,158
main
3,297
class Kamal::Secrets::Adapters::OnePassword < Kamal::Secrets::Adapters::Base delegate :optionize, to: Kamal::Utils private def login(account) unless loggedin?(account) `op signin #{to_options(account: account, force: true, raw: true)}`.tap do raise RuntimeError, "Failed to login to 1Pas...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/passbolt.rb
Ruby
mit
14,158
main
4,879
class Kamal::Secrets::Adapters::Passbolt < Kamal::Secrets::Adapters::Base def requires_account? false end private def login(*) `passbolt verify` raise RuntimeError, "Failed to login to Passbolt" unless $?.success? end def fetch_secrets(secrets, from:, **) secrets = prefixed_se...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/gcp_secret_manager.rb
Ruby
mit
14,158
main
4,420
class Kamal::Secrets::Adapters::GcpSecretManager < Kamal::Secrets::Adapters::Base private def login(account) # Since only the account option is passed from the cli, we'll use it for both account and service account # impersonation. # # Syntax: # ACCOUNT: USER | USER "|" DELEGATION_CH...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/adapters/bitwarden_secrets_manager.rb
Ruby
mit
14,158
main
2,223
class Kamal::Secrets::Adapters::BitwardenSecretsManager < Kamal::Secrets::Adapters::Base def requires_account? false end private LIST_ALL_SELECTOR = "all" LIST_ALL_FROM_PROJECT_SUFFIX = "/all" LIST_COMMAND = "secret list" GET_COMMAND = "secret get" def fetch_secrets(secrets, from:, accou...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/secrets/dotenv/inline_command_substitution.rb
Ruby
mit
14,158
main
1,694
class Kamal::Secrets::Dotenv::InlineCommandSubstitution # Unlike dotenv, this regex does not match escaped # parentheses when looking for command substitutions. INTERPOLATED_SHELL_COMMAND = / (?<backslash>\\)? # is it escaped with a backslash? \$ # literal $ (?<cmd> ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/build.rb
Ruby
mit
14,158
main
7,892
class Kamal::Cli::Build < Kamal::Cli::Base class BuildError < StandardError; end desc "deliver", "Build app and push app image to registry then pull image on servers" def deliver invoke :push invoke :pull end desc "push", "Build and push app image to registry" option :output, type: :string, defaul...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/accessory.rb
Ruby
mit
14,158
main
12,287
require "active_support/core_ext/array/conversions" require "concurrent/array" class Kamal::Cli::Accessory < Kamal::Cli::Base desc "boot [NAME]", "Boot new accessory service on host (use NAME=all to boot all accessories)" def boot(name, prepare: true) modify(lock: true) do if name == "all" KAMAL....
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/proxy.rb
Ruby
mit
14,158
main
12,355
class Kamal::Cli::Proxy < Kamal::Cli::Base desc "boot", "Boot proxy on servers" def boot modify(lock: true) do on(KAMAL.hosts) do |host| execute *KAMAL.docker.create_network rescue SSHKit::Command::Failed => e raise unless e.message.include?("already exists") end on(KAMA...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/main.rb
Ruby
mit
14,158
main
10,279
class Kamal::Cli::Main < Kamal::Cli::Base desc "setup", "Setup all accessories, push the env, and deploy app to servers" option :skip_push, aliases: "-P", type: :boolean, default: false, desc: "Skip image build and push" option :no_cache, type: :boolean, default: false, desc: "Build without using Docker's build c...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/app.rb
Ruby
mit
14,158
main
15,162
class Kamal::Cli::App < Kamal::Cli::Base desc "boot", "Boot app on servers (or reboot app if already running)" def boot modify(lock: true) do say "Get most recent version available as an image...", :magenta unless options[:version] using_version(version_or_latest) do |version| say "Start con...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/lock.rb
Ruby
mit
14,158
main
1,100
class Kamal::Cli::Lock < Kamal::Cli::Base desc "status", "Report lock status" def status handle_missing_lock do on(KAMAL.primary_host) do puts capture_with_debug(*KAMAL.lock.status) end end end desc "acquire", "Acquire the deploy lock" option :message, aliases: "-m", type: :string...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/prune.rb
Ruby
mit
14,158
main
998
class Kamal::Cli::Prune < Kamal::Cli::Base desc "all", "Prune unused images and stopped containers" def all modify(lock: true) do containers images end end desc "images", "Prune unused images" def images modify(lock: true) do on(KAMAL.hosts) do execute *KAMAL.auditor.rec...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/server.rb
Ruby
mit
14,158
main
2,111
class Kamal::Cli::Server < Kamal::Cli::Base desc "exec", "Run a custom command on the server (use --help to show options)" option :interactive, type: :boolean, aliases: "-i", default: false, desc: "Run the command interactively (use for console/bash)" def exec(*cmd) pre_connect_if_required cmd = Kamal::U...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/registry.rb
Ruby
mit
14,158
main
2,180
class Kamal::Cli::Registry < Kamal::Cli::Base desc "setup", "Setup local registry or log in to remote registry locally and remotely" option :skip_local, aliases: "-L", type: :boolean, default: false, desc: "Skip local login" option :skip_remote, aliases: "-R", type: :boolean, default: false, desc: "Skip remote lo...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/base.rb
Ruby
mit
14,158
main
7,536
require "thor" require "kamal/sshkit_with_ext" module Kamal::Cli class Base < Thor include SSHKit::DSL VERBOSITY = { verbose: :debug, quiet: :error }.freeze def self.exit_on_failure?() true end def self.dynamic_command_class() Kamal::Cli::Alias::Command end class_option :verbose, type: :boolea...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/secrets.rb
Ruby
mit
14,158
main
1,699
class Kamal::Cli::Secrets < Kamal::Cli::Base desc "fetch [SECRETS...]", "Fetch secrets from a vault" option :adapter, type: :string, aliases: "-a", required: true, desc: "Which vault adapter to use" option :account, type: :string, required: false, desc: "The account identifier or username" option :from, type: :...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/healthcheck/barrier.rb
Ruby
mit
14,158
main
479
require "concurrent/ivar" class Kamal::Cli::Healthcheck::Barrier def initialize @ivar = Concurrent::IVar.new end def close set(false) end def open set(true) end def wait unless opened? raise Kamal::Cli::Healthcheck::Error.new("Halted at barrier") end end private def ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/healthcheck/poller.rb
Ruby
mit
14,158
main
1,101
module Kamal::Cli::Healthcheck::Poller extend self def wait_for_healthy(&block) attempt = 1 timeout_at = Time.now + KAMAL.config.deploy_timeout readiness_delay = KAMAL.config.readiness_delay begin status = block.call if status == "running" # Wait for the readiness delay and co...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/app/error_pages.rb
Ruby
mit
14,158
main
933
class Kamal::Cli::App::ErrorPages ERROR_PAGES_GLOB = "{4??.html,5??.html}" attr_reader :host, :sshkit delegate :upload!, :execute, to: :sshkit def initialize(host, sshkit) @host = host @sshkit = sshkit end def run if KAMAL.config.error_pages_path with_error_pages_tmpdir do |local_error_...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/app/assets.rb
Ruby
mit
14,158
main
583
class Kamal::Cli::App::Assets attr_reader :host, :role, :sshkit delegate :execute, :capture_with_info, :info, to: :sshkit delegate :assets?, to: :role def initialize(host, role, sshkit) @host = host @role = role @sshkit = sshkit end def run if assets? execute *app.extract_assets ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/app/boot.rb
Ruby
mit
14,158
main
3,920
class Kamal::Cli::App::Boot attr_reader :host, :role, :version, :barrier, :sshkit delegate :execute, :capture_with_info, :capture_with_pretty_json, :info, :error, :upload!, to: :sshkit delegate :assets?, :running_proxy?, to: :role def initialize(host, role, sshkit, version, barrier) @host = host @role ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/app/ssl_certificates.rb
Ruby
mit
14,158
main
807
class Kamal::Cli::App::SslCertificates attr_reader :host, :role, :sshkit delegate :execute, :info, :upload!, to: :sshkit def initialize(host, role, sshkit) @host = host @role = role @sshkit = sshkit end def run if role.running_proxy? && role.proxy.custom_ssl_certificate? info "Writing ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/build/clone.rb
Ruby
mit
14,158
main
1,898
class Kamal::Cli::Build::Clone attr_reader :sshkit delegate :info, :error, :execute, :capture_with_info, to: :sshkit def initialize(sshkit) @sshkit = sshkit end def prepare begin clone_repo rescue SSHKit::Command::Failed => e if e.message =~ /already exists and is not an empty direct...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/build/port_forwarding.rb
Ruby
mit
14,158
main
1,610
require "concurrent/atomic/count_down_latch" class Kamal::Cli::Build::PortForwarding attr_reader :hosts, :port, :ssh_options def initialize(hosts, port, **ssh_options) @hosts = hosts @port = port @ssh_options = ssh_options end def forward @done = false forward_ports yield ensure ...
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/cli/alias/command.rb
Ruby
mit
14,158
main
259
class Kamal::Cli::Alias::Command < Thor::DynamicCommand def run(instance, args = []) if (command = KAMAL.resolve_alias(name)) KAMAL.reset Kamal::Cli::Main.start(Shellwords.split(command) + ARGV[1..-1]) else super end end end
github
basecamp/kamal
https://github.com/basecamp/kamal
lib/kamal/commander/specifics.rb
Ruby
mit
14,158
main
1,873
class Kamal::Commander::Specifics attr_reader :primary_host, :primary_role, :hosts, :roles delegate :stable_sort!, to: Kamal::Utils def initialize(config, specific_hosts, specific_roles) @config, @specific_hosts, @specific_roles = config, specific_hosts, specific_roles @roles, @hosts = specified_roles, ...