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 |
|---|---|---|---|---|---|---|---|---|
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli.rb | lib/rbkb/cli.rb | require 'rbkb'
require 'rbkb/extends'
require 'optparse'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
module Rbkb::Cli
# Rbkb::Cli::Executable is an abstract class for creating command line
# executables using the Ruby Black Bag framework.
class Executable
def self.run(... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug.rb | lib/rbkb/plug.rb | # Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
require 'rbkb'
begin require 'rubygems'; rescue LoadError; end
require 'eventmachine'
require 'rbkb/plug/plug'
require 'rbkb/plug/blit'
| ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/common.rb | lib/rbkb/extends/common.rb | require 'stringio'
require 'zlib'
require 'open3'
require 'digest/md5'
require 'digest/sha1'
require 'digest/sha2'
module Rbkb
DEFAULT_BYTE_ORDER = :big
HEXCHARS = [('0'..'9').to_a, ('a'..'f').to_a].flatten
end
| ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/array.rb | lib/rbkb/extends/array.rb | class Array
# Should be in the std library.
#
# keys = [:one, :two, :three]
# vals = [1, 2, 3]
#
# keys.zip(vals).to_hash
# #=> {:two=>2, :three=>3, :one=>1}})
#
# keys.to_hash(vals)
# #=> {:two=>2, :three=>3, :one=>1}})
def to_hash(vals = nil)
a = vals ? zip(vals) : self
a.eac... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/float.rb | lib/rbkb/extends/float.rb | require 'rbkb/extends/common'
module Rbkb
module Extends
module Float
def log2
Math.log(self) / Math.log(2)
end
end
end
end
# float is a weird "Type"
class Float
include Rbkb::Extends::Float
end
| ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/string.rb | lib/rbkb/extends/string.rb | require 'rbkb/extends/common'
require 'rbkb/extends/numeric'
require 'cgi'
module Rbkb
module Extends
module String
# This is so disgusting... but str.encode('BINARY')
# fails hard whenever certain utf-8 characters
# present. Try "\xca\xfe\xba\xbe".encode('BINARY')
# for kicks.
def ... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/object.rb | lib/rbkb/extends/object.rb | class Object
## This is from Topher Cyll's Stupd IRB tricks
def mymethods
(methods - self.class.superclass.methods).sort
end
end
| ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/enumerable.rb | lib/rbkb/extends/enumerable.rb | module Enumerable
def each_recursive(&block)
each do |n|
block.call(n)
n.each_recursive(&block) if n.is_a?(Enumerable)
end
end
def sum
inject(0) { |accum, i| accum + i }
end
def mean
sum / length.to_f
end
def sample_variance
m = mean
sum = inject(0) { |accum, i| accu... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/symbol.rb | lib/rbkb/extends/symbol.rb | class Symbol
# looks up this symbol as a constant defined in 'ns' (Object by default)
def const_lookup(ns = Object)
to_s.const_lookup(ns)
end
end
| ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends/numeric.rb | lib/rbkb/extends/numeric.rb | require 'rbkb/extends/common'
class Numeric
# calculate padding based on alignment(a)
def pad(a)
raise "bad alignment #{a.inspect}" unless a.is_a? Numeric and a > 0
self < 1 ? a + self : (a - 1) - (self - 1) % a
end
# tells you whether a number is within printable range
def printable?
self >= 0... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug/feed_import.rb | lib/rbkb/plug/feed_import.rb | # Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
require 'yaml'
require 'rbkb'
module FeedImport
## TODO switch to pcaprub or some other up to date pcap lib. make it a dep.
begin
## This requires the 'ruby-pcap' library from:
## http://raa.ruby-lang.org/project/pcap/
... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug/peer.rb | lib/rbkb/plug/peer.rb | # Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
require 'socket'
module Plug
class Peer
attr_reader :addr, :transport, :name, :owner, :host, :port
attr_accessor :mute
def initialize(addr, owner)
@addr = addr
@owner = owner
@transport = @owner.transp... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug/proxy.rb | lib/rbkb/plug/proxy.rb | # Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
module Plug
module Proxy
include Base
attr_accessor :target
def initialize(transport, _target)
@transport = transport
@peers = ProxyPeerList.new(self)
@kind = :proxy
end
end
class ProxyPeerList... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug/unix_domain.rb | lib/rbkb/plug/unix_domain.rb | # Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# Experimental!!!
require 'eventmachine'
require 'rbkb/plug'
require 'rbkb'
module Plug
class PeerStub
attr_reader :owner
def initialize(owner)
@owner = owner
end
def [](_junk)
@owner
end
def ... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug/blit.rb | lib/rbkb/plug/blit.rb | # Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
module Plug
module Blit
include Base
DEFAULT_IPADDR = '127.0.0.1'
DEFAULT_PORT = 25_195
DEFAULT_PROTOCOL = :TCP
OPCODES = {
0 => :squelch,
1 => :unsquelch,
2 => :delete,
5 => :sendmsg,
... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug/cli.rb | lib/rbkb/plug/cli.rb | require 'rbkb/cli'
require 'rbkb/plug'
require 'eventmachine'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
module Rbkb::Cli
# Rbkb::Cli::Executable is an abstract class for creating command line
# executables using the Ruby Black Bag framework.
class PlugCli < Executable
... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/plug/plug.rb | lib/rbkb/plug/plug.rb | # Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
require 'rbkb/plug/peer'
require 'stringio'
require 'socket'
module Plug
module UI
LOGCFG = { out: STDERR, dump: :hex }
def self.prompt(*msg)
warn msg
STDIN.gets
end
def self.log(*msg)
LOGCFG[:out... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/feed.rb | lib/rbkb/cli/feed.rb | require 'rbkb/cli'
require 'rbkb/plug'
require 'rbkb/plug/feed_import'
require 'eventmachine'
# Copyright 2009 emonti at moatasano dot com
# See README.rdoc for license information
#
# This is a plug-board message feeder from static data sources.
# The "feed" handles messages opaquely and just plays them in the given
... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/chars.rb | lib/rbkb/cli/chars.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# Repeats an argument N times
class Rbkb::Cli::Chars < Rbkb::Cli::Executable
def make_parser
super()
@oparse.banner += " 100 A; # print 100 A's"
end
def parse(*args)
super(*args)
bail_args @arg... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/urldec.rb | lib/rbkb/cli/urldec.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# urldec converts a url percent-encoded string back to its raw form.
# Input can be supplied via stdin, a string argument, or a file (with -f).
# (url percent-encoding is just fancy hex encoding)
class Rbkb::Cli::Url... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/slice.rb | lib/rbkb/cli/slice.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# Returns a slice from input. This is just a shell interface to a String.slice
# operation.
class Rbkb::Cli::Slice < Rbkb::Cli::Executable
def initialize(*args)
super(*args)
@opts[:last] ||= -1
end
def... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/dedump.rb | lib/rbkb/cli/dedump.rb | require 'rbkb/cli'
require 'rbkb/extends'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# Reverses a hexdump back to raw data. Designed to work with hexdumps created
# by Unix utilities like 'xxd' as well as 'hexdump -C'.
class Rbkb::Cli::Dedump < Rbkb::Cli::Executable
def initi... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/xor.rb | lib/rbkb/cli/xor.rb | #!/usr/bin/env ruby
require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# Repeating string xor. Takes input from a string, stdin, or a file (-f).
class Rbkb::Cli::Xor < Rbkb::Cli::Executable
def make_parser
super()
add_std_file_opt(:indat)
arg = @oparse
... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/rstrings.rb | lib/rbkb/cli/rstrings.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# rstrings is Unix "strings" in ruby... with some extra stuff
class Rbkb::Cli::Rstrings < Rbkb::Cli::Executable
def initialize(*args)
super(*args) do |this|
{
start_off: 0,
end_off: -1,
... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/d64.rb | lib/rbkb/cli/d64.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# d64 converts a base-64 encoded string back to its orginal form.
class Rbkb::Cli::D64 < Rbkb::Cli::Executable
def make_parser
super()
@oparse.banner += ' <data | blank for stdin>'
add_std_file_opt(:ind... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/urlenc.rb | lib/rbkb/cli/urlenc.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# urlenc converts a string or raw data to a url percent-encoded string
# Input can be supplied via stdin, a string argument, or a file (with -f).
# (url percent-encoding is just fancy hex encoding)
class Rbkb::Cli::U... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/b64.rb | lib/rbkb/cli/b64.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# b64 converts strings or raw data to base-64 encoding.
class Rbkb::Cli::B64 < Rbkb::Cli::Executable
def make_parser
super()
arg = @oparse
arg.banner += ' <data | blank for stdin>'
add_std_file_opt... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/crc32.rb | lib/rbkb/cli/crc32.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# crc32 returns a crc32 checksum in hex from stdin or a file
class Rbkb::Cli::Crc32 < Rbkb::Cli::Executable
def initialize(*args)
super(*args)
@opts[:first] ||= 0
@opts[:last] ||= -1
end
def make_... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/hexify.rb | lib/rbkb/cli/hexify.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# The hexify command converts a string or raw data to hex characters.
# Input can be supplied via stdin, a string argument, or a file (with -f).
class Rbkb::Cli::Hexify < Rbkb::Cli::Executable
def make_parser
s... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/blit.rb | lib/rbkb/cli/blit.rb | require 'rbkb/cli'
require 'rbkb/plug'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# blit is for use with any of the "plug" tools such as telson, feed, blitplug.
# It is used to send data over a socket via their OOB blit listener.
class Rbkb::Cli::Blit < Rbkb::Cli::Executable
... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/unhexify.rb | lib/rbkb/cli/unhexify.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# unhexify converts a string of hex bytes back to raw data. Input can be
# supplied via stdin, a hex-string argument, or a file containing hex (use -f).
class Rbkb::Cli::Unhexify < Rbkb::Cli::Executable
def make_pa... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/len.rb | lib/rbkb/cli/len.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
# len prepends a binary length number in front of its input and outputs
# raw on STDOUT
class Rbkb::Cli::Len < Rbkb::Cli::Executable
def initialize(*args)
# endianness pair. index 0 is always the default
@en... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/bgrep.rb | lib/rbkb/cli/bgrep.rb | require 'rbkb/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# searches for a binary string in input. string can be provided 'hexified'
class Rbkb::Cli::Bgrep < Rbkb::Cli::Executable
def initialize(*args)
super(*args) do |this|
this.opts[:start_off] ||= 0
thi... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/cli/telson.rb | lib/rbkb/cli/telson.rb | require 'rbkb/plug/cli'
# Copyright 2009 emonti at matasano.com
# See README.rdoc for license information
#
# This is an implementation of the original blackbag "telson" around
# ruby and eventmachine.
#
# Telson can do the following things with minimum fuss:
# - Run as a "stubbed" network client using UDP or TCP
# ... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/experimental/colordif.rb | experimental/colordif.rb | #!/usr/bin/env ruby
# Sort of like vbindiff, except smaller with less functionality, and in our toolshed ;)
# Useful for encoded HTTP parameters, raw dumped pkts and other little things
# todo: print out like hexdump -C
# Chris at mtso
module ColorConstants
BLACK = "\e[1;30m"
RED = "\e[1;31m"
GREEN = "\e[1;32m"
B... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/experimental/fmagic.rb | experimental/fmagic.rb | #----------------------------------------------------------------------
# Optional extensions based on dependencies below:
#----------------------------------------------------------------------
begin
# magick signatures: attempt to identify a buffer with magic(5)
# using the same library as file(1)
#
# Extend... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
emonti/rbkb | https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/experimental/magicripper.rb | experimental/magicripper.rb | #!/usr/bin/env ruby
# (emonti at matasano) Matasano Security LLC 2008
require 'rbkb'
require 'rbkb/command_line'
require 'stringio'
include RBkB::CommandLine
first = 0
last = nil
chunksz = 8192
#------------------------------------------------------------------------------
# Init options and arg parsing
OPTS = {:le... | ruby | MIT | 4645025c4317c9bd71257c5bbb70f5fe2342ffa5 | 2026-01-04T17:36:07.822164Z | false |
stereobooster/jekyll-press | https://github.com/stereobooster/jekyll-press/blob/15b333f1dab2bceb11858cf94fcf2139c2d59496/lib/jekyll-press.rb | lib/jekyll-press.rb | require "jekyll-press/version"
require 'html_press'
require 'multi_css'
require 'multi_js'
module Jekyll
module Compressor
def exclude?(dest, dest_path)
res = false
file_name = dest_path.slice(dest.length+1..dest_path.length)
exclude = @site.config['jekyll-press'] && @site.config['jekyll-press... | ruby | MIT | 15b333f1dab2bceb11858cf94fcf2139c2d59496 | 2026-01-04T17:36:20.845390Z | false |
stereobooster/jekyll-press | https://github.com/stereobooster/jekyll-press/blob/15b333f1dab2bceb11858cf94fcf2139c2d59496/lib/jekyll-press/version.rb | lib/jekyll-press/version.rb | module Jekyll
module Press
VERSION = "0.2.1"
end
end
| ruby | MIT | 15b333f1dab2bceb11858cf94fcf2139c2d59496 | 2026-01-04T17:36:20.845390Z | false |
coderbydesign/chart-js-rails | https://github.com/coderbydesign/chart-js-rails/blob/b97ec551e983c8fa2367fff00dd8e95f77423da5/lib/chart-js-rails.rb | lib/chart-js-rails.rb | require 'chart-js-rails/version'
module ChartJs
module Rails
class Engine < ::Rails::Engine
end
end
end
| ruby | MIT | b97ec551e983c8fa2367fff00dd8e95f77423da5 | 2026-01-04T17:36:24.268795Z | false |
coderbydesign/chart-js-rails | https://github.com/coderbydesign/chart-js-rails/blob/b97ec551e983c8fa2367fff00dd8e95f77423da5/lib/chart-js-rails/version.rb | lib/chart-js-rails/version.rb | module ChartJs
module Rails
VERSION = '0.1.7'.freeze
end
end
| ruby | MIT | b97ec551e983c8fa2367fff00dd8e95f77423da5 | 2026-01-04T17:36:24.268795Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api_spec.rb | spec/bitbucket_rest_api_spec.rb | describe BitBucket do
let(:api) { BitBucket }
describe "register_constant" do
it "sets a constant" do
api.register_constant({const_1: 'value1'})
end
end
describe "lookup_constant" do
it "returns the constant's value" do
expect(api.lookup_constant('CONST_1')).to eq 'value1'
expect... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/spec_helper.rb | spec/spec_helper.rb | require 'simplecov'
SimpleCov.start
require 'webmock/rspec'
require 'pry'
require 'vcr'
require 'bitbucket_rest_api'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
config.mock_with :mocha
end
config.mock_... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/parameter_filter_spec.rb | spec/bitbucket_rest_api/parameter_filter_spec.rb | require 'spec_helper'
require 'bitbucket_rest_api/core_ext/hash'
describe BitBucket::ParameterFilter, '#filter!' do
let(:hash) { { :a => { :b => { :c => 1 } } } }
let(:array) { [{ :a => { :b => { :c => 1 } } }, {d: {e: 2}}] }
let(:klass) {
Class.new do
include BitBucket::ParameterFilter
end
}
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/request_spec.rb | spec/bitbucket_rest_api/request_spec.rb | require 'spec_helper'
require 'bitbucket_rest_api/request'
describe BitBucket::Request do
let(:fake_api) { (Class.new { include BitBucket::Request })}
let(:faraday_connection) { Faraday.new(:url => 'https://api.bitbucket.org') }
describe "request" do
it "raises an ArgumentError if an unsupported HTTP verb i... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/api_spec.rb | spec/bitbucket_rest_api/api_spec.rb | require 'spec_helper'
describe BitBucket::API do
let(:setup_options) { { user: 'test_user' } }
let(:bitbucket_api) { described_class.new(setup_options) }
after do
[:user, :login, :password].each do |key|
bitbucket_api.send "clear_#{key}".to_sym
end
end
describe '#new' do
it 'passes options... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/client_spec.rb | spec/bitbucket_rest_api/client_spec.rb | require 'spec_helper'
describe BitBucket::Client do
let(:client) { described_class.new }
it "returns the a new object of the correct class" do
expect(client.issues).to be_a BitBucket::Issues
expect(client.repos).to be_a BitBucket::Repos
expect(client.users).to be_a BitBucket::Users
expect(client.u... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/issues_spec.rb | spec/bitbucket_rest_api/issues_spec.rb | require 'spec_helper'
require 'ostruct'
describe BitBucket::Issues do
let(:issue) { BitBucket::Issues.new }
describe '.create' do
before do
expect(issue).to receive(:request).with(
:post,
'/1.0/repositories/mock_username/mock_repo/issues/',
{ 'title' => 'mock_issue' },
{}... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/normalizer_spec.rb | spec/bitbucket_rest_api/normalizer_spec.rb | # encoding: utf-8
require 'spec_helper'
require 'bitbucket_rest_api/core_ext/hash'
describe BitBucket::Normalizer, '#normalize!' do
let(:hash) { { 'a' => { :b => { 'c' => 1 }, 'd' => ['a', { :e => 2 }] } } }
let(:klass) do
Class.new do
include BitBucket::Normalizer
end
end
subject(:instance) {... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/authorization_spec.rb | spec/bitbucket_rest_api/authorization_spec.rb | require 'spec_helper'
describe BitBucket::Authorization do
let(:oauth_api) { BitBucket::API.new(oauth_token: 'example_oauth_token') }
let(:basic_auth_api) { BitBucket::API.new(basic_auth: 'example_login:example_password') }
let(:basic_auth_api_hash) do
BitBucket::API.new(
basic_auth: { login: 'example_... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/invitations_spec.rb | spec/bitbucket_rest_api/invitations_spec.rb | require 'spec_helper'
describe BitBucket::Invitations do
subject { described_class.new }
describe '#invitations' do
before do
expect(subject).to receive(:request).with(
:post,
"/1.0/invitations/mock_username/mock_repo/mock_email_address",
{ :permission => 'read' },
{}
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/deprecation_spec.rb | spec/bitbucket_rest_api/deprecation_spec.rb | require 'spec_helper'
describe BitBucket do
let(:method) { 'create_repos'}
let(:alt_method) { 'repos.create'}
it { expect(described_class.constants).to include :DEPRECATION_PREFIX }
context '.deprecate' do
before do
BitBucket.deprecation_tracker = []
end
it 'tracks messages' do
expec... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/api_factory_spec.rb | spec/bitbucket_rest_api/api_factory_spec.rb | # encoding: utf-8
require 'spec_helper'
describe BitBucket::ApiFactory do
subject(:factory) { described_class }
context '#new' do
it 'throws error if klass type is ommitted' do
expect { factory.new nil }.to raise_error(ArgumentError)
end
it 'instantiates a new object' do
expect(factory.... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/teams_spec.rb | spec/bitbucket_rest_api/teams_spec.rb | require 'spec_helper'
describe BitBucket::Teams do
let(:team) { described_class.new }
describe '.list' do
before do
expect(team).to receive(:request).with(
:get,
'/2.0/teams/?role=member',
{},
{}
).and_return({"values" => ['team1', 'team2', 'team3']})
end
c... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/user_spec.rb | spec/bitbucket_rest_api/user_spec.rb | require 'spec_helper'
describe BitBucket::User do
let(:options) do
{
client_id: 'example_client_id',
client_secret: 'example_client_secret',
oauth_token: 'example_oauth_token',
oauth_secret: 'example_oauth_secret',
adapter: :net_http
}
end
before do
@user =... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos_spec.rb | spec/bitbucket_rest_api/repos_spec.rb | require 'spec_helper'
describe BitBucket::Repos do
let(:repo) { BitBucket::Repos.new }
# class_eval is setting global variables in api.rb, this is creating
# failed expectations when these variables are not reset to nil before
# the next test is run. Therefore we must clear them manually as
# for the user a... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/issues/comments_spec.rb | spec/bitbucket_rest_api/issues/comments_spec.rb | require 'spec_helper'
describe BitBucket::Issues::Comments do
let(:comments) { described_class.new }
describe '.list' do
before do
expect(comments).to receive(:request).with(
:get,
'/1.0/repositories/mock_username/mock_repo/issues/mock_issue_id/comments/',
{},
{}
).... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/issues/milestones_spec.rb | spec/bitbucket_rest_api/issues/milestones_spec.rb | require 'spec_helper'
describe BitBucket::Issues::Milestones do
subject { described_class.new }
describe '#list' do
before do
expect(subject).to receive(:request).with(
:get,
'/1.0/repositories/mock_username/mock_repo/issues/milestones',
{},
{}
).and_return(['milset... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/issues/components_spec.rb | spec/bitbucket_rest_api/issues/components_spec.rb | require 'spec_helper'
describe BitBucket::Issues::Components do
subject { described_class.new }
describe '#list' do
before do
expect(subject).to receive(:request).with(
:get,
'/1.0/repositories/mock_username/mock_repo/issues/components',
{},
{}
).and_return(['compon... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/error/bad_events_spec.rb | spec/bitbucket_rest_api/error/bad_events_spec.rb | require 'spec_helper'
describe BitBucket::Error::BadEvents do
context 'an event that does not exist is passed in BitBucket::Repos::Webhooks#create or BitBucket::Repos::Webhooks#edit' do
it 'should raise an error with a message' do
expect { raise described_class.new('bad:event') }.
to raise_error(BitB... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/error/blank_value_spec.rb | spec/bitbucket_rest_api/error/blank_value_spec.rb | require 'spec_helper'
describe BitBucket::Error::BlankValue do
context 'an event that does not exist is passed in BitBucket::Repos::Webhooks#create or BitBucket::Repos::Webhooks#edit' do
it 'should raise an error with a message' do
expect { raise described_class.new('required_key') }.
to raise_error(... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/error/no_events_spec.rb | spec/bitbucket_rest_api/error/no_events_spec.rb | require 'spec_helper'
describe BitBucket::Error::NoEvents do
context 'no events are passed in BitBucket::Repos::Webhooks#create or BitBucket::Repos::Webhooks#edit' do
it 'should raise an error with a message' do
expect { raise described_class.new }.
to raise_error(BitBucket::Error::NoEvents, "At leas... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/webhooks_spec.rb | spec/bitbucket_rest_api/repos/webhooks_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Webhooks, wip: true do
subject { described_class.new }
let(:post_put_params) do
{
'description' => 'mock_description',
'url' => 'mock_url',
'active' => true,
'events' => ['repo:push']
}
end
let(:missing_key_params) do
{
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/sources_spec.rb | spec/bitbucket_rest_api/repos/sources_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Sources do
let(:subject) { BitBucket::Repos::Sources.new }
describe '#list' do
context 'when some parameters are missing' do
it 'raises an error' do
expect do
subject.list(
'mock_username',
'mock_repo'
)... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/components_spec.rb | spec/bitbucket_rest_api/repos/components_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Components do
subject { described_class.new }
describe '#list' do
before do
expect(subject).to receive(:request).with(
:get,
'/2.0/repositories/mock_user/mock_repo/components',
{},
{}
).and_return({'values' => ['compon... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/keys_spec.rb | spec/bitbucket_rest_api/repos/keys_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Keys do
let(:deploy_keys) { described_class.new }
describe '.list' do
before do
expect(deploy_keys).to receive(:request).with(
:get,
'/1.0/repositories/mock_username/mock_repo/deploy-keys/',
{},
{}
).and_return(['key1'... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/forks_spec.rb | spec/bitbucket_rest_api/repos/forks_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Forks do
let(:forks) { BitBucket::Repos::Forks.new }
describe '.list' do
before do
expect(forks).to receive(:request).with(
:get,
'/2.0/repositories/mock_username/mock_repo/forks/',
{},
{}
).and_return(['fork1', 'fork... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/commits_spec.rb | spec/bitbucket_rest_api/repos/commits_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Commits do
let(:commits) { BitBucket::Repos::Commits.new }
describe '.list' do
before do
expect(commits).to receive(:request).with(
:get,
'/2.0/repositories/mock_username/mock_repo/commits',
{},
{}
)
end
it '... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/default_reviewers_spec.rb | spec/bitbucket_rest_api/repos/default_reviewers_spec.rb | require 'spec_helper'
describe BitBucket::Repos::DefaultReviewers do
subject { described_class.new }
describe '#list' do
before do
expect(subject).to receive(:request).with(
:get,
'/2.0/repositories/mock_user/mock_repo/default-reviewers',
{},
{}
)
end
it 'ma... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/download_spec.rb | spec/bitbucket_rest_api/repos/download_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Download do
describe '.get' do
it 'should send a GET request for the download link for the given repo' do
skip 'this is a regression test and the method is not finished being written'
end
end
end
| ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/pull_request_spec.rb | spec/bitbucket_rest_api/repos/pull_request_spec.rb | require 'spec_helper'
describe BitBucket::Repos::PullRequest do
subject { described_class.new }
describe '#list' do
before do
expect(subject).to receive(:request).with(
:get,
'/2.0/repositories/mock_user/mock_repo/pullrequests',
{},
{}
).and_return(['pr1', 'pr2', 'pr... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/changesets_spec.rb | spec/bitbucket_rest_api/repos/changesets_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Changesets do
let(:changesets) { BitBucket::Repos::Changesets.new }
describe '.list' do
before do
expect(changesets).to receive(:request).with(
:get,
'/1.0/repositories/mock_username/mock_repo/changesets',
{},
{}
).an... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/repos/following_spec.rb | spec/bitbucket_rest_api/repos/following_spec.rb | require 'spec_helper'
describe BitBucket::Repos::Following do
let(:following) { BitBucket::Repos::Following.new }
describe '.followers' do
before do
expect(following).to receive(:request).with(
:get,
'/1.0/repositories/mock_username/mock_repo/followers/',
{},
{}
).a... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/core_ext/array_spec.rb | spec/bitbucket_rest_api/core_ext/array_spec.rb | require 'spec_helper'
require 'bitbucket_rest_api/core_ext/array'
describe Array do
let(:array) { [:a, :b, :c, :d, { key: :value }] }
describe '#extract_options!' do
it 'selects a hash from the arguments list' do
expect(array.extract_options!).to eq({ key: :value })
end
end
end
| ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/core_ext/hash_spec.rb | spec/bitbucket_rest_api/core_ext/hash_spec.rb | # encoding: utf-8
require 'spec_helper'
describe Hash do
before do
BitBucket.new
@hash = { :a => 1, :b => 2, :c => 'e'}
@serialized = "a=1&b=2&c=e"
@nested_hash = { 'a' => { 'b' => {'c' => 1 } } }
@symbols = { :a => { :b => { :c => 1 } } }
end
context '#symbolize_keys' do
it 'should re... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/utils/url_spec.rb | spec/bitbucket_rest_api/utils/url_spec.rb | require 'spec_helper'
describe BitBucket::Utils::Url do
before do
@url_util = BitBucket::Utils::Url
end
describe '.build_query' do
it 'builds a query string from a params hash' do
expect(@url_util.build_query({key1: "val1", key2: "val2"})).to eq "key1=val1&key2=val2"
end
it 'builds a ... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/api/actions_spec.rb | spec/bitbucket_rest_api/api/actions_spec.rb | require 'spec_helper'
describe BitBucket::API, '#actions' do
let(:api) { BitBucket::Repos::Keys }
context 'when class' do
it "lists all available actions for an api" do
expect(api.actions).to match_array([:actions, :all, :create, :delete, :edit, :list])
end
end
context 'when instance' do
it... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/validations/token_spec.rb | spec/bitbucket_rest_api/validations/token_spec.rb | require 'spec_helper'
describe BitBucket::Validations::Token do
let(:token) { Class.new.extend(described_class) }
describe ".validates_token_for" do
it 'returns false if authentication token is not required' do
expect(token.validates_token_for(:get, '/anotherpath')).to be false
end
it 'returns ... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/validations/presence_spec.rb | spec/bitbucket_rest_api/validations/presence_spec.rb | require 'spec_helper'
describe BitBucket::Validations::Presence do
let(:presence_checker) { Class.new.extend(described_class) }
describe "._validates_user_repo_params" do
it 'raises an ArgumentError if user_name or repo_name is nil' do
expect{presence_checker._validate_user_repo_params('user_name', nil)... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/validations/format_spec.rb | spec/bitbucket_rest_api/validations/format_spec.rb | require 'spec_helper'
describe BitBucket::Validations::Format do
let(:format) { Class.new.extend(described_class) }
before do
@permitted = {"param1" => ["val1", "val2"], "param2" => /^regexp$/}
end
describe ".assert_valid_values" do
it "raises an UnknownValue error when provided an unpermitted paramet... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/validations/required_spec.rb | spec/bitbucket_rest_api/validations/required_spec.rb | require 'spec_helper'
describe BitBucket::Validations::Required do
class SpecClass
include BitBucket::Validations::Required
end
let(:spec_class) { SpecClass.new }
let(:params_with_blank) do
{
'title' => "mock_title",
'source' => {
'branch' => {
'name' => ""
}
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/response/mashify_spec.rb | spec/bitbucket_rest_api/response/mashify_spec.rb | require 'spec_helper'
describe BitBucket::Response::Mashify do
# let(:mashify) { described_class.new }
describe 'parse' do
before do
@mashify = BitBucket::Response::Mashify.new
@string = "Fantastic week!"
@array = ['Monday', 'Tuesday']
@hash = {one: 'one', two: 'two', three: 'three'}
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/response/jsonize_spec.rb | spec/bitbucket_rest_api/response/jsonize_spec.rb | require 'spec_helper'
describe BitBucket::Response::Jsonize do
let(:jsonize) { described_class.new }
before do
@body = "{\"key1\":\"val1\"}"
end
it "parses the json and returns a hash" do
expect(jsonize.parse(@body)).to eq({"key1"=>"val1"})
end
end
| ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/response/raise_error_spec.rb | spec/bitbucket_rest_api/response/raise_error_spec.rb | require 'spec_helper'
describe BitBucket::Response::RaiseError do
describe '.on_complete' do
before do
@raise_error = BitBucket::Response::RaiseError.new
end
it 'raises a BadRequest error on 400 status code' do
expect{ @raise_error.on_complete({status: 400}) }.to raise_error BitBucket::Error... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/request/jsonize_spec.rb | spec/bitbucket_rest_api/request/jsonize_spec.rb | require 'spec_helper'
describe BitBucket::Request::Jsonize do
let(:jsonize) { described_class.new(lambda { |env| env }) }
before do
@env = {
body: {key1: 'val1'},
request_headers: {
'Content-Type' => 'application/json; charset=utf-8'
}
}
end
it "converts the body to json" do
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/spec/bitbucket_rest_api/request/oauth_spec.rb | spec/bitbucket_rest_api/request/oauth_spec.rb | require 'spec_helper'
require 'rack/test'
describe BitBucket::Request::OAuth do
include Rack::Test::Methods
let(:app) { ->(env) { [200, env, "app"] } }
let (:middleware) { BitBucket::Request::OAuth.new(app) }
let(:request) { Rack::MockRequest.new(middleware) }
it "add url key to env hash with URI value"... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api.rb | lib/bitbucket_rest_api.rb | # encoding: utf-8
require 'bitbucket_rest_api/version'
require 'bitbucket_rest_api/configuration'
require 'bitbucket_rest_api/constants'
require 'bitbucket_rest_api/utils/url'
require 'bitbucket_rest_api/connection'
require 'bitbucket_rest_api/deprecation'
module BitBucket
extend Configuration
class << self
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/issues.rb | lib/bitbucket_rest_api/issues.rb | # encoding: utf-8
module BitBucket
class Issues < API
extend AutoloadHelper
autoload_all 'bitbucket_rest_api/issues',
:Comments => 'comments',
:Components => 'components',
:Milestones => 'milestones'
VALID_ISSUE_PARAM_NAMES = %w[
title
co... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/users.rb | lib/bitbucket_rest_api/users.rb | # encoding: utf-8
module BitBucket
class Users < API
extend AutoloadHelper
# Load all the modules after initializing Repos to avoid superclass mismatch
autoload_all 'bitbucket_rest_api/users',
:Account => 'account'
# Creates new Users API
def initialize(options = { })
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/deprecation.rb | lib/bitbucket_rest_api/deprecation.rb | # encoding: utf-8
module BitBucket
DEPRECATION_PREFIX = "[BitBucketAPI] Deprecation warning:"
class << self
attr_writer :deprecation_tracker
def deprecation_tracker
@deprecation_tracker ||= []
end
# Displays deprecation message to the user.
# Each message is printed once.
def dep... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/version.rb | lib/bitbucket_rest_api/version.rb | # encoding: utf-8
module BitBucket
module VERSION
MAJOR = 0
MINOR = 1
PATCH = 7
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
end
end # BitBucket
| ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/api_factory.rb | lib/bitbucket_rest_api/api_factory.rb | # encoding: utf-8
require 'bitbucket_rest_api/core_ext/hash'
module BitBucket
class ApiFactory
# Instantiates a new bitbucket api object
def self.new(klass, options={})
return create_instance(klass, options) if klass
raise ArgumentError, 'must provide klass to be instantiated'
end
# Pa... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/parameter_filter.rb | lib/bitbucket_rest_api/parameter_filter.rb | # -*- encoding: utf-8 -*-
module BitBucket
# Allows you to specify parameters keys which will be preserved
# in parameters hash and its subhashes. Any keys from the nested
# hash that do not match will be removed.
module ParameterFilter
# Removes any keys from nested hashes that don't match predefiend key... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/response.rb | lib/bitbucket_rest_api/response.rb | # encoding: utf-8
require 'faraday'
module BitBucket
# Contains methods and attributes that act on the response returned from the
# request
class Response < Faraday::Response::Middleware
CONTENT_TYPE = 'Content-Type'.freeze
class << self
attr_accessor :parser
end
def self.define_parser(&... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/result.rb | lib/bitbucket_rest_api/result.rb | # encoding: utf-8
module BitBucket
module Result
include BitBucket::Constants
# TODO Add result counts method to check total items looking at result links
def ratelimit_limit
loaded? ? @env[:response_headers][RATELIMIT_LIMIT] : nil
end
def ratelimit_remaining
loaded? ? @env[:respon... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/constants.rb | lib/bitbucket_rest_api/constants.rb | module BitBucket
module Constants
extend self
# Response headers
RATELIMIT_REMAINING = 'X-RateLimit-Remaining'.freeze
RATELIMIT_LIMIT = 'X-RateLimit-Limit'.freeze
CONTENT_TYPE = 'Content-Type'.freeze
CONTENT_LENGTH = 'content-length'.freeze
CACHE_CONTROL = 'cache-control'.freeze
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/validations.rb | lib/bitbucket_rest_api/validations.rb | # encoding: utf-8
module BitBucket
module Validations
extend AutoloadHelper
autoload_all 'bitbucket_rest_api/validations',
:Presence => 'presence',
:Token => 'token',
:Format => 'format',
:Required => 'required'
include Presence
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/api.rb | lib/bitbucket_rest_api/api.rb | # -*- encoding: utf-8 -*-
require 'bitbucket_rest_api/configuration'
require 'bitbucket_rest_api/connection'
require 'bitbucket_rest_api/validations'
require 'bitbucket_rest_api/request'
require 'bitbucket_rest_api/core_ext/hash'
require 'bitbucket_rest_api/core_ext/array'
require 'bitbucket_rest_api/api/actions'
requ... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/normalizer.rb | lib/bitbucket_rest_api/normalizer.rb | # -*- encoding: utf-8 -*-
module BitBucket
# Deals with normalizing client supplied parameter keys.
module Normalizer
# Turns any keys from nested hashes including nested arrays into strings
#
def normalize!(params)
case params
when Hash
params.keys.each do |k|
params[k.t... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
bitbucket-rest-api/bitbucket | https://github.com/bitbucket-rest-api/bitbucket/blob/2fc8fa575ca3636ee8603a4b0efce95bbd79fab0/lib/bitbucket_rest_api/configuration.rb | lib/bitbucket_rest_api/configuration.rb | # encoding: utf-8
module BitBucket
module Configuration
VALID_OPTIONS_KEYS = [
:adapter,
:client_id,
:client_secret,
:new_access_token,
:oauth_token,
:oauth_secret,
:endpoint,
:mime_type,
:user_agent,
:connection_options,
... | ruby | MIT | 2fc8fa575ca3636ee8603a4b0efce95bbd79fab0 | 2026-01-04T17:36:37.933374Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.