repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/sorbet/tapioca/require.rb | sorbet/tapioca/require.rb | # typed: true
# frozen_string_literal: true
require 'English'
require 'bundler/setup'
require 'byebug'
require 'cli/kit'
require 'cli/kit/version'
require 'cli/ui'
require 'cli/ui/version'
require 'fileutils'
require 'minitest/autorun'
require 'minitest/unit'
require 'mocha/minitest'
require 'open3'
require 'pathname'... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/lib/gen.rb | gen/lib/gen.rb | # typed: true
require 'cli/ui'
require 'cli/kit'
CLI::UI::StdoutRouter.enable
module Gen
TOOL_NAME = 'cli-kit'
CLI::Kit::CommandHelp.tool_name = TOOL_NAME
ROOT = File.expand_path('../../..', __FILE__)
TOOL_CONFIG_PATH = File.expand_path(File.join('~', '.config', TOOL_NAME))
LOG_FILE = File.join(TOOL_CONF... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/lib/gen/entry_point.rb | gen/lib/gen/entry_point.rb | # typed: true
require 'gen'
module Gen
module EntryPoint
class << self
#: (Array[String] args) -> void
def call(args)
cmd, command_name, args = Gen::Resolver.call(args)
Gen::Executor.call(cmd, command_name, args)
end
end
end
end
| ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/lib/gen/help.rb | gen/lib/gen/help.rb | # typed: true
require 'gen'
module Gen
module Help
class << self
#: (Array[String] path, ?to: IO) -> void
def generate(path, to: STDOUT)
case path.size
when 0
generate_toplevel(to: to)
when 1
generate_command_help(T.must(path.first), to: to)
else
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/lib/gen/commands.rb | gen/lib/gen/commands.rb | # typed: true
require 'gen'
module Gen
module Commands
Registry = CLI::Kit::CommandRegistry.new(default: 'help')
class << self
#: (Symbol const, String cmd, String path, ^-> singleton(Gen::Command) lamda_const) -> void
def register(const, cmd, path, lamda_const)
autoload(const, path)
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/lib/gen/generator.rb | gen/lib/gen/generator.rb | # typed: true
require 'gen'
require 'fileutils'
require 'open3'
require 'pathname'
require 'tmpdir'
module Gen
class Generator
class << self
#: (String project_name) -> void
def run(project_name)
new(project_name).run
end
end
TEMPLATE_ROOT = File.expand_path('gen/template', Ge... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/lib/gen/commands/new.rb | gen/lib/gen/commands/new.rb | # typed: true
require 'gen'
module Gen
module Commands
class New < Gen::Command
command_name('new')
desc('Create a new project')
long_desc(<<~LONGDESC)
This is currently a very simple command. In theory it could be extended
to support a number of flags like {{command:bundle gem... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/lib/gen/commands/help.rb | gen/lib/gen/commands/help.rb | # typed: true
require 'gen'
module Gen
module Commands
class Help < Gen::Command
desc('Show help for a command, or this page')
#: (Array[String] args, String _name) -> void
def call(args, _name)
Gen::Help.generate(args)
end
end
end
end
| ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/template/test/test_helper.rb | gen/template/test/test_helper.rb | begin
addpath = lambda do |p|
path = File.expand_path("../../#{p}", __FILE__)
$LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
end
addpath.call("lib")
end
require 'cli/kit'
require 'fileutils'
require 'tmpdir'
require 'tempfile'
require 'rubygems'
require 'bundler/setup'
CLI::UI::StdoutRouter... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/template/test/example_test.rb | gen/template/test/example_test.rb | require 'test_helper'
module __App__
class ExampleTest < Minitest::Test
include CLI::Kit::Support::TestHelper
def test_example
CLI::Kit::System.fake("ls -al", stdout: "a\nb", success: true)
out, = CLI::Kit::System.capture2('ls', '-al')
assert_equal %w(a b), out.split("\n")
errors =... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/template/lib/__app__.rb | gen/template/lib/__app__.rb | require 'cli/ui'
require 'cli/kit'
CLI::UI::StdoutRouter.enable
module __App__
TOOL_NAME = '__app__'
ROOT = File.expand_path('../..', __FILE__)
LOG_FILE = '/tmp/__app__.log'
autoload(:EntryPoint, '__app__/entry_point')
autoload(:Commands, '__app__/commands')
Config = CLI::Kit::Config.new(tool_na... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/template/lib/__app__/entry_point.rb | gen/template/lib/__app__/entry_point.rb | require '__app__'
module __App__
module EntryPoint
def self.call(args)
cmd, command_name, args = __App__::Resolver.call(args)
__App__::Executor.call(cmd, command_name, args)
end
end
end
| ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/template/lib/__app__/commands.rb | gen/template/lib/__app__/commands.rb | require '__app__'
module __App__
module Commands
Registry = CLI::Kit::CommandRegistry.new(default: 'help')
def self.register(const, cmd, path)
autoload(const, path)
Registry.add(->() { const_get(const) }, cmd)
end
register :Example, 'example', '__app__/commands/example'
register :He... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/template/lib/__app__/commands/help.rb | gen/template/lib/__app__/commands/help.rb | require '__app__'
module __App__
module Commands
class Help < __App__::Command
def call(args, _name)
puts CLI::UI.fmt("{{bold:Available commands}}")
puts ""
__App__::Commands::Registry.resolved_commands.each do |name, klass|
next if name == 'help'
puts CLI::UI.f... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/gen/template/lib/__app__/commands/example.rb | gen/template/lib/__app__/commands/example.rb | require '__app__'
module __App__
module Commands
class Example < __App__::Command
def call(_args, _name)
puts 'neato'
if rand < 0.05
raise(CLI::Kit::Abort, "you got unlucky!")
end
end
def self.help
"A dummy command.\nUsage: {{command:#{__App__::TOOL_N... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/test_helper.rb | test/test_helper.rb | addpath = lambda do |p|
path = File.expand_path("../../#{p}", __FILE__)
$LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
end
addpath.call('lib')
require 'cli/kit'
require 'fileutils'
require 'tmpdir'
require 'tempfile'
require 'rubygems'
require 'bundler/setup'
if ENV['CLI_UI_DEV']
addpath.call('../c... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/logger_test.rb | test/cli/kit/logger_test.rb | require 'test_helper'
module CLI
module Kit
class LoggerTest < Minitest::Test
def setup
super
@tmp_file = Tempfile.new('log').tap(&:close)
@logger = CLI::Kit::Logger.new(debug_log_file: @tmp_file.path)
end
def test_info
out, _ = capture_io do
@logger.i... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/command_registry_test.rb | test/cli/kit/command_registry_test.rb | require 'test_helper'
module CLI
module Kit
class CommandRegistryTest < Minitest::Test
attr_reader :reg, :ctx_reg
def setup
@reg = CommandRegistry.new(default: 'dflt')
@ctx_reg = CommandRegistry.new(default: 'dflt', contextual_resolver: MyContextualResolver)
end
module M... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/parse_args_test.rb | test/cli/kit/parse_args_test.rb | # typed: ignore
require('cli/kit')
require('test_helper')
module CLI
module Kit
class ParseArgsTest < Minitest::Test
# not a real command, just something to show the use of parse_args
class Command
include CLI::Kit::ParseArgs
OPTS = {
maybe: [false, 'on/off', '-m'],
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/error_handler_test.rb | test/cli/kit/error_handler_test.rb | require 'test_helper'
require 'tempfile'
module CLI
module Kit
class ErrorHandlerTest < Minitest::Test
class MockExceptionReporter < ErrorHandler::ExceptionReporter
class << self
def report(_exception, _logs = nil); end
end
end
def setup
@rep = MockExceptionRe... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/command_help_test.rb | test/cli/kit/command_help_test.rb | require 'test_helper'
module CLI
module Kit
class CommandHelpTest < Minitest::Test
def setup
CLI::Kit::CommandHelp.tool_name = 'test'
end
class ACommand < CLI::Kit::BaseCommand
command_name('a-command')
desc('do a thing')
long_desc(<<~LONGDESC)
This is... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/levenshtein_test.rb | test/cli/kit/levenshtein_test.rb | require 'test_helper'
module CLI
module Kit
class LevenshteinTest < Minitest::Test
# These tests were originally written by Jian Weihang (簡煒航) as part of his work
# on the jaro_winkler gem. The original code could be found here:
# https://github.com/tonytonyjan/jaro_winkler/blob/9bd12421/spec... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/resolver_test.rb | test/cli/kit/resolver_test.rb | require 'test_helper'
module CLI
module Kit
class ResolverTest < Minitest::Test
attr_reader :reg, :res
def setup
@reg = CommandRegistry.new(default: 'help')
@res = Resolver.new(tool_name: 'tool', command_registry: reg)
end
def test_resolver_match
reg.add(CLI::Kit... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/ini_test.rb | test/cli/kit/ini_test.rb | require 'test_helper'
module CLI
module Kit
class IniTest < Minitest::Test
def test_with_section_directives
helper = Ini.new(fixture_path('ini_with_heading.conf'))
assert_equal(
{ '[global]' => { 'key' => 'val', 'key2' => 'val2=' } },
helper.parse,
)
end
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/raise_test.rb | test/cli/kit/raise_test.rb | # typed: true
# frozen_string_literal: true
require('test_helper')
module CLI
module Kit
class RaiseTest < Minitest::Test
def test_simple_case
check(bug: true, silent: false, message: 'foo', klass: StandardError) do
CLI::Kit.raise(StandardError, 'foo')
end
end
def te... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/util_test.rb | test/cli/kit/util_test.rb | require 'test_helper'
module CLI
module Kit
class UtilTest < Minitest::Test
def test_to_filesize
assert_equal('0B', CLI::Kit::Util.to_filesize(0))
assert_equal('0 B', CLI::Kit::Util.to_filesize(0, space: true))
assert_equal('10B', CLI::Kit::Util.to_filesize(10 * 1024**0))
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/system_test.rb | test/cli/kit/system_test.rb | require 'test_helper'
module CLI
module Kit
include CLI::Kit::Support::TestHelper
class SystemTest < Minitest::Test
def test_split_partial_characters_doesnt_split_single_byte_characters
str = 'ルビー is cool'
assert_equal([str, ''], System.split_partial_characters(str))
end
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/opts_test.rb | test/cli/kit/opts_test.rb | require 'test_helper'
module CLI
module Kit
class OptsTest < Minitest::Test
class TestOpts < CLI::Kit::Opts
def force
flag(short: '-f', long: '--force', desc: 'Force')
end
def output
option!(short: '-o', long: '--output', default: 'text')
end
de... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/config_test.rb | test/cli/kit/config_test.rb | require 'test_helper'
module CLI
module Kit
class ConfigTest < Minitest::Test
include CLI::Kit::Support::TestHelper::FakeConfig
def setup
super
@file = File.join(@tmpdir, 'tool', 'config')
@config = Config.new(tool_name: 'tool')
end
def test_config_get_returns_fa... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/executor_test.rb | test/cli/kit/executor_test.rb | require 'test_helper'
require 'tempfile'
module CLI
module Kit
class ExecutorTest < Minitest::Test
attr_reader :exe
class Kill < CLI::Kit::BaseCommand
def call(args, _name)
Process.kill(args.first, Process.pid)
end
end
def setup
@tf = Tempfile.create('... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/support/test_helper_test.rb | test/cli/kit/support/test_helper_test.rb | require 'test_helper'
module CLI
module Kit
module Support
class TestHelperTest < Minitest::Test
include CLI::Kit::Support::TestHelper
def test_when_all_commands_not_run
CLI::Kit::System.fake('banana', success: true)
errors = assert_all_commands_run(should_raise: false... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/args/tokenizer_test.rb | test/cli/kit/args/tokenizer_test.rb | require 'test_helper'
module CLI
module Kit
module Args
class TokenizerTest < Minitest::Test
Token = Tokenizer::Token
def test_simple
check('-a', [Token::ShortOptionName.new('a')])
check('--b', [Token::LongOptionName.new('b')])
check('c', [Token::PositionalArg... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/args/parser_test.rb | test/cli/kit/args/parser_test.rb | require 'test_helper'
module CLI
module Kit
module Args
class ParserTest < Minitest::Test
Token = Tokenizer::Token
Node = Parser::Node
def setup
@defn = Args::Definition.new
@defn.add_flag(:f, short: '-f', long: '--force')
@defn.add_option(:zk, short: ... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/args/definition_test.rb | test/cli/kit/args/definition_test.rb | require 'test_helper'
module CLI
module Kit
module Args
class DefinitionTest < Minitest::Test
Flag = Definition::Flag
Option = Definition::Option
def test_simple
defn = Definition.new
defn.add_flag(:force, short: '-f')
assert_equal('f', defn.lookup_fla... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/test/cli/kit/args/evaluation_test.rb | test/cli/kit/args/evaluation_test.rb | require 'test_helper'
module CLI
module Kit
module Args
class EvaluationTest < Minitest::Test
Node = Parser::Node
def setup
@defn = Args::Definition.new
@defn.add_flag(:f, short: '-f', long: '--force')
@defn.add_option(:zk, short: '-z', long: '--zookeeper')
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/examples/single-file/example.rb | examples/single-file/example.rb | #!/usr/bin/env ruby
# typed: true
require 'cli/ui'
require 'cli/kit'
CLI::UI::StdoutRouter.enable
module Example
TOOL_NAME = 'example'
ROOT = File.expand_path('../..', __FILE__)
LOG_FILE = '/tmp/example.log'
module Commands
Registry = CLI::Kit::CommandRegistry.new(default: 'hello')
class << s... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/examples/minimal/example.rb | examples/minimal/example.rb | #!/usr/bin/env ruby
# typed: true
require 'cli/ui'
require 'cli/kit'
CLI::UI::StdoutRouter.enable
include(CLI::Kit)
registry = CommandRegistry.new(default: 'hello')
registry.add(
Class.new(BaseCommand) do
#: (Array[String], String) -> void
def call(_args, _name)
puts 'hello, world!'
end
end,
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit.rb | lib/cli/kit.rb | # typed: true
require 'cli/ui'
require 'cli/kit/core_ext'
module CLI
module Kit
autoload :Args, 'cli/kit/args'
autoload :BaseCommand, 'cli/kit/base_command'
autoload :CommandRegistry, 'cli/kit/command_registry'
autoload :CommandHelp, 'cli/kit/command_help'
autoload :Config, ... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/command_help.rb | lib/cli/kit/command_help.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module CommandHelp
include Kernel # for sorbet
#: (Array[String] args, String name) -> void
def call(args, name)
begin
opts = self.class.opts_class
opts_inst = opts.new
defn = Args::Definition.new
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/version.rb | lib/cli/kit/version.rb | # typed: true
module CLI
module Kit
VERSION = '5.2.0'
end
end
| ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/logger.rb | lib/cli/kit/logger.rb | # typed: true
require 'cli/kit'
require 'logger'
require 'fileutils'
module CLI
module Kit
class Logger
MAX_LOG_SIZE = 5 * 1024 * 1000 # 5MB
MAX_NUM_LOGS = 10
# Constructor for CLI::Kit::Logger
#
# @param debug_log_file [String] path to the file where debug logs should be stored
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/core_ext.rb | lib/cli/kit/core_ext.rb | # typed: strict
# frozen_string_literal: true
class Exception
# You'd think instance variables @bug and @silent would work here. They
# don't. I'm not sure why. If you, the reader, want to take some time to
# figure it out, go ahead and refactor to that.
#: -> bool
def bug?
true
end
#: -> bool
de... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/base_command.rb | lib/cli/kit/base_command.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
# @abstract
class BaseCommand
include CLI::Kit::CommandHelp
extend CLI::Kit::CommandHelp::ClassMethods
class << self
#: -> bool
def defined?
true
end
#: (Array[String] args, String command_nam... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/ini.rb | lib/cli/kit/ini.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
# INI is a language similar to JSON or YAML, but simplied
# The spec is here: https://en.wikipedia.org/wiki/INI_file
# This parser includes supports for 2 very basic uses
# - Sections
# - Key Value Pairs (within and outside of the sections)
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/opts.rb | lib/cli/kit/opts.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
class Opts
module Mixin
include Kernel
module MixinClassMethods
#: (Module included_module) -> void
def include(included_module)
super
return unless included_module.is_a?(MixinClassMethods)
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/levenshtein.rb | lib/cli/kit/levenshtein.rb | # typed: true
# Copyright (c) 2014-2016 Yuki Nishijima
# MIT License
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, ... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/error_handler.rb | lib/cli/kit/error_handler.rb | # typed: true
require 'cli/kit'
require 'English'
module CLI
module Kit
class ErrorHandler
#: type exception_reporter_or_proc = singleton(ExceptionReporter) | ^() -> singleton(ExceptionReporter)
#: ^(Exception arg0) -> Integer
attr_writer :override_exception_handler
#: (?log_file: Stri... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/resolver.rb | lib/cli/kit/resolver.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
class Resolver
#: (tool_name: String, command_registry: CLI::Kit::CommandRegistry) -> void
def initialize(tool_name:, command_registry:)
@tool_name = tool_name
@command_registry = command_registry
end
#: (Array[String... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/parse_args.rb | lib/cli/kit/parse_args.rb | # typed: true
module CLI
module Kit
module ParseArgs
# because sorbet type-checking takes the pedantic route that module doesn't include Kernel, therefore
# this is necessary (even tho it's ~probably fine~)
include Kernel
# untyped is used in two places. The interpretation of dynamic val... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/command_registry.rb | lib/cli/kit/command_registry.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
class CommandRegistry
#: type command_or_proc = singleton(CLI::Kit::BaseCommand) | ^() -> singleton(CLI::Kit::BaseCommand)
#: Hash[String, command_or_proc]
attr_reader :commands
#: Hash[String, String]
attr_reader :aliases
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/config.rb | lib/cli/kit/config.rb | # typed: true
require 'cli/kit'
require 'fileutils'
module CLI
module Kit
class Config
XDG_CONFIG_HOME = 'XDG_CONFIG_HOME'
#: (tool_name: String) -> void
def initialize(tool_name:)
@tool_name = tool_name
end
# Returns the config corresponding to `name` from the config fil... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/args.rb | lib/cli/kit/args.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Args
Error = Class.new(StandardError)
autoload :Definition, 'cli/kit/args/definition'
autoload :Parser, 'cli/kit/args/parser'
autoload :Evaluation, 'cli/kit/args/evaluation'
autoload :Tokenizer, 'cli/kit/args/tokenizer'
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/system.rb | lib/cli/kit/system.rb | # typed: true
require 'cli/kit'
require 'open3'
require 'English'
module CLI
module Kit
module System
SUDO_PROMPT = CLI::UI.fmt('{{info:(sudo)}} Password: ')
class << self
# Ask for sudo access with a message explaning the need for it
# Will make subsequent commands capable of runnin... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/executor.rb | lib/cli/kit/executor.rb | # typed: true
require 'cli/kit'
require 'English'
require 'fileutils'
module CLI
module Kit
class Executor
#: (log_file: String) -> void
def initialize(log_file:)
FileUtils.mkpath(File.dirname(log_file))
@log_file = log_file
end
#: (singleton(CLI::Kit::BaseCommand) comma... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/util.rb | lib/cli/kit/util.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Util
class << self
#
# Converts an integer representing bytes into a human readable format
#
#: (Integer bytes, ?precision: Integer, ?space: bool) -> String
def to_filesize(bytes, precision: 2, space: fals... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/support.rb | lib/cli/kit/support.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Support
autoload :TestHelper, 'cli/kit/support/test_helper'
end
end
end
| ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/support/test_helper.rb | lib/cli/kit/support/test_helper.rb | require 'cli/kit'
module CLI
module Kit
module Support
module TestHelper
def setup
super
CLI::Kit::System.reset!
end
def assert_all_commands_run(should_raise: true)
errors = CLI::Kit::System.error_message
CLI::Kit::System.reset!
# t... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/args/tokenizer.rb | lib/cli/kit/args/tokenizer.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Args
module Tokenizer
Error = Class.new(Args::Error)
class InvalidShortOption < Error
#: (String short_option) -> void
def initialize(short_option)
super("invalid short option: '-#{short_option}'"... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/args/parser.rb | lib/cli/kit/args/parser.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Args
class Parser
autoload :Node, 'cli/kit/args/parser/node'
Error = Class.new(Args::Error)
class InvalidOptionError < Error
#: (String option) -> void
def initialize(option)
super("inval... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/args/definition.rb | lib/cli/kit/args/definition.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Args
class Definition
Error = Class.new(Args::Error)
ConflictingFlag = Class.new(Error)
InvalidFlag = Class.new(Error)
InvalidLookup = Class.new(Error)
InvalidPosition = Class.new(Error)
#: Array[... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/args/evaluation.rb | lib/cli/kit/args/evaluation.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Args
class Evaluation
Error = Class.new(Args::Error)
class MissingRequiredOption < Error
#: (String name) -> void
def initialize(name)
super("missing required option `#{name}'")
end
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
Shopify/cli-kit | https://github.com/Shopify/cli-kit/blob/89fade7f638b5243f328ba207a12c75b312e869c/lib/cli/kit/args/parser/node.rb | lib/cli/kit/args/parser/node.rb | # typed: true
require 'cli/kit'
module CLI
module Kit
module Args
class Parser
class Node
#: -> void
def initialize
end
#: (untyped other) -> bool
def ==(other)
self.class == other.class
end
class Option < Node
... | ruby | MIT | 89fade7f638b5243f328ba207a12c75b312e869c | 2026-01-04T17:32:08.033266Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/passthrough_flags_spec.rb | spec/passthrough_flags_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'yaml'
describe 'flag_generation_tests' do
k8s_args = {
'k8s-args' => {
'hash': {
'key1' => 'value1',
'key2' => 'value2'
},
'array' => [ 'value1', 'value2' ],
'true' => true,
'false' => fal... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/kubelet_ctl_spec.rb | spec/kubelet_ctl_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'fileutils'
require 'open3'
def get_node_labels(rendered_kubelet_ctl)
node_labels = rendered_kubelet_ctl.split("\n").select { |line| line[/--node-labels=/i] }
expect(node_labels.length).to be(1)
labels = node_labels[0].match(/--node-lab... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/service_keys_spec.rb | spec/service_keys_spec.rb | # frozen_string_literal: true
require 'rspec'
describe 'service key' do
let(:valid_json) { { 'valid-json' => true }.to_json }
let(:link_spec) do
{
'cloud-provider' => {
'instances' => [],
'properties' => {
'cloud-provider' => {
'gce' => {
'service_key'... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/kubernetes_roles_post_start_spec.rb | spec/kubernetes_roles_post_start_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'yaml'
describe 'Kubernetes Post Start Custom Specs' do
let(:manifest_properties) do
{
'post-start-custom-specs' => [
{
'name' => 'psp1',
'value' => %q{
---
apiVersion: "no"
kind: nope
---
apiVersion: ... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/kubo_dns_aliases_spec.rb | spec/kubo_dns_aliases_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
describe 'kubo-dns-aliases' do
let(:link_spec) do
{
'kube-apiserver' => {
'address' => 'fake.kube-api-address',
'instances' => []
},
'etcd' => {
'address' => 'fake-etcd-address',
'properties' =>... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/openstack_ca_file_spec.rb | spec/openstack_ca_file_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
describe 'openstack ca-file' do
let(:valid_cert) { 'certificate' }
let(:link_spec) do
{
'cloud-provider' => {
'instances' => [],
'properties' => {
'cloud-provider' => {
'openstack' => {
... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/kube_controller_manager_bpm_yml_spec.rb | spec/kube_controller_manager_bpm_yml_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'yaml'
describe 'kube_controller_manager' do
context 'horizontal pod autoscaling' do
it 'sets the properties' do
rendered_kube_controller_manager_bpm_yml = compiled_template(
'kube-controller-manager',
'config/bpm.... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/kube_proxy_ctl_spec.rb | spec/kube_proxy_ctl_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'fileutils'
require 'open3'
def run_get_hostname_override(rendered_contents, executable_path)
File.open(executable_path, 'w', 0o777) do |f|
f.write(rendered_contents)
end
# exercise bash function by first changing path for any nece... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/apply_specs_spec.rb | spec/apply_specs_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'yaml'
describe 'apply-specs' do
let(:links) do
{
'kube-apiserver' => {
'instances' => [],
'properties' => {
'admin-username' => 'meatloaf',
'admin-password' => 'madagascar-TEST',
'por... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/kubelet_drain_spec.rb | spec/kubelet_drain_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
def get_k8s_disks_dir(rendered_drain)
lsblk_line = rendered_drain.split("\n").select { |line| line[/MOUNTPOINT/i] }
expect(lsblk_line.length).to be(1)
lsblk_line[0].match(/awk '\/(.+)\/ {print \$1}'/).captures[0]
end
describe 'kubelet drain' d... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/kube_apiserver_bpm_yml_spec.rb | spec/kube_apiserver_bpm_yml_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'yaml'
describe 'kube-apiserver' do
let(:link_spec) do
{
'kube-apiserver' => {
'address' => 'fake.kube-api-address',
'instances' => [],
'properties' => {}
},
'etcd' => {
'address' => 'fa... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/cloud_provider_ini_spec.rb | spec/cloud_provider_ini_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
describe 'cloud-provider-ini' do
let(:link_spec) do
{
'cloud-provider' => {
'instances' => [
{
'az' => 'z1'
}
],
'properties' => properties
}
}
end
let(:rendered_templa... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'support/template_helpers'
RSpec.configure do |config|
config.include TemplateHelpers
end
| ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
cloudfoundry-incubator/kubo-release | https://github.com/cloudfoundry-incubator/kubo-release/blob/5b821bc959d9c3e0210269217ce848f088ba4573/spec/support/template_helpers.rb | spec/support/template_helpers.rb | # frozen_string_literal: true
require 'bosh/template/renderer'
require 'yaml'
module TemplateHelpers
include Bosh::Template::PropertyHelper
def compiled_template(job_name, template_name, manifest_properties = {}, links = {}, network_properties = [], az = '', ip = '', id = '', instance_name: '')
manifest = em... | ruby | Apache-2.0 | 5b821bc959d9c3e0210269217ce848f088ba4573 | 2026-01-04T17:30:37.708988Z | false |
akerl/githubchart | https://github.com/akerl/githubchart/blob/2e3db95ba5c4d558fa4e3eae879bdd103167c0e0/spec/githubchart_spec.rb | spec/githubchart_spec.rb | require 'spec_helper'
describe GithubChart do
describe '#new' do
it 'creates a new Chart object' do
expect(GithubChart.new(data: [])).to be_an_instance_of GithubChart::Chart
end
end
describe '#supported' do
it 'lists supported types' do
expect(GithubChart.supported).to include(:svg)
... | ruby | MIT | 2e3db95ba5c4d558fa4e3eae879bdd103167c0e0 | 2026-01-04T17:31:19.991330Z | false |
akerl/githubchart | https://github.com/akerl/githubchart/blob/2e3db95ba5c4d558fa4e3eae879bdd103167c0e0/spec/spec_helper.rb | spec/spec_helper.rb | require 'rspec'
require 'githubchart'
| ruby | MIT | 2e3db95ba5c4d558fa4e3eae879bdd103167c0e0 | 2026-01-04T17:31:19.991330Z | false |
akerl/githubchart | https://github.com/akerl/githubchart/blob/2e3db95ba5c4d558fa4e3eae879bdd103167c0e0/spec/githubchart/svg_spec.rb | spec/githubchart/svg_spec.rb | require 'spec_helper'
require 'tempfile'
def test_svg(type)
file = Tempfile.new('svg')
file.write(GithubChart.new(user: 'akerl').render(type))
path = file.path
file.close
res = `file #{path}`
file.unlink
res
end
describe GithubChart::Chart do
describe '#render_svg' do
it 'makes an SVG' do
ex... | ruby | MIT | 2e3db95ba5c4d558fa4e3eae879bdd103167c0e0 | 2026-01-04T17:31:19.991330Z | false |
akerl/githubchart | https://github.com/akerl/githubchart/blob/2e3db95ba5c4d558fa4e3eae879bdd103167c0e0/lib/githubchart.rb | lib/githubchart.rb | require 'githubstats'
require 'matrix'
##
# Graphing tool for creating Github-style contribution charts
module GithubChart
class << self
##
# Helper to create new charts
def new(*args)
self::Chart.new(*args)
end
##
# Helper to list supported types
def supported
@supported |... | ruby | MIT | 2e3db95ba5c4d558fa4e3eae879bdd103167c0e0 | 2026-01-04T17:31:19.991330Z | false |
akerl/githubchart | https://github.com/akerl/githubchart/blob/2e3db95ba5c4d558fa4e3eae879bdd103167c0e0/lib/githubchart/version.rb | lib/githubchart/version.rb | ##
# Define the version
module GithubChart
VERSION = '4.0.0'.freeze
end
| ruby | MIT | 2e3db95ba5c4d558fa4e3eae879bdd103167c0e0 | 2026-01-04T17:31:19.991330Z | false |
akerl/githubchart | https://github.com/akerl/githubchart/blob/2e3db95ba5c4d558fa4e3eae879bdd103167c0e0/lib/githubchart/svg.rb | lib/githubchart/svg.rb | require 'svgplot'
##
# Add SVG support to GithubChart
module GithubChart
##
# Declare SVG support
add_support(:svg)
add_support(:svg_square)
##
# Convert stats into SVG
class Chart
CUBE_SIZE = 12
X_PAD = 27
Y_PAD = 20
##
# Define shared label style
SVG_SHARED_STYLE = {
f... | ruby | MIT | 2e3db95ba5c4d558fa4e3eae879bdd103167c0e0 | 2026-01-04T17:31:19.991330Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/test/active_support_ext_test.rb | test/active_support_ext_test.rb | # frozen_string_literal: true
require "test_helper"
require "autoload_reloader/active_support_ext"
module AutoloadReloader
class ActiveSupportExtTest < Minitest::Test
def setup
@tmpdir = Dir.mktmpdir
@top_level_constants = Object.constants
@old_loaded_features = $LOADED_FEATURES.dup
end
... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/test/version_test.rb | test/version_test.rb | # frozen_string_literal: true
require "test_helper"
module AutoloadReloader
class VersionTest < Minitest::Test
def test_version
assert_equal ::AutoloadReloader::VERSION, Gem::Version.new(::AutoloadReloader::VERSION).to_s
end
end
end
| ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "autoload_reloader"
require "tempfile"
if RUBY_ENGINE == 'ruby'
require "byebug"
end
require "minitest/autorun"
| ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/test/autoload_reloader_test.rb | test/autoload_reloader_test.rb | # frozen_string_literal: true
require "test_helper"
class AutoloadReloaderTest < Minitest::Test
def setup
@tmpdir = Dir.mktmpdir
@top_level_constants = Object.constants
AutoloadReloader.inflector # force autoload so loaded features don't change
@old_loaded_features = $LOADED_FEATURES.dup
end
def... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader.rb | lib/autoload_reloader.rb | # frozen_string_literal: true
require "autoload_reloader/version"
require "autoload_reloader/ruby_backports"
require "autoload_reloader/constant_reference"
require "autoload_reloader/autoloads"
require "autoload_reloader/unloaded_namespaces"
require "autoload_reloader/loaded"
require "autoload_reloader/paths"
require ... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/basic_inflector.rb | lib/autoload_reloader/basic_inflector.rb | # frozen_string_literal: true
module AutoloadReloader
module BasicInflector
def self.camelize(underscore_name)
underscore_name.split('_').map(&:capitalize).join
end
end
end
| ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/active_support_ext.rb | lib/autoload_reloader/active_support_ext.rb | # frozen_string_literal: true
require 'active_support/inflector'
require 'active_support/dependencies'
require 'autoload_reloader'
module AutoloadReloader
module PathsSync
AutoloadReloader.private_constant :PathsSync
class << self
attr_reader :autoload_paths
def extended(autoload_paths)
... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/version.rb | lib/autoload_reloader/version.rb | module AutoloadReloader
VERSION = "0.1.0"
end
| ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/ruby_backports.rb | lib/autoload_reloader/ruby_backports.rb | # frozen_string_literal: true
module AutoloadReloader
module RubyBackports
AutoloadReloader.private_constant :RubyBackports
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.5')
PARENT_AND_CURRENT_DIR = ['.', '..']
refine Dir.singleton_class do
def each_child(dirname)
Di... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/constant_reference.rb | lib/autoload_reloader/constant_reference.rb | # frozen_string_literal: true
module AutoloadReloader
ConstantReference = Struct.new(:parent, :name, :full_const_name, :filename, :path_root) do
def directory?
!filename.end_with?('.rb')
end
end
private_constant :ConstantReference
end
| ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/unloaded_namespaces.rb | lib/autoload_reloader/unloaded_namespaces.rb | # frozen_string_literal: true
module AutoloadReloader
using RubyBackports
module UnloadedNamespaces
AutoloadReloader.private_constant :UnloadedNamespaces
class << self
attr_accessor :nested_autoloads
end
self.nested_autoloads = {}
def self.loaded(mod, mod_name: mod.name)
return u... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/paths.rb | lib/autoload_reloader/paths.rb | # frozen_string_literal: true
module AutoloadReloader
module Paths
def self.concat(paths)
add(paths, prepend: false)
end
def self.push(*paths)
concat(paths)
end
def self.<<(path)
push(path)
end
def self.unshift(*paths)
add(paths, prepend: true)
end
def ... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/autoloads.rb | lib/autoload_reloader/autoloads.rb | # frozen_string_literal: true
module AutoloadReloader
using RubyBackports
module Autoloads
AutoloadReloader.private_constant :Autoloads
CONST_NAME_REGEX = /\A[A-Z][\w_]*\z/
class << self
attr_accessor :const_ref_by_filename
end
self.const_ref_by_filename = {}
def self.add_from_pat... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/loaded.rb | lib/autoload_reloader/loaded.rb | # frozen_string_literal: true
module AutoloadReloader
module Loaded
AutoloadReloader.private_constant :Loaded
class << self
attr_accessor :reloadable
end
self.reloadable = []
def self.add_reloadable(constant_reference)
reloadable << constant_reference
end
def self.unload_al... | ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
Shopify/autoload_reloader | https://github.com/Shopify/autoload_reloader/blob/6b4778ce852202a277db939a0983d6ccd7c8236b/lib/autoload_reloader/core_ext/kernel_require.rb | lib/autoload_reloader/core_ext/kernel_require.rb | module AutoloadReloader # to access it's private constants
module ::Kernel
module_function
alias_method :require_without_autoload_reloader, :require
def require(path)
Autoloads.around_require(path) do
require_without_autoload_reloader(path)
end
end
end
end
| ruby | MIT | 6b4778ce852202a277db939a0983d6ccd7c8236b | 2026-01-04T17:32:13.079459Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/spec/sidekiq_spec.rb | spec/sidekiq_spec.rb | # frozen_string_literal: true
class TestCutoffWorker
include Sidekiq::Worker
sidekiq_options cutoff: 3
def perform(wait)
Timecop.freeze(wait)
Cutoff.checkpoint!
end
end
class TestPlainWorker
include Sidekiq::Worker
def perform(wait)
Timecop.freeze(wait)
Cutoff.checkpoint!
end
end
RSp... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/spec/cutoff_spec.rb | spec/cutoff_spec.rb | # frozen_string_literal:true
RSpec.describe Cutoff do
it 'records allowed_seconds as a float' do
expect(described_class.new(3.5).allowed_seconds).to eq(3.5)
end
it 'reports #elapsed_seconds as time since initialized' do
Timecop.freeze
cutoff = described_class.new(1)
Timecop.freeze(1)
expect(... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
ENV['RAILS_ENV'] = 'test'
require 'byebug' if Gem.loaded_specs['byebug']
if Gem.loaded_specs['simplecov'] && (ENV.fetch('COVERAGE', nil) || ENV.fetch('CI', nil))
require 'simplecov'
if ENV['CI']
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::Cobert... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.