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 | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/subversion.rb | Ruby | apache-2.0 | 87 | master | 5,147 | class Subversion
end
require 'builder_error'
require 'subversion/changeset_log_parser'
require 'subversion/info_parser'
require 'subversion/log_parser'
require 'subversion/propget_parser'
require 'subversion/update_parser'
class Subversion
include CommandLine
attr_accessor :url, :path, :username, :password, :che... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/git.rb | Ruby | apache-2.0 | 87 | master | 3,448 | require 'rubygems'
require 'grit'
class GitRevision < Revision
attr_accessor :commit,:message
def initialize(commit)
@commit = commit
end
def number
@commit.id_abbrev
end
def committed_by
@commit.author
end
def committed_by
@commit.committer
end
def time
@commit.autho... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/project_blocker.rb | Ruby | apache-2.0 | 87 | master | 401 | class ProjectBlocker
def self.block(project)
lock_for(project).lock
end
def self.blocked?(project)
lock_for(project).locked?
end
def self.release(project)
lock_for(project).release
end
private
def self.lock_for(project)
lock_file = File.expand_path(File.join(project.path, "bu... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/platform.rb | Ruby | apache-2.0 | 87 | master | 1,331 | require 'rbconfig'
module Platform
def family
target_os = Config::CONFIG["target_os"] or raise 'Cannot determine operating system'
case target_os
when /linux/, /Linux/ then 'linux'
when /32/ then 'mswin32'
when /darwin/ then 'powerpc-darwin'
when /cyg/ then 'cygwin'
when /solaris/ then '... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/commands/cruise_plugin.rb | Ruby | apache-2.0 | 87 | master | 23,740 | # Cruise Plugin Manager (modified from the Rails Plugin Manager).
#
# Listing available plugins:
#
# $ ./script/plugin list
# continuous_builder http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder
# asset_timestamping http://svn.aviditybytes.com/rails/plugins/asset_timestamping
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/tasks/package.rake | Ruby | apache-2.0 | 87 | master | 227 | Rake::PackageTask.new("cruisecontrolrb", CruiseControl::VERSION::STRING) do |p|
p.need_tar = true
p.need_zip = true
p.package_files.include("**/*").exclude("log/**").exclude("tmp/**").exclude("doc/**").exclude("pkg")
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/tasks/cruise.rake | Ruby | apache-2.0 | 87 | master | 468 | desc 'Continuous build target'
task :cruise do
out = ENV['CC_BUILD_ARTIFACTS']
mkdir_p out unless File.directory? out if out
ENV['SHOW_ONLY'] = 'models,lib,helpers'
Rake::Task["test:units:rcov"].invoke
mv 'coverage/units', "#{out}/unit test coverage" if out
ENV['SHOW_ONLY'] = 'controllers'
Rake::Task[... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/tasks/doc_rubyforge.rake | Ruby | apache-2.0 | 87 | master | 268 | namespace :doc do
task :rubyforge do
gem 'webgen'
images_dir = 'doc/rubyforge_site/src/images'
mkdir images_dir if !File.directory? images_dir
cp Dir.glob('public/images/*'), images_dir
puts `webgen -d doc/rubyforge_site`
end
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/tasks/release.rake | Ruby | apache-2.0 | 87 | master | 591 | desc "Publish the release files to RubyForge. May not work."
task :release do
#task :release => [ :package ] do
require 'rubyforge'
options = {"cookie_jar" => RubyForge::COOKIE_F}
puts "Enter rubyforge password:"
options["password"] = $stdin.gets.strip
ruby_forge = RubyForge.new(File.dirname(__FILE__) + "/co... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/subversion/propget_parser.rb | Ruby | apache-2.0 | 87 | master | 409 | class Subversion::PropgetParser
def parse(lines)
directories = {}
current_dir = nil
lines.each do |line|
split = line.split(" - ")
if split.length > 1
current_dir = split[0]
line = split[1]
end
split = line.split(" ")
directories["#{current_dir}/#{split[0]}"] ... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/subversion/info_parser.rb | Ruby | apache-2.0 | 87 | master | 254 | require 'xml_simple'
class Subversion::InfoParser
def parse(xml)
info = XmlSimple.xml_in(xml.to_s, 'ForceArray' => false)['entry']
Subversion::Info.new(info['revision'].to_i, info['commit']['revision'].to_i, info['commit']['author'])
end
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/subversion/update_parser.rb | Ruby | apache-2.0 | 87 | master | 320 | class Subversion::UpdateParser
UPDATE_PATTERN = /^(...) (\S.*)$/
def parse(lines)
lines[0..-2].collect do |line|
match = UPDATE_PATTERN.match(line)
if match
operation, file = match[1..2]
ChangesetEntry.new(operation, file)
else
nil
end
end.compact
end
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/subversion/log_parser.rb | Ruby | apache-2.0 | 87 | master | 661 | require 'date'
require 'xml_simple'
class Subversion::LogParser
def parse(lines)
return [] if lines.empty?
entries = XmlSimple.xml_in(lines.join, 'ForceArray' => ['logentry','path'])['logentry'] || []
entries.map {|entry| parse_revision(entry) }
end
private
def parse_revision(hash)
changese... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/subversion/changeset_log_parser.rb | Ruby | apache-2.0 | 87 | master | 1,069 | class Subversion::ChangesetLogParser
def parse_log(lines)
return [] if lines.empty?
revisions = []
begin
while not lines.empty?
revision = parse_revision(lines)
revisions << revision
end
rescue
# Do nothing, the changeset is malformed.
end
revisions
end
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/builder_plugins/project_logger.rb | Ruby | apache-2.0 | 87 | master | 1,277 | #
# this plugin logs build events to a project log file in logs/<project name>_builder.log
#
# (this plugin is built in and needs no customization)
#
class ProjectLogger
def initialize(project)
end
def build_started(build)
CruiseControl::Log.event("Build #{build.label} started")
end
def build_finishe... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/builder_plugins/minimal_console_logger.rb | Ruby | apache-2.0 | 87 | master | 945 | # this plugin prints major events like builds starting / passing / failing to console
#
# it is useful in debugging
#
# (this plugin is built in and needs no customization)
#
class MinimalConsoleLogger
def initialize(project)
end
def build_started(build)
puts "Build #{build.label} started"
end
def bui... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/builder_plugins/builder_status.rb | Ruby | apache-2.0 | 87 | master | 1,691 | #
# this plugin allows the dashboard to know each builder's status and report it
#
# (this plugin is built in and needs no customization)
#
class BuilderStatus
def initialize(project)
@project = project
end
def status
if builder_down?
'builder_down'
else
read_status
end
end
def f... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/builder_plugins/email_notifier.rb | Ruby | apache-2.0 | 87 | master | 2,376 | # CruiseControl.rb can send email notices whenever build is broken or fixed. To make it happen, you need to tell it how
# to send email, and who to send it to. Do the following:
#
# 1. Configure SMTP server connection. Open <em>[cruise data]</em>/config/site_config.rb,
# read the comments in it and edit accord... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/builder_plugins/build_reaper.rb | Ruby | apache-2.0 | 87 | master | 603 | # this plugin will delete builds that are no longer wanted, configure it by setting
#
# Configuration.number_of_builds_to_keep = 20
#
# in site_config.rb
#
require 'fileutils'
class BuildReaper
cattr_accessor :number_of_builds_to_keep
def initialize(project)
@project = project
end
def build_finished(bui... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/builder_plugins/log_publisher.rb | Ruby | apache-2.0 | 87 | master | 740 | #
# this plugin will publish logs from your project into the build directory after a build finishes
# by default, it will publish files it finds that match the pattern
#
# <pre><code>log/*log</code></pre>
#
# but it can be configured to match any number of patterns like this
#
# <pre><code>project.log_publisher.globs... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/cruise_control/version.rb | Ruby | apache-2.0 | 87 | master | 200 | module CruiseControl
module VERSION #:nodoc:
unless defined? MAJOR
MAJOR = 1
MINOR = 3
MAINTENANCE = 0
STRING = [MAJOR, MINOR, MAINTENANCE].join('.')
end
end
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | lib/cruise_control/log.rb | Ruby | apache-2.0 | 87 | master | 1,596 | module CruiseControl
class Log
def self.verbose=(verbose)
@verbose = verbose
end
def self.verbose?
@verbose or false
end
def self.event(description, severity = :info)
return if severity == :debug and not @verbose
message = "[#{Time.now.strftime('%Y-%m-%d %H:%M:%... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/routes.rb | Ruby | apache-2.0 | 87 | master | 1,165 | ActionController::Routing::Routes.draw do |map|
map.home '', Configuration.default_page
map.resources :projects
map.builds_drop_down 'builds/older/:project', :controller => 'builds', :action => 'drop_down'
map.project_without_builds 'builds/:project', :controller => 'builds', :action => 'show'
map.build ... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/boot.rb | Ruby | apache-2.0 | 87 | master | 2,131 | # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
def find_home
['HOME', 'USERPROFILE'].each do |homekey|
return ENV[homekey] if ENV[homekey]
end
if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
end
begin
Fi... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/environment.rb | Ruby | apache-2.0 | 87 | master | 2,929 | # Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# CC.rb: this line should stay commented out
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when v... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/dashboard_initialize.rb | Ruby | apache-2.0 | 87 | master | 286 | site_css = CRUISE_DATA_ROOT + "/site.css"
if File.exists?(site_css)
File.open(RAILS_ROOT + "/public/stylesheets/site.css", "w") do |f|
f << "/* this is a copy of #{site_css}, please make any changes to it there */\n\n"
f << File.read(CRUISE_DATA_ROOT + "/site.css")
end
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/configuration.rb | Ruby | apache-2.0 | 87 | master | 1,386 | class Configuration
@default_page = {:controller => 'projects', :action => 'index'}
@default_polling_interval = 20.seconds
@sleep_after_build_loop_error = 30.seconds
@build_request_checking_interval = 5.seconds
@dashboard_refresh_interval = 5.seconds
@dashboard_url = nil
@email_from = 'cruisecontrol@thoug... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/environments/builder.rb | Ruby | apache-2.0 | 87 | master | 304 | config.cache_classes = true
config.log_path = CRUISE_OPTIONS[:log_file_name] || 'log/builder_WITHOUT_A_NAME.log'
config.log_level = CRUISE_OPTIONS[:verbose] ? :debug : :info
config.after_initialize do
require CRUISE_DATA_ROOT + '/site_config' if File.exists?(CRUISE_DATA_ROOT + "/site_config.rb")
end |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/environments/development.rb | Ruby | apache-2.0 | 87 | master | 1,155 | # Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/environments/production.rb | Ruby | apache-2.0 | 87 | master | 1,052 | # Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/environments/test.rb | Ruby | apache-2.0 | 87 | master | 879 | # Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | config/recipes/cruisecontrol.rb | Ruby | apache-2.0 | 87 | master | 1,061 | Capistrano::Configuration.instance(:must_exist).load do
namespace :deploy do
desc 'deploy CC.rb'
task :default do
stop_ccrb
update_code
after_update_code
symlink
start_ccrb
end
task :rollback do
stop_ccrb
rollback_code
symlink
start_ccrb
... |
github | benburkert/cruisecontrolrb | https://github.com/benburkert/cruisecontrolrb | tasks/cc_build.rake | Ruby | apache-2.0 | 87 | master | 2,480 | module CruiseControl
def self.invoke_rake_task(task_name)
puts "[CruiseControl] Invoking Rake task #{task_name.inspect}"
Rake::Task[task_name].invoke
end
# This hack is needed because db:test:purge implementation for MySQL drops the test database, invalidating
# the existing connection. A solution is ... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | Rakefile | Ruby | mit | 87 | main | 217 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new('rubocop')
task default: %i[spec rubocop] |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | event_sourcery.gemspec | Ruby | mit | 87 | main | 1,504 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'event_sourcery/version'
Gem::Specification.new do |spec|
spec.name = 'event_sourcery'
spec.version = EventSourcery::VERSION
spec.authors = ['Envato']
spec.em... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/spec_helper.rb | Ruby | mit | 87 | main | 4,939 | # frozen_string_literal: true
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to expl... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_body_serializer_spec.rb | Ruby | mit | 87 | main | 2,452 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventBodySerializer do
let(:submitted_by_uuid) { SecureRandom.uuid }
let(:submitted_at) { Time.now.utc }
describe '.serialize' do
subject(:serialize) { described_class.serialize(event_body) }
context 'when event body contains a Time object' do... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_spec.rb | Ruby | mit | 87 | main | 15,184 | # frozen_string_literal: true
RSpec.describe EventSourcery::Event do
let(:aggregate_id) { 'aggregate_id' }
let(:type) { 'type' }
let(:version) { 1 }
let(:body) do
{
symbol: 'value'
}
end
let(:uuid) { SecureRandom.uuid }
describe '#initialize' do
subject(:initializer) { described_class.... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/repository_spec.rb | Ruby | mit | 87 | main | 2,862 | # frozen_string_literal: true
RSpec.describe EventSourcery::Repository do
let(:event_store) { EventSourcery::Memory::EventStore.new }
let(:event_sink) { EventSourcery::EventStore::EventSink.new(event_store) }
let(:aggregate_id) { SecureRandom.uuid }
let(:aggregate_class) do
Class.new do
include Event... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/config_spec.rb | Ruby | mit | 87 | main | 639 | # frozen_string_literal: true
RSpec.describe EventSourcery::Config do
subject(:config) { described_class.new }
describe '#on_event_processor_critical_error' do
subject(:on_event_processor_critical_error) { config.on_event_processor_critical_error }
it 'has a default block set' do
expect(on_event_pr... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/aggregate_root_spec.rb | Ruby | mit | 87 | main | 4,117 | # frozen_string_literal: true
RSpec.describe EventSourcery::AggregateRoot do
def new_aggregate(id,
on_unknown_event: EventSourcery.config.on_unknown_event,
&block)
Class.new do
include EventSourcery::AggregateRoot
def initialize(id,
events... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_processing/event_stream_processor_registry_spec.rb | Ruby | mit | 87 | main | 1,159 | # frozen_string_literal: true
module MyProjector
def self.included(base)
base.send(:include, EventSourcery::EventProcessing::EventStreamProcessor)
end
end
module MyReactor
def self.included(base)
base.send(:include, EventSourcery::EventProcessing::EventStreamProcessor)
end
end
RSpec.describe EventSou... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_processing/esp_runner_spec.rb | Ruby | mit | 87 | main | 8,680 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventProcessing::ESPRunner do
subject(:esp_runner) do
described_class.new(
event_processors: event_processors,
event_source: event_source,
max_seconds_for_processes_to_terminate: 0.01,
shutdown_requested: shutdown_requested,
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_processing/event_stream_processor_spec.rb | Ruby | mit | 87 | main | 9,618 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventProcessing::EventStreamProcessor do
let(:tracker) { EventSourcery::Memory::Tracker.new }
def new_event_processor(&block)
Class.new do
include EventSourcery::EventProcessing::EventStreamProcessor
attr_reader :events
def initial... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_processing/esp_process_spec.rb | Ruby | mit | 87 | main | 3,355 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventProcessing::ESPProcess do
subject(:esp_process) do
described_class.new(
event_processor: esp,
event_source: event_source,
subscription_master: subscription_master,
after_fork: after_fork
)
end
let(:esp) { spy(:esp, p... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_processing/error_handlers/constant_retry_spec.rb | Ruby | mit | 87 | main | 2,461 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventProcessing::ErrorHandlers::ConstantRetry do
subject(:error_handler) do
described_class.new(
processor_name: processor_name
)
end
let(:processor_name) { 'processor_name' }
let(:on_event_processor_error) { spy }
let(:logger) { spy(L... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_processing/error_handlers/exponential_backoff_retry_spec.rb | Ruby | mit | 87 | main | 4,101 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventProcessing::ErrorHandlers::ExponentialBackoffRetry do
subject(:error_handler) do
described_class.new(
processor_name: processor_name
)
end
let(:processor_name) { 'processor_name' }
let(:on_event_processor_error) { spy }
let(:logge... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_processing/error_handlers/no_retry_spec.rb | Ruby | mit | 87 | main | 2,204 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventProcessing::ErrorHandlers::NoRetry do
subject(:error_handler) do
described_class.new(
processor_name: processor_name
)
end
let(:processor_name) { 'processor_name' }
let(:on_event_processor_error) { spy }
let(:logger) { spy(Logger)... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_store/poll_waiter_spec.rb | Ruby | mit | 87 | main | 317 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventStore::PollWaiter do
subject(:poll_waiter) { described_class.new(interval: 0) }
it 'calls the block and sleeps' do
count = 0
poll_waiter.poll do
count += 1
throw :stop if count == 3
end
expect(count).to eq 3
end
end |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_store/signal_handling_subscription_master_spec.rb | Ruby | mit | 87 | main | 794 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventStore::SignalHandlingSubscriptionMaster do
subject(:subscription_master) { described_class.new }
describe 'shutdown_if_requested' do
subject(:shutdown_if_requested) { subscription_master.shutdown_if_requested }
before do
allow(Signal)... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_store/event_source_spec.rb | Ruby | mit | 87 | main | 631 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventStore::EventSource do
let(:event_store) { double(:event_store) }
subject(:event_source) { described_class.new(adapter) }
describe 'adapter delegations' do
let(:adapter) { double }
%w[
get_next_from
latest_event_id
get_ev... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_store/event_builder_spec.rb | Ruby | mit | 87 | main | 955 | # frozen_string_literal: true
module EventSourcery
module EventStore
RSpec.describe EventBuilder do
describe '#build' do
let(:event_builder) { EventBuilder.new(event_type_serializer: EventSourcery.config.event_type_serializer) }
describe 'upcasting' do
before do
stub_... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_store/subscription_spec.rb | Ruby | mit | 87 | main | 3,258 | # frozen_string_literal: true
class TestPoller
attr_accessor :times, :after_poll_callback
def initialize(times: 1, after_poll_callback: proc {})
@times = times
@after_poll_callback = after_poll_callback
end
def poll(*_args)
Array(1..times).each do
yield
after_poll_callback.call
en... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_store/event_type_serializers/underscored_spec.rb | Ruby | mit | 87 | main | 1,134 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventStore::EventTypeSerializers::Underscored do
subject(:underscored) { described_class.new }
describe '#serialize' do
it "doesn't handle Event in a special way" do
expect(underscored.serialize(EventSourcery::Event)).to eq 'event_sourcery/even... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/event_store/event_type_serializers/class_name_spec.rb | Ruby | mit | 87 | main | 1,117 | # frozen_string_literal: true
RSpec.describe EventSourcery::EventStore::EventTypeSerializers::ClassName do
subject(:serializer) { described_class.new }
describe '#serialize' do
it "doesn't handle Event in a special way" do
expect(serializer.serialize(EventSourcery::Event)).to eq 'EventSourcery::Event'
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/memory/tracker_spec.rb | Ruby | mit | 87 | main | 443 | # frozen_string_literal: true
RSpec.describe EventSourcery::Memory::Tracker do
let(:processor_name) { 'test-processor' }
subject(:adapter) { described_class.new }
it 'tracks processed events' do
expect(adapter.last_processed_event_id(processor_name)).to eq 0
adapter.processed_event(processor_name, 1)
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/memory/config_spec.rb | Ruby | mit | 87 | main | 1,063 | # frozen_string_literal: true
RSpec.describe EventSourcery::Memory::Config do
subject(:config) { described_class.new }
context 'when reading the event_store' do
it 'returns a EventSourcery::Memory::EventStore' do
expect(config.event_store).to be_instance_of(EventSourcery::Memory::EventStore)
end
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/memory/projector_spec.rb | Ruby | mit | 87 | main | 2,007 | # frozen_string_literal: true
RSpec.describe EventSourcery::Memory::Projector do
let(:projector_class) do
Class.new do
include EventSourcery::Memory::Projector
processor_name 'test_processor'
end
end
let(:tracker) { EventSourcery::Memory::Tracker.new }
subject(:projector) do
projector... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | spec/event_sourcery/memory/event_store_spec.rb | Ruby | mit | 87 | main | 777 | # frozen_string_literal: true
RSpec.describe EventSourcery::Memory::EventStore do
let(:supports_versions) { false }
let(:event) { EventSourcery::Event.new(type: 'blah', aggregate_id: SecureRandom.uuid, body: {}) }
subject(:event_store) { described_class.new([], event_builder: EventSourcery.config.event_builder) ... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery.rb | Ruby | mit | 87 | main | 2,972 | # frozen_string_literal: true
require 'json'
require 'securerandom'
require 'time'
require 'event_sourcery/version'
require 'event_sourcery/event'
require 'event_sourcery/event_store/event_sink'
require 'event_sourcery/event_store/event_source'
require 'event_sourcery/errors'
require 'event_sourcery/event_store/each_... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/aggregate_root.rb | Ruby | mit | 87 | main | 4,972 | # frozen_string_literal: true
module EventSourcery
#
# EventSourcery::AggregateRoot provides a foundation for writing your own aggregate root classes.
# You can use it by including it in your classes, as show in the example code.
#
# Excerpt from {https://github.com/envato/event_sourcery/blob/HEAD/docs/core-... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/errors.rb | Ruby | mit | 87 | main | 894 | # frozen_string_literal: true
module EventSourcery
Error = Class.new(StandardError)
UnableToLockProcessorError = Class.new(Error)
ConcurrencyError = Class.new(Error)
AtomicWriteToMultipleAggregatesNotSupported = Class.new(Error)
MultipleCatchAllHandlersDefined = Class.new(Error)
# Error raised when event ... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event.rb | Ruby | mit | 87 | main | 5,806 | # frozen_string_literal: true
module EventSourcery
# Represents an Event
class Event
include Comparable
# Event type
#
# Will return `nil` if called on an instance of {EventSourcery::Event}.
def self.type
return if self == Event
EventSourcery.config.event_type_serializer.serialize... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/repository.rb | Ruby | mit | 87 | main | 2,351 | # frozen_string_literal: true
module EventSourcery
# This class provides a set of methods to help load and save aggregate instances.
#
# Refer to {https://github.com/envato/event_sourcery_todo_app/blob/31e200f4a2a65be5d847a66a20e23a334d43086b/app/commands/todo/amend.rb#L26 EventSourceryTodoApp}
# for a more co... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/config.rb | Ruby | mit | 87 | main | 3,324 | # frozen_string_literal: true
require 'logger'
module EventSourcery
# Configuration settings for EventSourcery.
class Config
# The default Proc to be run when an aggregate loads an event type that
# it doesn't know how to handle.
# What's specified here can be overridden when instantiating an aggregat... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_body_serializer.rb | Ruby | mit | 87 | main | 1,960 | # frozen_string_literal: true
module EventSourcery
# EventBodySerializer is used for serializing event bodies when persisting events.
class EventBodySerializer
# Serialize the given event body, with the default or the provided, serializer
#
# @param event_body event body to be serialized
# @param s... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/memory/projector.rb | Ruby | mit | 87 | main | 761 | # frozen_string_literal: true
module EventSourcery
module Memory
# Provides projection functionality for in-memory event processing.
module Projector
def self.included(base)
base.include(EventSourcery::EventProcessing::EventStreamProcessor)
base.include(InstanceMethods)
base.cla... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/memory/config.rb | Ruby | mit | 87 | main | 805 | # frozen_string_literal: true
module EventSourcery
# In-memory implementation for testing and development.
module Memory
# Configuration for in-memory event sourcing components.
class Config
attr_accessor :event_tracker
attr_writer :event_store, :event_source, :event_sink
def initialize
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/memory/tracker.rb | Ruby | mit | 87 | main | 1,567 | # frozen_string_literal: true
module EventSourcery
module Memory
# Being able to know where you're at when reading an event stream
# is important. In here are mechanisms to do so.
class Tracker
# Tracking where you're in an event stream at via an in memory hash.
# Note: This is not persisted ... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/memory/event_store.rb | Ruby | mit | 87 | main | 4,525 | # frozen_string_literal: true
module EventSourcery
module Memory
# In-memory event store.
#
# Note: This is not persisted and is generally used for testing.
class EventStore
include EventSourcery::EventStore::EachByRange
#
# @param events [Array] Optional. Collection of events
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/event_sink.rb | Ruby | mit | 87 | main | 398 | # frozen_string_literal: true
require 'forwardable'
module EventSourcery
module EventStore
# Delegates event storage operations to the underlying event store.
class EventSink
def initialize(event_store)
@event_store = event_store
end
extend Forwardable
def_delegators :event_... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/event_source.rb | Ruby | mit | 87 | main | 569 | # frozen_string_literal: true
module EventSourcery
module EventStore
# Delegates event retrieval operations to the underlying event store.
class EventSource
def initialize(event_store)
@event_store = event_store
end
extend Forwardable
def_delegators :event_store,
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/signal_handling_subscription_master.rb | Ruby | mit | 87 | main | 1,549 | # frozen_string_literal: true
module EventSourcery
module EventStore
# Manages shutdown signals and facilitate graceful shutdowns of subscriptions.
#
# @see Subscription
class SignalHandlingSubscriptionMaster
def initialize
@shutdown_requested = false
setup_graceful_shutdown
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/each_by_range.rb | Ruby | mit | 87 | main | 778 | # frozen_string_literal: true
module EventSourcery
module EventStore
# Provides iteration over events within a specified range.
module EachByRange
def each_by_range(from_event_id, to_event_id, event_types: nil)
caught_up = false
no_events_left = false
event_id = from_event_id
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/poll_waiter.rb | Ruby | mit | 87 | main | 872 | # frozen_string_literal: true
module EventSourcery
module EventStore
# This class provides a basic poll waiter implementation that calls the
# provided block and sleeps for the specified interval, to be used by a
# {Subscription}.
class PollWaiter
#
# @param interval [Float] Optional. Wil... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/event_builder.rb | Ruby | mit | 87 | main | 580 | # frozen_string_literal: true
module EventSourcery
module EventStore
# Builds event objects from serialised event data.
class EventBuilder
def initialize(event_type_serializer:)
@event_type_serializer = event_type_serializer
end
def build(**event_data)
type = event_data.fet... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/subscription.rb | Ruby | mit | 87 | main | 2,603 | # frozen_string_literal: true
module EventSourcery
module EventStore
# This allows Event Stream Processors (ESPs) to subscribe to an event store, and be notified when new events are
# added.
class Subscription
#
# @param event_store Event store to source events from
# @param poll_waiter... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/event_type_serializers/legacy.rb | Ruby | mit | 87 | main | 413 | # frozen_string_literal: true
module EventSourcery
module EventStore
module EventTypeSerializers
# To support legacy implementations. Type is provided when initializing
# the event, not derived from the class constant
class Legacy
def serialize(_event_class)
nil
end
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/event_type_serializers/underscored.rb | Ruby | mit | 87 | main | 2,509 | # frozen_string_literal: true
module EventSourcery
module EventStore
module EventTypeSerializers
# Stores event types by the underscored version of the class name and
# falls back to the generic Event class if the constant is not found
#
# Replace inflector with ActiveSupport like this:
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_store/event_type_serializers/class_name.rb | Ruby | mit | 87 | main | 483 | # frozen_string_literal: true
module EventSourcery
module EventStore
module EventTypeSerializers
# Stores event types by their class name and falls back to the generic
# Event class if the constant is not found
class ClassName
def serialize(event_class)
event_class.name
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/event_stream_processor_registry.rb | Ruby | mit | 87 | main | 1,332 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
# Registry for managing event stream processor classes.
class EventStreamProcessorRegistry
def initialize
@processors = []
end
# Register the class of the Event Stream Processor.
#
# @param klass ... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/esp_runner.rb | Ruby | mit | 87 | main | 3,984 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
# NOTE: databases should be disconnected before running this
# EventSourcery.config.postgres.event_store_database.disconnect
class ESPRunner
def initialize(event_processors:,
event_source:,
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/event_stream_processor.rb | Ruby | mit | 87 | main | 5,362 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
# Module for processing streams of events with customisable handlers.
module EventStreamProcessor
def self.included(base)
base.extend(ClassMethods)
base.include(InstanceMethods)
base.prepend(ProcessHandler... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/esp_process.rb | Ruby | mit | 87 | main | 1,880 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
# Manages the lifecycle of an event stream processor in a dedicated process.
class ESPProcess
DEFAULT_AFTER_FORK = ->(event_processor) {}
def initialize(event_processor:,
event_source:,
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/error_handlers/constant_retry.rb | Ruby | mit | 87 | main | 829 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
module ErrorHandlers
# Strategies for error handling.
class ConstantRetry
include EventSourcery::EventProcessing::ErrorHandlers::ErrorHandler
# The retry interval used with {with_error_handling}.
#
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/error_handlers/no_retry.rb | Ruby | mit | 87 | main | 619 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
module ErrorHandlers
# Error handler that exits the process on error without retrying.
class NoRetry
include EventSourcery::EventProcessing::ErrorHandlers::ErrorHandler
def initialize(processor_name:)
... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/error_handlers/error_handler.rb | Ruby | mit | 87 | main | 849 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
module ErrorHandlers
# Base module for error handling strategies in event processing.
module ErrorHandler
# The default with_error_handling method. Will always raise NotImplementedError
#
# @raise [NotIm... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/event_processing/error_handlers/exponential_backoff_retry.rb | Ruby | mit | 87 | main | 1,722 | # frozen_string_literal: true
module EventSourcery
module EventProcessing
module ErrorHandlers
# Error handler that retries with exponentially increasing delays.
class ExponentialBackoffRetry
include EventSourcery::EventProcessing::ErrorHandlers::ErrorHandler
# The starting value for... |
github | envato/event_sourcery | https://github.com/envato/event_sourcery | lib/event_sourcery/rspec/event_store_shared_examples.rb | Ruby | mit | 87 | main | 12,879 | # frozen_string_literal: true
TestEvent2 = Class.new(EventSourcery::Event)
UserSignedUp = Class.new(EventSourcery::Event)
ItemRejected = Class.new(EventSourcery::Event)
Type1 = Class.new(EventSourcery::Event)
Type2 = Class.new(EventSourcery::Event)
BillingDetailsProvided = Class.new(EventSourcery::Event)
RSpec.shared... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | Rakefile | Ruby | apache-2.0 | 88 | main | 1,007 | require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
#desc 'Generate Vocabularies'
#task :gen_vocabs => %w(ci).map { |v| "lib/intertwingler/#{v}.rb" }
# XXX turn this into a rake task at some point :P
task :vocabs do
require 'rdf/vocab/writer'
# eh... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | intertwingler.gemspec | Ruby | apache-2.0 | 88 | main | 3,950 | # -*- mode: enh-ruby -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'intertwingler/version'
Gem::Specification.new do |spec|
spec.name = 'intertwingler'
spec.version = Intertwingler::VERSION
spec.authors = ['Dorian Taylor']
sp... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | Gemfile | Ruby | apache-2.0 | 88 | main | 914 | source 'https://rubygems.org'
# uggggggggggghhhhhhhh
# gem 'uri-urn', '0.0.5',
# git: 'https://gitlab.com/doriantaylor/uri-urn.git', branch: 'master'
# do this until upstream merges
gem 'mimemagic',
git: 'https://github.com/doriantaylor/rb-mimemagic.git',
branch: 'aliases-etc'
gem 'tty-prompt', '0.23.1',
git... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | experimental/parse-config.rb | Ruby | apache-2.0 | 88 | main | 6,799 | #!/usr/bin/env ruby
# -*- mode: enh-ruby -*-
# third-party rdf
require 'rdf'
require 'rdf/vocab' # dat vocab
require 'rdf/turtle' # to parse input
require 'sparql' # dat algebra, lol
# this should haul in a bunch of stuff
require 'intertwingler/vocab'
require 'intertwingler/graphops'
# save some typing
ITCV = I... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | experimental/how-about-readline.rb | Ruby | apache-2.0 | 88 | main | 526 | #!/usr/bin/env ruby
# -*- mode: enh-ruby -*-
# i was specifically trying to avoid readline
require 'readline'
# typical completion; btw has to be an actual proc, can't be a lambda
Readline.completion_proc = proc do |word|
words = %w[hurr durr lol]
words.grep(/\A#{Regexp.quote word}/)
end
# this is how you get te... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | experimental/stable-fragments.rb | Ruby | apache-2.0 | 88 | main | 9,291 | # This is a little side quest to figure out stable fragment identifiers
# based on RFC9562 §5.8 (UUID v8): https://datatracker.ietf.org/doc/html/rfc9562
#
# What we _want_ are fragment identifiers that can be
# deterministically generated based on a set of immutable facts about
# a particular (RDF) subject. By "immutab... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | experimental/tty-reader.rb | Ruby | apache-2.0 | 88 | main | 1,237 | #!/usr/bin/env ruby
# -*- mode: enh-ruby -*-
# turns out tty-prompt subsumes tty-reader
require 'tty-prompt'
require 'pathname'
prompt = TTY::Prompt.new
reader = prompt.reader
reader.completion_handler = -> path do
path = path.strip
path = ?/ if path.empty?
path = Pathname(path).expand_path
# warn path
u... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | spec/intertwingler_spec.rb | Ruby | apache-2.0 | 88 | main | 1,082 | require 'spec_helper'
###
#
# okay since there is not really anywhere better to do this, here is
# the tentative testing plan:
#
# 1. test the extended graph operations
#
# 2. test the URI resolver
#
# 3. test the document parser (Intertwingler::Document::Parsed)
#
# 4. test the markup analysis/surgery
#
# 4.1 augme... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | spec/intertwingler/graphops_spec.rb | Ruby | apache-2.0 | 88 | main | 977 | require 'spec_helper'
require 'rdf'
require 'intertwingler/graphops'
RSpec.describe Intertwingler::GraphOps do
context 'stateless behaviour' do
# type_strata
# all_related (basically a shorthand for type_strata descend: true)
# type_is?
# property_set (née predicate_set)
# symmetric?
end
co... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | spec/intertwingler/resolver_spec.rb | Ruby | apache-2.0 | 88 | main | 642 | require 'spec_helper'
require 'intertwingler/resolver'
RSpec.describe Intertwingler::Resolver do
context 'stateless methods' do
# preproc
# split_pp
# split_qp
# terminal_slug
end
context 'uuid<->uri resolution methods' do
# uuid_for
# uri_for
end
context 'curie methods' do
# ... |
github | doriantaylor/rb-intertwingler | https://github.com/doriantaylor/rb-intertwingler | spec/intertwingler/transform_spec.rb | Ruby | apache-2.0 | 88 | main | 4,678 | require 'spec_helper'
require 'rdf'
require 'rdf/turtle'
require 'intertwingler/transform'
RSpec.describe Intertwingler::Transform do
root = Pathname(Dir.getwd)
VOCAB = RDF::Vocabulary.new 'tag:makethingsmakesense.com,2020:transform/'
repo = RDF::Repository.new
repo.load root + 'example/transforms.ttl'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.