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 | bmabey/rosetta_queue | https://github.com/bmabey/rosetta_queue | features/support/env.rb | Ruby | mit | 49 | master | 758 | require 'rubygems'
$:.unshift(File.dirname(__FILE__) + '/../../lib')
require 'rosetta_queue'
require 'rosetta_queue/spec_helpers'
require 'spec/expectations'
require 'rosetta_queue/spec_helpers'
CONSUMER_LOG_DIR = File.expand_path(File.dirname(__FILE__) + "/../support/tmp")
begin
RosettaQueue.logger = RosettaQueue:... |
github | bmabey/rosetta_queue | https://github.com/bmabey/rosetta_queue | features/support/sample_consumers.rb | Ruby | mit | 49 | master | 451 | require File.expand_path(File.dirname(__FILE__) + '/env.rb')
class SampleConsumer
include ::RosettaQueue::MessageHandler
subscribes_to :foo
options :durable => true
attr_reader :msg
def on_message(msg)
@msg = msg
puts "MESSAGE #{msg}"
end
end
class SampleConsumerTwo
include ::RosettaQueue::M... |
github | bmabey/rosetta_queue | https://github.com/bmabey/rosetta_queue | features/step_definitions/common_messaging_steps.rb | Ruby | mit | 49 | master | 2,363 | def eval_consumer_class(queue, log_file="point-to-point.log", klass_name=nil)
klass_name = "#{queue.to_s.capitalize}Consumer" if klass_name.nil?
return if Object.const_defined?(klass_name)
options = {}
unless @adapter_type == "stomp"
options = ":ack => true"
else
options = ":ack => 'client'"
end
... |
github | bmabey/rosetta_queue | https://github.com/bmabey/rosetta_queue | features/step_definitions/publish_subscribe_steps.rb | Ruby | mit | 49 | master | 795 | Given /^multiple consumers are listening to queue '(.*)'$/ do |queue|
@managers = []
Thread.new do
@managers << RosettaQueue::ThreadedManager.create do |m|
m.add(eval_consumer_class(queue, "fooconsumer.log", "FooConsumer").new)
m.start
end
end
Thread.new do
@managers << RosettaQueue::Th... |
github | bmabey/rosetta_queue | https://github.com/bmabey/rosetta_queue | features/step_definitions/filtering_steps.rb | Ruby | mit | 49 | master | 530 | Then /^a (receiving|sending) filter is defined to prepend 'Foo' to all messages$/ do |filter_type|
RosettaQueue::Filters.reset
RosettaQueue::Filters.define do |f|
f.send(filter_type) { |message| "Foo #{message}" }
end
end
When /^the message on '(.+)' is consumed$/ do |queue_name|
# TODO
# @consumed_messa... |
github | bmabey/rosetta_queue | https://github.com/bmabey/rosetta_queue | features/step_definitions/point_to_point_steps.rb | Ruby | mit | 49 | master | 617 | Given /^a consumer is listening to queue '(.*)'$/ do |queue|
klass = eval_consumer_class(queue)
@thread = Thread.new do
cons = klass.new
case @adapter_type
when /evented/
EM.run do
RosettaQueue::Consumer.new(cons).receive
end
else
RosettaQueue::Consumer.new(cons).receive
... |
github | galtzo-floss/capistrano_mailer | https://github.com/galtzo-floss/capistrano_mailer | Rakefile | Ruby | mit | 49 | main | 6,842 | # frozen_string_literal: true
# Galtzo FLOSS Rakefile v1.0.2 - 2025-08-12
#
# MIT License (see License.txt)
#
# Copyright (c) 2025 Peter H. Boling (galtzo.com)
#
# Expected to work in any project that uses Bundler.
#
# Sets up tasks for rspec, minitest, rubocop, reek, yard, and stone_checksums.
#
# rake build ... |
github | galtzo-floss/capistrano_mailer | https://github.com/galtzo-floss/capistrano_mailer | capistrano_mailer.gemspec | Ruby | mit | 49 | main | 1,167 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/capistrano_mailer/version', __FILE__)
Gem::Specification.new do |s|
s.name = "capistrano_mailer"
s.version = CapistranoMailer::VERSION
s.authors = ["Peter Boling", "Dave Nolan", "Jason Rust"]
s.description = "Capistrano Deployment Email Notification. ... |
github | galtzo-floss/capistrano_mailer | https://github.com/galtzo-floss/capistrano_mailer | test/build_gem_test.rb | Ruby | mit | 49 | main | 432 | require 'test/unit'
require 'yaml'
require 'rubygems/specification'
class BuildGemTest < Test::Unit::TestCase
def test_build_gem
data = File.read(File.join(File.dirname(__FILE__), '..', 'capistrano_mailer.gemspec'))
spec = nil
if data !~ %r{!ruby/object:Gem::Specification}
Thread.new { spec = eval... |
github | galtzo-floss/capistrano_mailer | https://github.com/galtzo-floss/capistrano_mailer | lib/cap_mailer.rb | Ruby | mit | 49 | main | 8,417 | class CapMailer < ActionMailer::Base
@@default_base_config ||= ActiveSupport::InheritableOptions.new({
:sender_address => %("#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")} Capistrano Deployment" <capistrano.mailer@example... |
github | galtzo-floss/capistrano_mailer | https://github.com/galtzo-floss/capistrano_mailer | lib/capistrano/mailer.rb | Ruby | mit | 49 | main | 1,063 | require 'capistrano_mailer/version'
require 'capistrano'
unless Capistrano::Configuration.respond_to?(:instance)
abort 'capistrano/mailer requires Capistrano 2'
end
require 'capistrano/log_with_awesome'
require 'inline-style'
require 'action_mailer'
require 'cap_mailer'
module Capistrano
class Configuration
... |
github | galtzo-floss/capistrano_mailer | https://github.com/galtzo-floss/capistrano_mailer | lib/capistrano/mailer_recipes.rb | Ruby | mit | 49 | main | 717 | namespace :show do
task :me do
set :task_name, task_call_frames.first.task.fully_qualified_name
end
end
namespace :deploy do
desc "Send email notification of deployment (only send variables you want to be in the email)"
task :notify, :roles => :app do
show.me # this sets the task_name variable
... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | event_sourced_record.gemspec | Ruby | mit | 49 | master | 1,431 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'event_sourced_record/version'
Gem::Specification.new do |spec|
spec.name = "event_sourced_record"
spec.version = EventSourcedRecord::VERSION
spec.authors = ["Francis Hw... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/test_helper.rb | Ruby | mit | 49 | master | 3,308 | require 'rails'
require 'rails/test_help'
require 'rails/generators/test_case'
require 'pry'
require 'mocha/test_unit'
#require 'rails/generators/active_record'
$: << 'lib'
require 'event_sourced_record'
require 'generators/event_sourced_record'
#require 'generators/event_sourced_record/event_sourced_record_generator'
... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/generators/calculator_generator_test.rb | Ruby | mit | 49 | master | 794 | require 'test_helper'
class EventSourcedRecord::CalculatorGeneratorTest < Rails::Generators::TestCase
destination 'tmp/calculator_generator_test'
setup :prepare_destination
tests EventSourcedRecord::CalculatorGenerator
setup do
@generate_calls = Hash.new { |h,k| h[k] = [] }
EventSourcedRecord::Calcula... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/generators/event_sourced_record_generator_test.rb | Ruby | mit | 49 | master | 1,682 | require 'test_helper'
class EventSourcedRecord::EventSourcedRecordGeneratorTest < Rails::Generators::TestCase
destination 'tmp/event_sourced_record_generator_test'
setup :prepare_destination
tests EventSourcedRecord::EventSourcedRecordGenerator
setup do
@generate_calls = Hash.new { |h,k| h[k] = [] }
E... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/generators/observer_generator_test.rb | Ruby | mit | 49 | master | 796 | require 'test_helper'
class EventSourcedRecord::ObserverGeneratorTest < Rails::Generators::TestCase
Destination = 'tmp/observer_generator_test'
destination Destination
setup :prepare_destination
tests EventSourcedRecord::ObserverGenerator
setup do
config_path = File.join(Destination, 'config')
FileU... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/generators/projection_generator_test.rb | Ruby | mit | 49 | master | 1,879 | require 'test_helper'
class EventSourcedRecord::ProjectionGeneratorTest < Rails::Generators::TestCase
destination 'tmp/projection_generator_test'
setup :prepare_destination
tests EventSourcedRecord::ProjectionGenerator
setup do
@generate_calls = Hash.new { |h,k| h[k] = [] }
EventSourcedRecord::Project... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/generators/event_generator_test.rb | Ruby | mit | 49 | master | 1,713 | require 'test_helper'
class EventSourcedRecord::EventGeneratorTest < Rails::Generators::TestCase
destination 'tmp/event_generator_test'
setup :prepare_destination
tests EventSourcedRecord::EventGenerator
setup do
@generate_calls = Hash.new { |h,k| h[k] = [] }
EventSourcedRecord::EventGenerator.any_ins... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/generators/templates/application.rb | Ruby | mit | 49 | master | 287 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module ShampooExpress
class Application < Rails::Application
end
end |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/event_sourced_record/calculator_test.rb | Ruby | mit | 49 | master | 4,526 | require 'test_helper'
class EventSourcedRecord::CalculatorTest < MiniTest::Unit::TestCase
def setup
@event = SubscriptionEvent.creation.create!(
bottles_per_shipment: 1, bottles_purchased: 6, user_id: 12345
)
assert @event.subscription_uuid
end
def test_run_when_the_sourced_record_doesnt_exi... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | test/event_sourced_record/event_test.rb | Ruby | mit | 49 | master | 4,292 | require 'test_helper'
class EventSourcedRecord::EventTest < MiniTest::Unit::TestCase
def test_creation_auto_generates_uuid
event = SubscriptionEvent.creation.new
assert event.subscription_uuid
end
def test_creation_data_assignment
event = SubscriptionEvent.creation.new(
bottles_per_shipment: 1... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/event_sourced_record/calculator.rb | Ruby | mit | 49 | master | 2,710 | class EventSourcedRecord::Calculator
def self.events(*event_symbols)
@event_symbols = event_symbols
end
def self.event_classes
@event_symbols.map { |sym|
Module.const_get(sym.to_s.singularize.camelize)
}
end
def initialize(lookup)
@lookup = lookup
end
def run(options = {})
ins... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/event_sourced_record/event.rb | Ruby | mit | 49 | master | 2,813 | require 'active_record/immutable'
module EventSourcedRecord::Event
include ActiveRecord::Immutable
def self.included(model)
model.cattr_accessor :_event_type_configs
model.extend ClassMethods
model.after_initialize :ensure_data
model.after_initialize :ensure_projection_uuid
model.after_initial... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/event_sourced_record/event/event_type_config.rb | Ruby | mit | 49 | master | 734 | require 'active_model'
class EventSourcedRecord::Event::EventTypeConfig
include ::ActiveModel::Validations::ClassMethods
attr_reader :_validators
def initialize
@_validators = Hash.new { |h,k| h[k] = [] }
@attributes = []
end
def attributes(*attrs)
attrs.present? ? @attributes = attrs : @attri... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record.rb | Ruby | mit | 49 | master | 359 | require 'rails/generators/active_record'
require 'generators/event_sourced_record/event_sourced_record_generator'
require 'generators/event_sourced_record/calculator_generator'
require 'generators/event_sourced_record/event_generator'
require 'generators/event_sourced_record/observer_generator'
require 'generators/even... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/test_unit/service_generator.rb | Ruby | mit | 49 | master | 409 | require 'rails/generators/test_unit'
module TestUnit # :nodoc:
module Generators # :nodoc:
class ServiceGenerator < Base # :nodoc:
source_root File.expand_path('../templates', __FILE__)
check_class_collision suffix: "ServiceTest"
def create_service_files
template 'service_test.rb', Fil... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/projection_generator.rb | Ruby | mit | 49 | master | 1,816 | require 'generators/event_sourced_record'
class EventSourcedRecord::ProjectionGenerator < ActiveRecord::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :attributes,
:type => :array, :default => []
def create_migration_file
ar_major_version = ActiveRecord::VERSION::MAJOR... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/observer_generator.rb | Ruby | mit | 49 | master | 725 | class EventSourcedRecord::ObserverGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
def create_observer_file
template(
'observer.rb',
File.join('app/observers', class_path, "#{file_name}.rb")
)
end
def create_application_observer_hook
appl... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/event_sourced_record_generator.rb | Ruby | mit | 49 | master | 1,415 | class EventSourcedRecord::EventSourcedRecordGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
argument :attributes,
:type => :array, :default => [],
:banner => "field[:type][:index] field[:type][:index]"
check_class_collision
def create_calculator_class
... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/calculator_generator.rb | Ruby | mit | 49 | master | 464 | class EventSourcedRecord::CalculatorGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
argument :attributes,
:type => :array, :default => []
def create_calculator_file
template(
'calculator.rb', File.join('app/services', class_path, "#{file_name}.rb")
... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/event_generator.rb | Ruby | mit | 49 | master | 1,450 | require 'generators/event_sourced_record'
class EventSourcedRecord::EventGenerator < ActiveRecord::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :attributes,
:type => :array, :default => []
def create_migration_file
ar_major_version = ActiveRecord::VERSION::MAJOR
... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/templates/event_migration.ar3.rb | Ruby | mit | 49 | master | 500 | class <%= event_migration_class_name %> < ActiveRecord::Migration
def change
create_table :<%= event_table_name %> do |t|
<% attributes.each do |attribute| -%>
t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
<% end -%>
<% if options[:timestamps] %>
t.timestamps
<% end -%>... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/templates/event_model.rb | Ruby | mit | 49 | master | 367 | <% module_namespacing do -%>
class <%= event_class_name %> < ActiveRecord::Base
include EventSourcedRecord::Event
serialize :data
belongs_to :<%= belongs_to_name %>,
foreign_key: '<%= belongs_to_foreign_key %>', primary_key: 'uuid'
event_type :creation do
# attributes :user_id
#
# validates :... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/templates/projection_model.ar4.rb | Ruby | mit | 49 | master | 545 | <% module_namespacing do -%>
class <%= projection_class_name %> < <%= projection_parent_class_name.classify %>
<% attributes.select(&:reference?).each do |attribute| -%>
belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %>
<% end -%>
has_many :events,
class_name: '<%= event_... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/templates/projection_model.ar3.rb | Ruby | mit | 49 | master | 417 | <% module_namespacing do -%>
class <%= projection_class_name %> < <%= projection_parent_class_name.classify %>
<% attributes.select {|attr| attr.reference? }.each do |attribute| -%>
belongs_to :<%= attribute.name %>
<% end -%>
has_many :events,
class_name: '<%= event_class_name %>',
foreign_key: '<%= has_ma... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/templates/projection_migration.ar3.rb | Ruby | mit | 49 | master | 547 | class <%= projection_migration_class_name %> < ActiveRecord::Migration
def change
create_table :<%= projection_table_name %> do |t|
<% attributes.each do |attribute| -%>
t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
<% end -%>
t.string :uuid
t.timestamps
end
<... |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/event_sourced_record/templates/event_sourced_record.rake | Ruby | mit | 49 | master | 220 | namespace :<%= file_name %> do
task :recalculate => :environment do
<%= projection_class_name %>.all.each do |<%= file_name %>|
<%= calculator_class_name%>.new(<%= file_name %>).run.save!
end
end
end |
github | fhwang/event_sourced_record | https://github.com/fhwang/event_sourced_record | lib/generators/rspec/service_generator.rb | Ruby | mit | 49 | master | 386 | require 'generators/rspec'
module Rspec
module Generators # :nodoc:
class ServiceGenerator < Base # :nodoc:
source_root File.expand_path('../templates', __FILE__)
check_class_collision suffix: "ServiceTest"
def create_service_files
template 'service_spec.rb', File.join('spec/services',... |
github | djanowski/pygmentize | https://github.com/djanowski/pygmentize | pygmentize.gemspec | Ruby | mit | 49 | master | 676 | require "./lib/pygmentize"
Gem::Specification.new do |s|
s.name = "pygmentize"
s.version = Pygmentize::VERSION
s.summary = "A Ruby gem that vendors Pygments"
s.description = "A Ruby gem that vendors Pygments"
s.authors = ["Damian Janowski", "Michel Martens", "... |
github | djanowski/pygmentize | https://github.com/djanowski/pygmentize | lib/pygmentize.rb | Ruby | mit | 49 | master | 767 | require "shellwords"
class Pygmentize
VERSION = "0.0.4"
def self.bin
"/usr/bin/env python #{File.expand_path("../vendor/pygments/pygmentize", File.dirname(__FILE__))}"
end
# generate string of additional options from hash
def self.options_string(options)
opts_string = options.to_a.reduce([]) { |a,i... |
github | djanowski/pygmentize | https://github.com/djanowski/pygmentize | test/pygmentize.rb | Ruby | mit | 49 | master | 843 | # encoding: UTF-8
require File.expand_path("../lib/pygmentize", File.dirname(__FILE__))
require "nokogiri"
require "shellwords"
test "colorizes output" do
output = Pygmentize.process(%Q[{foo: "bar"}], :javascript)
doc = Nokogiri::HTML(output)
assert doc.at_xpath(".//div[@class='highlight']")
assert doc.at_x... |
github | yhirano55/activerecord-explainer | https://github.com/yhirano55/activerecord-explainer | activerecord-explainer.gemspec | Ruby | mit | 49 | master | 1,402 | # frozen_string_literal: true
lib = File.expand_path('./lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'activerecord/explainer/version'
Gem::Specification.new do |s|
s.name = 'activerecord-explainer'
s.version = ActiveRecord::Explainer::VERSION
s.authors = ['... |
github | yhirano55/activerecord-explainer | https://github.com/yhirano55/activerecord-explainer | lib/activerecord/explainer.rb | Ruby | mit | 49 | master | 388 | # frozen_string_literal: true
require 'active_record'
require_relative 'explainer/config'
require_relative 'explainer/version'
begin
require 'rails'
require_relative 'explainer/railtie'
rescue LoadError
nil
end
module ActiveRecord
module Explainer # :nodoc:
def self.configure
yield config
end
... |
github | yhirano55/activerecord-explainer | https://github.com/yhirano55/activerecord-explainer | lib/activerecord/explainer/railtie.rb | Ruby | mit | 49 | master | 413 | # frozen_string_literal: true
module ActiveRecord
module Explainer
class Railtie < ::Rails::Railtie # :nodoc:
config.after_initialize do
ActiveSupport.on_load :active_record do
require_relative 'subscriber'
ActiveRecord::Explainer.config.logger = Rails.logger
ActiveRe... |
github | yhirano55/activerecord-explainer | https://github.com/yhirano55/activerecord-explainer | lib/activerecord/explainer/subscriber.rb | Ruby | mit | 49 | master | 1,652 | require 'active_support/log_subscriber'
module ActiveRecord
module Explainer
class Subscriber < ActiveSupport::LogSubscriber # :nodoc:
def sql(event)
payload = event.payload
return if ignore_payload?(payload) || !ActiveRecord::Base.connection.supports_explain?
# Save `affected_rows... |
github | yhirano55/activerecord-explainer | https://github.com/yhirano55/activerecord-explainer | lib/activerecord/explainer/config.rb | Ruby | mit | 49 | master | 230 | # frozen_string_literal: true
require 'logger'
module ActiveRecord
module Explainer
class Config # :nodoc:
attr_accessor :logger
def initialize
@logger = Logger.new(STDOUT)
end
end
end
end |
github | yhirano55/activerecord-explainer | https://github.com/yhirano55/activerecord-explainer | spec/spec_helper.rb | Ruby | mit | 49 | master | 814 | require 'bundler/setup'
require 'activerecord-explainer'
ActiveRecord::Base.configurations = { 'test' => { 'adapter' => 'sqlite3', 'database' => ':memory:' } }
ActiveRecord::Base.establish_connection(:test)
class User < ActiveRecord::Base; end
class CreateUsers < ActiveRecord::Migration[5.1]
def self.up
create... |
github | yhirano55/activerecord-explainer | https://github.com/yhirano55/activerecord-explainer | spec/activerecord/explainer/subscriber_spec.rb | Ruby | mit | 49 | master | 546 | # frozen_string_literal: true
require 'spec_helper'
require 'activerecord/explainer/subscriber'
RSpec.describe ActiveRecord::Explainer::Subscriber do
before(:context) do
ActiveRecord::Explainer.config.logger = Logger.new(File::NULL)
ActiveRecord::Explainer::Subscriber.attach_to(:active_record)
end
cont... |
github | cesarferreira/react-native-logcat | https://github.com/cesarferreira/react-native-logcat | react-native-logcat.gemspec | Ruby | mit | 48 | master | 1,040 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'react-native-logcat/version'
Gem::Specification.new do |spec|
spec.name = "react-native-logcat"
spec.version = ReactNativeLogCat::VERSION
spec.authors = ["cesar ferreir... |
github | cesarferreira/react-native-logcat | https://github.com/cesarferreira/react-native-logcat | lib/react-native-logcat.rb | Ruby | mit | 48 | master | 885 | require 'open3'
require 'colorize'
module ReactNativeLogCat
def self.add_timestamp(str)
timestamp = Time.now.strftime("%H:%M:%S")
return "[#{timestamp}] #{str}"
end
def self.clean(str)
return str[/^[A-Z]\/.*\):(.*)/,1]
end
def self.transform_line(str)
if str[0..1] == "D/"
return add... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | samovar.gemspec | Ruby | mit | 48 | main | 942 | # frozen_string_literal: true
require_relative "lib/samovar/version"
Gem::Specification.new do |spec|
spec.name = "samovar"
spec.version = Samovar::VERSION
spec.summary = "Samovar is a flexible option parser excellent support for sub-commands and help documentation."
spec.authors = ["Samuel Williams", "Gabriel ... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | gems.rb | Ruby | mit | 48 | main | 462 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
source "https://rubygems.org"
gemspec
group :maintenance, optional: true do
gem "bake-modernize"
gem "bake-gem"
gem "bake-releases"
gem "agent-context"
gem "utopia-project"
end
group :test do
gem "... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/options.rb | Ruby | mit | 48 | main | 4,178 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
require "samovar/options"
describe Samovar::Options do
let(:options) do
subject.parse do
option "-x <value>", "The x factor", default: 2
option "-y <value>", "The y factor"
option "--symbol <va... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/coerce.rb | Ruby | mit | 48 | main | 619 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "samovar"
class Coerce < Samovar::Command
options do
option "--things <array>", "A list of things" do |input|
input.split(/\s*,\s*/)
end
option "--count <integer>", "A number to count", ty... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/nested.rb | Ruby | mit | 48 | main | 3,170 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
require "samovar"
class InnerA < Samovar::Command
options
end
class InnerB < InnerA
options do
option "--help", "Do you need it?"
end
end
class InnerC < InnerB
options do
option "--frobulate", "Zork ... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/one.rb | Ruby | mit | 48 | main | 1,277 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require "samovar/many"
describe Samovar::One do
let(:default) {"1"}
let(:input) {["2", "3", "4"]}
let(:one) {subject.new(:thing, "a thing", default: default)}
it "has string representation" do
expect... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/flags.rb | Ruby | mit | 48 | main | 640 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "samovar/flags"
describe Samovar::Flags do
let(:flags) {subject.new("-f/--flag")}
it "can count flags" do
expect(flags.count).to be == 1
end
it "returns nil when no match" do
result = flags.pars... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/many.rb | Ruby | mit | 48 | main | 1,632 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require "samovar/many"
describe Samovar::Many do
let(:default) {["1", "2", "3"]}
let(:input) {["2", "3", "--else"]}
let(:many) {subject.new(:items, "some items", default: default)}
it "has string repre... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/table.rb | Ruby | mit | 48 | main | 1,293 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require "samovar/table"
require "samovar/options"
describe Samovar::Table do
let(:parent) {subject.new}
let(:table) {subject.new(parent)}
it "can merge options" do
parent << Samovar::Options.parse
tab... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/command.rb | Ruby | mit | 48 | main | 5,532 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require "samovar"
class Bottom < Samovar::Command
self.description = "Create a new teapot package using the specified repository."
one :project_name, "The name of the new project in title-case, e.g. 'My Pr... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/split.rb | Ruby | mit | 48 | main | 1,336 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require "samovar/split"
describe Samovar::Split do
let(:default) {["1", "2", "3"]}
let(:input) {["2", "--", "3"]}
let(:split) {subject.new(:arguments, "arguments", default: default)}
it "has string rep... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/output.rb | Ruby | mit | 48 | main | 965 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "samovar"
require "samovar/output/rows"
require "samovar/output/header"
describe Samovar::Output::Rows do
let(:rows) {subject.new}
it "can check if empty" do
expect(rows).to be(:empty?)
end
it "ca... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/error.rb | Ruby | mit | 48 | main | 1,173 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "samovar"
describe Samovar::InvalidInputError do
let(:command) {Samovar::Command.new}
it "can create an error with invalid input" do
error = Samovar::InvalidInputError.new(command, ["--unknown-flag"])... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | test/samovar/output/usage_formatter.rb | Ruby | mit | 48 | main | 3,781 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "samovar"
describe Samovar::Output::UsageFormatter do
let(:output) {StringIO.new}
with "basic command" do
let(:command_class) do
Class.new(Samovar::Command) do
self.description = "Test command ... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/failure.rb | Ruby | mit | 48 | main | 218 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2023, by Samuel Williams.
module Samovar
# Represents a runtime failure in command execution.
class Failure < RuntimeError
end
end |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/one.rb | Ruby | mit | 48 | main | 2,379 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2023, by Samuel Williams.
module Samovar
# Represents a single positional argument in a command.
#
# A `One` parser extracts exactly one argument from the command line that matches the specified pattern.
class One
# Initialize a ... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/nested.rb | Ruby | mit | 48 | main | 2,917 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2023, by Samuel Williams.
module Samovar
# Represents nested sub-commands in a command.
#
# A `Nested` parser allows you to define multiple sub-commands that can be invoked from the parent command.
class Nested
# Initialize a new... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/flags.rb | Ruby | mit | 48 | main | 5,798 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
module Samovar
# Represents a collection of flag alternatives for an option.
#
# Flags parse text like `-f/--flag <value>` into individual flag parsers.
class Flags
# Initialize a new flags parser.
#
... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/many.rb | Ruby | mit | 48 | main | 2,581 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2023, by Samuel Williams.
module Samovar
# Represents multiple positional arguments in a command.
#
# A `Many` parser extracts all arguments from the command line until it encounters a stop pattern (typically an option flag).
class... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/command.rb | Ruby | mit | 48 | main | 7,027 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require_relative "table"
require_relative "options"
require_relative "nested"
require_relative "one"
require_relative "many"
require_relative "split"
require_relative "output"
require_relative "error"
modul... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/version.rb | Ruby | mit | 48 | main | 200 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
# Copyright, 2018, by Gabriel Mazetto.
# @namespace
module Samovar
VERSION = "2.4.1"
end |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/options.rb | Ruby | mit | 48 | main | 4,422 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
require_relative "option"
module Samovar
# Represents a collection of command-line options.
#
# Options provide a DSL for defining multiple option flags in a single block.
class Options
# Parse and crea... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/error.rb | Ruby | mit | 48 | main | 1,688 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
module Samovar
# The base class for all Samovar errors.
class Error < StandardError
end
# Raised when invalid input is provided on the command line.
class InvalidInputError < Error
# Initialize a new i... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/option.rb | Ruby | mit | 48 | main | 3,923 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require_relative "flags"
require_relative "error"
module Samovar
# Represents a single command-line option.
#
# An option is a flag-based argument that can have various forms (short, long, with or without ... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/table.rb | Ruby | mit | 48 | main | 3,164 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
module Samovar
# Represents a table of parsing rows for a command.
#
# A table manages the collection of options, arguments, and nested commands that define how to parse a command line.
class Table
# Cre... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/split.rb | Ruby | mit | 48 | main | 2,529 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2025, by Samuel Williams.
module Samovar
# Represents a split point in the command-line arguments.
#
# A `Split` parser divides the argument list at a marker (typically `--`), allowing you to separate arguments meant for your comman... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/output/row.rb | Ruby | mit | 48 | main | 897 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
module Samovar
module Output
# Represents a row in usage output.
#
# Rows display formatted option or argument information with proper column alignment.
class Row < Array
# Initialize a new row.
... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/output/header.rb | Ruby | mit | 48 | main | 886 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2023, by Samuel Williams.
module Samovar
module Output
# Represents a header row in usage output.
#
# Headers display command names and their descriptions.
class Header
# Initialize a new header.
#
# @parameter name ... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/output/rows.rb | Ruby | mit | 48 | main | 2,408 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require_relative "header"
require_relative "columns"
require_relative "row"
module Samovar
module Output
# Represents a collection of rows for usage output.
#
# Manages hierarchical usage information w... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/output/usage_formatter.rb | Ruby | mit | 48 | main | 2,452 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require "mapping/model"
require "console/terminal"
require_relative "../error"
require_relative "header"
require_relative "row"
require_relative "rows"
module Samovar
module Output
# Formats and prints u... |
github | ioquatix/samovar | https://github.com/ioquatix/samovar | lib/samovar/output/columns.rb | Ruby | mit | 48 | main | 1,121 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2016-2023, by Samuel Williams.
module Samovar
# Namespace for output formatting classes.
module Output
end
end
module Samovar
module Output
# Represents column widths for aligned output formatting.
#
# Calculates the maximum widt... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | Gemfile | Ruby | mit | 48 | main | 207 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in bigrails-redis.gemspec
gemspec
gem "rake"
gem "rspec"
gem "standard"
gem "fakeredis"
gem "connection_pool" |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | bigrails-redis.gemspec | Ruby | mit | 48 | main | 1,000 | # frozen_string_literal: true
require_relative "lib/big_rails/redis/version"
Gem::Specification.new do |spec|
spec.name = "bigrails-redis"
spec.version = BigRails::Redis::VERSION
spec.authors = ["Ngan Pham"]
spec.email = ["ngan@users.noreply.github.com"]
spec.summary = "Redis connection manager for Rails a... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | lib/big_rails/redis.rb | Ruby | mit | 48 | main | 341 | # frozen_string_literal: true
require_relative "redis/version"
require "active_support"
module BigRails
module Redis
extend ActiveSupport::Autoload
autoload :ApplicationExtension
autoload :Builder
autoload :Configuration
autoload :ConfigurationDsl
autoload :Registry
end
end
require "big_... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | lib/big_rails/redis/configuration_dsl.rb | Ruby | mit | 48 | main | 718 | # frozen_string_literal: true
module BigRails
module Redis
class ConfigurationDsl
FILENAME = "redis.rb"
attr_reader :__configurations
def self.resolve
new.__configurations
end
def initialize
@__configurations = {}
file = File.join(Rails.application.paths[... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | lib/big_rails/redis/builder.rb | Ruby | mit | 48 | main | 1,348 | # frozen_string_literal: true
require "redis"
require "redis/distributed"
module BigRails
module Redis
class Builder
class << self
def call(options)
config = Configuration.new(options)
if config.pool_options.any?
ensure_connection_pool_added!
::Connect... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | lib/big_rails/redis/registry.rb | Ruby | mit | 48 | main | 2,097 | # frozen_string_literal: true
module BigRails
module Redis
class Registry
class UnknownConnection < StandardError
end
class VerificationError < StandardError
end
attr_accessor :builder
def initialize
@connections = {}
@wrapped_connections = {}
@build... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | lib/big_rails/redis/configuration.rb | Ruby | mit | 48 | main | 608 | require "active_support/cache/redis_cache_store"
module BigRails
module Redis
class Configuration
attr_reader :redis_options
attr_reader :pool_options
attr_reader :urls
def initialize(redis_options)
@redis_options = redis_options
@urls = Array(redis_options.delete(:url))
... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | spec/spec_helper.rb | Ruby | mit | 48 | main | 467 | # frozen_string_literal: true
require "bigrails-redis"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
Dir[File.... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | spec/big_rails/redis/registry_spec.rb | Ruby | mit | 48 | main | 2,694 | # frozen_string_literal: true
RSpec.describe BigRails::Redis::Registry do
subject(:instance) { described_class.new }
before { load_config("simple") }
describe "#for" do
context "when name is not valid" do
it "raises error" do
expect {
instance.for("foo")
}.to raise_error(des... |
github | rubyatscale/bigrails-redis | https://github.com/rubyatscale/bigrails-redis | spec/support/fixtures.rb | Ruby | mit | 48 | main | 440 | # frozen_string_literal: true
require "pathname"
require "ostruct"
module Spec
module Support
module Fixtures
def load_config(type)
allow(Rails).to receive(:application).and_return(
OpenStruct.new(paths: {
"config" => [Pathname.new("spec/fixtures/#{type}").expand_path]
... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | metadata.rb | Ruby | apache-2.0 | 48 | main | 552 | name 'memcached'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Installs memcached and includes memcached_instance resource for setting up memcached instances'
source_url 'https://github.com/sous-chefs/memcached'
issues_url ... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | resources/memcached_instance.rb | Ruby | apache-2.0 | 48 | main | 3,948 | #
# Cookbook:: memcached
# resource:: memcached_instance
#
# Author:: Tim Smith <tsmith@chef.io>
# Copyright:: 2016-2020, Chef Software, Inc.
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | libraries/helpers.rb | Ruby | apache-2.0 | 48 | main | 2,790 | module Memcached
module Helpers
def service_user
value_for_platform_family(
%w(suse fedora rhel amazon) => 'memcached',
'debian' => 'memcache',
'default' => 'nobody'
)
end
def service_group
value_for_platform_family(
%w(suse fedora rhel amazon) => 'memcac... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | test/integration/default/default_spec.rb | Ruby | apache-2.0 | 48 | main | 744 | describe package('memcached') do
it { should be_installed }
end
describe service('memcached') do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end
describe port(11_211) do
it { should be_listening }
end
memcache_user =
if os.family == 'redhat'
'memcached'
else
'me... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | test/integration/instance/instance_spec.rb | Ruby | apache-2.0 | 48 | main | 2,106 | describe package('memcached') do
it { should be_installed }
end
%w(
memcached_backend_cache
memcached_web_cache
memcached_painful_cache
memcached_socket
).each do |memcached_srv|
describe service memcached_srv do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | recipes/_package.rb | Ruby | apache-2.0 | 48 | main | 1,206 | #
# Cookbook:: memcached
# Recipe:: default
#
# Copyright:: 2009-2016, Chef Software, Inc.
# Copyright:: 2020, Oregon State University
#
# 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
#
# ... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | recipes/default.rb | Ruby | apache-2.0 | 48 | main | 1,318 | #
# Cookbook:: memcached
# Recipe:: default
#
# Copyright:: 2009-2016, Chef Software, Inc.
#
# 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
#... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | attributes/default.rb | Ruby | apache-2.0 | 48 | main | 1,265 | #
# Cookbook:: memcached
# Attributes:: default
#
# Copyright:: 2009-2016, Chef Software, Inc.
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.