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 | ianwhite/orm_adapter | https://github.com/ianwhite/orm_adapter | lib/orm_adapter.rb | Ruby | mit | 195 | master | 513 | require 'orm_adapter/base'
require 'orm_adapter/to_adapter'
require 'orm_adapter/version'
module OrmAdapter
# A collection of registered adapters
def self.adapters
@@adapters ||= []
end
end
require 'orm_adapter/adapters/active_record' if defined?(ActiveRecord::Base)
require 'orm_adapter/adapters/data_mapper... |
github | ianwhite/orm_adapter | https://github.com/ianwhite/orm_adapter | lib/orm_adapter/base.rb | Ruby | mit | 195 | master | 3,954 | module OrmAdapter
class Base
attr_reader :klass
# Your ORM adapter needs to inherit from this Base class and its adapter
# will be registered. To create an adapter you should create an inner
# constant "OrmAdapter" e.g. ActiveRecord::Base::OrmAdapter
#
# @see orm_adapters/active_record
# ... |
github | ianwhite/orm_adapter | https://github.com/ianwhite/orm_adapter | lib/orm_adapter/adapters/mongo_mapper.rb | Ruby | mit | 195 | master | 1,843 | require 'mongo_mapper'
module MongoMapper
module Document
module ClassMethods
include OrmAdapter::ToAdapter
end
class OrmAdapter < ::OrmAdapter::Base
# get a list of column names for a given class
def column_names
klass.column_names
end
# @see OrmAdapter::Base#get!... |
github | ianwhite/orm_adapter | https://github.com/ianwhite/orm_adapter | lib/orm_adapter/adapters/data_mapper.rb | Ruby | mit | 195 | master | 1,425 | require 'dm-core'
module DataMapper
module Model
include OrmAdapter::ToAdapter
end
module Resource
class OrmAdapter < ::OrmAdapter::Base
# get a list of column names for a given class
def column_names
klass.properties.map(&:name)
end
# @see OrmAdapter::Base#get!
de... |
github | ianwhite/orm_adapter | https://github.com/ianwhite/orm_adapter | lib/orm_adapter/adapters/mongoid.rb | Ruby | mit | 195 | master | 1,679 | require 'mongoid'
module Mongoid
module Document
module ClassMethods
include OrmAdapter::ToAdapter
end
class OrmAdapter < ::OrmAdapter::Base
# get a list of column names for a given class
def column_names
klass.fields.keys
end
# @see OrmAdapter::Base#get!
def... |
github | ianwhite/orm_adapter | https://github.com/ianwhite/orm_adapter | lib/orm_adapter/adapters/active_record.rb | Ruby | mit | 195 | master | 2,344 | require 'active_record'
module OrmAdapter
class ActiveRecord < Base
# Return list of column/property names
def column_names
klass.column_names
end
# @see OrmAdapter::Base#get!
def get!(id)
klass.find(wrap_key(id))
end
# @see OrmAdapter::Base#get
def get(id)
klass.w... |
github | byroot/bootscale | https://github.com/byroot/bootscale | Gemfile | Ruby | mit | 195 | master | 309 | source 'https://rubygems.org'
gemspec
gem 'bundler'
gem 'rake'
gem 'rspec'
gem 'msgpack'
group :dummy do
gem 'rails', '4.2.3'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
end |
github | byroot/bootscale | https://github.com/byroot/bootscale | bootscale.gemspec | Ruby | mit | 195 | master | 611 | require File.expand_path('../lib/bootscale/version', __FILE__)
Gem::Specification.new do |spec|
spec.name = 'bootscale'
spec.version = Bootscale::VERSION
spec.authors = ['Jean Boussier']
spec.email = ['jean.boussier@gmail.com']
spec.summary = %q{Speedup applications boot b... |
github | byroot/bootscale | https://github.com/byroot/bootscale | spec/cache_spec.rb | Ruby | mit | 195 | master | 1,849 | require 'spec_helper'
RSpec.describe 'caches' do
let(:files) do
%w(
a/foo.rb
b/foo.rb
b/bar.rb
)
end
let(:load_path) { %w(a b).map { |d| File.join(tmpdir, d) } }
let!(:tmpdir) { Dir.mktmpdir }
before do
allow_any_instance_of(described_class).to receive(:load_path).and_return(... |
github | byroot/bootscale | https://github.com/byroot/bootscale | spec/file_storage_spec.rb | Ruby | mit | 195 | master | 817 | require 'spec_helper'
require 'bootscale/file_storage'
RSpec.describe Bootscale::FileStorage do
around { |test| in_tmpdir(&test) }
subject { Bootscale::FileStorage.new(Dir.pwd) }
it "dumps via Marshal by default" do
expect(Bootscale::FileStorage::Serializer).to eq Marshal
end
it "can dump binary" do
... |
github | byroot/bootscale | https://github.com/byroot/bootscale | spec/spec_helper.rb | Ruby | mit | 195 | master | 630 | require 'bundler/setup'
require 'bootscale'
require 'pathname'
require 'tmpdir'
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
Bootscale.logger = Logger.new(nil)
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_ma... |
github | byroot/bootscale | https://github.com/byroot/bootscale | spec/cache_builder_spec.rb | Ruby | mit | 195 | master | 865 | require 'spec_helper'
RSpec.describe Bootscale::CacheBuilder do
it "list all the files in the provided load paths" do
cache = subject.generate([File.expand_path("spec/dummy/app/controllers"), File.expand_path("spec/dummy/app/helpers")])
expect(cache.keys.sort).to eq %w(application_controller.rb application_h... |
github | byroot/bootscale | https://github.com/byroot/bootscale | spec/integration_spec.rb | Ruby | mit | 195 | master | 3,098 | require 'spec_helper'
RSpec.describe Bootscale do
it "doesn't break application boot" do
expect {
Dir.chdir(File.expand_path('../dummy', __FILE__)) do
system('bundle', 'exec', 'rails', 'r', 'p 1 + 1')
end
}.to output(%{2\n}).to_stdout_from_any_process
end
it "doesn't break auto loadi... |
github | byroot/bootscale | https://github.com/byroot/bootscale | spec/support/expect_script_helper.rb | Ruby | mit | 195 | master | 1,501 | class ScriptOutput < RSpec::Matchers::BuiltIn::Output
def matches?(block)
@block = block
return false unless Proc === block
@source = block.call
@actual = @stream_capturer.capture lambda { run_example(@source) }
raise "Script exited with status: #{$?.exitstatus}, output:\n#{@actual}" unless $?.suc... |
github | byroot/bootscale | https://github.com/byroot/bootscale | spec/dummy/config/application.rb | Ruby | mit | 195 | master | 1,112 | require File.expand_path('../boot', __FILE__)
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
# Settings in config/environments/* take precede... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale.rb | Ruby | mit | 195 | master | 798 | require 'logger'
require_relative 'bootscale/version'
module Bootscale
DOT_SO = '.so'.freeze
DOT_RB = '.rb'.freeze
LEADING_SLASH = '/'.freeze
class << self
attr_reader :cache, :cache_directory
attr_accessor :logger
def cache_builder
@cache_builder ||= CacheBuilder.new
end
def regen... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/utils.rb | Ruby | mit | 195 | master | 760 | module Bootscale
module Utils
# Write to a file atomically. Useful for situations where you
# don't want other processes or threads to see half-written files.
#
# Utils.atomic_write('important.file') do |file|
# file.write('hello')
# end
#
# Returns nothing.
def self.atomic... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/core_ext.rb | Ruby | mit | 195 | master | 468 | module Kernel
alias_method :require_without_cache, :require
def require(path)
require_without_cache(Bootscale.cache[path] || path)
end
end
class << Kernel
alias_method :require_without_cache, :require
def require(path)
require_without_cache(Bootscale.cache[path] || path)
end
end
class Module
ali... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/entry.rb | Ruby | mit | 195 | master | 1,258 | module Bootscale
class Entry
DL_EXTENSIONS = [
RbConfig::CONFIG['DLEXT'],
RbConfig::CONFIG['DLEXT2'],
].reject { |ext| !ext || ext.empty? }.map { |ext| ".#{ext}"}
REQUIREABLE_FILES = "**/*{#{DOT_RB},#{DL_EXTENSIONS.join(',')}}"
NORMALIZE_NATIVE_EXTENSIONS = !DL_EXTENSIONS.include?(DOT_SO)
... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/cache_builder.rb | Ruby | mit | 195 | master | 716 | module Bootscale
class CacheBuilder
def initialize
@entries = {}
end
def clear!
@entries = {}
end
# generate the requireables cache from all current load-path entries
# each load-path is cached individually, so new ones can be added or removed
# but added/removed files will n... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/cache.rb | Ruby | mit | 195 | master | 1,321 | require_relative 'file_storage'
module Bootscale
class Cache
def initialize(cache_directory = nil)
@storage = FileStorage.new(cache_directory) if cache_directory
reload
end
def load_path
$LOAD_PATH
end
def reload(force = true)
@cache = fetch(load_path) if force
end
... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/file_storage.rb | Ruby | mit | 195 | master | 1,017 | require 'digest/md5'
require_relative 'utils'
module Bootscale
class FileStorage
def initialize(directory)
@directory = directory
end
def load(load_path)
path = cache_path(load_path)
Serializer.load(File.read(path)) if File.exist?(path)
end
def dump(load_path, cache)
pat... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/active_support.rb | Ruby | mit | 195 | master | 1,533 | module Bootscale
module ActiveSupport
class << self
attr_reader :cache, :cache_directory
def cache_builder
@cache_builder ||= CacheBuilder.new
end
def setup(options = {})
@cache_directory = options.fetch(:cache_directory, Bootscale.cache_directory)
require 'active... |
github | byroot/bootscale | https://github.com/byroot/bootscale | lib/bootscale/active_support/core_ext.rb | Ruby | mit | 195 | master | 753 | require 'active_support/dependencies'
module ActiveSupport
module Dependencies
# ActiveSupport::Dependencies.search_for_file works pretty much like Kernel#require.
# It has a load path (AS::Dependencies.autoload_paths) and when it's looking for a file to load
# it search the load path entries one by one ... |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | Rakefile | Ruby | mit | 195 | master | 233 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/lib/omniauth/**/*_test.rb']
t.verbose = true
end
task default: :test |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | omniauth_openid_connect.gemspec | Ruby | mit | 195 | master | 2,102 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'omniauth/openid_connect/version'
Gem::Specification.new do |spec|
spec.name = 'omniauth_openid_connect'
spec.version = OmniAuth::OpenIDConnect::VERSION
spec.author... |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | Gemfile | Ruby | mit | 195 | master | 237 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('3.1')
gem 'net-imap', require: false
gem 'net-pop', require: false
gem 'net-smtp', require: false
end |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | Guardfile | Ruby | mit | 195 | master | 366 | # frozen_string_literal: true
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'minitest' do
# with Minitest::Unit
watch(%r{^test/(.*)/(.*)_test\.rb})
watch(%r{^lib/(.*)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
watch(%r{^test/test_helper\.rb}) { 'test' }
end
guard :bundler do
... |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | test/strategy_test_case.rb | Ruby | mit | 195 | master | 2,411 | # frozen_string_literal: true
class StrategyTestCase < Minitest::Test
class DummyApp
def call(env); end
end
attr_accessor :identifier, :secret, :issuer, :nonce
def setup
@identifier = '1234'
@secret = '1234asdgat3'
@issuer = 'https://server.example.com'
@nonce = SecureRandom.hex(16)
end... |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | test/test_helper.rb | Ruby | mit | 195 | master | 652 | # frozen_string_literal: true
require 'simplecov'
require 'minitest/autorun'
require 'mocha/minitest'
require 'faker'
require 'active_support'
require 'webmock/minitest'
SimpleCov.start do
if ENV['CI']
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_fil... |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | test/lib/omniauth/strategies/openid_connect_test.rb | Ruby | mit | 195 | master | 43,154 | # frozen_string_literal: true
require_relative '../../../test_helper'
module OmniAuth
module Strategies
class OpenIDConnectTest < StrategyTestCase # rubocop:disable Metrics/ClassLength
def test_client_options_defaults
assert_equal 'https', strategy.options.client_options.scheme
assert_equa... |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | lib/omniauth/openid_connect/errors.rb | Ruby | mit | 195 | master | 201 | # frozen_string_literal: true
module OmniAuth
module OpenIDConnect
class Error < RuntimeError; end
class MissingCodeError < Error; end
class MissingIdTokenError < Error; end
end
end |
github | omniauth/omniauth_openid_connect | https://github.com/omniauth/omniauth_openid_connect | lib/omniauth/strategies/openid_connect.rb | Ruby | mit | 195 | master | 16,229 | # frozen_string_literal: true
require 'base64'
require 'timeout'
require 'net/http'
require 'open-uri'
require 'omniauth'
require 'openid_connect'
require 'forwardable'
module OmniAuth
module Strategies
class OpenIDConnect # rubocop:disable Metrics/ClassLength
include OmniAuth::Strategy
extend Forwa... |
github | github/elastomer-client | https://github.com/github/elastomer-client | Gemfile | Ruby | mit | 195 | main | 512 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
group :development do
gem "activesupport", ">= 7.0"
gem "bundler", "~> 2.0"
gem "debug", "~> 1.7"
gem "minitest", "~> 5.17"
gem "minitest-focus", "~> 1.3"
gem "rake"
gem "rubocop", "~> 1.63.0"
gem "rubocop-github", "~> 0.20.0"
gem ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | elastomer-client.gemspec | Ruby | mit | 195 | main | 1,210 | # coding: utf-8
# frozen_string_literal: true
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "elastomer_client/version"
Gem::Specification.new do |spec|
spec.name = "elastomer-client"
spec.version = ElastomerClient::VERSION
spec.authors ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | Rakefile | Ruby | mit | 195 | main | 742 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new do |t|
t.test_files = FileList["test/**/*_test.rb"]
end
task default: :test
namespace :actions do
desc "list valid actions"
task :list do
# there are two distinct :action declarations we need to find
... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client.rb | Ruby | mit | 195 | main | 17,264 | # frozen_string_literal: true
require "addressable/template"
require "faraday"
require "faraday_middleware"
require "multi_json"
require "semantic"
require "zlib"
require "elastomer_client/version"
require "elastomer_client/version_support"
module ElastomerClient
class Client
IVAR_BLACK_LIST = [:@basic_auth, ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/version_support.rb | Ruby | mit | 195 | main | 584 | # frozen_string_literal: true
module ElastomerClient
class VersionSupport
attr_reader :version
# version - an Elasticsearch version string e.g., 5.6.6 or 8.7.0
#
# Raises ArgumentError if version is unsupported.
def initialize(version)
if version < "5.0" || version >= "9.0"
raise ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/notifications.rb | Ruby | mit | 195 | main | 2,998 | # frozen_string_literal: true
require "active_support"
require "active_support/notifications"
require "securerandom"
require "elastomer_client/client"
module ElastomerClient
# So you want to get notifications from your Elasticsearch client? Well,
# you've come to the right place!
#
# require 'elastomer_cli... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/template.rb | Ruby | mit | 195 | main | 2,874 | # frozen_string_literal: true
module ElastomerClient
class Client
# Returns a Template instance.
def template(name)
Template.new self, name
end
class Template
# Create a new template client for making API requests that pertain to
# template management.
#
# client - E... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/snapshot.rb | Ruby | mit | 195 | main | 5,048 | # frozen_string_literal: true
module ElastomerClient
class Client
# Provides access to snapshot API commands.
#
# repository - The name of the repository as a String
# name - The name of the snapshot as a String
#
# Returns a Snapshot instance.
def snapshot(repository = nil, name =... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/nodes.rb | Ruby | mit | 195 | main | 4,079 | # frozen_string_literal: true
module ElastomerClient
class Client
# Provides access to node-level API commands. The default node is set to
# nil which target all nodes. You can pass in "_all" (to get the
# same effect) or "_local" to target only the current node the client is
# connected to. And you... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/docs.rb | Ruby | mit | 195 | main | 24,989 | # frozen_string_literal: true
module ElastomerClient
class Client
# Provides access to document-level API commands. Indexing documents and
# searching documents are both handled by this module.
#
# name - The name of the index as a String (optional)
# type - The document type as a String (option... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/multi_percolate.rb | Ruby | mit | 195 | main | 4,601 | # frozen_string_literal: true
module ElastomerClient
class Client
# Execute an array of percolate actions in bulk. Results are returned in an
# array in the order the actions were sent.
#
# The `multi_percolate` method can be used in two ways. Without a block
# the method will perform an API cal... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/index.rb | Ruby | mit | 195 | main | 21,929 | # frozen_string_literal: true
module ElastomerClient
class Client
# Provides access to index-level API commands. An index name is required for
# these API calls. If you want to operate on all indices - flushing all
# indices, for example - then you will need to use the "_all" index name.
#
# You... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/ccr.rb | Ruby | mit | 195 | main | 5,800 | # frozen_string_literal: true
module ElastomerClient
class Client
# Returns a CCR instance
def ccr
Ccr.new(self)
end
class Ccr
# Create a new Ccr for initiating requests for cross cluster replication.
# More context: https://www.elastic.co/guide/en/elasticsearch/reference/current/... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/delete_by_query.rb | Ruby | mit | 195 | main | 567 | # frozen_string_literal: true
module ElastomerClient
class Client
# Execute delete_by_query using the native _delete_by_query API if supported
# or the application-level implementation.
#
# Warning: These implementations have different parameters and return types.
# If you want to use one or the ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/errors.rb | Ruby | mit | 195 | main | 3,288 | # frozen_string_literal: true
module ElastomerClient
# Parent class for all ElastomerClient errors.
Error = Class.new StandardError
class Client
# General error response from client requests.
class Error < ::ElastomerClient::Error
# Construct a new Error from the given response object or a mess... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/tasks.rb | Ruby | mit | 195 | main | 8,016 | # frozen_string_literal: true
module ElastomerClient
class Client
# Returns a Tasks instance for querying the cluster bound to this client for
# metadata about internal tasks in flight, and to submit administrative
# requests (like cancellation) concerning those tasks.
#
# Returns a new Tasks ob... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/update_by_query.rb | Ruby | mit | 195 | main | 1,444 | # frozen_string_literal: true
module ElastomerClient
class Client
# Update documents based on a query using the Elasticsearch _update_by_query API.
#
# query - The query body as a Hash
# params - Parameters Hash
#
# Examples
#
# # request body query
# update_by_query({
# ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/bulk.rb | Ruby | mit | 195 | main | 15,763 | # frozen_string_literal: true
module ElastomerClient
class Client
# The `bulk` method can be used in two ways. Without a block the method
# will perform an API call, and it requires a bulk request body and
# optional request parameters. If given a block, the method will use a
# Bulk instance to asse... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/native_delete_by_query.rb | Ruby | mit | 195 | main | 1,284 | # frozen_string_literal: true
module ElastomerClient
class Client
# Delete documents based on a query using the Elasticsearch _delete_by_query API.
#
# query - The query body as a Hash
# params - Parameters Hash
#
# Examples
#
# # request body query
# native_delete_by_query({... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/cluster.rb | Ruby | mit | 195 | main | 9,929 | # frozen_string_literal: true
module ElastomerClient
class Client
# Returns a Cluster instance.
def cluster
@cluster ||= Cluster.new self
end
class Cluster
# Create a new cluster client for making API requests that pertain to
# the cluster health and management.
#
# c... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/repository.rb | Ruby | mit | 195 | main | 4,831 | # frozen_string_literal: true
module ElastomerClient
class Client
# Returns a Repository instance.
def repository(name = nil)
Repository.new(self, name)
end
class Repository
# Create a new index client for making API requests that pertain to
# the health and management individual ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/scroller.rb | Ruby | mit | 195 | main | 9,358 | # frozen_string_literal: true
module ElastomerClient
class Client
# Create a new Scroller instance for scrolling all results from a `query`.
#
# query - The query to scroll as a Hash or a JSON encoded String
# opts - Options Hash
# :index - the name of the index to search
# :type -... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/reindex.rb | Ruby | mit | 195 | main | 906 | # frozen_string_literal: true
module ElastomerClient
class Client
# Returns a Reindex instance
def reindex
Reindex.new(self)
end
class Reindex
# Create a new Reindex for initiating reindex tasks.
# More context: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/multi_search.rb | Ruby | mit | 195 | main | 3,904 | # frozen_string_literal: true
module ElastomerClient
class Client
# Execute an array of searches in bulk. Results are returned in an
# array in the order the queries were sent.
#
# The `multi_search` method can be used in two ways. Without a block
# the method will perform an API call, and it re... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/percolator.rb | Ruby | mit | 195 | main | 2,273 | # frozen_string_literal: true
module ElastomerClient
class Client
class Percolator
# Create a new Percolator for managing a query.
#
# client - ElastomerClient::Client used for HTTP requests to the server
# index_name - The index name
# id - The _id for the query
... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/rest_api_spec.rb | Ruby | mit | 195 | main | 1,548 | # frozen_string_literal: true
module ElastomerClient
class Client
# Provides access to the versioned REST API specs for Elasticsearch.
module RestApiSpec
# Returns an ApiSpec instance for the given Elasticsearcion version. This
# method will load the ApiSpec version class if it has not already ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/rest_api_spec/api_spec_v5_6.rb | Ruby | mit | 195 | main | 189,917 | # Generated REST API spec file - DO NOT EDIT!
# Date: 2018-01-10
# ES version: 5.6
module ElastomerClient::Client::RestApiSpec
class ApiSpecV5_6 < ApiSpec
def initialize
@rest_apis = {
"bulk" => RestApi.new(
documentation: "https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/rest_api_spec/api_spec.rb | Ruby | mit | 195 | main | 4,095 | # frozen_string_literal: true
module ElastomerClient::Client::RestApiSpec
# This is the superclass for the version specific API Spec classes that will
# be generated using the `script/generate-rest-api-spec` script. Each version
# of Elasticsarch we support will have it's own ApiSpec class that will
# validat... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/client/rest_api_spec/rest_api.rb | Ruby | mit | 195 | main | 1,287 | # frozen_string_literal: true
require "forwardable"
module ElastomerClient::Client::RestApiSpec
class RestApi
extend Forwardable
attr_reader :documentation
attr_reader :methods
attr_reader :url
attr_reader :body
def_delegators :@url,
:select_parts, :select_params, :valid_part?, :va... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/middleware/compress.rb | Ruby | mit | 195 | main | 1,558 | # frozen_string_literal: true
require "stringio"
module ElastomerClient
module Middleware
# Request middleware that compresses request bodies with GZip for supported
# versions of Elasticsearch.
#
# It will only compress when there is a request body that is a String. This
# middleware should be i... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/middleware/limit_size.rb | Ruby | mit | 195 | main | 853 | # frozen_string_literal: true
module ElastomerClient
module Middleware
# Request middleware that raises an exception if the request body exceeds a
# `max_request_size`.
class LimitSize < Faraday::Middleware
def initialize(app = nil, options = {})
super(app)
@max_request_size = opt... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/middleware/encode_json.rb | Ruby | mit | 195 | main | 1,658 | # frozen_string_literal: true
module ElastomerClient
module Middleware
# Request middleware that encodes the body as JSON.
#
# Processes only requests with matching Content-type or those without a type.
# If a request doesn't have a type but has a body, it sets the Content-type
# to JSON MIME-typ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/middleware/opaque_id.rb | Ruby | mit | 195 | main | 2,729 | # frozen_string_literal: true
require "securerandom"
module ElastomerClient
module Middleware
# This Faraday middleware implements the "X-Opaque-Id" request / response
# headers for Elasticsearch. The X-Opaque-Id header, when provided on the
# request header, will be returned as a header in the respons... |
github | github/elastomer-client | https://github.com/github/elastomer-client | lib/elastomer_client/middleware/parse_json.rb | Ruby | mit | 195 | main | 1,069 | # frozen_string_literal: true
module ElastomerClient
module Middleware
# Parse response bodies as JSON.
class ParseJson < Faraday::Middleware
CONTENT_TYPE = "Content-Type".freeze
MIME_TYPE = "application/json".freeze
def call(environment)
@app.call(environment).on_complete do |... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/test_helper.rb | Ruby | mit | 195 | main | 6,943 | # frozen_string_literal: true
require "rubygems" unless defined? Gem
require "bundler"
Bundler.require(:default, :development)
require "webmock/minitest"
WebMock.allow_net_connect!
require "securerandom"
if ENV["COVERAGE"] == "true"
require "simplecov"
SimpleCov.start do
add_filter "/test/"
add_filter "... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/mock_response.rb | Ruby | mit | 195 | main | 696 | # frozen_string_literal: true
module ElastomerClient
module Middleware
class MockResponse < Faraday::Middleware
def initialize(app, &block)
super(app)
@response_block = block
end
def call(env)
env.clear_body if env.needs_body?
env.status = 200
env.respo... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/notifications_test.rb | Ruby | mit | 195 | main | 2,935 | # frozen_string_literal: true
require File.expand_path("../test_helper", __FILE__)
require "elastomer_client/notifications"
describe ElastomerClient::Notifications do
before do
@name = "elastomer-notifications-test"
@index = $client.index @name
@index.delete if @index.exists?
@events = []
@subsc... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/version_support_test.rb | Ruby | mit | 195 | main | 1,054 | # frozen_string_literal: true
require_relative "test_helper"
describe ElastomerClient::VersionSupport do
describe "supported versions" do
it "allows 5.0.0 to 8.x" do
five_series = ["5.0.0", "5.0.9", "5.1.0", "5.9.0", "5.99.100"]
eight_series = ["8.0.0", "8.0.9", "8.1.0", "8.9.0", "8.99.100"]
... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/assertions.rb | Ruby | mit | 195 | main | 1,914 | # frozen_string_literal: true
module Minitest::Assertions
# COMPATIBILITY
# ES8+ response uses "result" instead of "created"
def assert_created(response)
assert $client.version_support.es_version_8_plus? ? response["result"] == "created" : response["created"], "document was not created"
end
def assert_a... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client_test.rb | Ruby | mit | 195 | main | 15,608 | # frozen_string_literal: true
require File.expand_path("../test_helper", __FILE__)
require File.expand_path("../mock_response", __FILE__)
require "elastomer_client/notifications"
describe ElastomerClient::Client do
it "uses the adapter specified at creation" do
c = ElastomerClient::Client.new(adapter: :test)
... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/middleware/parse_json_test.rb | Ruby | mit | 195 | main | 1,736 | # frozen_string_literal: true
require File.expand_path("../../test_helper", __FILE__)
describe ElastomerClient::Middleware::ParseJson do
let(:middleware) { ElastomerClient::Middleware::ParseJson.new(lambda { |env| Faraday::Response.new(env) }) }
let(:headers) { Hash.new }
def process(body, content_type = nil)
... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/middleware/encode_json_test.rb | Ruby | mit | 195 | main | 2,157 | # frozen_string_literal: true
require File.expand_path("../../test_helper", __FILE__)
describe ElastomerClient::Middleware::EncodeJson do
let(:middleware) { ElastomerClient::Middleware::EncodeJson.new(lambda { |env| env }) }
def process(body, content_type: nil, method: :post)
env = { body:, request_headers: ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/middleware/opaque_id_test.rb | Ruby | mit | 195 | main | 2,010 | # frozen_string_literal: true
require File.expand_path("../../test_helper", __FILE__)
describe ElastomerClient::Middleware::OpaqueId do
before do
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
stub.get("/_cluster/health") { |env|
[200,
{ "X-Opaque-Id" => env[:request_headers]["... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/core_ext/time_test.rb | Ruby | mit | 195 | main | 1,320 | # frozen_string_literal: true
require File.expand_path("../../test_helper", __FILE__)
require "elastomer_client/core_ext/time"
describe "JSON conversions for Time" do
before do
@name = "elastomer-time-test"
@index = $client.index(@name)
unless @index.exists?
@index.create \
settings: { "... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/docs_test.rb | Ruby | mit | 195 | main | 21,590 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Docs do
before do
@name = "elastomer-docs-test"
@index = $client.index(@name)
unless @index.exists?
@index.create \
settings: { "index.number_of_shards" => 1, "index.number_of_replicas" => ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/nodes_test.rb | Ruby | mit | 195 | main | 1,844 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Nodes do
it "gets info for the node(s)" do
h = $client.nodes.info
assert h.key?("cluster_name"), "the cluster name is returned"
assert_instance_of Hash, h["nodes"], "the node list is returned"
end
it... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/bulk_test.rb | Ruby | mit | 195 | main | 11,396 | # frozen_string_literal: true
require_relative "../test_helper"
require "json"
describe ElastomerClient::Client::Bulk do
before do
@name = "elastomer-bulk-test"
@index = $client.index(@name)
unless @index.exists?
@index.create \
settings: { "index.number_of_shards" => 1, "index.number_o... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/repository_test.rb | Ruby | mit | 195 | main | 2,825 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Repository do
before do
if !run_snapshot_tests?
skip "To enable snapshot tests, add a path.repo setting to your elasticsearch.yml file."
end
@name = "elastomer-repository-test"
@repo = $client.re... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/multi_search_test.rb | Ruby | mit | 195 | main | 5,682 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::MultiSearch do
before do
@name = "elastomer-msearch-test"
@index = $client.index(@name)
unless @index.exists?
@index.create \
settings: { "index.number_of_shards" => 1, "index.number_of_rep... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/reindex_test.rb | Ruby | mit | 195 | main | 3,008 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Reindex do
before do
@source_index = $client.index("source_index")
@dest_index = $client.index("dest_index")
@non_existent_index = $client.index("non_existent_index")
if @source_index.exists?
@sou... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/cluster_test.rb | Ruby | mit | 195 | main | 5,121 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Cluster do
before do
@name = "elastomer-cluster-test"
@index = $client.index @name
@index.delete if @index.exists?
@cluster = $client.cluster
end
after do
@index.delete if @index.exists?
end... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/update_by_query_test.rb | Ruby | mit | 195 | main | 3,901 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::UpdateByQuery do
before do
@index = $client.index "elastomer-update-by-query-test"
@index.delete if @index.exists?
@docs = @index.docs("docs")
end
after do
@index.delete if @index.exists?
end
... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/errors_test.rb | Ruby | mit | 195 | main | 3,596 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Error do
it "is instantiated with a simple message" do
err = ElastomerClient::Client::Error.new "something went wrong"
assert_equal "something went wrong", err.message
end
it "is instantiated from an HTT... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/ccr_test.rb | Ruby | mit | 195 | main | 4,369 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Ccr do
before do
skip "Cannot test Ccr API without a replica cluster" unless $replica_client.available?
begin
ccr.delete_auto_follow("follower_pattern")
rescue StandardError
puts "No auto-follo... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/scroller_test.rb | Ruby | mit | 195 | main | 2,716 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Scroller do
before do
@name = "elastomer-scroller-test"
@index = $client.index(@name)
@type = $client.version_support.es_version_8_plus? ? "_doc" : "book"
unless @index.exists?
@index.create \... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/template_test.rb | Ruby | mit | 195 | main | 1,543 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Cluster do
before do
@name = "elastomer-template-test"
@template = $client.template @name
end
after do
@template.delete if @template.exists?
end
it "lists templates in the cluster" do
if $cli... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/native_delete_by_query_test.rb | Ruby | mit | 195 | main | 3,585 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::NativeDeleteByQuery do
before do
@index = $client.index "elastomer-delete-by-query-test"
@index.delete if @index.exists?
@docs = @index.docs("docs")
end
after do
@index.delete if @index.exists?
e... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/tasks_test.rb | Ruby | mit | 195 | main | 4,184 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Tasks do
before do
@tasks = $client.tasks
@index = $client.index("elastomer-tasks-test")
@index.create(default_index_settings)
wait_for_index(@index.name)
end
after do
@index.delete if @index.... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/stubbed_client_test.rb | Ruby | mit | 195 | main | 814 | # frozen_string_literal: true
require_relative "../test_helper"
describe "stubbed client tests" do
before do
@stubs = Faraday::Adapter.lookup_middleware(:test)::Stubs.new
@client = ElastomerClient::Client.new adapter: [:test, @stubs]
@client.instance_variable_set(:@version, "5.6.4")
end
describe E... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/multi_percolate_test.rb | Ruby | mit | 195 | main | 4,174 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::MultiPercolate do
before do
if $client.version_support.es_version_8_plus?
skip "Multi percolate not supported in ES version #{$client.version}"
end
@name = "elastomer-mpercolate-test"
@index = ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/snapshot_test.rb | Ruby | mit | 195 | main | 4,328 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Snapshot do
before do
@index = nil
@restored_index = nil
if !run_snapshot_tests?
skip "To enable snapshot tests, add a path.repo setting to your elasticsearch.yml file."
end
@index_name = "e... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/index_test.rb | Ruby | mit | 195 | main | 14,315 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Index do
before do
@name = "elastomer-index-test"
@index = $client.index @name
@index.delete if @index.exists?
end
after do
@index.delete if @index.exists?
end
it "does not require an index ... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/percolator_test.rb | Ruby | mit | 195 | main | 1,788 | # frozen_string_literal: true
require_relative "../test_helper"
describe ElastomerClient::Client::Percolator do
before do
if $client.version_support.es_version_8_plus?
skip "Percolate not supported in ES version #{$client.version}"
end
@index = $client.index "elastomer-percolator-test"
@inde... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/rest_api_spec/api_spec_test.rb | Ruby | mit | 195 | main | 2,018 | # frozen_string_literal: true
require_relative "../../test_helper"
describe ElastomerClient::Client::RestApiSpec::ApiSpec do
before do
@api_spec = ElastomerClient::Client::RestApiSpec.api_spec("5.6.4")
end
it "selects valid path parts" do
parts = {:index => "test", "type" => "doc", :foo => "bar"}
... |
github | github/elastomer-client | https://github.com/github/elastomer-client | test/client/rest_api_spec/rest_api_test.rb | Ruby | mit | 195 | main | 3,928 | # frozen_string_literal: true
require_relative "../../test_helper"
describe ElastomerClient::Client::RestApiSpec::RestApi do
before do
@rest_api = ElastomerClient::Client::RestApiSpec::RestApi.new \
documentation: "https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-state.html",
... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | bundleup.gemspec | Ruby | mit | 195 | main | 1,543 | require_relative "lib/bundleup/version"
Gem::Specification.new do |spec|
spec.name = "bundleup"
spec.version = Bundleup::VERSION
spec.authors = ["Matt Brictson"]
spec.email = ["bundleup@mattbrictson.com"]
spec.summary = "A friendlier command-line interface for Bundler’s `update` and `outdated` commands."
... |
github | mattbrictson/bundleup | https://github.com/mattbrictson/bundleup | Gemfile | Ruby | mit | 195 | main | 300 | source "https://rubygems.org"
gemspec
gem "irb"
gem "minitest", "~> 6.0"
gem "minitest-rg", "~> 5.3"
gem "mocha", "~> 3.0"
gem "rake", "~> 13.0"
gem "rubocop", "1.86.0"
gem "rubocop-minitest", "0.39.1"
gem "rubocop-packaging", "0.6.0"
gem "rubocop-performance", "1.26.1"
gem "rubocop-rake", "0.7.1" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.