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 |
|---|---|---|---|---|---|---|---|---|
westonganger/paper_trail-association_tracking | https://github.com/westonganger/paper_trail-association_tracking/blob/93a1c8359e55136bdea7e3053e23c2b45acb6dce/lib/paper_trail_association_tracking/reifiers/has_many.rb | lib/paper_trail_association_tracking/reifiers/has_many.rb | # frozen_string_literal: true
module PaperTrailAssociationTracking
module Reifiers
# Reify a single, direct (not `through`) `has_many` association of `model`.
# @api private
module HasMany
class << self
# @api private
def reify(assoc, model, options, transaction_id, version_table_na... | ruby | MIT | 93a1c8359e55136bdea7e3053e23c2b45acb6dce | 2026-01-04T17:34:04.567102Z | false |
westonganger/paper_trail-association_tracking | https://github.com/westonganger/paper_trail-association_tracking/blob/93a1c8359e55136bdea7e3053e23c2b45acb6dce/lib/paper_trail_association_tracking/reifiers/belongs_to.rb | lib/paper_trail_association_tracking/reifiers/belongs_to.rb | # frozen_string_literal: true
module PaperTrailAssociationTracking
module Reifiers
# Reify a single `belongs_to` association of `model`.
# @api private
module BelongsTo
class << self
# @api private
def reify(assoc, model, options, transaction_id)
id = model.send(assoc.fore... | ruby | MIT | 93a1c8359e55136bdea7e3053e23c2b45acb6dce | 2026-01-04T17:34:04.567102Z | false |
westonganger/paper_trail-association_tracking | https://github.com/westonganger/paper_trail-association_tracking/blob/93a1c8359e55136bdea7e3053e23c2b45acb6dce/lib/paper_trail_association_tracking/frameworks/active_record.rb | lib/paper_trail_association_tracking/frameworks/active_record.rb | # frozen_string_literal: true
require "paper_trail_association_tracking/frameworks/active_record/models/paper_trail/version_association"
require "paper_trail_association_tracking/version_concern"
| ruby | MIT | 93a1c8359e55136bdea7e3053e23c2b45acb6dce | 2026-01-04T17:34:04.567102Z | false |
westonganger/paper_trail-association_tracking | https://github.com/westonganger/paper_trail-association_tracking/blob/93a1c8359e55136bdea7e3053e23c2b45acb6dce/lib/paper_trail_association_tracking/frameworks/rails/railtie.rb | lib/paper_trail_association_tracking/frameworks/rails/railtie.rb | # frozen_string_literal: true
module PaperTrailAssociationTracking
class Railtie < ::Rails::Railtie
initializer "paper_trail_association_tracking", after: "paper_trail" do
ActiveSupport.on_load(:active_record) do
require "paper_trail/frameworks/active_record"
require "paper_trail_associati... | ruby | MIT | 93a1c8359e55136bdea7e3053e23c2b45acb6dce | 2026-01-04T17:34:04.567102Z | false |
westonganger/paper_trail-association_tracking | https://github.com/westonganger/paper_trail-association_tracking/blob/93a1c8359e55136bdea7e3053e23c2b45acb6dce/lib/paper_trail_association_tracking/frameworks/active_record/models/paper_trail/version_association.rb | lib/paper_trail_association_tracking/frameworks/active_record/models/paper_trail/version_association.rb | # frozen_string_literal: true
require "paper_trail_association_tracking/version_association_concern"
module PaperTrail
# This is the default ActiveRecord model provided by PaperTrail. Most simple
# applications will only use this and its partner, `Version`, but it is
# possible to sub-class, extend, or even do ... | ruby | MIT | 93a1c8359e55136bdea7e3053e23c2b45acb6dce | 2026-01-04T17:34:04.567102Z | false |
westonganger/paper_trail-association_tracking | https://github.com/westonganger/paper_trail-association_tracking/blob/93a1c8359e55136bdea7e3053e23c2b45acb6dce/doc/bug_report_template.rb | doc/bug_report_template.rb | ### Bug Report Template
require "bundler/inline"
# STEP ONE: What versions are you using?
gemfile(true) do
ruby "2.6"
source "https://rubygems.org"
gem "activerecord", "6.0.2"
gem "minitest"
gem "paper_trail", "~>10.3.0"
gem "paper_trail-association_tracking"
gem "sqlite3"
end
require "active_record"
r... | ruby | MIT | 93a1c8359e55136bdea7e3053e23c2b45acb6dce | 2026-01-04T17:34:04.567102Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/test_helper.rb | test/test_helper.rb | begin
require 'simplecov'
SimpleCov.profiles.define 'garb' do
add_filter '/test/'
add_filter '/config/'
add_filter 'version'
add_group 'Libraries', 'lib'
end
SimpleCov.start 'garb'
rescue LoadError
puts 'Install simplecov if you use 1.9 and want coverage metrics'
end
require 'bundler'
Bundl... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb_test.rb | test/unit/garb_test.rb | require 'test_helper'
class GarbTest < MiniTest::Unit::TestCase
context "The Garb module" do
should 'prefix a string with ga: for GA' do
assert_equal '-ga:bob', Garb.to_google_analytics(stub(:to_google_analytics => '-ga:bob'))
assert_equal 'ga:bob', Garb.to_google_analytics('bob')
end
should... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/symbol_operator_test.rb | test/unit/symbol_operator_test.rb | require 'test_helper'
class SymbolOperatorTest < MiniTest::Unit::TestCase
context "An instance of a SymbolOperator" do
should "lower camelize the target" do
assert_equal "ga:uniqueVisits==", SymbolOperator.new(:unique_visits, :eql).to_google_analytics
end
should "return target and operator togethe... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/session_test.rb | test/unit/garb/session_test.rb | require 'test_helper'
module Garb
class SessionTest < MiniTest::Unit::TestCase
context "The Session class" do
should "be able retrieve an auth_token for a user" do
auth_request = mock {|m| m.expects(:auth_token).with({}).returns('toke') }
Request::Authentication.expects(:new).with('email'... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/oauth_session_test.rb | test/unit/garb/oauth_session_test.rb | require 'test_helper'
module Garb
class OAuthSessionTest < MiniTest::Unit::TestCase
context "An instance of OAuthSession" do
should "have tests" do
assert true
end
end
end
end | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/report_response_test.rb | test/unit/garb/report_response_test.rb | require 'test_helper'
module Garb
SpecialKlass = Class.new(OpenStruct)
class ReportResponseTest < MiniTest::Unit::TestCase
context "A ReportResponse" do
context "with a report feed" do
setup do
@json = File.read(File.join(File.dirname(__FILE__), '..', '..', "/fixtures/report_feed.json"... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/report_parameter_test.rb | test/unit/garb/report_parameter_test.rb | require 'test_helper'
module Garb
class ReportParameterTest < MiniTest::Unit::TestCase
context "An instance of the ReportParameter class" do
setup do
@metrics = ReportParameter.new(:metrics)
end
should "have a name" do
assert_equal "metrics", @metrics.name
end
sho... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/model_test.rb | test/unit/garb/model_test.rb | require 'test_helper'
class ResultKlass
def initialize(attrs)
end
end
module Garb
class ModelTest < MiniTest::Unit::TestCase
context "A class extended with Garb::Model" do
setup do
@test_model = Class.new
@test_model.extend(Garb::Model)
end
# public API
should "be ab... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/filter_parameters_test.rb | test/unit/garb/filter_parameters_test.rb | require 'test_helper'
module Garb
class FilterParametersTest < MiniTest::Unit::TestCase
context "A FilterParameters" do
context "when converting parameters hash into query string parameters" do
should "parameterize hash operators and join elements with AND" do
filters = FilterParameters.n... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/profile_reports_test.rb | test/unit/garb/profile_reports_test.rb | require 'test_helper'
module Garb
Exits = Class.new
class FakeProfile
include ProfileReports
end
class ProfileReportsTest < MiniTest::Unit::TestCase
context "The ProfileReports module" do
should "define a new method when given a class" do
ProfileReports.add_report_method(Exits)
... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/management/web_property_test.rb | test/unit/garb/management/web_property_test.rb | require 'test_helper'
module Garb
module Management
class WebPropertyTest < MiniTest::Unit::TestCase
context "the WebProperty class" do
should "turn entries for path into array of web properties" do
feed = stub(:entries => ["entry1"])
Feed.stubs(:new).returns(feed)
We... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/management/feed_test.rb | test/unit/garb/management/feed_test.rb | require 'test_helper'
module Garb
module Management
class FeedTest < MiniTest::Unit::TestCase
context "a Feed" do
setup do
@request = stub
Request::Data.stubs(:new).returns(@request)
@feed = Feed.new(Garb::Session.new, '/accounts')
end
should "have a p... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/management/account_test.rb | test/unit/garb/management/account_test.rb | require 'test_helper'
module Garb
module Management
class AccountTest < MiniTest::Unit::TestCase
context "The Account class" do
should "turn entries for path into array of accounts" do
feed = stub(:entries => ["entry1"])
Feed.stubs(:new).returns(feed)
Account.stubs(:n... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/management/segment_test.rb | test/unit/garb/management/segment_test.rb | require 'test_helper'
module Garb
module Management
class SegmentTest < MiniTest::Unit::TestCase
context "The Segment class" do
should "turn entries for path into array of accounts" do
feed = stub(:entries => ["entry1"])
Feed.stubs(:new).returns(feed)
Segment.stubs(:n... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/management/profile_test.rb | test/unit/garb/management/profile_test.rb | require 'test_helper'
module Garb
module Management
class ProfileTest < MiniTest::Unit::TestCase
context "The Profile class" do
should "turn entries for path into array of profiles" do
feed = stub(:entries => ["entry1"])
Feed.stubs(:new).returns(feed)
Profile.stubs(:n... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/management/goal_test.rb | test/unit/garb/management/goal_test.rb | require 'test_helper'
module Garb
module Management
class GoalTest < MiniTest::Unit::TestCase
context "the Goal class" do
should "turn entries for path into array of goals" do
feed = stub(:entries => ["entry1"])
Feed.stubs(:new).returns(feed)
Goal.stubs(:new)
... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/request/authentication_test.rb | test/unit/garb/request/authentication_test.rb | require 'test_helper'
module Garb
module Request
class AuthenticationTest < MiniTest::Unit::TestCase
context "An instance of the Request::Authentication class" do
setup do
@request = Request::Authentication.new('email', 'password')
Garb.ca_cert_file = File.join(File.dirname(__... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/test/unit/garb/request/data_test.rb | test/unit/garb/request/data_test.rb | require 'test_helper'
module Garb
module Request
class DataTest < MiniTest::Unit::TestCase
context "An instance of the Request::Data class" do
setup do
@session = Session.new
@session.auth_token = 'abcdefg123456'
end
teardown do
Garb.proxy_address = n... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb.rb | lib/garb.rb | $:.unshift File.dirname(__FILE__)
require 'net/http'
require 'net/https'
require 'cgi'
require 'ostruct'
require 'multi_json'
module Garb
autoload :VERSION, 'garb/version'
autoload :Attributes, 'garb/attributes'
autoload :PathAttribute, 'garb/path_attribute'
autoload :Destination, 'g... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/attributes.rb | lib/garb/attributes.rb | module Garb
module Attributes
def self.extended(base)
base.extend ClassMethods
end
module ClassMethods
def ga_attribute(*keys)
hashes, symbols = keys.partition { |k| k.is_a? Hash }
symbols.each { |key| define_a_method_for key }
hashes.each { |hash| map_values_for hash ... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/path_attribute.rb | lib/garb/path_attribute.rb | module Garb
module PathAttribute
def path
@path ||= @entry['selfLink'].gsub(Management::Feed::BASE_URL, '')
end
end
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/session.rb | lib/garb/session.rb | module Garb
class Session
module Methods
attr_accessor :auth_token, :access_token, :email, :api_key
# use only for single user authentication
def login(email, password, opts = {})
self.email = email
auth_request = Request::Authentication.new(email, password, opts)
self.a... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/version.rb | lib/garb/version.rb | module Garb
module VERSION
MAJOR = 0
MINOR = 9
TINY = 8
def self.to_s # :nodoc:
[MAJOR, MINOR, TINY].join '.'
end
end
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/destination.rb | lib/garb/destination.rb | module Garb
class Destination
attr_reader :match_type, :url, :steps, :case_sensitive
alias case_sensitive? case_sensitive
def initialize(attributes)
return unless attributes.is_a? Hash
@match_type = attributes['matchType']
@url = attributes['url'] # TODO was @expression
@case_se... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/errors.rb | lib/garb/errors.rb | module Garb
class Error < StandardError; end
class MissingCertFileError < Error; end
class AuthError < Error; end
class ClientError < Error
attr_reader :code, :message, :errors, :uri
def initialize(uri, message, code = nil, errors = [])
@code, @message, @errors, @uri = code, message, errors, uri... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/result_set.rb | lib/garb/result_set.rb | require 'forwardable'
module Garb
class ResultSet
include Enumerable
include Comparable
extend Forwardable
attr_accessor :results, :total_results, :sampled
alias sampled? sampled
def_delegators :results, :each, :to_a, :count, :size, :empty?
def initialize(results)
@results = resu... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/reports.rb | lib/garb/reports.rb | require 'garb/reports/exits'
require 'garb/reports/visits'
require 'garb/reports/bounces'
require 'garb/reports/pageviews'
require 'garb/reports/unique_pageviews'
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/step.rb | lib/garb/step.rb | module Garb
class Step
attr_reader :name, :number, :url
def initialize(attributes)
return unless attributes.is_a? Hash
@name = attributes['name']
@number = attributes['number']
@url = attributes['url']
end
end
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/report_response.rb | lib/garb/report_response.rb | module Garb
class ReportResponse
def initialize(response_body, instance_klass = OpenStruct)
@response_body = response_body
@instance_klass = instance_klass
end
def results
if @results.nil?
@results = ResultSet.new(parse)
@results.total_results = total_results
@re... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/profile_reports.rb | lib/garb/profile_reports.rb | module Garb
module ProfileReports
def self.add_report_method(klass)
# demodulize leaves potential to redefine
# these methods given different namespaces
method_name = klass.name.to_s.demodulize.underscore
return if method_name.empty?
class_eval <<-CODE
def #{method_name}(opt... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/model.rb | lib/garb/model.rb | module Garb
module Model
MONTH = (60 * 60 * 24 * 30).freeze
URL = 'https://www.googleapis.com/analytics/v3/data/ga'.freeze
def self.extended(base)
ProfileReports.add_report_method(base)
# base.set_instance_klass(base)
end
def metrics(*fields)
@metrics ||= ReportParameter.new(:m... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/report_parameter.rb | lib/garb/report_parameter.rb | module Garb
class ReportParameter
attr_reader :elements
def initialize(name)
@name = name
@elements = []
end
def name
@name.to_s
end
def <<(element)
(@elements += [element].flatten).compact!
self
end
def to_params
value = elements.map { |param| G... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/support.rb | lib/garb/support.rb | unless Object.const_defined? 'ActiveSupport'
require 'garb/core_ext/string'
require 'garb/core_ext/array'
end
require 'garb/core_ext/symbol'
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/filter_parameters.rb | lib/garb/filter_parameters.rb | module Garb
class FilterParameters
attr_accessor :parameters
def initialize(parameters)
self.parameters = (Array.wrap(parameters) || []).compact
end
def to_params
value = array_to_params(parameters)
value.empty? ? {} : { 'filters' => value }
end
private
def array_to_p... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/management/feed.rb | lib/garb/management/feed.rb | module Garb
module Management
class Feed
BASE_URL = 'https://www.googleapis.com/analytics/v3/management'.freeze
attr_reader :request
def initialize(session, path)
@request = Request::Data.new(session, BASE_URL + path)
end
def parsed_response
@parsed_response ||= Mu... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/management/web_property.rb | lib/garb/management/web_property.rb | module Garb
module Management
class WebProperty
extend Attributes
include PathAttribute
attr_reader :session, :entry
ga_attribute :id, :name, :account_id, :website_url
def self.all(session = Session, path = '/accounts/~all/webproperties')
feed = Feed.new(session, path)
... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/management/goal.rb | lib/garb/management/goal.rb | module Garb
module Management
class Goal
extend Attributes
include PathAttribute
attr_reader :session
ga_attribute :name, :number, :value, :active
alias active? active
def self.all(session = Session, path = '/accounts/~all/webproperties/~all/profiles/~all/goals')
fee... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/management/account.rb | lib/garb/management/account.rb | module Garb
module Management
class Account
extend Garb::Attributes
include PathAttribute
attr_reader :session
ga_attribute :id, :name
def initialize(entry, session)
@entry = entry
@session = session
end
def self.all(session = Session)
feed = Fe... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/management/segment.rb | lib/garb/management/segment.rb | module Garb
module Management
class Segment
extend Attributes
include PathAttribute
attr_reader :session
ga_attribute :name, :definition, id: 'segmentId'
def self.all(session = Session)
feed = Feed.new(session, '/segments')
feed.entries.map { |entry| new(entry, sess... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/management/profile.rb | lib/garb/management/profile.rb | module Garb
module Management
class Profile
include ProfileReports
include PathAttribute
extend Attributes
attr_reader :session
ga_attribute :id, :name, :account_id, :web_property_id, :website_url
def self.all(session = Session, path = '/accounts/~all/webproperties/~all/prof... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/core_ext/array.rb | lib/garb/core_ext/array.rb | unless Object.const_defined?('ActiveSupport')
class Array
def self.wrap(object)
if object.nil?
[]
elsif object.respond_to?(:to_ary)
object.to_ary
else
[object]
end
end
end
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/core_ext/string.rb | lib/garb/core_ext/string.rb | # Pull in some AS String utilities (not loaded if AS is available)
unless Object.const_defined?('ActiveSupport')
class String
def camelize(first_letter = :upper)
case first_letter
when :upper then Garb::Inflector.camelize(self, true)
when :lower then Garb::Inflector.camelize(self, false)
e... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/core_ext/symbol.rb | lib/garb/core_ext/symbol.rb | module SymbolOperatorMethods
OPERATORS = {
eql: '==',
not_eql: '!=',
gt: '>',
gte: '>=',
lt: '<',
lte: '<=',
matches: '==',
does_not_match: '!=',
contains: '=~',
does_not_contain: '!~',
substring: '=@',
not_substring: '!@',
... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/reports/visits.rb | lib/garb/reports/visits.rb | class Visits
extend Garb::Model
metrics :visits
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/reports/pageviews.rb | lib/garb/reports/pageviews.rb | class Pageviews
extend Garb::Model
metrics :pageviews
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/reports/unique_pageviews.rb | lib/garb/reports/unique_pageviews.rb | class UniquePageviews
extend Garb::Model
metrics :unique_pageviews
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/reports/exits.rb | lib/garb/reports/exits.rb | class Exits
extend Garb::Model
metrics :exits
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/reports/bounces.rb | lib/garb/reports/bounces.rb | class Bounces
extend Garb::Model
metrics :bounces
end
| ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/request/data.rb | lib/garb/request/data.rb | module Garb
module Request
class Data
def initialize(session, base_url, parameters = {})
@session, @base_url, @parameters = session, base_url, parameters
end
def parameters
@parameters ||= {}
@parameters['key'] ||= @session.api_key unless @session.api_key.nil?
@p... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
Sija/garb | https://github.com/Sija/garb/blob/eb51f50af6e3ad18f1a7754baee61aa315725cf5/lib/garb/request/authentication.rb | lib/garb/request/authentication.rb | module Garb
module Request
class Authentication
URL = 'https://www.google.com/accounts/ClientLogin'.freeze
def initialize(email, password, opts = {})
@email = email
@password = password
@account_type = opts[:account_type] || 'HOSTED_OR_GOOGLE'
end
def parameters
... | ruby | MIT | eb51f50af6e3ad18f1a7754baee61aa315725cf5 | 2026-01-04T17:34:06.149687Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/spec/end_to_end_spec.rb | spec/end_to_end_spec.rb | require "erb"
require "spec_helper"
describe "a new ec2 instance" do
ec2
# Telfile
telfile do
<<EOF
user "gub"
ruby "1.9.3"
ssh_options ["-o", "User=ubuntu", "-o", "StrictHostKeyChecking=no", "-o", "IdentityFile=#{ENV["TELEPORT_SSH_KEY"]}"]
role :master, :packages => %w(nginx), :recipes => %w(ruby.rb)
serv... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/spec/spec_helper.rb | spec/spec_helper.rb | SUPPORT = "#{File.dirname(__FILE__)}/support"
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib"
$LOAD_PATH << File.dirname(__FILE__)
$LOAD_PATH << SUPPORT
require "awesome_print"
require "rspec"
require "teleport"
Dir["#{SUPPORT}/*.rb"].each { |i| require File.basename(i) }
TELDIRS = "#{File.dirname(__FILE__)}/teldi... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/spec/support/telfile.rb | spec/support/telfile.rb | # run inside a specific dir
module Support
module Telfile
TMP = "/tmp/teleport_spec"
def telfile(contents = nil, &block)
pwd = nil
before(:all) do
pwd = Dir.pwd
`rm -rf #{TMP} && mkdir -p #{TMP}`
Dir.chdir(TMP)
File.open("Telfile", "w") do |f|
if block
... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/spec/support/exit_code.rb | spec/support/exit_code.rb | # http://stackoverflow.com/questions/5118745/is-systemexit-a-special-kind-of-exception
module ExitCodeMatchers
RSpec::Matchers.define :exit_with_code do |code|
actual = nil
match do |block|
begin
block.call
rescue SystemExit => e
actual = e.status
end
actual && actual ... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/spec/support/ec2.rb | spec/support/ec2.rb | require "AWS"
# spin up a fresh ec2 instance
module Support
module Ec2
# these are all us-east-1 64-bit instance
AMI_10_04 = "8fac75e6" # lucid
AMI_10_10 = "098f5760" # maverick
AMI_11_04 = "35c31a5c" # natty
AMI_11_10 = "8baa73e2" # oneiric
AMI_12_04 = "3c994355" # precise
KEYPAIR = "tel... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/spec/unit/teleport/config_spec.rb | spec/unit/teleport/config_spec.rb | require "spec_helper"
describe Teleport::Config do
context "with a blank Telfile" do
telfile("")
let(:config) do
Teleport::Config.new
end
it "defaults to the current username" do
config.user.should == `whoami`.strip
end
it "defaults to the first vm in RUBIES" do
config.ruby... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport.rb | lib/teleport.rb | require "teleport/constants"
require "teleport/version"
require "teleport/util"
require "teleport/config"
require "teleport/mirror"
require "teleport/install"
require "teleport/infer"
require "teleport/main"
| ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/main.rb | lib/teleport/main.rb | require "optparse"
module Teleport
# The main class for the teleport command line.
class Main
include Constants
include Util
TAR = "#{DIR}.tgz"
def initialize(cmd = :teleport)
cli(cmd)
case @options[:cmd]
when :teleport
$stderr = $stdout
teleport
when :ins... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/version.rb | lib/teleport/version.rb | module Teleport
# Gem version
VERSION = "1.0.20"
end
| ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/mirror.rb | lib/teleport/mirror.rb | require "erb"
module Teleport
# Helper module for recursively mirroring files from a src to a dst.
module Mirror
include Constants
# Don't install these files.
IGNORE = [
".",
"..",
"Gemfile",
"Gemfile.lock",
/^.#/,
... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/constants.rb | lib/teleport/constants.rb | module Constants
# The temp directory that teleport uses on the target machine.
DIR = "/tmp/_teleported"
# The teleport gem within our temp directory.
GEM = "#{DIR}/gem"
# Directory where user install data (Telfile and friends) is stored.
DATA = "#{DIR}/data"
# Directory where user install files ... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/config.rb | lib/teleport/config.rb | module Teleport
# This class parses Telfile, and includes DSL and the models.
class Config
include Constants
RUBIES = ["2.0.0", "1.9.3", "1.9.2", "REE", "1.8.7"]
attr_accessor :user, :ruby, :ssh_options, :roles, :servers, :apt, :packages, :recipes, :callbacks, :dsl, :ssh_key
def initialize(file =... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/infer.rb | lib/teleport/infer.rb | require "set"
# Many, many thanks to Blueprint!
# https://github.com/devstructure/blueprint
module Teleport
class Infer
include Util
# Copyright 2011 DevStructure. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/install.rb | lib/teleport/install.rb | module Teleport
# Class that performs the install on the target machine.
class Install
include Constants
include Util
include Mirror
def initialize(config)
@config = config
run_verbose!
_read_config
# setup @config constants. Put them in mirror so they're
# accessible... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
gurgeous/teleport | https://github.com/gurgeous/teleport/blob/4f01d68388ce3853739cedd89485b0dcac60102c/lib/teleport/util.rb | lib/teleport/util.rb | require "cgi"
require "digest/md5"
require "etc"
require "fileutils"
require "yaml"
module Teleport
# Helper module for executing commands and printing stuff
# out.
#
# The general idea is to only print commands that are actually
# interesting. For example, mkdir_if_necessary won't print anything
# if the ... | ruby | MIT | 4f01d68388ce3853739cedd89485b0dcac60102c | 2026-01-04T17:34:00.377784Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/cause-abort.rb | cause-abort.rb | #!/usr/bin/env ruby
require 'zookeeper'
require File.expand_path('../spec/support/zookeeper_spec_helpers', __FILE__)
class CauseAbort
include Zookeeper::Logger
include Zookeeper::SpecHelpers
attr_reader :path, :pids_root, :data
def initialize
@path = "/_zktest_"
@pids_root = "#{@path}/pids"
@dat... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/scripts/upgrade-1.0-sed-alike.rb | scripts/upgrade-1.0-sed-alike.rb | #!/usr/bin/env ruby
if ARGV.empty?
$stderr.puts <<-EOS
Usage: #{File.basename(__FILE__)} file1 file2 file3
Fix references to Zookeeper classes and modules.
This script acts like sed and edits files in place (not saving backups,
as you *are* using source control and aren't a complete tool).
if you have any doubts... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/zoomonkey/zoomonkey.rb | zoomonkey/zoomonkey.rb | require 'zookeeper'
require 'zk-server'
require 'fileutils'
require 'tmpdir'
SLEEP_TIME = 30
STDOUT.sync = true
if ENV['DEBUG']
def zookeeper_logger(from)
l = Logger.new(STDOUT)
l.formatter = proc do |sev, time, c, msg|
"t=#{time.to_i} from=#{from} level=#{sev.downcase} message=#{msg.inspect}\n"
e... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/ext/c_zookeeper.rb | ext/c_zookeeper.rb | Zookeeper.require_lib(
'zookeeper/logger',
'zookeeper/common',
'zookeeper/constants',
'zookeeper/exceptions' # zookeeper_c depends on exceptions defined in here
)
begin
Zookeeper.require_root 'ext/zookeeper_c'
rescue LoadError # Rubygems 3.4+ cleans up build artifacts in the ext/ directory.
Zookeeper.r... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/ext/extconf.rb | ext/extconf.rb | require 'mkmf'
require 'rbconfig'
require 'fileutils'
HERE = File.expand_path(File.dirname(__FILE__))
BUNDLE = Dir.glob("zkc-*.tar.gz").sort.last
ZKC_VERSION = BUNDLE[/(zkc-.*?)\.tar.gz$/, 1]
PATCHES = Dir.glob("patches/#{ZKC_VERSION}*.patch")
BUNDLE_PATH = File.join(HERE, ZKC_VERSION, 'c')
$EXTRA_CONF = ''
# CLANG... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/ext/zookeeper_base.rb | ext/zookeeper_base.rb | require 'forwardable'
Zookeeper.require_root 'ext/c_zookeeper'
# The low-level wrapper-specific methods for the C lib
# subclassed by the top-level Zookeeper class
module Zookeeper
class ZookeeperBase
extend Forwardable
include Forked
include Common # XXX: clean this up, no need to include *everything*
... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/ext/generate_gvl_code.rb | ext/generate_gvl_code.rb | #!/usr/bin/env ruby
=begin
the idea here is to take each zoo_* function declaration in the header file, and turn it into
a calling arguments struct, a wrapper function and a macro for packing the values.
so for:
ZOOAPI int zoo_acreate(zhandle_t *zh, const char *path, const char *value,
int valuelen, con... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/compatibilty_spec.rb | spec/compatibilty_spec.rb | require 'spec_helper'
describe 'Compatibiliy layer' do
it %[should raise the correct error when a const is missing] do
expect { Zookeeper::THISISANINVALIDCONST }.to raise_error(NameError)
end
end
| ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/latch_spec.rb | spec/latch_spec.rb | require 'spec_helper'
# this is a simple sanity check of my timeout addition
describe Zookeeper::Latch do
subject { described_class.new }
describe %[await] do
describe %[with timeout] do
it %[should return after waiting until timeout if not released] do
other_latch = described_class.new
... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/chrooted_connection_spec.rb | spec/chrooted_connection_spec.rb | require 'spec_helper'
require 'shared/connection_examples'
describe 'Zookeeper chrooted' do
let(:path) { "/_zkchroottest_" }
let(:data) { "underpants" }
let(:chroot_path) { '/slyphon-zookeeper-chroot' }
let(:connection_string) { "#{Zookeeper.default_cnx_str}#{chroot_path}" }
before do
@zk = Zookeeper.n... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/zookeeper_spec.rb | spec/zookeeper_spec.rb | require 'spec_helper'
require 'shared/connection_examples'
describe 'Zookeeper' do
let(:path) { "/_zktest_" }
let(:data) { "underpants" }
let(:connection_string) { Zookeeper.default_cnx_str }
before do
@zk = Zookeeper.new(connection_string)
end
after do
@zk and @zk.close
end
def zk
@zk... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/default_watcher_spec.rb | spec/default_watcher_spec.rb | require 'spec_helper'
describe Zookeeper do
describe :initialize, 'with watcher block' do
before do
@events = []
@watch_block = lambda do |hash|
logger.debug "watch_block: #{hash.inspect}"
@events << hash
end
@zk = Zookeeper.new(Zookeeper.default_cnx_str, 10, @watch_block... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/em_spec.rb | spec/em_spec.rb | require File.expand_path('../spec_helper', __FILE__)
require 'zookeeper/em_client'
gem 'evented-spec', '~> 0.9.0'
require 'evented-spec'
describe 'ZookeeperEM' do
describe 'Client' do
include EventedSpec::SpecHelper
default_timeout 3.0
def setup_zk
@zk = ZookeeperEM::Client.new(Zookeeper.default... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/c_zookeeper_spec.rb | spec/c_zookeeper_spec.rb | # tests the CZookeeper, obviously only available when running under MRI
unless defined?(::JRUBY_VERSION)
require 'spec_helper'
describe Zookeeper::CZookeeper do
def pop_all_events
[].tap do |rv|
begin
rv << @event_queue.pop(non_blocking=true)
rescue ThreadError
end
... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
$LOAD_PATH.unshift(File.expand_path('../../ext', __FILE__))
$LOAD_PATH.uniq!
require 'rubygems'
release_ops_path = File.expand_path('../../releaseops/lib', __FILE__)
if File.exist?(release_ops_path)
require File.join(release_ops_path, 'releaseops')
Rele... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/forked_connection_spec.rb | spec/forked_connection_spec.rb | require 'spec_helper'
unless defined?(::JRUBY_VERSION)
describe %[forked connection] do
let(:path) { "/_zktest_" }
let(:pids_root) { "#{path}/pids" }
let(:data) { "underpants" }
let(:connection_string) { Zookeeper.default_cnx_str }
def process_alive?(pid)
Process.kill(0, @pid)
true
... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/support/00_logging.rb | spec/support/00_logging.rb | module Zookeeper
TEST_LOG_PATH = File.expand_path('../../../test.log', __FILE__)
def self.setup_test_logger
log =
if (ENV['ZOOKEEPER_DEBUG'] || ENV['ZKRB_DEBUG'])
::Logger.new(STDERR)
else
::Logger.new(TEST_LOG_PATH)
end
log.level = ::Logger::DEBUG
Zookeeper::Logger.... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/support/10_spawn_zookeeper.rb | spec/support/10_spawn_zookeeper.rb | module Zookeeper
def self.spawn_zookeeper?
!!ENV['SPAWN_ZOOKEEPER']
end
def self.default_cnx_host
ENV['ZK_DEFAULT_HOST'] || 'localhost'
end
@test_port ||= spawn_zookeeper? ? 21811 : 2181
class << self
attr_accessor :test_port
end
def self.default_cnx_str
"#{default_cnx_host}:#{test_p... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/support/progress_formatter.rb | spec/support/progress_formatter.rb | require 'rspec/core/formatters/progress_formatter'
module RSpec
module Core
module Formatters
class ProgressFormatter
def example_started(example)
SpecGlobalLogger.logger << pending_color("\n=====<([ #{example.full_description} ])>=====\n")
super(example)
end
end
... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/support/zookeeper_spec_helpers.rb | spec/support/zookeeper_spec_helpers.rb | module Zookeeper
module SpecHelpers
class TimeoutError < StandardError; end
include Zookeeper::Constants
include Zookeeper::Logger
def ensure_node(zk, path, data)
return if zk.closed?
if zk.stat(:path => path)[:stat].exists?
zk.set(:path => path, :data => data)
else
... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/ext/zookeeper_base_spec.rb | spec/ext/zookeeper_base_spec.rb | require 'spec_helper'
unless defined?(::JRUBY_VERSION)
describe Zookeeper::ZookeeperBase do
before do
@zk = described_class.new(Zookeeper.default_cnx_str)
end
after do
@zk.close unless @zk.closed?
end
it %[should have an original_pid assigned] do
expect(@zk.original_pid).to eq... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/shared/connection_examples.rb | spec/shared/connection_examples.rb | require 'shared/all_success_return_values'
shared_examples_for "connection" do
before :each do
ensure_node(zk, path, data)
end
after :each do
ensure_node(zk, path, data)
end
# unfortunately, we can't test w/o exercising other parts of the driver, so
# if "set" is broken, this test will fail as w... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/spec/shared/all_success_return_values.rb | spec/shared/all_success_return_values.rb | shared_examples_for "all success return values" do
it %[should have a return code of Zookeeper::ZOK] do
expect(@rv[:rc]).to eq(Zookeeper::ZOK)
end
it %[should have a req_id integer] do
expect(@rv[:req_id]).to be_kind_of(Integer)
end
end
| ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/lib/zookeeper.rb | lib/zookeeper.rb | # Ruby wrapper for the Zookeeper C API
require 'thread'
require 'monitor'
require 'forwardable'
require 'logger'
require 'benchmark'
module Zookeeper
ZOOKEEPER_ROOT = File.expand_path('../..', __FILE__)
# require a path relative to the lib directory
# this is to avoid monkeying explicitly with $LOAD_PATH
#
... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/lib/zookeeper/common.rb | lib/zookeeper/common.rb | require 'zookeeper/exceptions'
require 'zookeeper/common/queue_with_pipe'
module Zookeeper
module Common
def event_dispatch_thread?
@dispatcher && (@dispatcher == Thread.current)
end
private
def setup_dispatch_thread!
@mutex.synchronize do
if @dispatcher
logger.debug { "dispatcher already ... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/lib/zookeeper/rake_tasks.rb | lib/zookeeper/rake_tasks.rb | require 'rake'
require 'rake/tasklib'
module Zookeeper
# @private
module RakeTasks
def self.define_test_tasks_for(*rubies)
rubies.each do |r|
TestOneRuby.new(:name => r) do |tor|
yield tor if block_given?
end
end
end
class TestOneRuby < ::Rake::TaskLib
incl... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/lib/zookeeper/em_client.rb | lib/zookeeper/em_client.rb | require 'zookeeper'
require 'eventmachine'
module ZookeeperEM
class Client < Zookeeper::Client
# @private
# the EM Connection instance we receive once we call EM.watch on our selectable_io
attr_reader :em_connection
def initialize(*a, &b)
@on_close = EM::DefaultDeferrable.new
@on_... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/lib/zookeeper/version.rb | lib/zookeeper/version.rb | module Zookeeper
VERSION = '1.5.5'
DRIVER_VERSION = '3.4.5'
end
| ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
zk-ruby/zookeeper | https://github.com/zk-ruby/zookeeper/blob/a497f79d4d138f1a497b38e27d314530416967fb/lib/zookeeper/exceptions.rb | lib/zookeeper/exceptions.rb | module Zookeeper
module Exceptions
include Constants
class ZookeeperException < StandardError
unless defined?(CONST_MISSING_WARNING)
CONST_MISSING_WARNING = <<-EOS
------------------------------------------------------------------------------------------
WARNING! THE ZOOKEEPER NAMESPACE HAS CHANGED AS... | ruby | MIT | a497f79d4d138f1a497b38e27d314530416967fb | 2026-01-04T17:33:54.311549Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.