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 |
|---|---|---|---|---|---|---|---|---|
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/regular_allocator.rb | lib/knapsack_pro/regular_allocator.rb | # frozen_string_literal: true
module KnapsackPro
class RegularAllocator
class Split
def initialize(connection, response)
@connection = connection
@response = response
raise ArgumentError.new(connection.response) if connection.errors?
end
def exists?
raise "Conn... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/slow_test_file_determiner.rb | lib/knapsack_pro/slow_test_file_determiner.rb | # frozen_string_literal: true
module KnapsackPro
class SlowTestFileDeterminer
TIME_THRESHOLD_PER_CI_NODE = 0.7 # 70%
# test_files: { 'path' => 'a_spec.rb', 'time_execution' => 0.0 }
def self.call(test_files)
total_execution_time = test_files.sum { |test_file| test_file.fetch('time_execution') }
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/queue.rb | lib/knapsack_pro/queue.rb | # frozen_string_literal: true
module KnapsackPro
class Queue
include Enumerable
def initialize
@batches = []
end
def each(&block)
@batches.each(&block)
end
def add_batch_for(test_file_paths)
return if test_file_paths.empty?
@batches << KnapsackPro::Batch.new(test_fi... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/railtie.rb | lib/knapsack_pro/railtie.rb | # frozen_string_literal: true
require 'rails'
require 'knapsack_pro'
module KnapsackPro
class Railtie < Rails::Railtie
rake_tasks do
KnapsackPro.load_tasks
end
end
end
| ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/mask_string.rb | lib/knapsack_pro/mask_string.rb | # frozen_string_literal: true
module KnapsackPro
class MaskString
def self.call(string)
string.gsub(/(?<=\w{2})[a-zA-Z]/, "*")
end
end
end
| ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_file_pattern.rb | lib/knapsack_pro/test_file_pattern.rb | # frozen_string_literal: true
module KnapsackPro
class TestFilePattern
def self.call(adapter_class)
KnapsackPro::Config::Env.test_file_pattern || adapter_class::TEST_DIR_PATTERN
end
def self.test_dir(adapter_class)
test_file_pattern = call(adapter_class)
test_file_pattern.split('/').fi... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_file_finder.rb | lib/knapsack_pro/test_file_finder.rb | # frozen_string_literal: true
module KnapsackPro
class TestFileFinder
def self.call(test_file_pattern, test_file_list_enabled: true)
new(test_file_pattern, test_file_list_enabled).call
end
# finds slow test files on disk based on ENV patterns
# returns example: [{ 'path' => 'a_spec.rb' }]
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/repository_adapter_initiator.rb | lib/knapsack_pro/repository_adapter_initiator.rb | # frozen_string_literal: true
module KnapsackPro
class RepositoryAdapterInitiator
def self.call
case KnapsackPro::Config::Env.repository_adapter
when 'git'
KnapsackPro::RepositoryAdapters::GitAdapter.new
else
KnapsackPro::RepositoryAdapters::EnvAdapter.new
end
end
en... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_suite.rb | lib/knapsack_pro/test_suite.rb | # frozen_string_literal: true
module KnapsackPro
class TestSuite
Result = Struct.new(:test_files, :quick?)
def initialize(adapter_class)
@adapter_class = adapter_class
end
# Detect test files present on the disk that should be run.
# This may include fast test files + slow test files spli... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_file_cleaner.rb | lib/knapsack_pro/test_file_cleaner.rb | # frozen_string_literal: true
module KnapsackPro
class TestFileCleaner
def self.clean(test_file_path)
test_file_path.sub(/^\.\//, '')
end
end
end
| ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_files_with_test_cases_composer.rb | lib/knapsack_pro/test_files_with_test_cases_composer.rb | # frozen_string_literal: true
module KnapsackPro
class TestFilesWithTestCasesComposer
# Args:
# All 3 arguments have structure: [{ 'path' => 'spec/a_spec.rb', 'time_execution' => 0.0 }]
# time_execution is not always present (but it's not relevant here)
#
# test_files - list of test files t... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/urls.rb | lib/knapsack_pro/urls.rb | # frozen_string_literal: true
module KnapsackPro
module Urls
HOST = 'https://knapsackpro.com'
SUPPORT = "#{HOST}/perma/ruby/support"
DASHBOARD__ZEROISH_TEST_EXECUTION_TIMES = "#{HOST}/perma/ruby/dashboard-zeroish-test-execution-times"
ENCRYPTION = "#{HOST}/perma/ruby/encryption"
FALLBACK_MODE... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/build_distribution_fetcher.rb | lib/knapsack_pro/build_distribution_fetcher.rb | # frozen_string_literal: true
module KnapsackPro
class BuildDistributionFetcher
class BuildDistributionEntity
def initialize(response)
@response = response
end
def time_execution
response.fetch('time_execution')
end
def test_files
response.fetch('test_files... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_case_mergers/rspec_merger.rb | lib/knapsack_pro/test_case_mergers/rspec_merger.rb | # frozen_string_literal: true
module KnapsackPro
module TestCaseMergers
class RSpecMerger < BaseMerger
def call
all_test_files_hash = {}
merged_test_file_examples_hash = {}
test_files.each do |test_file|
path = test_file.fetch('path')
test_file_path = extract_te... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_case_mergers/base_merger.rb | lib/knapsack_pro/test_case_mergers/base_merger.rb | # frozen_string_literal: true
module KnapsackPro
module TestCaseMergers
class BaseMerger
# values must be string to avoid circular dependency problem during loading files
ADAPTER_TO_MERGER_MAP = {
KnapsackPro::Adapters::RSpecAdapter => 'KnapsackPro::TestCaseMergers::RSpecMerger',
}
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/repository_adapters/git_adapter.rb | lib/knapsack_pro/repository_adapters/git_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module RepositoryAdapters
class GitAdapter < BaseAdapter
def commit_hash
`git -C "#{working_dir}" rev-parse HEAD`.strip
end
def branch
`git -C "#{working_dir}" rev-parse --abbrev-ref HEAD`.strip
end
def branches
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/repository_adapters/base_adapter.rb | lib/knapsack_pro/repository_adapters/base_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module RepositoryAdapters
class BaseAdapter
def commit_hash
raise NotImplementedError
end
def branch
raise NotImplementedError
end
def branches
raise NotImplementedError
end
end
end
end
| ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/repository_adapters/env_adapter.rb | lib/knapsack_pro/repository_adapters/env_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module RepositoryAdapters
class EnvAdapter < BaseAdapter
def commit_hash
KnapsackPro::Config::Env.commit_hash
end
def branch
KnapsackPro::Config::Env.branch
end
end
end
end
| ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/extensions/rspec_extension.rb | lib/knapsack_pro/extensions/rspec_extension.rb | # frozen_string_literal: true
module KnapsackPro
module Extensions
# Facade to abstract calls to internal RSpec methods.
# To allow comparing the monkey patch with the original RSpec code, keep a similar method structure and permalink to the source.
module RSpecExtension
Seed = Struct.new(:value, :... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/pure/queue/rspec_pure.rb | lib/knapsack_pro/pure/queue/rspec_pure.rb | # frozen_string_literal: true
module KnapsackPro
module Pure
module Queue
class RSpecPure
FAILURE_EXIT_CODE = 1
FORMATTERS = [
'KnapsackPro::Formatters::TimeTracker',
]
def add_knapsack_pro_formatters_to(spec_opts)
return spec_opts unless spec_opts
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/hooks/queue.rb | lib/knapsack_pro/hooks/queue.rb | # frozen_string_literal: true
module KnapsackPro
module Hooks
class Queue
class << self
attr_reader :before_queue_store,
:before_subset_queue_store,
:after_subset_queue_store,
:after_queue_store
def reset_before_queue
@before_queue_store = nil
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb | lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb | # frozen_string_literal: true
module KnapsackPro
module TestCaseDetectors
class RSpecTestExampleDetector
def generate_json_report(rspec_args)
raise "The internal KNAPSACK_PRO_RSPEC_OPTIONS environment variable is unset. Ensure it is not overridden accidentally. Otherwise, please report this as a bu... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/cucumber_runner.rb | lib/knapsack_pro/runners/cucumber_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
class CucumberRunner < BaseRunner
def self.run(args)
ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_cucumber
ENV['KNAPSACK_PRO_REGULAR_MODE_ENABLED'] = 'true'
adapter_class = KnapsackP... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/rspec_runner.rb | lib/knapsack_pro/runners/rspec_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
class RSpecRunner < BaseRunner
def self.run(args)
require 'rspec/core'
ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_rspec
ENV['KNAPSACK_PRO_REGULAR_MODE_ENABLED'] = 'true'
EN... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/base_runner.rb | lib/knapsack_pro/runners/base_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
class BaseRunner
def self.run(args)
raise NotImplementedError
end
def initialize(adapter_class)
@allocator_builder = KnapsackPro::RegularAllocatorBuilder.new(adapter_class)
@allocator = allocator_builder.al... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/spinach_runner.rb | lib/knapsack_pro/runners/spinach_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
class SpinachRunner < BaseRunner
def self.run(args)
ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_spinach
adapter_class = KnapsackPro::Adapters::SpinachAdapter
KnapsackPro::Config::En... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/test_unit_runner.rb | lib/knapsack_pro/runners/test_unit_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
class TestUnitRunner < BaseRunner
def self.run(args)
ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_test_unit
ENV['KNAPSACK_PRO_REGULAR_MODE_ENABLED'] = 'true'
adapter_class = Knapsack... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/minitest_runner.rb | lib/knapsack_pro/runners/minitest_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
class MinitestRunner < BaseRunner
def self.run(args)
ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_minitest
ENV['KNAPSACK_PRO_REGULAR_MODE_ENABLED'] = 'true'
adapter_class = KnapsackP... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/queue/cucumber_runner.rb | lib/knapsack_pro/runners/queue/cucumber_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
module Queue
class CucumberRunner < BaseRunner
def self.run(args)
require 'cucumber/rake/task'
ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_cucumber
ENV['KNAPSACK_PRO_Q... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/queue/rspec_runner.rb | lib/knapsack_pro/runners/queue/rspec_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
module Queue
class RSpecRunner < BaseRunner
def self.run(args, stream_error = $stderr, stream_out = $stdout)
require 'rspec/core'
require_relative '../../extensions/rspec_extension'
require_relative '../..... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/queue/base_runner.rb | lib/knapsack_pro/runners/queue/base_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
module Queue
class BaseRunner
TerminationError = Class.new(StandardError)
TERMINATION_SIGNALS = %w(HUP INT TERM ABRT QUIT USR1 USR2)
@@terminate_process = false
def self.run(args)
raise NotImplemente... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/runners/queue/minitest_runner.rb | lib/knapsack_pro/runners/queue/minitest_runner.rb | # frozen_string_literal: true
module KnapsackPro
module Runners
module Queue
class MinitestRunner < BaseRunner
def self.run(args)
require 'minitest'
# Avoid installing `at_exit` since we are calling `Minitest.run` ourselves.
# Without this, Minitest would run again (a... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/adapters/spinach_adapter.rb | lib/knapsack_pro/adapters/spinach_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module Adapters
class SpinachAdapter < BaseAdapter
TEST_DIR_PATTERN = 'features/**{,/*/**}/*.feature'
def self.test_path(scenario)
scenario.feature.filename
end
def bind_time_tracker
::Spinach.hooks.before_scenario do |sce... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/adapters/rspec_adapter.rb | lib/knapsack_pro/adapters/rspec_adapter.rb | # frozen_string_literal: true
require_relative '../formatters/time_tracker_fetcher'
module KnapsackPro
module Adapters
class RSpecAdapter < BaseAdapter
TEST_DIR_PATTERN = 'spec/**{,/*/**}/*_spec.rb'
# https://github.com/rspec/rspec/blob/86b5e4218eece4c1913fe9aad24c0a96d8bc9f40/rspec-core/lib/rspec/c... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/adapters/base_adapter.rb | lib/knapsack_pro/adapters/base_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module Adapters
class BaseAdapter
# Just example, please overwrite constant in subclass
TEST_DIR_PATTERN = 'test/**{,/*/**}/*_test.rb'
def self.adapter_bind_method_called_file
adapter_name = self.to_s.gsub('::', '-')
"#{KnapsackP... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/adapters/minitest_adapter.rb | lib/knapsack_pro/adapters/minitest_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module Adapters
class MinitestAdapter < BaseAdapter
TEST_DIR_PATTERN = 'test/**{,/*/**}/*_test.rb'
@@parent_of_test_dir = nil
def self.test_path(obj)
path, _line =
begin
Object.const_source_location(obj.class.to_s)
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/adapters/cucumber_adapter.rb | lib/knapsack_pro/adapters/cucumber_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module Adapters
class CucumberAdapter < BaseAdapter
TEST_DIR_PATTERN = 'features/**{,/*/**}/*.feature'
def self.test_path(object)
if ::Cucumber::VERSION.to_i >= 2
test_case = object
test_case.location.file
else
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/adapters/test_unit_adapter.rb | lib/knapsack_pro/adapters/test_unit_adapter.rb | # frozen_string_literal: true
module KnapsackPro
module Adapters
class TestUnitAdapter < BaseAdapter
TEST_DIR_PATTERN = 'test/**{,/*/**}/*_test.rb'
@@parent_of_test_dir = nil
def self.test_path(obj)
full_test_path = nil
found_valid_test_file_path = false
obj.tests.each... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/temp_files.rb | lib/knapsack_pro/config/temp_files.rb | # frozen_string_literal: true
module KnapsackPro
module Config
class TempFiles
# relative to the directory where you run knapsack_pro gem (user's project)
TEMP_DIRECTORY_PATH = '.knapsack_pro'
def self.ensure_temp_directory_exists!
unless File.exist?(gitignore_file_path)
crea... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/env_generator.rb | lib/knapsack_pro/config/env_generator.rb | # frozen_string_literal: true
module KnapsackPro
module Config
class EnvGenerator
class << self
def set_queue_id
if ENV['KNAPSACK_PRO_QUEUE_ID']
raise 'Queue ID already generated.'
else
ENV['KNAPSACK_PRO_QUEUE_ID'] = "#{Time.now.to_i}_#{SecureRandom.uuid}... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/env.rb | lib/knapsack_pro/config/env.rb | # frozen_string_literal: true
module KnapsackPro
module Config
class Env
LOG_LEVELS = {
'fatal' => ::Logger::FATAL,
'error' => ::Logger::ERROR,
'warn' => ::Logger::WARN,
'info' => ::Logger::INFO,
'debug' => ::Logger::DEBUG,
}
class << self
de... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/travis.rb | lib/knapsack_pro/config/ci/travis.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
class Travis < Base
def node_build_id
ENV['TRAVIS_BUILD_NUMBER']
end
def commit_hash
ENV['TRAVIS_COMMIT']
end
def branch
ENV['TRAVIS_BRANCH']
end
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/semaphore.rb | lib/knapsack_pro/config/ci/semaphore.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
# Semaphore Classic is deprecated
# https://semaphoreci.com/blog/semaphore-classic-deprecation
class Semaphore < Base
def node_total
ENV['SEMAPHORE_THREAD_COUNT']
end
def node_index
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/codeship.rb | lib/knapsack_pro/config/ci/codeship.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
class Codeship < Base
def node_total
# not provided
end
def node_index
# not provided
end
def node_build_id
ENV['CI_BUILD_NUMBER']
end
def commit... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/semaphore2.rb | lib/knapsack_pro/config/ci/semaphore2.rb | # frozen_string_literal: true
# https://docs.semaphoreci.com/article/12-environment-variables
module KnapsackPro
module Config
module CI
class Semaphore2 < Base
def node_total
ENV['SEMAPHORE_JOB_COUNT']
end
def node_index
index = ENV['SEMAPHORE_JOB_INDEX']
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/github_actions.rb | lib/knapsack_pro/config/ci/github_actions.rb | # frozen_string_literal: true
# https://docs.github.com/en/actions/reference/workflows-and-actions/variables
module KnapsackPro
module Config
module CI
class GithubActions < Base
def node_total
# not provided
end
def node_index
# not provided
end
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/buildkite.rb | lib/knapsack_pro/config/ci/buildkite.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
class Buildkite < Base
def node_total
ENV['BUILDKITE_PARALLEL_JOB_COUNT']
end
def node_index
ENV['BUILDKITE_PARALLEL_JOB']
end
def node_build_id
ENV['BUILDKITE_BU... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/cirrus_ci.rb | lib/knapsack_pro/config/ci/cirrus_ci.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
class CirrusCI < Base
def node_total
ENV['CI_NODE_TOTAL']
end
def node_index
ENV['CI_NODE_INDEX']
end
def node_build_id
ENV['CIRRUS_BUILD_ID']
end
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/app_veyor.rb | lib/knapsack_pro/config/ci/app_veyor.rb | # frozen_string_literal: true
# https://www.appveyor.com/docs/environment-variables/
module KnapsackPro
module Config
module CI
class AppVeyor < Base
def node_total
# not provided
end
def node_index
# not provided
end
def node_build_id
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/circle.rb | lib/knapsack_pro/config/ci/circle.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
class Circle < Base
def node_total
ENV['CIRCLE_NODE_TOTAL']
end
def node_index
ENV['CIRCLE_NODE_INDEX']
end
def node_build_id
ENV['CIRCLE_BUILD_NUM']
end
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/base.rb | lib/knapsack_pro/config/ci/base.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
class Base
def node_total
end
def node_index
end
def node_build_id
end
def node_retry_count
end
def commit_hash
end
def branch
end
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/heroku.rb | lib/knapsack_pro/config/ci/heroku.rb | # frozen_string_literal: true
module KnapsackPro
module Config
module CI
class Heroku < Base
def node_total
ENV['CI_NODE_TOTAL']
end
def node_index
ENV['CI_NODE_INDEX']
end
def node_build_id
ENV['HEROKU_TEST_RUN_ID']
end
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/codefresh.rb | lib/knapsack_pro/config/ci/codefresh.rb | # frozen_string_literal: true
# https://codefresh.io/docs/docs/codefresh-yaml/variables/#system-provided-variables
module KnapsackPro
module Config
module CI
class Codefresh < Base
def node_total
# not provided
end
def node_index
# not provided
end
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/config/ci/gitlab_ci.rb | lib/knapsack_pro/config/ci/gitlab_ci.rb | # frozen_string_literal: true
# https://docs.gitlab.com/ce/ci/variables/
module KnapsackPro
module Config
module CI
class GitlabCI < Base
def node_total
ENV['CI_NODE_TOTAL']
end
def node_index
return unless ENV['GITLAB_CI']
# GitLab 11.5
inde... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/client/connection.rb | lib/knapsack_pro/client/connection.rb | # frozen_string_literal: true
require 'stringio'
module KnapsackPro
module Client
class Connection
class ServerError < StandardError; end
TIMEOUT = 15
REQUEST_RETRY_TIMEBOX = 8
def initialize(action)
@action = action
@http_debug_output = StringIO.new
end
de... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/client/api/action.rb | lib/knapsack_pro/client/api/action.rb | # frozen_string_literal: true
module KnapsackPro
module Client
module API
class Action
attr_reader :endpoint_path, :http_method, :request_hash
def initialize(args)
@endpoint_path = args.fetch(:endpoint_path)
@http_method = args.fetch(:http_method)
@request_has... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/client/api/v1/queues.rb | lib/knapsack_pro/client/api/v1/queues.rb | # frozen_string_literal: true
module KnapsackPro
module Client
module API
module V1
class Queues < Base
CODE_ATTEMPT_CONNECT_TO_QUEUE_FAILED = 'ATTEMPT_CONNECT_TO_QUEUE_FAILED'
class << self
def queue(args)
request_hash = {
:fixed_queue... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/client/api/v1/base.rb | lib/knapsack_pro/client/api/v1/base.rb | # frozen_string_literal: true
module KnapsackPro
module Client
module API
module V1
class Base
private
def self.action_class
KnapsackPro::Client::API::Action
end
end
end
end
end
end
| ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/client/api/v1/build_subsets.rb | lib/knapsack_pro/client/api/v1/build_subsets.rb | # frozen_string_literal: true
module KnapsackPro
module Client
module API
module V1
class BuildSubsets < Base
class << self
def create(args)
action_class.new(
endpoint_path: '/v1/build_subsets',
http_method: :post,
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/client/api/v1/build_distributions.rb | lib/knapsack_pro/client/api/v1/build_distributions.rb | # frozen_string_literal: true
module KnapsackPro
module Client
module API
module V1
class BuildDistributions < Base
TEST_SUITE_SPLIT_CACHE_MISS_CODE = 'TEST_SUITE_SPLIT_CACHE_MISS'
class << self
def subset(args)
request_hash = {
:fixed_... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/formatters/time_tracker_fetcher.rb | lib/knapsack_pro/formatters/time_tracker_fetcher.rb | # frozen_string_literal: true
module KnapsackPro
module Formatters
class TimeTrackerFetcher
def self.call
::RSpec
.configuration
.formatters
.find { |f| f.class.to_s == "KnapsackPro::Formatters::TimeTracker" }
end
def self.unexecuted_test_files
tim... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/formatters/rspec_json_formatter.rb | lib/knapsack_pro/formatters/rspec_json_formatter.rb | # frozen_string_literal: true
RSpec::Support.require_rspec_core('formatters/json_formatter')
# based on https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/formatters/json_formatter.rb
module KnapsackPro
module Formatters
class RSpecJsonFormatter < ::RSpec::Core::Formatters::JsonFormatter
::RSp... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/formatters/time_tracker.rb | lib/knapsack_pro/formatters/time_tracker.rb | # frozen_string_literal: true
require 'stringio'
require 'set'
require_relative '../utils'
module KnapsackPro
module Formatters
class TimeTracker
::RSpec::Core::Formatters.register self,
:example_group_started,
:example_started,
:example_finished,
:example_group_finished
... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/crypto/decryptor.rb | lib/knapsack_pro/crypto/decryptor.rb | # frozen_string_literal: true
module KnapsackPro
module Crypto
class Decryptor
class TooManyEncryptedTestFilesError < StandardError; end
def self.call(test_suite, test_files)
return test_files unless KnapsackPro::Config::Env.test_files_encrypted?
new(test_suite.calculate_test_files.... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/crypto/encryptor.rb | lib/knapsack_pro/crypto/encryptor.rb | # frozen_string_literal: true
module KnapsackPro
module Crypto
class Encryptor
def self.call(test_files)
if KnapsackPro::Config::Env.test_files_encrypted?
new(test_files).call
else
test_files
end
end
def initialize(test_files)
@test_files = t... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/crypto/branch_encryptor.rb | lib/knapsack_pro/crypto/branch_encryptor.rb | # frozen_string_literal: true
module KnapsackPro
module Crypto
class BranchEncryptor
NON_ENCRYPTABLE_BRANCHES = [
'master',
'main',
'develop',
'development',
'dev',
'staging',
'production',
# GitHub Actions has branch names starting with refs/... | ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
KnapsackPro/knapsack_pro-ruby | https://github.com/KnapsackPro/knapsack_pro-ruby/blob/04da025adfa702ef7bfcdda588049512550b3127/lib/knapsack_pro/crypto/digestor.rb | lib/knapsack_pro/crypto/digestor.rb | # frozen_string_literal: true
module KnapsackPro
module Crypto
class Digestor
def self.salt_hexdigest(str_to_encrypt)
salt = KnapsackPro::Config::Env.salt
str = salt + str_to_encrypt
Digest::SHA2.hexdigest(str)
end
end
end
end
| ruby | MIT | 04da025adfa702ef7bfcdda588049512550b3127 | 2026-01-04T17:38:43.340996Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/integration/default/serverspec/default_spec.rb | test/integration/default/serverspec/default_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/cookbook/metadata.rb | test/cookbook/metadata.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/cookbook/recipes/default.rb | test/cookbook/recipes/default.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/cookbook/providers/test_plugin.rb | test/cookbook/providers/test_plugin.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/cookbook/attributes/default.rb | test/cookbook/attributes/default.rb | #
# Copyright 2017, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/cookbook/resources/test_plugin.rb | test/cookbook/resources/test_plugin.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/service_mixin_spec.rb | test/spec/service_mixin_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/app_mixin_spec.rb | test/spec/app_mixin_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/utils_spec.rb | test/spec/utils_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/spec_helper.rb | test/spec/spec_helper.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/resources/application_template_spec.rb | test/spec/resources/application_template_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/resources/application_directory_spec.rb | test/spec/resources/application_directory_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/resources/application_cookbook_file_spec.rb | test/spec/resources/application_cookbook_file_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/resources/application_file_spec.rb | test/spec/resources/application_file_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/test/spec/resources/application_spec.rb | test/spec/resources/application_spec.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application.rb | lib/poise_application.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/app_mixin.rb | lib/poise_application/app_mixin.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/version.rb | lib/poise_application/version.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/resources.rb | lib/poise_application/resources.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/utils.rb | lib/poise_application/utils.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/app_file_mixin.rb | lib/poise_application/app_file_mixin.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/service_mixin.rb | lib/poise_application/service_mixin.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/cheftie.rb | lib/poise_application/cheftie.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/error.rb | lib/poise_application/error.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/resources/application_directory.rb | lib/poise_application/resources/application_directory.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/resources/application.rb | lib/poise_application/resources/application.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/resources/application_file.rb | lib/poise_application/resources/application_file.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/resources/application_template.rb | lib/poise_application/resources/application_template.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
poise/application | https://github.com/poise/application/blob/1c9d273210c5fbbde4329d8809368daeac4711ff/lib/poise_application/resources/application_cookbook_file.rb | lib/poise_application/resources/application_cookbook_file.rb | #
# Copyright 2015-2016, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ruby | Apache-2.0 | 1c9d273210c5fbbde4329d8809368daeac4711ff | 2026-01-04T17:38:53.558075Z | false |
equivalent/scrapbook2 | https://github.com/equivalent/scrapbook2/blob/b39d2865158b4730fe6edd442420301db958cc89/archive/blogs/new_post_script.rb | archive/blogs/new_post_script.rb | require 'inputs'
require 'date'
topic = Inputs.name("What is the name of the article ?")
sanitized_topic = topic.downcase.gsub(/\s/,'-').gsub(/[^\w_-]/, '').squeeze('-')
@time = Time.now
filename = "#{@time.to_date}-#{sanitized_topic}.md"
template = <<EOF
# #{topic}
```elixir
```
EOF
filepath = "#{filename}"
... | ruby | MIT | b39d2865158b4730fe6edd442420301db958cc89 | 2026-01-04T17:38:11.379134Z | false |
equivalent/scrapbook2 | https://github.com/equivalent/scrapbook2/blob/b39d2865158b4730fe6edd442420301db958cc89/archive/mini-blogs/new_post_script.rb | archive/mini-blogs/new_post_script.rb | require 'inputs'
require 'date'
topic = Inputs.name("What is the name of the article ?")
sanitized_topic = topic.downcase.gsub(/\s/,'-').gsub(/[^\w_-]/, '').squeeze('-')
@time = Time.now
filename = "#{@time.to_date}-#{sanitized_topic}.md"
template = <<EOF
# #{topic}
```elixir
```
EOF
filepath = "#{filename}"
... | ruby | MIT | b39d2865158b4730fe6edd442420301db958cc89 | 2026-01-04T17:38:11.379134Z | false |
equivalent/scrapbook2 | https://github.com/equivalent/scrapbook2/blob/b39d2865158b4730fe6edd442420301db958cc89/archive/blogs_gist/enumerable_complying_to_rails_conventions.rb | archive/blogs_gist/enumerable_complying_to_rails_conventions.rb | # published at https://gist.github.com/equivalent/9a97dff5a8a24bf84868d913a512add7
#
require 'rspec'
class Membership
attr_accessor :type, :owner
def free?
type == 'free'
end
def paid?
type == 'paid'
end
def unassigned?
owner.nil?
end
# purely for debugging purpose
def to_s
"I'm a... | ruby | MIT | b39d2865158b4730fe6edd442420301db958cc89 | 2026-01-04T17:38:11.379134Z | false |
equivalent/scrapbook2 | https://github.com/equivalent/scrapbook2/blob/b39d2865158b4730fe6edd442420301db958cc89/archive/blogs_gist/enumerables_enumerators_and_lazynes.rb | archive/blogs_gist/enumerables_enumerators_and_lazynes.rb | #require 'pry' # pry gem for debugging
require 'forwardable' # core ruby lib.
# Don't mind this module, it's just for formating output of examples
module Article
def self.h1(title)
extended_title = "###### #{title} ######"
puts "\n\n\n#{extended_title}\n"
puts "=" * extended_title.length
end
... | ruby | MIT | b39d2865158b4730fe6edd442420301db958cc89 | 2026-01-04T17:38:11.379134Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.