source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | SimplyBuilt/activejob-retriable | https://github.com/SimplyBuilt/activejob-retriable | test/dummy/db/schema.rb | Ruby | mit | 49 | master | 939 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... |
github | SimplyBuilt/activejob-retriable | https://github.com/SimplyBuilt/activejob-retriable | test/dummy/app/jobs/callbacks_job.rb | Ruby | mit | 49 | master | 495 | class CallbacksJob < ApplicationJob
queue_as :default
def self.callback_results
@_callback_results ||= []
end
def self.reset_results!
@_callback_results = nil
end
before_exception do
self.class.callback_results << current_exception
end
after_exception do
self.class.callback_results <... |
github | SimplyBuilt/activejob-retriable | https://github.com/SimplyBuilt/activejob-retriable | test/dummy/app/jobs/rescue_job.rb | Ruby | mit | 49 | master | 216 | class RescueJob < ApplicationJob
JobError = Class.new(StandardError)
max_retry 3
rescue_from JobError do
retry_job wait: 1.hour unless retries_exhausted?
end
def perform
raise JobError
end
end |
github | SimplyBuilt/activejob-retriable | https://github.com/SimplyBuilt/activejob-retriable | test/dummy/config/application.rb | Ruby | mit | 49 | master | 420 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "activejob/retriable"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files i... |
github | SimplyBuilt/activejob-retriable | https://github.com/SimplyBuilt/activejob-retriable | test/dummy/config/environments/production.rb | Ruby | mit | 49 | master | 3,461 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | SimplyBuilt/activejob-retriable | https://github.com/SimplyBuilt/activejob-retriable | test/active_job/retriable_test.rb | Ruby | mit | 49 | master | 2,180 | require 'test_helper'
class ActiveJob::RetriableTest < ActiveJob::TestCase
test 'failed job is retried until DEFAULT_MAX' do
assert_performed_jobs 25 do
RaiseJob.perform_later
end
end
test 'failed job is retried until specified max_retry' do
assert_performed_jobs 10 do
MaxJob.perform_lat... |
github | SimplyBuilt/activejob-retriable | https://github.com/SimplyBuilt/activejob-retriable | test/active_job/retriable/test_adapter_test.rb | Ruby | mit | 49 | master | 2,118 | require 'test_helper'
class ActiveJob::Retriable::TestAdapterTest < ActiveJob::TestCase
test 'enqueued_jobs have job defined' do
NoopJob.perform_later
assert_equal NoopJob, enqueued_jobs.first[:job]
end
test 'performed_jobs has job defined' do
perform_enqueued_jobs do
NoopJob.perform_later
... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | Rakefile | Ruby | mit | 49 | main | 5,106 | # frozen_string_literal: true
require "rake/testtask"
require "rake/clean"
require "protoboeuf"
include ProtoBoeuf::ProtocUtils
require "rubocop/rake_task"
RuboCop::RakeTask.new
BASE_DIR = File.dirname(__FILE__)
LIB_DIR = File.expand_path(BASE_DIR, "lib")
codegen_rb_files = ["lib/protoboeuf/codegen.rb", "lib/prot... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | protoboeuf.gemspec | Ruby | mit | 49 | main | 1,007 | # frozen_string_literal: true
require_relative "lib/protoboeuf/version"
Gem::Specification.new do |spec|
spec.name = "protoboeuf"
spec.version = ProtoBoeuf::VERSION
spec.authors = ["Shopify Engineering"]
spec.email = ["gems@shopify.com"]
spec.summary = "A pure-Ruby protobuf encoder / decoder supporting `pr... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | Gemfile | Ruby | mit | 49 | main | 268 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "minitest-color"
gem "google-protobuf"
gem "rake"
gem "minitest"
gem "benchmark-ips"
gem "debug", ">= 1.0.0", require: false
gem "rubocop", require: false
gem "rubocop-shopify", require: false |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | bench/benchmark.rb | Ruby | mit | 49 | main | 6,365 | # frozen_string_literal: true
require "protoboeuf/protoc_utils"
require "protoboeuf/benchmark_pb"
require "upstream/benchmark_pb"
require "benchmark/ips"
include ProtoBoeuf::ProtocUtils
# Ensure the dataset is random but always the same
Random.srand(42)
# Recursively populate the type map
def pop_type_map(type_map,... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | bench/lib/redblack.rb | Ruby | mit | 49 | main | 1,811 | # frozen_string_literal: true
require "upstream/benchmark_pb"
require "redblack/node"
module RBTree
private_class_method def self.balance color, key, value, left, right
# x, y, z are keys
# a, b, c, d are nodes
case [color, key, left, right]
in ["black", z, ["red", y, yv, ["red", x, xv, a, b], c], d... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | bench/lib/redblack/node.rb | Ruby | mit | 49 | main | 432 | module RBNode
def each(&blk)
yield self
unless leaf
left.each(&blk)
right.each(&blk)
end
end
def insert key, val
RBTree.insert self, key, val
end
def key? k
return false if leaf
return true if k == key
k < key ? left.key?(k) : right.key?(k)
end
def deconstruct
... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/sigstore_test.rb | Ruby | mit | 49 | main | 462 | # frozen_string_literal: true
require "helper"
class SigStoreTest < ProtoBoeuf::Test
def test_sigstore
Dir.entries("test/fixtures/sigstore").each do |entry|
next unless entry.include?(".proto")
file_name = File.join("test/fixtures/sigstore", entry)
# puts file_name
unit = parse_proto_f... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/helper.rb | Ruby | mit | 49 | main | 412 | # frozen_string_literal: true
ENV["MT_NO_PLUGINS"] = "1"
require "minitest/autorun"
# require "minitest/color"
require_relative "fixtures/test_pb"
require "protoboeuf"
module ProtoBoeuf
class Test < Minitest::Test
extend ProtocUtils
def parse_proto_file(...)
self.class.parse_proto_file(...)
end
... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/codegen_test.rb | Ruby | mit | 49 | main | 24,906 | # frozen_string_literal: true
require "helper"
require "tempfile"
require_relative "fixtures/package_test_pb.rb"
module ProtoBoeuf
# Allow CI to default the append_as_bytes option to false.
class CodeGen
prepend(Module.new do
def to_ruby(this_file = nil, options = { append_as_bytes: !ENV["NO_APPEND_AS_B... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/autoloadergen_test.rb | Ruby | mit | 49 | main | 879 | # frozen_string_literal: true
require "helper"
require "protoboeuf/autoloadergen"
class AutoloaderGenTest < ProtoBoeuf::Test
FIXTURE_PATH = File.expand_path("fixtures/autoloadergen/google", __dir__)
def test_generates_autoloader_module
# test/fixtures/autoloadergen/google/test_protos/*.proto needs an autoloa... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/codegen_compatibility_test.rb | Ruby | mit | 49 | main | 7,467 | # frozen_string_literal: true
require_relative "helper"
require "tmpdir"
require "google/protobuf/descriptor_pb"
module ProtoBoeuf
class CodeGenCompatibilityTest < Test
def test_to_proto
ours, theirs = codegen_string('syntax = "proto3"; message ToProto { string s = 1; }')
our_bin, their_bin = [ours,... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/hash_serialization_test.rb | Ruby | mit | 49 | main | 8,841 | # frozen_string_literal: true
require "helper"
require "json"
class HashSerializationTest < ProtoBoeuf::Test
unit = parse_proto_string(<<~PROTO)
syntax = "proto3";
message Employer {
string name = 1;
}
message Person {
string first_name = 1;
optional string nick_name = 2;
o... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/gem_test.rb | Ruby | mit | 49 | main | 747 | # frozen_string_literal: true
require "helper"
class GemTest < ProtoBoeuf::Test
def test_can_be_required
Tempfile.create do |file|
file.write(<<~RUBY)
require "bundler/inline"
gemfile do
gem "protoboeuf", path: "#{__dir__}/..", require: true
end
::ProtoBoeuf
... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/message_test.rb | Ruby | mit | 49 | main | 27,252 | # frozen_string_literal: true
require "helper"
class MessageTest < ProtoBoeuf::Test
FIXTURE_FILE = File.join(File.dirname(__FILE__), "fixtures/test.proto")
unit = parse_proto_file(FIXTURE_FILE)
gen = ProtoBoeuf::CodeGen.new(unit)
class_eval gen.to_ruby
def test_sint64
data = ::TestSint64.encode(::Test... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/well_known_types_test.rb | Ruby | mit | 49 | main | 5,066 | # frozen_string_literal: true
require "helper"
require "protoboeuf/google/protobuf/descriptor"
require "protoboeuf/google/protobuf/uint64value"
class WellKnownTypesTest < ProtoBoeuf::Test
def test_any
unit = parse_proto_string(<<~EOPROTO)
syntax = "proto3";
import "google/protobuf/any.proto";
... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | test/codegen/field_test.rb | Ruby | mit | 49 | main | 6,749 | # frozen_string_literal: true
require "helper"
module ProtoBoeuf
class CodeGen
class FieldTest < ProtoBoeuf::Test
def test_delegates_common_methods
fields = fields_for_proto_message(<<~PROTO)
syntax = "proto3";
message MyMessage {
optional int32 field1 = 1 [depreca... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/protoc_utils.rb | Ruby | mit | 49 | main | 1,523 | # frozen_string_literal: true
require "open3"
require "tempfile"
require "google/protobuf/descriptor_pb"
module ProtoBoeuf
module ProtocUtils
DEFAULT_PROTOC_IMPORT_PATHS = [
"/",
__dir__,
].freeze
def parse_proto_string(string, *additional_import_paths)
Tempfile.create do |proto_file... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/autoloadergen.rb | Ruby | mit | 49 | main | 4,254 | # frozen_string_literal: true
require "erb"
require "syntax_tree"
require "pathname"
module ProtoBoeuf
class AutoloaderGen
# This class generates top-level autoloader modules for our well known types. Given autogenerated .rb files like:
# - lib/protoboeuf/google/protobuf/foo.rb
# - lib/protoboeuf/g... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/codegen.rb | Ruby | mit | 49 | main | 56,742 | # frozen_string_literal: true
require "erb"
require "syntax_tree"
module ProtoBoeuf
class CodeGen
require "protoboeuf/codegen/type_helper"
require "protoboeuf/codegen/field"
class EnumCompiler
attr_reader :generate_types
include TypeHelper
class << self
def result(enum, gene... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf.rb | Ruby | mit | 49 | main | 3,090 | # frozen_string_literal: true
# rubocop:disable all
# Autogenerated by `rake well_known_types`. Do not edit!
module ProtoBoeuf
module Google
module Protobuf
autoload :Any, "protoboeuf/google/protobuf/any"
autoload :BoolValue, "protoboeuf/google/protobuf/boolvalue"
autoload :BytesValue, "protob... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/api.rb | Ruby | mit | 49 | main | 248 | # frozen_string_literal: true
# rubocop:disable all
# Autogenerated by `rake well_known_types`. Do not edit!
module ProtoBoeuf
module Google
module Api
autoload :FieldBehavior, "protoboeuf/google/api/field_behavior"
end
end
end |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/field_mask.rb | Ruby | mit | 49 | main | 18,409 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class FieldMask
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
end... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/uint32value.rb | Ruby | mit | 49 | main | 17,915 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class UInt32Value
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
e... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/timestamp.rb | Ruby | mit | 49 | main | 25,970 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class Timestamp
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
end... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/uint64value.rb | Ruby | mit | 49 | main | 17,915 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class UInt64Value
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
e... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/duration.rb | Ruby | mit | 49 | main | 25,969 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class Duration
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
end
... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/struct.rb | Ruby | mit | 49 | main | 96,657 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
module NullValue
NULL_VALUE = 0
def self.lookup(val)
return :NULL_VALUE if val == 0
end
def self.resolve(val)
return 0 if val == :... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/any.rb | Ruby | mit | 49 | main | 24,119 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class Any
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
end
... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/floatvalue.rb | Ruby | mit | 49 | main | 14,647 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class FloatValue
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
en... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/stringvalue.rb | Ruby | mit | 49 | main | 17,713 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class StringValue
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
e... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/int64value.rb | Ruby | mit | 49 | main | 18,676 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class Int64Value
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
en... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/doublevalue.rb | Ruby | mit | 49 | main | 14,648 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class DoubleValue
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
e... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/boolvalue.rb | Ruby | mit | 49 | main | 14,835 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class BoolValue
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
end... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/bytesvalue.rb | Ruby | mit | 49 | main | 17,661 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class BytesValue
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
en... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/protobuf/int32value.rb | Ruby | mit | 49 | main | 18,544 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Protobuf
class Int32Value
def self.decode(buff)
allocate.decode_from(buff.b, 0, buff.bytesize)
end
def self.encode(obj)
obj._encode("".b)
en... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/google/api/field_behavior.rb | Ruby | mit | 49 | main | 1,279 | # encoding: ascii-8bit
# rubocop:disable all
# frozen_string_literal: true
module ProtoBoeuf
module Google
module Api
module FieldBehavior
FIELD_BEHAVIOR_UNSPECIFIED = 0
OPTIONAL = 1
REQUIRED = 2
OUTPUT_ONLY = 3
INPUT_ONLY = 4
IMMUTABLE = 5
UNORDERED_... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/codegen/field.rb | Ruby | mit | 49 | main | 3,101 | # frozen_string_literal: true
require "forwardable"
# Adds some convenience methods to Google::Protobuf::FieldDescriptorProto
module ProtoBoeuf
class CodeGen
class Field
attr_reader :original_field, :message, :syntax
extend Forwardable
def_delegators :@original_field,
:has_oneof_inde... |
github | Shopify/protoboeuf | https://github.com/Shopify/protoboeuf | lib/protoboeuf/codegen/type_helper.rb | Ruby | mit | 49 | main | 3,410 | # frozen_string_literal: true
module ProtoBoeuf
class CodeGen
module TypeHelper
TYPE_MAPPING = {
:TYPE_INT32 => "Integer",
:TYPE_SINT32 => "Integer",
:TYPE_UINT32 => "Integer",
:TYPE_INT64 => "Integer",
:TYPE_SINT64 => "Integer",
:TYPE_FIXED64 => "Integer",
... |
github | hlaueriksson/jekyll-url-shortener | https://github.com/hlaueriksson/jekyll-url-shortener | Gemfile | Ruby | mit | 50 | master | 1,389 | source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | Rakefile | Ruby | mit | 49 | master | 573 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the rails_on_gae plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for th... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | templates/bumble_appengine_jruby.rb | Ruby | mit | 49 | master | 3,921 | # original: http://github.com/olabini/bumble/tree/master
# modified by Ando Yasushi (andyjpn@gmail.com)
# use the appengine_jruby wrapper instead of direct use of GAE/J
#require 'appengine-apis/datastore'
module Bumble
module InstanceMethods
def initialize(attrs = {}, *args)
super(*args)
@__entity ... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | templates/rake_fix.rb | Ruby | mit | 49 | master | 238 | if defined? Rake
module Rake
class Application
alias original_load_imports load_imports
def load_imports
@pending_imports.delete_if{|fn| fn.is_a?(Class)}
original_load_imports
end
end
end
end |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | templates/bumble.rb | Ruby | mit | 49 | master | 4,745 | # http://github.com/olabini/bumble/tree/master
require 'java'
module Bumble
module DS
import com.google.appengine.api.datastore.DatastoreServiceFactory
import com.google.appengine.api.datastore.Entity
import com.google.appengine.api.datastore.FetchOptions
import com.google.appengine.api.datastore.Key... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | templates/require_fix.rb | Ruby | mit | 49 | master | 970 | # http://blog.s21g.com/articles/1448
def cleanup_path(path)
if path.to_s.match(/^file:/) && path.is_a?(String)
jar_path, inner_path = path.split('!', 2)
inner_path = File.expand_path(inner_path)
path = [jar_path, inner_path].join('!')
end
path
end
alias :require_original :require
def require(path)
... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | templates/beeu.rb | Ruby | mit | 49 | master | 1,197 | # http://github.com/olabini/beeu/tree/master
require 'java'
module BeeU
module US
import com.google.appengine.api.users.UserServiceFactory
Service = UserServiceFactory.user_service
end
class << self
def login(request)
US::Service.create_login_url(request.url)
end
def logout(request)
... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | templates/production.rb | Ruby | mit | 49 | master | 1,539 | # Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Enable threaded mode
#config.threadsafe!
class ServletContextAndStdoutLogger
def debug(progname =... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | generators/bumble_model/bumble_model_generator.rb | Ruby | mit | 49 | master | 242 | class BumbleModelGenerator < Rails::Generator::NamedBase
def manifest
record do |m|
m.template('bumble_model.rb', "app/models/#{@file_path}.rb",
:assigns => {:class_name => @class_name, :args => @args})
end
end
end |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | generators/bumble_model/templates/bumble_model.rb | Ruby | mit | 49 | master | 426 | # ref. http://github.com/olabini/bumble/blob/96bdfc02b8bfc159c55035fbbbfb5b12536dd367/bumble/bumble.rb
#
# InstanceMethods:
# - key
# - to_param
# - save!
# - delete!
#
# ClassMethods:
# - get(key)
# - delete(key)
# - find(condition)
# - create(attrs)
# - all(conditions, options)
#
# Define Relationship:
# - belongs_t... |
github | technohippy/rails_on_gae | https://github.com/technohippy/rails_on_gae | tasks/rails_on_gae_tasks.rake | Ruby | mit | 49 | master | 3,556 | require 'erb'
require 'pathname'
PLUGIN_ROOT = Pathname.new(File.dirname(__FILE__)).parent
def template_path(filename)
"#{PLUGIN_ROOT}/templates/#{filename}"
end
def template(filename, b=binding)
ERB.new(File.read(template_path(filename))).result(b)
end
def cp_template(filename, dirname)
cp(template_path(filen... |
github | excid3/mailbin | https://github.com/excid3/mailbin | Gemfile | Ruby | mit | 49 | main | 352 | source "https://rubygems.org"
# Specify your gem's dependencies in mail_drop.gemspec.
gemspec
gem "puma"
gem "sqlite3"
gem "sprockets-rails"
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false
# Start debugger with binding.b [https://github.com/ruby/d... |
github | excid3/mailbin | https://github.com/excid3/mailbin | mailbin.gemspec | Ruby | mit | 49 | main | 918 | require_relative "lib/mailbin/version"
Gem::Specification.new do |spec|
spec.name = "mailbin"
spec.version = Mailbin::VERSION
spec.authors = [ "Chris Oliver" ]
spec.email = [ "excid3@gmail.com" ]
spec.homepage = "https://github.com/excid3/mailbin"
spec.summary = "Mailbin collect... |
github | excid3/mailbin | https://github.com/excid3/mailbin | Rakefile | Ruby | mit | 49 | main | 358 | require "bundler/setup"
require "bundler/gem_tasks"
require "rake/testtask"
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
load "rails/tasks/engine.rake"
desc "Run tests"
Rake::TestTask.new(:test) do |t|
t.libs << "lib"
t.libs << "test"
t.pattern = "test/**/*_test.rb"
t.verbose = true
t.war... |
github | excid3/mailbin | https://github.com/excid3/mailbin | app/controllers/mailbin/messages_controller.rb | Ruby | mit | 49 | main | 2,310 | module Mailbin
class MessagesController < ApplicationController
around_action :set_locale, only: [ :show ]
helper_method :attachment_url, :part_query, :locale_query
content_security_policy(false)
rescue_from Errno::ENOENT do
redirect_to root_path
end
def index
@emails = Mailbin... |
github | excid3/mailbin | https://github.com/excid3/mailbin | test/dummy/test/mailers/user_mailer_test.rb | Ruby | mit | 49 | main | 309 | require "test_helper"
class UserMailerTest < ActionMailer::TestCase
test "welcome" do
mail = UserMailer.welcome
assert_equal "Welcome", mail.subject
assert_equal [ "to@example.org" ], mail.to
assert_equal [ "from@example.com" ], mail.from
assert_match "Hi", mail.body.encoded
end
end |
github | excid3/mailbin | https://github.com/excid3/mailbin | test/dummy/test/mailers/previews/user_mailer_preview.rb | Ruby | mit | 49 | main | 249 | # Preview all emails at http://localhost:3000/rails/mailers/user_mailer
class UserMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/user_mailer/welcome
def welcome
UserMailer.welcome
end
end |
github | excid3/mailbin | https://github.com/excid3/mailbin | test/dummy/app/mailers/user_mailer.rb | Ruby | mit | 49 | main | 419 | class UserMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.user_mailer.welcome.subject
#
def welcome
@greeting = "Hi"
attachments.inline["logo.png"] = File.read Rails.root.join("app/assets/images/logo.png")
attachmen... |
github | excid3/mailbin | https://github.com/excid3/mailbin | test/dummy/db/schema.rb | Ruby | mit | 49 | main | 762 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | excid3/mailbin | https://github.com/excid3/mailbin | test/dummy/config/routes.rb | Ruby | mit | 49 | main | 665 | Rails.application.routes.draw do
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
mount Mailbin::Engine => :mailbin
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors t... |
github | excid3/mailbin | https://github.com/excid3/mailbin | test/dummy/config/application.rb | Ruby | mit | 49 | main | 1,107 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dummy
class Application < Rails::Application
config.load_defaults Rails::VERSION::STRING.to_f
# For compatibil... |
github | excid3/mailbin | https://github.com/excid3/mailbin | lib/mailbin.rb | Ruby | mit | 49 | main | 1,025 | require "mailbin/version"
require "mailbin/engine"
module Mailbin
autoload :DeliveryMethod, "mailbin/delivery_method"
autoload :InlinePreviewInterceptor, "mailbin/inline_preview_interceptor"
mattr_accessor :importmap, default: Importmap::Map.new
mattr_accessor :storage_location
class << self
def all
... |
github | excid3/mailbin | https://github.com/excid3/mailbin | lib/mailbin/inline_preview_interceptor.rb | Ruby | mit | 49 | main | 358 | module Mailbin
class InlinePreviewInterceptor < ActionMailer::InlinePreviewInterceptor
private
# Convert to base64 unless it's already done
def data_url(part)
source = part.body.encoding == "base64" ? part.body.raw_source : strict_encode64(part.body.raw_source)
"data:#{part.mime_type};... |
github | excid3/mailbin | https://github.com/excid3/mailbin | lib/mailbin/delivery_method.rb | Ruby | mit | 49 | main | 474 | module Mailbin
class DeliveryMethod
attr_accessor :settings
def initialize(options = {})
self.settings = options
end
def deliver!(mail)
mail.message_id = SecureRandom.uuid
FileUtils.mkdir_p(settings[:location])
File.open(location_for(mail), "w") do |file|
file.write(... |
github | excid3/mailbin | https://github.com/excid3/mailbin | lib/mailbin/engine.rb | Ruby | mit | 49 | main | 1,134 | require "importmap-rails"
require "turbo-rails"
module Mailbin
class Engine < ::Rails::Engine
isolate_namespace Mailbin
initializer "mailbin.add_delivery_method" do
Mailbin.storage_location ||= Rails.root.join("tmp", "mailbin")
ActiveSupport.on_load :action_mailer do
ActionMailer::Base.... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | github-v3-api.gemspec | Ruby | mit | 49 | master | 1,139 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'github_v3_api/version'
Gem::Specification.new do |spec|
spec.name = "github-v3-api"
spec.version = GitHubV3API::VERSION
spec.authors = ["John Wilger"]
spec.email ... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/issue_spec.rb | Ruby | mit | 49 | master | 540 | require 'spec_helper'
describe GitHubV3API::Issue do
describe 'attr_readers' do
it 'should define attr_readers that pull values from the issue data' do
fields = %w(url html_url number state title body user labels assignee
milestone comments pull_request closed_at created_at updated_at)
... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/orgs_api_spec.rb | Ruby | mit | 49 | master | 2,890 | require 'spec_helper'
describe GitHubV3API::OrgsAPI do
describe '#list' do
it 'returns the public and private orgs for the authenticated user' do
connection = double(GitHubV3API)
connection.should_receive(:get).with('/user/orgs').and_return([:org_hash1, :org_hash2])
api = GitHubV3API::OrgsAPI.n... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/user_api_spec.rb | Ruby | mit | 49 | master | 894 | require 'spec_helper'
describe GitHubV3API::UsersAPI do
describe '#current' do
it 'returns the user data for the authenticated user' do
connection = double(GitHubV3API)
connection.should_receive(:get).with('/user').and_return(:user_hash1)
api = GitHubV3API::UsersAPI.new(connection)
GitHub... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/github_v3_api_spec.rb | Ruby | mit | 49 | master | 4,132 | require 'spec_helper'
describe GitHubV3API do
let(:auth_token) { 'abcde' }
let(:test_header) { {:accept => :json,
:authorization => "token #{auth_token}",
:user_agent => 'rubygem-github-v3-api'} }
it 'is initialized with an OAuth2 access token' do
lambda { GitH... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/org_spec.rb | Ruby | mit | 49 | master | 2,526 | require 'spec_helper'
describe GitHubV3API::Org do
describe 'attr_readers' do
it 'should define attr_readers that pull values from the org data' do
fields = %w(avatar_url billing_email blog collaborators
company created_at disk_usage email followers following
html_url id location login name... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/user_spec.rb | Ruby | mit | 49 | master | 1,458 | require 'spec_helper'
describe GitHubV3API::User do
describe 'attr_readers' do
it 'should define attr_readers that pull values from the user data' do
fields = %w(login id avatar_url gravatar_id url name company blog location
email hireable bio public_repos public_gists followers followin... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/repos_api_spec.rb | Ruby | mit | 49 | master | 3,459 | require 'spec_helper'
describe GitHubV3API::ReposAPI do
describe '#list' do
it 'returns the public and private repos for the authenticated user' do
connection = double(GitHubV3API)
connection.should_receive(:get).with('/user/repos').and_return([:repo_hash1, :repo_hash2])
api = GitHubV3API::Repo... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/issues_api_spec.rb | Ruby | mit | 49 | master | 3,592 | require 'spec_helper'
describe GitHubV3API::IssuesAPI do
describe "#list" do
context "options = nil" do
it "returns issues for a user" do
connection = double(GitHubV3API)
connection.should_receive(:get).with('/issues', {}).and_return([:issue_hash1, :issue_hash2])
api = GitHubV3API::... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | spec/repo_spec.rb | Ruby | mit | 49 | master | 3,161 | require 'spec_helper'
describe GitHubV3API::Repo do
describe 'attr_readers' do
it 'should define attr_readers that pull values from the repo data' do
fields = %w(created_at description fork forks has_downloads has_issues
has_wiki homepage html_url language master_branch name open_issues
... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api.rb | Ruby | mit | 49 | master | 3,678 | require 'rest-client'
require 'json'
require 'github_v3_api/entity'
require 'github_v3_api/issues_api'
require 'github_v3_api/issue'
require 'github_v3_api/users_api'
require 'github_v3_api/user'
require 'github_v3_api/orgs_api'
require 'github_v3_api/org'
require 'github_v3_api/repos_api'
require 'github_v3_api/repo'
... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/entity.rb | Ruby | mit | 49 | master | 1,331 | class GitHubV3API
# This is the base class used for value objects returned by the API. See
# descendent classes for more details.
class Entity
def self.new_with_all_data(api, data) #:nodoc:
entity = allocate
entity.initialize_fetched(api, data)
entity
end
# +api+:: an instance of th... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/user.rb | Ruby | mit | 49 | master | 596 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Represents a single GitHub User and provides access to its data attributes.
class User < Entity
attr_reader :login, :id, :avatar_url, :gravatar_id, :url, :name, :company,
:blog, :location, :email, :hireable, :bio, :publ... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/issue.rb | Ruby | mit | 49 | master | 388 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Represents a single GitHub Issue and provides access to its data attributes.
class Issue < Entity
attr_reader :url, :html_url, :number, :state, :title, :body, :user,
:labels, :assignee, :milestone, :comments, :pull_reque... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/issues_api.rb | Ruby | mit | 49 | master | 3,152 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Provides access to the GitHub Issues API (http://developer.github.com/v3/issues/)
#
# example:
#
# api = GitHubV3API.new(ACCESS_TOKEN)
#
# # get list of your issues
# my_issues = api.issues.list
# #=> returns an array ... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/repos_api.rb | Ruby | mit | 49 | master | 3,108 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Provides access to the GitHub Repos API (http://developer.github.com/v3/repos/)
#
# example:
#
# api = GitHubV3API.new(ACCESS_TOKEN)
#
# # get list of all of the user's public and private repos
# repos = api.repos.list
#... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/users_api.rb | Ruby | mit | 49 | master | 1,322 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Provides access to the GitHub Users API (http://developer.github.com/v3/users/)
#
# example:
#
# api = GitHubV3API.new(ACCESS_TOKEN)
#
# # get list of logged-in user
# a_user = api.current
# #=> returns an instance of ... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/repo.rb | Ruby | mit | 49 | master | 821 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Represents a single GitHub Repo and provides access to its data attributes.
class Repo < Entity
attr_reader :created_at, :description, :fork, :forks, :has_downloads,
:has_issues, :has_wiki, :homepage, :html_url, :language, :master... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/orgs_api.rb | Ruby | mit | 49 | master | 2,502 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Provides access to the GitHub Orgs API (http://developer.github.com/v3/orgs/)
#
# example:
#
# api = GitHubV3API.new(ACCESS_TOKEN)
#
# # get list of all orgs to which the user belongs
# orgs = api.orgs.list
# #=> retur... |
github | jwilger/github-v3-api | https://github.com/jwilger/github-v3-api | lib/github_v3_api/org.rb | Ruby | mit | 49 | master | 1,111 | # See GitHubV3API documentation in lib/github_v3_api.rb
class GitHubV3API
# Represents a single GitHub Org and provides access to its data attributes.
class Org < Entity
attr_reader :avatar_url, :billing_email, :blog, :collaborators,
:company, :created_at, :disk_usage, :email, :followers, :following,
... |
github | puppetlabs/puppetlabs-rsync | https://github.com/puppetlabs/puppetlabs-rsync | Gemfile | Ruby | apache-2.0 | 49 | main | 3,742 | source ENV['GEM_SOURCE'] || 'https://rubygems.org'
def location_for(place_or_version, fake_version = nil)
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
if place_or_version && (git_url = place_or_version.match(git_url_regex))
[fake_version, {... |
github | puppetlabs/puppetlabs-rsync | https://github.com/puppetlabs/puppetlabs-rsync | Rakefile | Ruby | apache-2.0 | 49 | main | 337 | # frozen_string_literal: true
require 'bundler'
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
PuppetLint.configuration.send('di... |
github | puppetlabs/puppetlabs-rsync | https://github.com/puppetlabs/puppetlabs-rsync | spec/spec_helper.rb | Ruby | apache-2.0 | 49 | main | 2,176 | # frozen_string_literal: true
RSpec.configure do |c|
c.mock_with :rspec
end
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
include RspecPuppetFacts
default_facts = {
puppetvers... |
github | puppetlabs/puppetlabs-rsync | https://github.com/puppetlabs/puppetlabs-rsync | spec/defines/get_spec.rb | Ruby | apache-2.0 | 49 | main | 9,333 | require 'spec_helper'
describe 'rsync::get', type: :define do
let :title do
'foobar'
end
let :common_params do
{
source: 'example.com',
}
end
describe 'when using default class paramaters' do
let :params do
common_params
end
it {
is_expected.to contain_exec('rsync ... |
github | puppetlabs/puppetlabs-rsync | https://github.com/puppetlabs/puppetlabs-rsync | spec/defines/server_module_spec.rb | Ruby | apache-2.0 | 49 | main | 6,175 | require 'spec_helper'
describe 'rsync::server::module', type: :define do
on_supported_os.each do |os, facts|
context "on #{os} " do
let :facts do
facts
end
let :title do
'foobar'
end
let :pre_condition do
'class { "rsync::server": }'
end
let :f... |
github | puppetlabs/puppetlabs-rsync | https://github.com/puppetlabs/puppetlabs-rsync | spec/defines/put_spec.rb | Ruby | apache-2.0 | 49 | main | 5,828 | require 'spec_helper'
describe 'rsync::put', type: :define do
let :title do
'foobar'
end
let :common_params do
{
source: 'example.com',
}
end
describe 'when using default class paramaters' do
let :params do
common_params
end
it {
is_expected.to contain_exec('rsync ... |
github | puppetlabs/puppetlabs-rsync | https://github.com/puppetlabs/puppetlabs-rsync | spec/classes/server_spec.rb | Ruby | apache-2.0 | 49 | main | 3,151 | require 'spec_helper'
describe 'rsync::server', type: :class do
on_supported_os.each do |os, facts|
context "on #{os} " do
let :facts do
facts
end
describe 'when using default params' do
it {
is_expected.to contain_class('xinetd')
is_expected.to contain_xinet... |
github | blendle/object-cache | https://github.com/blendle/object-cache | Rakefile | Ruby | mit | 49 | master | 375 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rubocop/rake_task'
RuboCop::RakeTask.new do |t|
t.options = %w[--display-cop-names --extra-details --display-style-guide]
end
Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.libs << 'lib'
t.test_files = FileList['t... |
github | blendle/object-cache | https://github.com/blendle/object-cache | object-cache.gemspec | Ruby | mit | 49 | master | 1,002 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'object/cache'
Gem::Specification.new do |spec|
spec.name = 'object-cache'
spec.version = Cache::VERSION
spec.authors = %w[Jean Mertz]
spec.email = ... |
github | blendle/object-cache | https://github.com/blendle/object-cache | test/cache_test.rb | Ruby | mit | 49 | master | 5,744 | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'mock_redis'
require 'object/cache'
require 'minitest/autorun'
# :no-doc:
class CacheTest < Minitest::Test # rubocop:disable Metrics/ClassLength
def setup
Cache.backend = MockRedis.new
Cache.default_ttl = 604_800
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.