source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | infinitered/ruby-xcdm | https://github.com/infinitered/ruby-xcdm | Rakefile | Ruby | mit | 94 | master | 267 | require 'rake/testtask'
require 'bundler/gem_tasks'
task :test do
Bundler.require('test') if defined?(Bundler)
Rake::TestTask.new do |t|
t.libs << "lib"
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
end
task :default => :test |
github | infinitered/ruby-xcdm | https://github.com/infinitered/ruby-xcdm | test/schema_test.rb | Ruby | mit | 94 | master | 1,588 | require 'minitest/autorun'
require 'xcdm/entity'
require 'xcdm/schema'
require 'rexml/document'
require 'active_support/inflector'
module XCDM
class SchemaTest < Minitest::Test
def test_initialize
s = Schema.new("0.0.1", "4.6")
assert_equal "0.0.1", s.version
assert_equal "4.6", s.xcode_versio... |
github | infinitered/ruby-xcdm | https://github.com/infinitered/ruby-xcdm | test/entity_test.rb | Ruby | mit | 94 | master | 6,881 | require 'minitest/autorun'
require 'xcdm/entity'
require 'xcdm/schema'
require 'rexml/document'
module XCDM
class EntityTest < Minitest::Test
attr_reader :e, :pub
def setup
s = XCDM::Schema.new("0.0.1", "4.6")
@pub ||= Entity.new(s, "Publication", abstract: true)
@e ||= Entity.new(s, "Art... |
github | infinitered/ruby-xcdm | https://github.com/infinitered/ruby-xcdm | lib/ruby-xcdm.rb | Ruby | mit | 94 | master | 1,268 | require 'xcdm/schema'
require 'xcdm/entity'
if defined?(Motion::Project::Config)
class Motion::Project::Config
variable :xcdm
def xcdm
@xcdm ||= Struct.new(:name).new(nil)
end
end
if File.directory?(File.join(App.config.project_dir, "schemas"))
namespace :schema do
desc "Clear the... |
github | infinitered/ruby-xcdm | https://github.com/infinitered/ruby-xcdm | lib/xcdm/schema.rb | Ruby | mit | 94 | master | 3,517 | require 'xcdm/entity'
require 'fileutils'
require 'plist'
module XCDM
class Schema
attr_reader :version, :entities, :xcode_version
def initialize(version, xcode_version)
@version = version
@xcode_version = xcode_version
@entities = []
end
def entity(name, options = {}, &block)
... |
github | infinitered/ruby-xcdm | https://github.com/infinitered/ruby-xcdm | lib/xcdm/entity.rb | Ruby | mit | 94 | master | 5,008 | require 'active_support/inflector'
require 'builder'
module XCDM
class Entity
DEFAULT_PROPERTY_ATTRIBUTES = { optional: 'YES', syncable: 'YES' }
DEFAULT_RELATIONSHIP_ATTRIBUTES = { optional: 'YES', deletionRule: 'Nullify', syncable: 'YES' }
TYPE_MAPPING = {
integer16: 'Integer 16',
int... |
github | collectiveidea/command | https://github.com/collectiveidea/command | command.gemspec | Ruby | mit | 94 | master | 663 | # encoding: utf-8
Gem::Specification.new do |spec|
spec.name = "command"
spec.version = "1.0.0"
spec.author = "Steve Richert"
spec.email = "steve.richert@gmail.com"
spec.description = "Command provides a simple object-oriented interface for running shell commands from Ruby."
spec.summary ... |
github | collectiveidea/command | https://github.com/collectiveidea/command | lib/command.rb | Ruby | mit | 94 | master | 445 | require "open3"
class Command
attr_reader :stdin, :stdout, :stderr
def self.run(stdin)
new(stdin).run
end
def initialize(stdin)
@stdin = stdin
end
def run
@stdout, @stderr, @status = Open3.capture3(stdin)
self
end
def exitstatus
@status && @status.exitstatus
end
alias_metho... |
github | collectiveidea/command | https://github.com/collectiveidea/command | spec/lib/command_spec.rb | Ruby | mit | 94 | master | 1,935 | require "spec_helper"
describe Command do
describe ".run" do
let!(:stdin) { double(:stdin) }
let(:command) { double(:command) }
it "initializes, runs and returns a new command" do
expect(Command).to receive(:new).once.with(stdin) { command }
expect(command).to receive(:run).once.with(no_args... |
github | dommmel/jekyll-youtube | https://github.com/dommmel/jekyll-youtube | jekyll-youtube.gemspec | Ruby | mit | 94 | master | 919 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'jekyll-youtube/version'
Gem::Specification.new do |spec|
spec.name = "jekyll-youtube"
spec.version = Jekyll::Youtube::VERSION
spec.authors = ["Dommmel"]
spec.email ... |
github | dommmel/jekyll-youtube | https://github.com/dommmel/jekyll-youtube | lib/jekyll-youtube.rb | Ruby | mit | 94 | master | 1,362 | require "jekyll"
require "jekyll-youtube/version"
class YouTubeEmbed < Liquid::Tag
def initialize(tagName, content, tokens)
super
@content = content
end
def render(context)
youtube_url = "#{context[@content.strip]}"
if youtube_url[/youtu\.be\/([^\?]*)/]
@youtube_id = $1
else
# Re... |
github | socketry/async-container | https://github.com/socketry/async-container | async-container.gemspec | Ruby | mit | 94 | main | 970 | # frozen_string_literal: true
require_relative "lib/async/container/version"
Gem::Specification.new do |spec|
spec.name = "async-container"
spec.version = Async::Container::VERSION
spec.summary = "Abstract container-based parallelism using threads and processes where appropriate."
spec.authors = ["Samuel Willia... |
github | socketry/async-container | https://github.com/socketry/async-container | gems.rb | Ruby | mit | 94 | main | 479 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
source "https://rubygems.org"
gemspec
group :maintenance, optional: true do
gem "bake-gem"
gem "bake-modernize"
gem "bake-releases"
gem "agent-context"
gem "utopia-project"
end
group :test do
gem "... |
github | socketry/async-container | https://github.com/socketry/async-container | bake.rb | Ruby | mit | 94 | main | 560 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025-2026, by Samuel Williams.
# Update the project documentation with the new version number.
#
# @parameter version [String] The new version number.
def after_gem_release_version_increment(version)
context["releases:update"].call(version)... |
github | socketry/async-container | https://github.com/socketry/async-container | config/sus.rb | Ruby | mit | 94 | main | 352 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "covered/sus"
include Covered::Sus
ENV["CONSOLE_LEVEL"] ||= "fatal"
ENV["METRICS_BACKEND"] ||= "metrics/backend/test"
def prepare_instrumentation!
require "metrics"
end
def before_tests(...)
prepar... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/metrics/provider/async/container/generic.rb | Ruby | mit | 94 | main | 564 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require_relative "../../../../async/container/generic"
require "metrics/provider"
Metrics::Provider(Async::Container::Generic) do
ASYNC_CONTAINER_GENERIC_HEALTH_CHECK_FAILED = Metrics.metric("async.container.gener... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container.rb | Ruby | mit | 94 | main | 218 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
require_relative "container/controller"
# @namespace
module Async
# @namespace
module Container
end
end |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/error.rb | Ruby | mit | 94 | main | 1,313 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
module Async
module Container
# Represents an error that occured during container execution.
class Error < StandardError
end
Interrupt = ::Interrupt
# Similar to {Interrupt}, but represents `SI... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/group.rb | Ruby | mit | 94 | main | 6,893 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2026, by Samuel Williams.
require "fiber"
require "async/clock"
require_relative "error"
module Async
module Container
# The default timeout for terminating processes, before escalating to killing.
GRACEFUL_TIMEOUT = ENV.fetch("A... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/statistics.rb | Ruby | mit | 94 | main | 4,371 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2026, by Samuel Williams.
require "async/reactor"
module Async
module Container
# Tracks various statistics relating to child instances in a container.
class Statistics
# Tracks rate information over a sliding time window using... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/forked.rb | Ruby | mit | 94 | main | 8,020 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2026, by Samuel Williams.
require_relative "error"
require_relative "generic"
require_relative "channel"
require_relative "notify/pipe"
module Async
module Container
# A multi-process container which uses {Process.fork}.
class Fo... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/hybrid.rb | Ruby | mit | 94 | main | 1,525 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
# Copyright, 2022, by Anton Sozontov.
require_relative "forked"
require_relative "threaded"
module Async
module Container
# Provides a hybrid multi-process multi-thread container.
class Hybrid < Forked
... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/notify.rb | Ruby | mit | 94 | main | 616 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2025, by Samuel Williams.
require_relative "notify/pipe"
require_relative "notify/socket"
require_relative "notify/console"
require_relative "notify/log"
module Async
module Container
module Notify
@client = nil
# Select t... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/policy.rb | Ruby | mit | 94 | main | 4,241 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Samuel Williams.
module Async
module Container
# A policy for managing container behavior and responding to child process lifecycle events.
class Policy
# Called when a child is spawned.
# @parameter container [Generic] T... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/threaded.rb | Ruby | mit | 94 | main | 7,780 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2026, by Samuel Williams.
require_relative "generic"
require_relative "channel"
require_relative "notify/pipe"
module Async
module Container
# A multi-thread container which uses {Thread.fork}.
class Threaded < Generic
# Indica... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/keyed.rb | Ruby | mit | 94 | main | 1,528 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2025, by Samuel Williams.
module Async
module Container
# Tracks a key/value pair such that unmarked keys can be identified and cleaned up.
# This helps implement persistent processes that start up child processes per directory or ... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/best.rb | Ruby | mit | 94 | main | 973 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2024, by Samuel Williams.
require_relative "forked"
require_relative "threaded"
require_relative "hybrid"
module Async
module Container
# Whether the underlying process supports fork.
# @returns [Boolean]
def self.fork?
::Pro... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/channel.rb | Ruby | mit | 94 | main | 1,251 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2025, by Samuel Williams.
require "json"
module Async
module Container
# Provides a basic multi-thread/multi-process uni-directional communication channel.
class Channel
# Initialize the channel using a pipe.
def initialize(... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/controller.rb | Ruby | mit | 94 | main | 7,341 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2026, by Samuel Williams.
require_relative "error"
require_relative "best"
require_relative "statistics"
require_relative "notify"
require_relative "policy"
module Async
module Container
# Manages the life-cycle of one or more cont... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/generic.rb | Ruby | mit | 94 | main | 11,111 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2026, by Samuel Williams.
# Copyright, 2025, by Marc-André Cournoyer.
require "etc"
require "async/clock"
require_relative "group"
require_relative "keyed"
require_relative "statistics"
require_relative "policy"
module Async
module C... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/notify/server.rb | Ruby | mit | 94 | main | 3,576 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2026, by Samuel Williams.
# Copyright, 2020, by Olle Jonsson.
require "tmpdir"
require "socket"
require "securerandom"
require "set"
module Async
module Container
module Notify
# A simple UDP server that can be used to receive me... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/notify/console.rb | Ruby | mit | 94 | main | 1,088 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2026, by Samuel Williams.
require_relative "client"
require "console"
module Async
module Container
module Notify
# Implements a general process readiness protocol with output to the local console.
class Console < Client
... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/notify/client.rb | Ruby | mit | 94 | main | 2,508 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2026, by Samuel Williams.
module Async
module Container
# Handles the details of several process readiness protocols.
module Notify
# Represents a client that can send messages to the parent controller in order to notify it of r... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/notify/log.rb | Ruby | mit | 94 | main | 1,719 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require_relative "client"
require "socket"
module Async
module Container
module Notify
# Represents a client that uses a local log file to communicate readiness, status changes, etc.
class Log < Client
... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/notify/socket.rb | Ruby | mit | 94 | main | 2,405 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2025, by Samuel Williams.
require_relative "client"
require "socket"
module Async
module Container
module Notify
# Implements the systemd NOTIFY_SOCKET process readiness protocol.
# See <https://www.freedesktop.org/software/sy... |
github | socketry/async-container | https://github.com/socketry/async-container | lib/async/container/notify/pipe.rb | Ruby | mit | 94 | main | 2,483 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2026, by Samuel Williams.
# Copyright, 2020, by Juan Antonio Martín Lucas.
require_relative "client"
require "json"
module Async
module Container
module Notify
# Implements a process readiness protocol using an inherited pipe fi... |
github | socketry/async-container | https://github.com/socketry/async-container | bake/async/container/notify/log.rb | Ruby | mit | 94 | main | 668 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
def initialize(...)
super
require "async/container/notify/log"
end
# Check if the log file exists and the service is ready.
# @parameter path [String] The path to the notification log file, uses the `NOTIFY_LOG... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container.rb | Ruby | mit | 94 | main | 1,235 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
require "async/container"
describe Async::Container do
with ".processor_count" do
it "can get processor count" do
expect(Async::Container.processor_count).to be >= 1
end
it "can override the proce... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/controller.rb | Ruby | mit | 94 | main | 5,070 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2026, by Samuel Williams.
require "async/container/controller"
require "async/container/controllers"
require "async/container/notify/server"
require "async/container/notify/socket"
describe Async::Container::Controller do
let(:control... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/channel.rb | Ruby | mit | 94 | main | 785 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "async/container/channel"
describe Async::Container::Channel do
let(:channel) {subject.new}
after do
@channel&.close
end
it "can send and receive" do
channel.out.puts "Hello, World!"
expect... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/threaded.rb | Ruby | mit | 94 | main | 360 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2024, by Samuel Williams.
require "async/container/threaded"
require "async/container/a_container"
describe Async::Container::Threaded do
it_behaves_like Async::Container::AContainer
it "should not be multiprocess" do
expect(subj... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/notify.rb | Ruby | mit | 94 | main | 2,578 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2026, by Samuel Williams.
require "async/container/controller"
require "async/container/notify/server"
require "async"
describe Async::Container::Notify do
let(:server) {subject::Server.open}
let(:notify_socket) {server.path}
let(:... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/hybrid.rb | Ruby | mit | 94 | main | 406 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require "async/container/hybrid"
require "async/container/best"
require "async/container/a_container"
describe Async::Container::Hybrid do
it_behaves_like Async::Container::AContainer
it "should be multip... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/forked.rb | Ruby | mit | 94 | main | 1,525 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
# Copyright, 2020, by Olle Jonsson.
require "async/container/best"
require "async/container/forked"
require "async/container/a_container"
describe Async::Container::Forked do
let(:container) {subject.new}
... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/statistics.rb | Ruby | mit | 94 | main | 4,784 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025-2026, by Samuel Williams.
require "async/container/statistics"
describe Async::Container::Statistics::Rate do
let(:rate) {subject.new(window: 10)}
with "#window" do
it "stores window size" do
rate = subject.new(window: 30)
... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/policy.rb | Ruby | mit | 94 | main | 5,710 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Samuel Williams.
require "async/container/policy"
require "async/container/best"
describe Async::Container::Policy do
let(:policy) {subject.new}
with "interface" do
it "has child_spawn callback" do
expect(policy).to respon... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/group.rb | Ruby | mit | 94 | main | 7,847 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025-2026, by Samuel Williams.
require "async/container/group"
require "async/container/channel"
describe Async::Container::Group do
let(:group) {Async::Container::Group.new}
with "#size" do
it "returns zero for empty group" do
exp... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/notify/socket.rb | Ruby | mit | 94 | main | 375 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "async/container/notify/socket"
describe Async::Container::Notify::Socket do
with ".open!" do
it "can open a socket" do
socket = subject.open!({subject::NOTIFY_SOCKET => "test"})
expect(socket)... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/notify/pipe.rb | Ruby | mit | 94 | main | 1,208 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2025, by Samuel Williams.
# Copyright, 2020, by Olle Jonsson.
require "async/container/controller"
require "async/container/controllers"
describe Async::Container::Notify::Pipe do
let(:notify_script) {Async::Container::Controllers.pat... |
github | socketry/async-container | https://github.com/socketry/async-container | test/async/container/notify/log.rb | Ruby | mit | 94 | main | 1,582 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "async/container/controller"
require "async/container/controllers"
require "tmpdir"
require "bake"
describe Async::Container::Notify::Log do
let(:notify_script) {Async::Container::Controllers.path_for("no... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/controller.rb | Ruby | mit | 94 | main | 850 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022, by Anton Sozontov.
# Copyright, 2024-2025, by Samuel Williams.
require "../lib/async/container/controller"
class Controller < Async::Container::Controller
def setup(container)
container.run(count: 1, restart: tr... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/minimal.rb | Ruby | mit | 94 | main | 1,339 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2026, by Samuel Williams.
# Copyright, 2020, by Olle Jonsson.
class Threaded
def initialize(&block)
@channel = Channel.new
@thread = Thread.new(&block)
@waiter = Thread.new do
begin
@thread.join
rescue Exception => e... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/channel.rb | Ruby | mit | 94 | main | 737 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2024, by Samuel Williams.
# Copyright, 2020, by Olle Jonsson.
require "json"
class Channel
def initialize
@in, @out = IO.pipe
end
def after_fork
@out.close
end
def receive
if data = @in.gets
JSON.parse(data, symbolize... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/container.rb | Ruby | mit | 94 | main | 706 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2026, by Samuel Williams.
# Copyright, 2019, by Yuji Yaginuma.
# Copyright, 2022, by Anton Sozontov.
require_relative "../lib/async/container"
Console.logger.debug!
container = Async::Container.new
Console.debug "... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/benchmark/scalability.rb | Ruby | mit | 94 | main | 907 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
# gem install async-container
gem "async-container"
require "async/clock"
require_relative "../../lib/async/container"
def fibonacci(n)
if n < 2
return n
else
return fibonacci(n-1) + fibonacci(n-2)
end... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/puma/gems.rb | Ruby | mit | 94 | main | 227 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
source "https://rubygems.org"
gem "async-container", path: "../.."
gem "io-endpoint"
gem "puma"
gem "rack", "~> 3" |
github | socketry/async-container | https://github.com/socketry/async-container | examples/puma/puma.rb | Ruby | mit | 94 | main | 220 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
on_booted do
require "async/container/notify"
notify = Async::Container::Notify.open!
notify&.ready!
end |
github | socketry/async-container | https://github.com/socketry/async-container | examples/puma/application.rb | Ruby | mit | 94 | main | 935 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
require "async/container"
require "console"
require "io/endpoint/host_endpoint"
require "io/endpoint/bound_endpoint"
# Console.logger.debug!
class Application < Async::Container::Controll... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/http/server.rb | Ruby | mit | 94 | main | 831 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2026, by Samuel Williams.
require "async/container"
require "async/http/endpoint"
require "async/http/server"
container = Async::Container::Forked.new
endpoint = Async::HTTP::Endpoint.parse("http://localhost:9292"... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/http/client.rb | Ruby | mit | 94 | main | 399 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2024, by Samuel Williams.
require "async"
require "async/http/endpoint"
require "async/http/client"
endpoint = Async::HTTP::Endpoint.parse("http://localhost:9292")
Async do
client = Async::HTTP::Client.new(endpoin... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/health_check/test.rb | Ruby | mit | 94 | main | 1,041 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "metrics"
require_relative "../../lib/async/container/controller"
NAMES = [
"Cupcake", "Donut", "Eclair", "Froyo", "Gingerbread", "Honeycomb", "Ice Cream Sandwich", "Jelly Bean", "KitKa... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/grace/server.rb | Ruby | mit | 94 | main | 1,316 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2026, by Samuel Williams.
require "../../lib/async/container"
require "io/endpoint/host_endpoint"
Console.logger.debug!
module SignalWrapper
def self.trap(signal, &block)
signal = signal
original = Signal.t... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/service/service.rb | Ruby | mit | 94 | main | 701 | #!/usr/bin/env async-service
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Samuel Williams.
require "async"
require "async/service/managed_service"
require "async/service/managed_environment"
class SleepService < Async::Service::ManagedService
def run(instance, evaluator)
A... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/queue/server.rb | Ruby | mit | 94 | main | 2,169 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2026, by Samuel Williams.
require "async"
require "async/container"
require "io/endpoint"
require "io/endpoint/unix_endpoint"
require "msgpack"
class Wrapper < MessagePack::Factory
def initialize
super()
# s... |
github | socketry/async-container | https://github.com/socketry/async-container | examples/fan-out/pipe.rb | Ruby | mit | 94 | main | 436 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2024, by Samuel Williams.
require "async/container"
container = Async::Container.new
input, output = IO.pipe
container.async do |instance|
output.close
while message = input.gets
puts "Hello World from #{inst... |
github | socketry/async-container | https://github.com/socketry/async-container | gems/async-head.rb | Ruby | mit | 94 | main | 222 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2024, by Samuel Williams.
source "https://rubygems.org"
eval_gemfile "../gems.rb"
gem "async", git: "https://github.com/socketry/async" |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | Gemfile | Ruby | mit | 94 | main | 399 | source "https://rubygems.org"
gem "bundler" # For specs!
gem "byebug", # for debugging
">= 2.0.3"
# For complexity!
# (this syntax is not supported by gem_bench, but also shouldn't make it blow up)
gem <<~GEM_NAME.chomp
pry-byebug
GEM_NAME
# Need test-unit be loaded by bundler for evaluation in specs
gem "test-u... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | Rakefile | Ruby | mit | 94 | main | 737 | require "bundler/gem_tasks"
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
desc("alias test task to spec")
task(test: :spec)
rescue LoadError
task(:spec) do
warn("rspec is disabled")
end
end
begin
require "yard-junk/rake"
YardJunk::Rake.define_task
rescue LoadError
task("... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | gem_bench.gemspec | Ruby | mit | 94 | main | 3,343 | # Get the GEMFILE_VERSION without *require* "my_gem/version", for code coverage accuracy
# See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-825171399
load "lib/gem_bench/version.rb"
gem_version = GemBench::Version::VERSION
GemBench::Version.send(:remove_const, :VERSION)
Gem::Specification.new d... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench.rb | Ruby | mit | 94 | main | 2,325 | # external gems
require "version_gem"
require "bundler" # This gem utilizes bundler as a tool.
# this library
require_relative "gem_bench/version"
require_relative "gem_bench/scout"
require_relative "gem_bench/player"
require_relative "gem_bench/team"
require_relative "gem_bench/gemfile_line_tokenizer"
require_relativ... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench/strict_version_gem.rb | Ruby | mit | 94 | main | 1,463 | module GemBench
# Helps determine if a gem dependency is "valid" according to the strict rules of:
# - every gem must have a version requirement of some sort
class StrictVersionGem
attr_reader :name, :version, :version_type, :valid, :relevant_lines, :index, :tokenized_line
class << self
def from_... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench/player.rb | Ruby | mit | 94 | main | 3,720 | module GemBench
# Each gem either needs to be required at boot time or not.
# Player helps determine which gems can use `require: false` in the Gemfile to cut down load times.
class Player
# MAJOR.MINOR split on point length == 2
# MAJOR.MINOR.PATCH split on point length == 3
# Semver 2.0 Standard is ... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench/gemfile_line_tokenizer.rb | Ruby | mit | 94 | main | 9,481 | module GemBench
# Line by line parser of a Gemfile
# Uses regular expressions, which, I know, GROSS, but also meh
# You aren't using this as a runtime gem in your app are you?
# Let me know how you use it!
class GemfileLineTokenizer
GEM_REGEX = /\A\s*gem\s+([^#]*).*\Z/.freeze # run against gem lines like:... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench/strict_version_requirement.rb | Ruby | mit | 94 | main | 2,221 | module GemBench
# Helps enforce a version requirement for every dependency in a Gemfile
class StrictVersionRequirement
attr_reader :gemfile_path, :gems, :starters, :benchers, :verbose
def initialize(options = {})
@gemfile_path = options.fetch(:gemfile_path, "#{Dir.pwd}/Gemfile")
file = File.ope... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench/jersey.rb | Ruby | mit | 94 | main | 7,855 | # Std Libs Dependencies
require "tmpdir"
module GemBench
# Re-write a gem to a temp directory, re-namespace the primary namespace of that gem module, and load it.
# If the original gem defines multiple top-level namespaces, they can all be renamed by providing more key value pairs.
# If the original gem monkey p... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench/scout.rb | Ruby | mit | 94 | main | 1,831 | # Scout's job is to figure out where gems are hiding
#
module GemBench
# Looks through loaded gems' (RubyGems & Bundler) source code searching for stuff
class Scout
attr_reader :gem_paths, :gemfile_path, :gemfile_lines, :gemfile_trash, :loaded_gems
def initialize(check_gemfile: nil, **options)
@check... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | lib/gem_bench/team.rb | Ruby | mit | 94 | main | 9,159 | require "forwardable"
module GemBench
# It doesn't make sense to use Team unless the Gemfile you want to evaluate is currently loaded.
# For example:
# - if you are in a rails console, and want to evaluate the Gemfile of the Rails app, that's great!
# - if you are in a context with no Gemfile loaded, or a ... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/spec_helper.rb | Ruby | mit | 94 | main | 571 | # External library dependencies
require "version_gem/ruby"
# RSpec Configs
require "config/byebug"
require "config/rspec/rspec_block_is_expected"
require "config/rspec/rspec_core"
require "config/rspec/version_gem"
# Last thing before loading this gem is to setup code coverage
begin
# This does not require "simplec... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench_spec.rb | Ruby | mit | 94 | main | 867 | RSpec.describe GemBench do
describe "::check" do
subject(:check) { described_class.check(**opts) }
let(:opts) { {} }
it "succeeds" do
block_is_expected.to not_raise_error
end
end
describe "::versions_present?" do
subject(:versions_present) { described_class.versions_present?(**opts) }... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/support/gemfile.rb | Ruby | mit | 94 | main | 1,379 | source "https://rubygems.org"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
# No constraint
gem "anonymous_active_record"
# SemVer constraint
gem "require_bench", "~> 1.0"
# Locked constraint
gem "debug_logging", "4.0.2"
# Git constraint, tag
gem "dynamoid", github: "Dynamoid/dynamoid", tag... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/support/dev_gemfile.rb | Ruby | mit | 94 | main | 1,033 | source "https://rubygems.org"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
git_source(:gitlab) { |repo_name| "https://gitlab.com/#{repo_name}" }
group :development do
# No constraint
gem "anonymous_active_record"
# SemVer constraint
gem "require_bench", "~> 1.0"
# Locked constrain... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/strict_version_gem_spec.rb | Ruby | mit | 94 | main | 596 | # frozen_string_literal: true
RSpec.describe GemBench::StrictVersionGem do
subject(:instance) { described_class.new(*args) }
let(:args) {
[
name,
version,
version_type,
valid,
relevant_lines,
index,
tokenized_line,
]
}
let(:name) { "oh_hi" }
let(:version) { ... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/player_spec.rb | Ruby | mit | 94 | main | 4,381 | RSpec.describe GemBench::Player do
let(:options) {
{
name: "gem_bench",
version: "0.1.0",
}
}
let(:instance) { described_class.new(options) }
describe "initialize" do
it "does not raise error" do
block_is_expected.not_to raise_error
end
end
describe "#set_starter" do
... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/scout_spec.rb | Ruby | mit | 94 | main | 8,956 | RSpec.describe GemBench::Scout do
let(:instance) { described_class.new }
describe "initialize" do
it "does not raise error" do
expect { instance }.not_to raise_error
end
context "when check_gemfile" do
context "when true" do
let(:instance) { described_class.new(check_gemfile: true)... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/jersey_spec.rb | Ruby | mit | 94 | main | 3,646 | require "gem_bench/jersey"
require "method_source"
RSpec.describe GemBench::Jersey do
let(:args) do
{
gem_name: gem_name,
trades: trades,
metadata: metadata,
verbose: verbose,
}
end
let(:gem_name) { "method_source" }
let(:old_namespace) { "MethodSource" }
let!(:alphabet) { "A... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/version_spec.rb | Ruby | mit | 94 | main | 220 | RSpec.describe GemBench::Version do
it_behaves_like "a Version module", described_class
it "is greater than 1.0.0" do
expect(Gem::Version.new(described_class) >= Gem::Version.new("1.0.0")).to be(true)
end
end |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/gemfile_line_tokenizer_spec.rb | Ruby | mit | 94 | main | 2,574 | # frozen_string_literal: true
require "rspec"
RSpec.describe GemBench::GemfileLineTokenizer do
subject(:instance) { described_class.new(*args) }
let(:args) {
[
all_lines,
line,
index,
]
}
let(:all_lines) { %w(hello darkness) }
let(:line) { "hello" }
let(:index) { 0 }
describe... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/strict_version_requirement_spec.rb | Ruby | mit | 94 | main | 2,942 | # frozen_string_literal: true
require "rspec"
RSpec.describe GemBench::StrictVersionRequirement do
subject(:instance) { described_class.new(options) }
let(:options) { {} }
describe "::new" do
it "succeeds" do
block_is_expected.to not_raise_error
end
context "when verbose" do
let(:opti... |
github | galtzo-floss/gem_bench | https://github.com/galtzo-floss/gem_bench | spec/gem_bench/team_spec.rb | Ruby | mit | 94 | main | 16,207 | RSpec.describe GemBench::Team do
subject(:instance) { described_class.new(**options) }
let(:options) { {} }
describe "#initialize" do
it "succeeds" do
block_is_expected.not_to raise_error
end
context "when gemfile_path" do
let(:options) { {gemfile_path: File.join(File.dirname(__FILE__),... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | katakata_irb.gemspec | Ruby | mit | 94 | main | 1,470 | # frozen_string_literal: true
require_relative "lib/katakata_irb/version"
Gem::Specification.new do |spec|
spec.name = "katakata_irb"
spec.version = KatakataIrb::VERSION
spec.authors = ["tompng"]
spec.email = ["tomoyapenguin@gmail.com"]
spec.summary = "IRB with Typed Completion"
spec.description = "IRB w... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | lib/katakata_irb.rb | Ruby | mit | 94 | main | 404 | # frozen_string_literal: true
require 'katakata_irb/version'
require 'katakata_irb/completor'
require 'katakata_irb/types'
module KatakataIrb
class << self
attr_accessor :log_output, :last_completion_error
def log_puts(...)
if STDOUT.tty?
STDOUT.cooked { log_output&.puts(...) }
else
... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | lib/katakata_irb/completor.rb | Ruby | mit | 94 | main | 10,994 | # frozen_string_literal: true
require_relative 'type_analyzer'
require 'irb'
require 'prism'
module KatakataIrb::Completor
HIDDEN_METHODS = %w[Namespace TypeName] # defined by rbs, should be hidden
singleton_class.attr_accessor :prev_analyze_result
def self.candidates_from_result(result)
candidates = case ... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | lib/katakata_irb/type_analyzer.rb | Ruby | mit | 94 | main | 46,107 | # frozen_string_literal: true
require 'set'
require_relative 'types'
require_relative 'scope'
require 'prism'
class KatakataIrb::TypeAnalyzer
class DigTarget
def initialize(parents, receiver, &block)
@dig_ids = parents.to_h { [_1.__id__, true] }
@target_id = receiver.__id__
@block = block
... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | lib/katakata_irb/types.rb | Ruby | mit | 94 | main | 14,964 | # frozen_string_literal: true
module KatakataIrb; end
module KatakataIrb::Types
singleton_class.attr_reader :rbs_builder, :rbs_load_error
def self.preload_in_thread
@loader_thread ||= Thread.new do
@rbs_builder = load_rbs_builder
end
end
def self.load_rbs_builder
require 'rbs'
require '... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | lib/katakata_irb/scope.rb | Ruby | mit | 94 | main | 12,365 | # frozen_string_literal: true
require 'set'
require_relative 'types'
module KatakataIrb
OBJECT_SINGLETON_CLASS_METHOD = Object.instance_method(:singleton_class)
OBJECT_INSTANCE_VARIABLES_METHOD = Object.instance_method(:instance_variables)
OBJECT_INSTANCE_VARIABLE_GET_METHOD = Object.instance_method(:instance_... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | test/test_completion.rb | Ruby | mit | 94 | main | 3,724 | # frozen_string_literal: true
require 'test_helper'
KatakataIrb::Types.preload_in_thread.join
class TestCompletor < Minitest::Test
def empty_binding() = binding
def assert_completion(code, binding: empty_binding, include: nil, exclude: nil)
raise ArgumentError if include.nil? && exclude.nil?
result = Kat... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | test/test_type.rb | Ruby | mit | 94 | main | 3,852 | # frozen_string_literal: true
require 'test_helper'
class TestType < Minitest::Test
def test_type_inspect
true_type = KatakataIrb::Types::TRUE
false_type = KatakataIrb::Types::FALSE
nil_type = KatakataIrb::Types::NIL
string_type = KatakataIrb::Types::STRING
true_or_false = KatakataIrb::Types::Un... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | test/test_helper.rb | Ruby | mit | 94 | main | 204 | # frozen_string_literal: true
require "simplecov"
SimpleCov.start
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "katakata_irb"
require "minitest/autorun"
KatakataIrb.log_output = STDOUT |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | test/test_type_analyze.rb | Ruby | mit | 94 | main | 35,433 | # frozen_string_literal: true
require 'test_helper'
KatakataIrb::Types.preload_in_thread.join
class TestTypeAnalyze < Minitest::Test
def empty_binding() = binding
def analyze(code, binding: nil)
KatakataIrb::Completor.analyze(code, binding || empty_binding)
end
def assert_analyze_type(code, type, token ... |
github | tompng/katakata_irb | https://github.com/tompng/katakata_irb | test/test_scope.rb | Ruby | mit | 94 | main | 3,201 | # frozen_string_literal: true
require 'test_helper'
class TestScope < Minitest::Test
Types = KatakataIrb::Types
RootScope = KatakataIrb::RootScope
Scope = KatakataIrb::Scope
NIL = Types::NIL
A, B, C, D, E, F, G, H, I, J, K = ('A'..'K').map do |name|
klass = Class.new
klass.define_singleton_method(:i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.