repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/configuration.rb | lib/tapp/configuration.rb | module Tapp
class Configuration
attr_accessor :default_printer, :report_caller
def initialize
reset
end
def reset
self.default_printer = :pretty_print
self.report_caller = false
end
end
end
| ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/printer.rb | lib/tapp/printer.rb | require 'singleton'
module Tapp
module Printer
@printers = {}
class << self
def register(name, printer)
@printers[name] = printer
end
def instance(name)
@printers.fetch(name).instance
end
end
class Base
include Singleton
def print(*args)
... | ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/util.rb | lib/tapp/util.rb | module Tapp
module Util
module_function
def report_called
inner, outer = caller.partition {|line|
line =~ %r(/lib/tapp/(?!turnip))
}
method_quoted = inner.last.split(':in').last.strip
puts "#{method_quoted} in #{outer.first}"
end
end
end
| ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/printer/puts.rb | lib/tapp/printer/puts.rb | require 'tapp/printer'
module Tapp::Printer
class Puts < Base
def print(*args)
puts(*args)
end
end
register :puts, Puts
end
| ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/printer/pretty_print.rb | lib/tapp/printer/pretty_print.rb | require 'tapp/printer'
module Tapp::Printer
class PrettyPrint < Base
def print(*args)
require 'pp'
self.class.class_eval do
remove_method :print
def print(*args)
pp(*args)
end
end
print(*args)
end
end
register :pretty_print, PrettyPrint
end
| ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/spec/spec_helper.rb | spec/spec_helper.rb | require "jet_black/rspec"
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_... | ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/spec/black_box/rails_app_spec.rb | spec/black_box/rails_app_spec.rb | require "jet_black"
RSpec.describe "Using Discoball in a Rails app" do
let(:session) do
JetBlack::Session.new(options: { clean_bundler_env: true })
end
it "works with a block" do
create_rails_application
setup_discoball
setup_rspec_rails
install_success_api
setup_controller_action(<<~RU... | ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/spec/lib/capybara_discoball_spec.rb | spec/lib/capybara_discoball_spec.rb | require "capybara_discoball"
require "net/http"
require "sinatra/base"
RSpec.describe Capybara::Discoball do
it "spins up a server" do
example_discoball_app = Class.new(Sinatra::Base) do
get("/") { "success" }
end
server_url = described_class.spin(example_discoball_app)
response = Net::HTTP.ge... | ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/spec/lib/capybara_discoball/runner_spec.rb | spec/lib/capybara_discoball/runner_spec.rb | require "capybara_discoball"
require "sinatra/base"
RSpec.describe Capybara::Discoball::Runner do
describe "when Capybara fails to find an unused port" do
it "retries up to 3 times" do
expected_url = "http://localhost:9999"
allow(Capybara::Discoball::Server).to receive(:new).and_return(
unbo... | ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/lib/capybara_discoball.rb | lib/capybara_discoball.rb | require "capybara_discoball/version"
require "capybara_discoball/server"
require "capybara_discoball/runner"
module Capybara
module Discoball
def self.spin(app, &block)
Runner.new(app, &block).boot
end
end
end
| ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/lib/capybara_discoball/version.rb | lib/capybara_discoball/version.rb | module Capybara
module Discoball
VERSION = "0.1.0"
end
end
| ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/lib/capybara_discoball/retryable.rb | lib/capybara_discoball/retryable.rb | module Capybara
module Discoball
module Retryable
def with_retries(retry_count, *rescuable_exceptions)
yield
rescue *rescuable_exceptions => e
if retry_count > 0
retry_count -= 1
puts e.inspect if ENV.key?("DEBUG")
retry
else
raise
... | ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/lib/capybara_discoball/runner.rb | lib/capybara_discoball/runner.rb | require "capybara"
require_relative "retryable"
module Capybara
module Discoball
class Runner
include Capybara::Discoball::Retryable
RETRY_COUNT = 3
def initialize(server_factory, &block)
@server_factory = server_factory
@after_server = block || Proc.new {}
end
de... | ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
thoughtbot/capybara_discoball | https://github.com/thoughtbot/capybara_discoball/blob/d06cebf7dde482e80163fe438d6005219f0456cf/lib/capybara_discoball/server.rb | lib/capybara_discoball/server.rb | require "capybara/server"
module Capybara
module Discoball
class Server < ::Capybara::Server
def url
"http://#{host}:#{port}"
end
end
end
end
| ruby | MIT | d06cebf7dde482e80163fe438d6005219f0456cf | 2026-01-04T17:50:47.867547Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/integration_test.rb | test/integration_test.rb | require 'rubygems'
require 'test/unit'
require 'fileutils'
require 'shoulda'
class IntegrationTest < Test::Unit::TestCase
# This is slow, and Test:Unit does not have "before/after :all" method, so I'm using a single testcase for multiple tests
should "be able to send a build request, have it run and show the resul... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/requester/requester_test.rb | test/requester/requester_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/requester/requester.rb'))
require 'test/unit'
require 'shoulda'
require 'flexmock/test_unit'
# Probably a bug in flexmock, for 1.9.2
unless defined?(Test::Unit::AssertionFailedError)
class Test::Unit::AssertionFailedError
end
end
module Testbot... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/fixtures/local/spec/models/car_spec.rb | test/fixtures/local/spec/models/car_spec.rb | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false | |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/fixtures/local/spec/models/house_spec.rb | test/fixtures/local/spec/models/house_spec.rb | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false | |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/runner/safe_result_text_test.rb | test/runner/safe_result_text_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/shared/testbot.rb'))
require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/runner/safe_result_text.rb'))
require 'test/unit'
require 'shoulda'
module Testbot::Runner
class SafeResultTextTest < Test::Unit::TestCase
should "not... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/runner/job_test.rb | test/runner/job_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/shared/testbot.rb'))
require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/runner/job.rb'))
require 'test/unit'
require 'shoulda'
require 'flexmock/test_unit'
module Testbot::Runner
class JobTest < Test::Unit::TestCase
def ex... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/server/server_test.rb | test/server/server_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/server/server'))
require 'test/unit'
require 'rack/test'
require 'shoulda'
require 'flexmock/test_unit'
set :environment, :test
module Testbot::Server
class ServerTest < Test::Unit::TestCase
include Rack::Test::Methods
def setup
J... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/server/group_test.rb | test/server/group_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/server/group'))
require 'test/unit'
require 'shoulda'
require 'flexmock/test_unit'
module Testbot::Server
class GroupTest < Test::Unit::TestCase
context "self.build" do
should "create file groups based on the number of instances" do
... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/shared/testbot_test.rb | test/shared/testbot_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/shared/testbot')) unless defined?(Testbot)
require 'test/unit'
require 'shoulda'
require 'flexmock/test_unit'
require 'sinatra'
require File.expand_path(File.join(File.dirname(__FILE__), '../../lib/requester/requester'))
require File.expand_path(File... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/shared/adapters/adapter_test.rb | test/shared/adapters/adapter_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/shared/adapters/adapter.rb'))
require 'test/unit'
require 'shoulda'
class AdapterTest < Test::Unit::TestCase
should "be able to find adapters" do
assert_equal RspecAdapter, Adapter.find(:spec)
assert_equal TestUnitAdapter, Adapter.fi... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/shared/adapters/rspec_adapter_test.rb | test/shared/adapters/rspec_adapter_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/shared/adapters/rspec_adapter.rb'))
require 'test/unit'
require 'shoulda'
class RspecAdapterTest < Test::Unit::TestCase
context "sum_results" do
should "be able to parse and sum results" do
results =<<STR
srv-y5ei5:/tmp/testbot
....... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/shared/adapters/cucumber_adapter_test.rb | test/shared/adapters/cucumber_adapter_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/shared/adapters/cucumber_adapter.rb'))
require 'test/unit'
require 'shoulda'
class CucumberAdapterTest < Test::Unit::TestCase
context "sum_results" do
should "be able to parse and sum results" do
results =<<STR
testbot4:/tmp/tes... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/test/shared/adapters/helpers/ruby_env_test.rb | test/shared/adapters/helpers/ruby_env_test.rb | require File.expand_path(File.join(File.dirname(__FILE__), '../../../../lib/shared/adapters/helpers/ruby_env.rb'))
require 'test/unit'
require 'shoulda'
require 'flexmock/test_unit'
class RubyEnvTest < Test::Unit::TestCase
def setup
# Can't override a stub in flexmock?
def RubyEnv.rvm?; false; end
end
... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/railtie.rb | lib/railtie.rb | begin
require 'rails'
@rails_loaded = true
rescue LoadError => ex
@rails_loaded = false
end
if @rails_loaded
module Testbot
class Railtie < Rails::Railtie
rake_tasks do
load File.expand_path(File.join(File.dirname(__FILE__), "tasks/testbot.rake"))
end
end
end
end
| ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/testbot.rb | lib/testbot.rb | # Rails plugin hook
require File.expand_path(File.join(File.dirname(__FILE__), '/shared/testbot'))
| ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/requester/requester.rb | lib/requester/requester.rb | require 'rubygems'
require 'httparty'
require 'ostruct'
require 'erb'
require File.dirname(__FILE__) + '/../shared/ssh_tunnel'
require File.expand_path(File.dirname(__FILE__) + '/../shared/testbot')
class Hash
def symbolize_keys_without_active_support
inject({}) do |options, (key, value)|
options[(key.to_s... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/generators/testbot/testbot_generator.rb | lib/generators/testbot/testbot_generator.rb | require File.expand_path(File.dirname(__FILE__) + "/../../shared/testbot")
require "acts_as_rails3_generator"
class TestbotGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
class_option :connect, :type => :string, :required => true, :desc => "Which server to use (required... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/runner/safe_result_text.rb | lib/runner/safe_result_text.rb | require 'iconv'
module Testbot::Runner
class SafeResultText
def self.clean(text)
clean_escape_sequences(strip_invalid_utf8(text))
end
def self.strip_invalid_utf8(text)
# http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
ic.ico... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/runner/runner.rb | lib/runner/runner.rb | require 'rubygems'
require 'httparty'
require 'ostruct'
require File.expand_path(File.dirname(__FILE__) + '/../shared/ssh_tunnel')
require File.expand_path(File.dirname(__FILE__) + '/../shared/adapters/adapter')
require File.expand_path(File.dirname(__FILE__) + '/job')
module Testbot::Runner
TIME_BETWEEN_NORMAL_POLL... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/runner/job.rb | lib/runner/job.rb | require File.expand_path(File.join(File.dirname(__FILE__), 'runner.rb'))
require File.expand_path(File.join(File.dirname(__FILE__), 'safe_result_text.rb'))
require 'posix/spawn'
module Testbot::Runner
class Job
attr_reader :root, :project, :build_id
TIME_TO_WAIT_BETWEEN_POSTING_RESULTS = 5
def initiali... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/server/memory_model.rb | lib/server/memory_model.rb | class MemoryModel < OpenStruct
@@db = {}
@@types = {}
def initialize(hash)
@@types[self.class] ||= {}
hash = resolve_types(symbolize_keys(hash))
super(hash)
end
def id
object_id
end
def type
@table[:type]
end
def attributes
@table
end
def update(hash)
@table.merge... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/server/group.rb | lib/server/group.rb | require 'rubygems'
module Testbot::Server
class Group
DEFAULT = nil
def self.build(files, sizes, instance_count, type)
tests_with_sizes = slow_tests_first(map_files_and_sizes(files, sizes))
groups = []
current_group, current_size = 0, 0
tests_with_sizes.each do |test, size|
... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/server/build.rb | lib/server/build.rb | module Testbot::Server
class Build < MemoryModel
def initialize(hash)
super({ :success => true, :done => false, :results => '' }.merge(hash))
end
def self.create_and_build_jobs(hash)
hash["jruby"] = (hash["jruby"] == "true") ? 1 : 0
build = create(hash.reject { |k, v| k == 'available_... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/server/runner.rb | lib/server/runner.rb | module Testbot::Server
class Runner < MemoryModel
attribute :idle_instances, :integer
attribute :max_instances, :integer
def self.record!(hash)
create_or_update_by_mac!(hash)
end
def self.create_or_update_by_mac!(hash)
if runner = find_by_uid(hash[:uid])
runner.update hash
... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/server/server.rb | lib/server/server.rb | require 'rubygems'
require 'sinatra'
require 'yaml'
require 'json'
require File.expand_path(File.join(File.dirname(__FILE__), '/../shared/testbot'))
require File.expand_path(File.join(File.dirname(__FILE__), 'memory_model.rb'))
require File.expand_path(File.join(File.dirname(__FILE__), 'job.rb'))
require File.expand_pa... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/server/job.rb | lib/server/job.rb | module Testbot::Server
class Job < MemoryModel
def update(hash)
super(hash)
if self.build
self.done = done?
done = !Job.all.find { |j| !j.done && j.build == self.build }
self.build.update(:results => build_results(build), :done => done)
build_broken_by_job = (self.st... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/simple_daemonize.rb | lib/shared/simple_daemonize.rb | require 'rubygems'
require 'daemons'
class SimpleDaemonize
def self.start(proc, pid_path, app_name)
working_dir = Dir.pwd
group = Daemons::ApplicationGroup.new(app_name)
group.new_application(:mode => :none).start
File.open(pid_path, 'w') { |file| file.write(Process.pid) }
Dir.chdir(work... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/version.rb | lib/shared/version.rb | module Testbot
# Don't forget to update readme and changelog
def self.version
version = "0.7.9"
dev_version_file = File.join(File.dirname(__FILE__), '..', '..', 'DEV_VERSION')
if File.exists?(dev_version_file)
version += File.read(dev_version_file)
end
version
end
end
| ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/color.rb | lib/shared/color.rb | class Color
def self.colorize(text, color)
colors = { :green => 32, :orange => 33, :red => 31, :cyan => 36 }
if colors[color]
"\033[#{colors[color]}m#{text}\033[0m"
else
raise "Color not implemented: #{color}"
end
end
def self.strip(text)
text.gsub(/\e.+?m/, '')
end
end
| ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/testbot.rb | lib/shared/testbot.rb | require File.expand_path(File.join(File.dirname(__FILE__), '/version'))
require File.expand_path(File.join(File.dirname(__FILE__), '/simple_daemonize'))
require File.expand_path(File.join(File.dirname(__FILE__), '/adapters/adapter'))
require 'fileutils'
module Testbot
require 'railtie' if defined?(Rails)
if ENV['... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/ssh_tunnel.rb | lib/shared/ssh_tunnel.rb | require 'rubygems'
require 'net/ssh'
class SSHTunnel
def initialize(host, user, local_port = 2288)
@host, @user, @local_port = host, user, local_port
end
def open
connect
start_time = Time.now
while true
break if @up
sleep 0.5
if Time.now - start_time > 5
puts "SSH co... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/adapters/rspec_adapter.rb | lib/shared/adapters/rspec_adapter.rb | require File.expand_path(File.join(File.dirname(__FILE__), "/helpers/ruby_env"))
require File.expand_path(File.join(File.dirname(__FILE__), "../color"))
class RspecAdapter
def self.command(project_path, ruby_interpreter, files)
spec_command = RubyEnv.ruby_command(project_path, :script => "script/spec", :bin =... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/adapters/adapter.rb | lib/shared/adapters/adapter.rb | class Adapter
FILES = Dir[File.dirname(__FILE__) + "/*_adapter.rb"]
FILES.each { |file| require(file) }
def self.all
FILES.map { |file| load_adapter(file) }
end
def self.find(type)
if adapter = all.find { |adapter| adapter.type == type.to_s }
adapter
else
raise "Unknown adapter: #{t... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/adapters/rspec2_adapter.rb | lib/shared/adapters/rspec2_adapter.rb | require File.expand_path(File.join(File.dirname(__FILE__), "/helpers/ruby_env"))
class Rspec2Adapter
def self.command(project_path, ruby_interpreter, files)
spec_command = RubyEnv.ruby_command(project_path,
:bin => "rspec",
:ruby_interpreter => ruby_interpreter)
if File.exists?("#{project_path}... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/adapters/cucumber_adapter.rb | lib/shared/adapters/cucumber_adapter.rb | require File.expand_path(File.join(File.dirname(__FILE__), "/helpers/ruby_env"))
require File.expand_path(File.join(File.dirname(__FILE__), "../color"))
class CucumberAdapter
def self.command(project_path, ruby_interpreter, files)
cucumber_command = RubyEnv.ruby_command(project_path, :script => "script/cucumb... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/adapters/test_unit_adapter.rb | lib/shared/adapters/test_unit_adapter.rb | require File.expand_path(File.join(File.dirname(__FILE__), "/helpers/ruby_env"))
class TestUnitAdapter
def self.command(project_path, ruby_interpreter, files)
ruby_command = RubyEnv.ruby_command(project_path, :ruby_interpreter => ruby_interpreter)
%{#{ruby_command} -Itest -e '%w(#{files}).each { |file| re... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
joakimk/testbot | https://github.com/joakimk/testbot/blob/d200b0ff53b7c1b886ff515fc0d160d41067b13a/lib/shared/adapters/helpers/ruby_env.rb | lib/shared/adapters/helpers/ruby_env.rb | class RubyEnv
def self.bundler?(project_path)
gem_exists?("bundler") && File.exists?("#{project_path}/Gemfile")
end
def self.gem_exists?(gem)
if Gem::Specification.respond_to?(:find_by_name)
Gem::Specification.find_by_name(gem)
else
# older depricated method
Gem.available?(gem)
... | ruby | MIT | d200b0ff53b7c1b886ff515fc0d160d41067b13a | 2026-01-04T17:50:51.240118Z | false |
oelmekki/activerecord_any_of | https://github.com/oelmekki/activerecord_any_of/blob/f95f8b7c16364b67c221f8fcdf82e152c5542a03/spec/activerecord_any_of_spec.rb | spec/activerecord_any_of_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'ActiverecordAnyOf' do
fixtures :authors, :posts, :users
let(:davids) { Author.where(name: 'David') }
it 'matches hash combinations' do
expect(Author.where.any_of({ name: 'David' }, { name: 'Mary' })).to match_array(authors(:david, :mary))
end
... | ruby | MIT | f95f8b7c16364b67c221f8fcdf82e152c5542a03 | 2026-01-04T17:50:52.089997Z | false |
oelmekki/activerecord_any_of | https://github.com/oelmekki/activerecord_any_of/blob/f95f8b7c16364b67c221f8fcdf82e152c5542a03/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
plugin_test_dir = File.dirname(__FILE__)
require 'bundler'
require 'simplecov'
SimpleCov.start
SimpleCov.minimum_coverage 95 # we can't cover rails-6 code when running on rails-7, and reversibly
require 'logger'
require 'rails/all'
require 'active_record'
Bundler.require :default, :dev... | ruby | MIT | f95f8b7c16364b67c221f8fcdf82e152c5542a03 | 2026-01-04T17:50:52.089997Z | false |
oelmekki/activerecord_any_of | https://github.com/oelmekki/activerecord_any_of/blob/f95f8b7c16364b67c221f8fcdf82e152c5542a03/spec/support/models.rb | spec/support/models.rb | # frozen_string_literal: true
class Author < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :author
end
class SpecialPost < Post
end
class StiPost < Post
end
class User < ActiveRecord::Base
has_many :memberships
has_many :companies, through: :memberships, source: :organiz... | ruby | MIT | f95f8b7c16364b67c221f8fcdf82e152c5542a03 | 2026-01-04T17:50:52.089997Z | false |
oelmekki/activerecord_any_of | https://github.com/oelmekki/activerecord_any_of/blob/f95f8b7c16364b67c221f8fcdf82e152c5542a03/spec/support/schema.rb | spec/support/schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :authors do |t|
t.string :name
t.datetime :created_at
t.datetime :updated_at
end
create_table :posts do |t|
t.string :title
t.text :body
t.integer :author_id
t.string :type
t.datetime :created_at... | ruby | MIT | f95f8b7c16364b67c221f8fcdf82e152c5542a03 | 2026-01-04T17:50:52.089997Z | false |
oelmekki/activerecord_any_of | https://github.com/oelmekki/activerecord_any_of/blob/f95f8b7c16364b67c221f8fcdf82e152c5542a03/lib/activerecord_any_of.rb | lib/activerecord_any_of.rb | # frozen_string_literal: true
require 'activerecord_any_of/alternative_builder'
module ActiverecordAnyOf
# Injected into WhereChain.
module Chained
# Returns a new relation, which includes results matching any of the conditions
# passed as parameters. You can think of it as a sql <tt>OR</tt> implementatio... | ruby | MIT | f95f8b7c16364b67c221f8fcdf82e152c5542a03 | 2026-01-04T17:50:52.089997Z | false |
oelmekki/activerecord_any_of | https://github.com/oelmekki/activerecord_any_of/blob/f95f8b7c16364b67c221f8fcdf82e152c5542a03/lib/activerecord_any_of/version.rb | lib/activerecord_any_of/version.rb | # frozen_string_literal: true
module ActiverecordAnyOf
VERSION = '2.0.2'
end
| ruby | MIT | f95f8b7c16364b67c221f8fcdf82e152c5542a03 | 2026-01-04T17:50:52.089997Z | false |
oelmekki/activerecord_any_of | https://github.com/oelmekki/activerecord_any_of/blob/f95f8b7c16364b67c221f8fcdf82e152c5542a03/lib/activerecord_any_of/alternative_builder.rb | lib/activerecord_any_of/alternative_builder.rb | # frozen_string_literal: true
module ActiverecordAnyOf
IS_RAILS_6 = ActiveRecord.version.to_s.between?('6', '7')
# Main class allowing to build alternative conditions for the query.
class AlternativeBuilder
def initialize(match_type, context, *queries)
if queries.first.is_a?(Hash) && (queries.count ==... | ruby | MIT | f95f8b7c16364b67c221f8fcdf82e152c5542a03 | 2026-01-04T17:50:52.089997Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/rails/init.rb | rails/init.rb | # This will help setup for easier setup in Rails apps.
puts 'SimpleRecord rails/init.rb...'
SimpleRecord.options[:connection_mode] = :per_thread
::ApplicationController.class_eval do
def close_sdb_connection
puts "Closing sdb connection."
SimpleRecord.close_connection
end
end
::ApplicationCont... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_conversions.rb | test/test_conversions.rb | require "yaml"
require 'aws'
require_relative "test_base"
require_relative "../lib/simple_record"
require_relative 'models/my_model'
require_relative 'models/my_child_model'
class ConversionsTest < TestBase
def test_ints
x = 0
assert_equal "09223372036854775808", SimpleRecord::Translations.pad_an... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_usage.rb | test/test_usage.rb | # These ones take longer to run
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'm... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_simple_record.rb | test/test_simple_record.rb | gem 'test-unit'
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require_relative "test_base"
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require_relative 'model... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_pagination.rb | test/test_pagination.rb | require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require_rel... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_encodings.rb | test/test_encodings.rb | require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + "/../lib/simple_record")
require "yaml"
require 'aws'
require_relative 'models/my_simple_model'
require 'active_support'
require 'test_base'
class TestEncodings < TestBase
def test_aaa_setup_delete_domain
MySimpleModel.delete_domain
... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_translations.rb | test/test_translations.rb | gem 'test-unit'
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require_relative "test_base"
require "yaml"
require 'aws'
require_relative 'models/my_translation'
# Tests for simple_record/translations.rb
#
class TestTr... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_temp.rb | test/test_temp.rb | gem 'test-unit'
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require_relative "test_base"
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require_relative 'model... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_base.rb | test/test_base.rb | gem 'test-unit'
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
#require 'active_support'
class TestBase < Test::Un... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_lobs.rb | test/test_lobs.rb | require 'test/unit'
require_relative "../lib/simple_record"
require_relative "test_helpers"
require_relative "test_base"
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require_relative 'models/model_with_enc'
# Tests for SimpleRecord
#
class TestLobs < TestBas... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_results_array.rb | test/test_results_array.rb | # These ones take longer to run
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'm... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_marshalled.rb | test/test_marshalled.rb | require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + "/../lib/simple_record")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require 'active_support'
require 'test_base'
class Person < SimpleRecord::Base
has_strings :name, :i_as_s
has_... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_helpers.rb | test/test_helpers.rb | class TestHelpers
end
| ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_validations.rb | test/test_validations.rb | gem 'test-unit'
require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require_relative "test_base"
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require_relative 'model... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_rails3.rb | test/test_rails3.rb | require 'test/unit'
require 'active_model'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_c... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_shards.rb | test/test_shards.rb | require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require_relative 'models/my_sharded_model'
# Tests for SimpleRecord
#
class TestShards... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_dirty.rb | test/test_dirty.rb | require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + "/../lib/simple_record")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require 'active_support'
require 'test_base'
class Person < SimpleRecord::Base
has_strings :name, :i_as_s
has_... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_json.rb | test/test_json.rb | require 'test/unit'
require File.join(File.dirname(__FILE__), "/../lib/simple_record")
require File.join(File.dirname(__FILE__), "./test_helpers")
require File.join(File.dirname(__FILE__), "./test_base")
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require_rel... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/test_global_options.rb | test/test_global_options.rb | require 'test/unit'
require_relative "../lib/simple_record"
require "yaml"
require 'aws'
require_relative 'models/my_model'
require_relative 'models/my_child_model'
require 'active_support/core_ext'
require_relative 'test_base'
class Person < SimpleRecord::Base
has_strings :name, :i_as_s
has_ints :age
end
cla... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/my_translation.rb | test/models/my_translation.rb | require File.expand_path(File.dirname(__FILE__) + "/../../lib/simple_record")
class MyTranslation < SimpleRecord::Base
has_strings :name, :stage_name
has_ints :age
has_booleans :singer
has_dates :birthday
has_floats :weight, :height
end
| ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/my_sharded_model.rb | test/models/my_sharded_model.rb | require File.expand_path(File.dirname(__FILE__) + "/../../lib/simple_record")
class MyShardedModel < SimpleRecord::Base
shard :shards=>:my_shards, :map=>:my_mapping_function
has_strings :name
def self.num_shards
10
end
def self.my_shards
Array(0...self.num_shards)
end
def my_mapping_function... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/my_child_model.rb | test/models/my_child_model.rb | require File.expand_path(File.dirname(__FILE__) + "/../../lib/simple_record")
require_relative 'my_model'
class MyChildModel < SimpleRecord::Base
belongs_to :my_model
belongs_to :x, :class_name=>"MyModel"
has_attributes :name, :child_attr
end
=begin
puts 'word'
mm = MyModel.new
puts 'word2'
mcm = My... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/validated_model.rb | test/models/validated_model.rb | require_relative "../../lib/simple_record"
require 'active_model'
class ValidatedModel < MyBaseModel
has_strings :name
validates_presence_of :name
validates_uniqueness_of :name
end
| ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/my_base_model.rb | test/models/my_base_model.rb | require File.expand_path(File.dirname(__FILE__) + "/../../lib/simple_record")
class MyBaseModel < SimpleRecord::Base
has_strings :base_string
has_virtuals :v1
end
| ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/my_simple_model.rb | test/models/my_simple_model.rb | require File.expand_path(File.dirname(__FILE__) + "/../../lib/simple_record")
require_relative 'my_base_model'
require_relative 'my_sharded_model'
class MySimpleModel < SimpleRecord::Base
has_strings :name, :nickname, :s1, :s2
has_ints :age, :save_count
has_booleans :cool
has_dates :birthday, :date1, :date2, ... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/my_model.rb | test/models/my_model.rb | require File.expand_path(File.dirname(__FILE__) + "/../../lib/simple_record")
require_relative 'my_base_model'
require_relative 'my_sharded_model'
require 'active_model'
class MyModel < MyBaseModel
has_strings :name, :nickname, :s1, :s2
has_ints :age, :save_count
has_booleans :cool
has_dates :birthday, :date1... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/test/models/model_with_enc.rb | test/models/model_with_enc.rb |
class ModelWithEnc < SimpleRecord::Base
has_strings :name,
{:name=>:ssn, :encrypted=>"simple_record_test_key"},
{:name=>:password, :hashed=>true}
end
| ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record.rb | lib/simple_record.rb | # Usage:
# require 'simple_record'
#
# class MyModel < SimpleRecord::Base
#
# has_attributes :name, :age
# are_ints :age
#
# end
#
# AWS_ACCESS_KEY_ID='XXXXX'
# AWS_SECRET_ACCESS_KEY='YYYYY'
# SimpleRecord.establish_connection(AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY)
#
## Save an object
# mm = MyModel.new
# mm.name... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | true |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/attributes.rb | lib/simple_record/attributes.rb | module SimpleRecord
module Attributes
# For all things related to defining attributes.
def self.included(base)
#puts 'Callbacks included in ' + base.inspect
=begin
instance_eval <<-endofeval
def self.defined_attributes
#puts 'class defined_attributes'
... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/password.rb | lib/simple_record/password.rb | require 'digest/sha2'
# Thanks to: http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing
module SimpleRecord
# This module contains functions for hashing and storing passwords
module Password
# Generates a new salt and rehashes the password
def Password.create_hash(password)
sa... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/errors.rb | lib/simple_record/errors.rb | module SimpleRecord
class SimpleRecordError < StandardError
end
class RecordNotSaved < SimpleRecordError
attr_accessor :record
def initialize(record=nil)
@record = record
super("Validation failed: #{@record.errors.full_messages.join(", ")}")
end
end
... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/translations.rb | lib/simple_record/translations.rb | # This module defines all the methods that perform data translations for storage and retrieval.
module SimpleRecord
module Translations
@@offset = 9223372036854775808
@@padding = 20
@@date_format = "%Y-%m-%dT%H:%M:%S";
def ruby_to_string_val(att_meta, value)
if att_meta.type == :int
... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/logging.rb | lib/simple_record/logging.rb | module SimpleRecord
require 'csv'
module Logging
module ClassMethods
def write_usage(type, domain, q_type, params, results)
#puts 'params=' + params.inspect
#puts 'logging_options=' + SimpleRecord.usage_logging_options.inspect
if SimpleReco... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/sharding.rb | lib/simple_record/sharding.rb | require 'concur'
module SimpleRecord
module Sharding
def self.included(base)
# base.extend ClassMethods
end
module ClassMethods
def shard(options=nil)
@sharding_options = options
end
def sharding_options
@sharding_options
end
def is_sharded?
... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/stats.rb | lib/simple_record/stats.rb | module SimpleRecord
class Stats
attr_accessor :selects, :saves, :deletes, :s3_puts, :s3_gets, :s3_deletes
def initialize
@selects = 0
@saves = 0
@deletes = 0
@s3_puts = 0
@s3_gets = 0
@s3_deletes = 0
end
def cl... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/callbacks.rb | lib/simple_record/callbacks.rb | module SimpleRecord
# For Rails3 support
module Callbacks3
# def destroy #:nodoc:
# _run_destroy_callbacks { super }
# end
#
# private
#
# def create_or_update #:nodoc:
# puts '3 create_or_update'
# _run_save_callbacks { super }
# end
#
# def create #:nodoc:
# puts '3 create'... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/validations.rb | lib/simple_record/validations.rb | # This is actually still used to continue support for this.
# ActiveModel does not work the same way so need to continue using this, will change name.
module SimpleRecord
module Validations
# if defined?(:valid?) # from ActiveModel
# alias_method :am_valid?, :valid?
# end
def self.included(base)
# ... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/json.rb | lib/simple_record/json.rb | module SimpleRecord
module Json
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def json_create(object)
obj = new
for key, value in object
next if key == 'json_class'
if key == 'id'
obj.id = value
next
... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/encryptor.rb | lib/simple_record/encryptor.rb | require 'openssl'
# Thanks to http://github.com/shuber/encryptor
module SimpleRecord
module Encryptor
# The default options to use when calling the <tt>encrypt</tt> and <tt>decrypt</tt> methods
#
# Defaults to { :algorithm => 'aes-256-cbc' }
#
# Run 'openssl list-cipher-commands' in your terminal... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/active_sdb.rb | lib/simple_record/active_sdb.rb | #
# Copyright (c) 2008 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | true |
appoxy/simple_record | https://github.com/appoxy/simple_record/blob/0252a022a938f368d6853ab1ae31f77f80b9f044/lib/simple_record/results_array.rb | lib/simple_record/results_array.rb | module SimpleRecord
#
# We need to make this behave as if the full set were loaded into the array.
class ResultsArray
include Enumerable
attr_reader :next_token, :clz, :params, :items, :index, :box_usage, :request_id
def initialize(clz=nil, params=[], results=nil, next_token=nil)... | ruby | MIT | 0252a022a938f368d6853ab1ae31f77f80b9f044 | 2026-01-04T17:50:57.195630Z | false |
openjournals/theoj | https://github.com/openjournals/theoj/blob/73c6acccc0aefe64b0030c818f405b25b7e7b589/app/serializers/basic_user_serializer.rb | app/serializers/basic_user_serializer.rb | class BasicUserSerializer < BaseSerializer
attributes :name
end
| ruby | MIT | 73c6acccc0aefe64b0030c818f405b25b7e7b589 | 2026-01-04T17:49:58.613320Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.