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 |
|---|---|---|---|---|---|---|---|---|
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/app/_plugins/generators/alias.rb | app/_plugins/generators/alias.rb | # frozen_string_literal: true
module Jekyll
class Alias < Jekyll::Generator
priority :lowest
def generate(site)
static_files = [
'app/_headers'
]
static_files.each do |path|
content = File.read(path)
page = PageWithoutAFile.new(site, __dir__, '', path.sub('app/', ... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/app/_plugins/generators/versions.rb | app/_plugins/generators/versions.rb | # frozen_string_literal: true
module Jekyll
class Versions < Jekyll::Generator
priority :normal
def generate(site)
latest_version = latest_version(site.data['versions'])
site.data['latest_version'] = latest_version
# Add a `version` property to every versioned page
# TODO: Also crea... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/app/_plugins/generators/sitemap.rb | app/_plugins/generators/sitemap.rb | # frozen_string_literal: true
module Sitemap
class Generator < Jekyll::Generator
priority :lowest
def generate(site)
# What's our latest version?
latest = site.data['latest_version']
# Grab all pages that contain that version
all_pages = []
# Build a map of the latest availabl... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/app/_plugins/filters/indent_filter.rb | app/_plugins/filters/indent_filter.rb | # frozen_string_literal: true
module IndentFilter
def indent(input)
input
.gsub("\n</code>", '</code>')
.split("\n")
.map { |l| l.prepend(' ') }
.join("\n")
end
end
Liquid::Template.register_filter(IndentFilter)
| ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/spec/spec_helper.rb | jekyll-kuma-plugins/spec/spec_helper.rb | # frozen_string_literal: true
require 'jekyll_kuma_plugins'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
conf... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/spec/jekyll/kuma_plugins/plugins_spec.rb | jekyll-kuma-plugins/spec/jekyll/kuma_plugins/plugins_spec.rb | # frozen_string_literal: true
RSpec.describe Jekyll::KumaPlugins do
it 'has a version number' do
expect(Jekyll::KumaPlugins::VERSION).not_to be nil
end
end
| ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/spec/jekyll/kuma_plugins/common/params_spec.rb | jekyll-kuma-plugins/spec/jekyll/kuma_plugins/common/params_spec.rb | # frozen_string_literal: true
require 'rspec'
require 'jekyll/kuma_plugins/common/params'
# Assuming ParamsParser is mixed into a class for testing
class TestParser
include Jekyll::KumaPlugins::Common
end
RSpec.describe TestParser do
let(:parser) { TestParser.new }
let(:defaults) { { if_version: nil, init_valu... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/spec/jekyll/kuma_plugins/liquid/tags/cpinstall_spec.rb | jekyll-kuma-plugins/spec/jekyll/kuma_plugins/liquid/tags/cpinstall_spec.rb | # frozen_string_literal: true
RSpec.describe Jekyll::KumaPlugins::Liquid::Tags::InstallCp do
subject do
described_class.parse('cpinstall', '', Liquid::Tokenizer.new("#{entry}{%endcpinstall%}"),
Liquid::ParseContext.new).render(Liquid::Context.new({
... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/spec/jekyll/kuma_plugins/liquid/tags/policyyaml_spec.rb | jekyll-kuma-plugins/spec/jekyll/kuma_plugins/liquid/tags/policyyaml_spec.rb | # frozen_string_literal: true
RSpec.describe Jekyll::KumaPlugins::Liquid::Tags::PolicyYaml do
subject do
described_class.parse('policy_yaml', '', Liquid::Tokenizer.new("#{entry}{%endpolicy_yaml%}"),
Liquid::ParseContext.new).render(Liquid::Context.new({
... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/spec/jekyll/kuma_plugins/liquid/tags/policyyaml/transformers_spec.rb | jekyll-kuma-plugins/spec/jekyll/kuma_plugins/liquid/tags/policyyaml/transformers_spec.rb | # frozen_string_literal: true
RSpec.describe Jekyll::KumaPlugins::Liquid::Tags::PolicyYamlTransformers do
describe Jekyll::KumaPlugins::Liquid::Tags::PolicyYamlTransformers::MeshServiceTargetRefTransformer do
subject { described_class.new }
describe '#matches?' do
it 'matches spec.to.targetRef with Me... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll_kuma_plugins.rb | jekyll-kuma-plugins/lib/jekyll_kuma_plugins.rb | # frozen_string_literal: true
require 'jekyll'
require_relative 'jekyll/kuma_plugins'
| ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins.rb | # frozen_string_literal: true
require_relative 'kuma_plugins/version'
require_relative 'kuma_plugins/liquid/tags/jsonschema'
require_relative 'kuma_plugins/liquid/tags/schema_viewer'
require_relative 'kuma_plugins/liquid/tags/embed'
require_relative 'kuma_plugins/liquid/tags/policyyaml'
require_relative 'kuma_plugins/... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/version.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/version.rb | # frozen_string_literal: true
module Jekyll
module KumaPlugins
VERSION = '0.1.0'
end
end
| ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/generators/demourl.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/generators/demourl.rb | # frozen_string_literal: true
module Jekyll
module KumaPlugins
class Generator < Jekyll::Generator
priority :lowest
def generate(site)
demo_version = site.config.fetch('mesh_demo_version', 'main')
site.pages.each do |page|
page.content = page.content.gsub('kuma-demo://', "h... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/common/path_helpers.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/common/path_helpers.rb | # frozen_string_literal: true
module Jekyll
module KumaPlugins
module Common
module PathHelpers
PATHS_CONFIG = 'mesh_raw_generated_paths'
DEFAULT_PATHS = ['app/assets'].freeze
def read_file(paths, file_name)
paths.each do |path|
file_path = File.join(path, fil... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/common/params.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/common/params.rb | # frozen_string_literal: true
module Jekyll
module KumaPlugins
module Common
# Regex to capture key-value pairs, standalone keys, and parameters with missing values
PARAM_REGEX = /(\w+)=((["'])(.*?)\3|\S+)?|(\w+)/
def parse_name_and_params(markup, default = {})
# Ensure default_params ... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/blocks/helmvalues.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/blocks/helmvalues.rb | # frozen_string_literal: true
# This plugin generates a code block with YAML for Helm's values.yaml file,
# nesting the YAML content under the specified prefix path.
# For example, if the prefix path is "foo.bar.baz" and the YAML content is:
# ```yaml
# a:
# b:
# c: [d,e,f]
# ```
# The output will be:
# ```yaml
... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/schema_viewer.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/schema_viewer.rb | # frozen_string_literal: true
require 'json'
require 'yaml'
require 'cgi'
require_relative '../../common/path_helpers'
require_relative 'schema_viewer/renderer'
module Jekyll
module KumaPlugins
module Liquid
module Tags
# Renders JSON schema as interactive HTML viewer
class SchemaViewer < ... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/cpinstall.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/cpinstall.rb | # frozen_string_literal: true
# This plugin adds key values to install and generates 2 tabs for helm and kumactl.
# It removes duplication of examples for both universal and kubernetes environments.
require 'yaml'
module Jekyll
module KumaPlugins
module Liquid
module Tags
class InstallCp < ::Liquid... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/inc.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/inc.rb | # frozen_string_literal: true
require_relative '../../common/params'
module Jekyll
module KumaPlugins
module Liquid
module Tags
class Inc < ::Liquid::Tag
include Jekyll::KumaPlugins::Common
def initialize(_tag_name, markup, _parse_context)
super
# Pars... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/cpinstallfile.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/cpinstallfile.rb | # frozen_string_literal: true
# This plugin simplifies installation documentation by generating tabs for `kumactl`
# and Helm commands, using a set of customizable parameters. It reduces the need for
# duplicate installation examples across Universal and Kubernetes environments.
# The plugin requires a tabs name to be... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml.rb | # frozen_string_literal: true
# This plugins lets us to write the policy YAML only once.
# It removes duplication of examples for both universal and kubernetes environments.
# The expected format is universal. It only works for policies V2 with a `spec` blocks.
require 'yaml'
require 'rubygems' # Required for Gem::Ver... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/embed.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/embed.rb | # frozen_string_literal: true
require_relative '../../common/path_helpers'
module Jekyll
module KumaPlugins
module Liquid
module Tags
class Embed < ::Liquid::Tag
include Jekyll::KumaPlugins::Common::PathHelpers
def initialize(tag_name, markup, options)
super
... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/rbacresources.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/rbacresources.rb | # frozen_string_literal: true
# This plugin generates tabbed tables for RBAC resources (ClusterRole, ClusterRoleBinding,
# Role, RoleBinding) from a given YAML file. Each tab corresponds to a resource kind,
# and each resource is shown in a nested tab with its name and YAML content.
#
# When no `filename` is provided,... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/jsonschema.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/jsonschema.rb | # frozen_string_literal: true
require 'json'
require 'yaml'
require_relative '../../common/path_helpers'
module Jekyll
module KumaPlugins
module Liquid
module Tags
class JsonSchema < ::Liquid::Tag
include Jekyll::KumaPlugins::Common::PathHelpers
def initialize(tag_name, markup... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml/terraform_generator.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml/terraform_generator.rb | # frozen_string_literal: true
module Jekyll
module KumaPlugins
module Liquid
module Tags
# Generates Terraform HCL from YAML policy data
class TerraformGenerator
def generate(yaml_data)
type = yaml_data['type']
name = yaml_data['name']
resource_... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml/transformers.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml/transformers.rb | # frozen_string_literal: true
module Jekyll
module KumaPlugins
module Liquid
module Tags
module PolicyYamlTransformers
# Base class for YAML node transformers
class BaseTransformer
def matches?(_path, _node, _context)
raise NotImplementedError, 'Subclas... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml/tab_generator.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/policyyaml/tab_generator.rb | # frozen_string_literal: true
module Jekyll
module KumaPlugins
module Liquid
module Tags
# Generates HTML tabs for policy YAML display
class TabGenerator
def generate(render_context, contents, terraform_content)
docs_path = build_docs_path(render_context)
a... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/schema_viewer/renderer.rb | jekyll-kuma-plugins/lib/jekyll/kuma_plugins/liquid/tags/schema_viewer/renderer.rb | # frozen_string_literal: true
require 'json'
require 'cgi'
module Jekyll
module KumaPlugins
module Liquid
module Tags
module SchemaViewerComponents
# Renders schema data to HTML
class Renderer
DESCRIPTION_TRUNCATE_LENGTH = 100
def initialize(schema, fil... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'jekyll-generator-single-source'
require_relative 'support/golden_file_manager'
require_relative '../app/_plugins/tags/tabs/tabs'
require_relative '../jekyll-kuma-plugins/lib/jekyll_kuma_plugins'
# Register the tab and tabs tags from the Jekyll tabs plugin
Liquid::Template.regi... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/spec/support/golden_file_manager.rb | spec/support/golden_file_manager.rb | # frozen_string_literal: true
require 'fileutils'
require 'diff/lcs'
module GoldenFileManager
ASSETS_DIR = 'dist/vite/assets/'
OUTPUT_CSS = File.join(ASSETS_DIR, 'application.css')
OUTPUT_JS = File.join(ASSETS_DIR, 'application.js')
def self.load_input(file_path)
File.read(file_path)
end
def self.lo... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/spec/kuma_plugins/liquid/tags/inc_spec.rb | spec/kuma_plugins/liquid/tags/inc_spec.rb | # frozen_string_literal: true
ProcessedPage = Struct.new(:content)
RSpec.describe Jekyll::KumaPlugins::Liquid::Tags::Inc do
let(:version) { '2.9.1' }
let(:release) { Jekyll::GeneratorSingleSource::Product::Release.new({ 'release' => version }) }
let(:page) { { 'release' => release.to_liquid } }
let(:environme... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/spec/kuma_plugins/liquid/tags/rbacresources_spec.rb | spec/kuma_plugins/liquid/tags/rbacresources_spec.rb | # frozen_string_literal: true
RSpec.describe Jekyll::KumaPlugins::Liquid::Tags::RbacResources do
shared_examples 'rbac resources rendering' do |input_file, golden_file|
it "renders correctly for #{input_file}" do
site = Jekyll::Site.new(Jekyll.configuration({}))
context = Liquid::Context.new({}, {}, ... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/spec/kuma_plugins/liquid/tags/policy_yaml_spec.rb | spec/kuma_plugins/liquid/tags/policy_yaml_spec.rb | # frozen_string_literal: true
RSpec.describe Jekyll::KumaPlugins::Liquid::Tags::PolicyYaml do
# Set up the Jekyll site and context for testing
shared_examples 'policy yaml rendering' do |input_file, golden_file, tag_options, release|
it "renders correctly for #{input_file}" do
site = Jekyll::Site.new(Je... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
kumahq/kuma-website | https://github.com/kumahq/kuma-website/blob/7b6c49c772192d2ecf31f70c006229013ad32a56/spec/kuma_plugins/liquid/tags/schema_viewer_spec.rb | spec/kuma_plugins/liquid/tags/schema_viewer_spec.rb | # frozen_string_literal: true
RSpec.describe Jekyll::KumaPlugins::Liquid::Tags::SchemaViewer do
shared_examples 'schema viewer rendering' do |schema_name, schema_type, golden_file|
it "renders correctly for #{schema_name} type=#{schema_type}" do
site = Jekyll::Site.new(Jekyll.configuration({
... | ruby | Apache-2.0 | 7b6c49c772192d2ecf31f70c006229013ad32a56 | 2026-01-04T17:42:48.724969Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle_spec.rb | spec/riddle_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle do
describe '.version_warning' do
before :each do
@existing_version = Riddle.loaded_version
end
after :each do
Riddle.loaded_version = @existing_version
end
it "should do nothing if there is a Sphinx versio... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'rubygems'
require 'bundler'
$:.unshift File.dirname(__FILE__) + '/../lib'
$:.unshift File.dirname(__FILE__) + '/..'
Dir['spec/support/**/*.rb'].each { |f| require f }
Bundler.require :default, :development
require 'riddle'
RSpec.configure do |config|
config.include BinaryF... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/support/binary_fixtures.rb | spec/support/binary_fixtures.rb | # frozen_string_literal: true
module BinaryFixtures
def query_contents(key)
path = "spec/fixtures/data/#{Riddle.loaded_version}/#{key}.bin"
contents = open(path) { |f| f.read }
contents.respond_to?(:encoding) ?
contents.force_encoding('ASCII-8BIT') : contents
end
end
| ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/support/sphinx.rb | spec/support/sphinx.rb | # frozen_string_literal: true
require 'erb'
require 'yaml'
require 'tempfile'
if RUBY_PLATFORM == 'java'
require 'java'
require 'jdbc/mysql'
Jdbc::MySQL.load_driver
end
class Sphinx
attr_accessor :host, :username, :password, :port
def initialize
self.host = ENV['MYSQL_HOST'] || 'localhost'
sel... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/support/jruby_client.rb | spec/support/jruby_client.rb | # frozen_string_literal: true
class JRubyClient
def initialize(host, username, password, port)
address = "jdbc:mysql://#{host}"
properties = Java::JavaUtil::Properties.new
properties.setProperty "user", username if username
properties.setProperty "password", password if password
properties... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/support/mri_client.rb | spec/support/mri_client.rb | # frozen_string_literal: true
class MRIClient
def initialize(host, username, password, port)
@client = Mysql2::Client.new(
:host => host,
:username => username,
:password => password,
:port => port,
:local_infile => true
)
end
def query(statement)
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/response_spec.rb | spec/unit/response_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Client::Response do
it "should interpret an integer correctly" do
Riddle::Client::Response.new([42].pack('N')).next_int.should == 42
end
it "should interpret a string correctly" do
str = "this is a string"
Riddle::Client::Respon... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/client_spec.rb | spec/unit/client_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Client do
it "should have the same keys for both commands and versions, except persist" do
(Riddle::Client::Commands.keys - [:persist]).should == Riddle::Client::Versions.keys
end
it "should default to localhost as the server" do
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/message_spec.rb | spec/unit/message_spec.rb | # encoding: BINARY
# frozen_string_literal: true
require 'spec_helper'
describe Riddle::Client::Message do
it "should start with an empty string" do
Riddle::Client::Message.new.to_s.should == ""
end
it "should append raw data correctly" do
data = [1, 2, 3].pack('NNN')
message = Riddle::Client::Mess... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/riddle_spec.rb | spec/unit/riddle_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "Riddle" do
it "should escape characters correctly" do
invalid_chars = ['(', ')', '|', '-', '!', '@', '~', '"', '/']
invalid_chars.each do |char|
base = "string with '#{char}' character"
Riddle.escape(base).should == base.gsub(char, "\... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration_spec.rb | spec/unit/configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration do
it "should render all given indexes and sources, plus the indexer and search sections" do
config = Riddle::Configuration.new
config.searchd.port = 3312
config.searchd.pid_file = "file.pid"
source = Riddle::Config... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/filter_spec.rb | spec/unit/filter_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Client::Filter do
it "should render a filter that uses an array of ints correctly" do
filter = Riddle::Client::Filter.new("field", [1, 2, 3])
filter.query_message.should == query_contents(:filter_array)
end
it "should render a filte... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/common_spec.rb | spec/unit/configuration/common_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::Common do
it "should always be valid" do
common = Riddle::Configuration::Common.new
common.should be_valid
end
it "should support Sphinx's common settings" do
settings = %w( lemmatizer_base on_json_attr_error json... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/source_spec.rb | spec/unit/configuration/source_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::Source do
#
end | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/realtime_index_spec.rb | spec/unit/configuration/realtime_index_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::RealtimeIndex do
let(:index) { Riddle::Configuration::RealtimeIndex.new('rt1') }
describe '#valid?' do
it "should not be valid without a name" do
index.name = nil
index.path = 'foo'
index.should_not be_valid... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/distributed_index_spec.rb | spec/unit/configuration/distributed_index_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::DistributedIndex do
it "should not be valid without any indices" do
index = Riddle::Configuration::DistributedIndex.new("dist1")
index.should_not be_valid
end
it "should be valid with just local indices" do
index = ... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/tsv_source_spec.rb | spec/unit/configuration/tsv_source_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::TSVSource do
it "should be invalid without an tsvpipe command, name and type if there's no parent" do
source = Riddle::Configuration::TSVSource.new("tsv1")
source.should_not be_valid
source.tsvpipe_command = "ls /var/nu... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/indexer_spec.rb | spec/unit/configuration/indexer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::Indexer do
it "should always be valid" do
indexer = Riddle::Configuration::Indexer.new
indexer.should be_valid
end
it "should support Sphinx's indexer settings" do
settings = %w( mem_limit max_iops max_iosize )
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/template_index_spec.rb | spec/unit/configuration/template_index_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::TemplateIndex do
it "should be invalid without a name" do
index = Riddle::Configuration::TemplateIndex.new(nil)
index.should_not be_valid
index.name = "test1"
index.should be_valid
end
it "should raise a Config... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/searchd_spec.rb | spec/unit/configuration/searchd_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::Searchd do
if Riddle.loaded_version.to_f >= 0.9
it "should be invalid without a listen or pid_file" do
searchd = Riddle::Configuration::Searchd.new
searchd.should_not be_valid
searchd.port = 3312
searchd... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/index_spec.rb | spec/unit/configuration/index_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::DistributedIndex do
it "should be invalid without a name, sources or path if there's no parent" do
index = Riddle::Configuration::Index.new(nil)
index.should_not be_valid
index.name = "test1"
index.should_not be_val... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/sql_source_spec.rb | spec/unit/configuration/sql_source_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::SQLSource do
it "should be invalid without a host, user, database, and query if there's no parent" do
source = Riddle::Configuration::SQLSource.new("src1", "mysql")
source.should_not be_valid
source.sql_host = "lo... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/unit/configuration/xml_source_spec.rb | spec/unit/configuration/xml_source_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration::XMLSource do
it "should be invalid without an xmlpipe command, name and type if there's no parent" do
source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
source.should_not be_valid
source.xmlpipe_comman... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/auto_version_spec.rb | spec/riddle/auto_version_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::AutoVersion do
describe '.configure' do
before :each do
@controller = Riddle::Controller.new stub('configuration'), 'sphinx.conf'
Riddle::Controller.stub(:new => @controller)
unless ENV['SPHINX_VERSION'].nil?
@env_ve... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/client_spec.rb | spec/riddle/client_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Client do
describe '#initialize' do
it "should check the loaded Sphinx version" do
Riddle.should_receive(:version_warning)
Riddle::Client.new
end
end
end
| ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/query_spec.rb | spec/riddle/query_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Query, :live => true do
describe '.connection' do
let(:connection) { Riddle::Query.connection 'localhost', 9306 }
it "returns a MySQL Client" do
connection.should be_a(Mysql2::Client)
end
it "should handle search requests" ... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/configuration_spec.rb | spec/riddle/configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Configuration do
describe Riddle::Configuration::Index do
describe '#settings' do
it 'should return array with all settings of index' do
Riddle::Configuration::Index.settings.should_not be_empty
end
it 'should return... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/controller_spec.rb | spec/riddle/controller_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Controller do
let(:controller) do
Riddle::Controller.new double('configuration'), 'sphinx.conf'
end
describe '#sphinx_version' do
it "should return 1.10 if using 1.10-beta" do
controller.stub(:` => 'Sphinx 1.10-beta (r2420)')
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/query/select_spec.rb | spec/riddle/query/select_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'date'
require 'time'
describe Riddle::Query::Select do
let(:query) { Riddle::Query::Select.new }
it 'handles basic queries on a specific index' do
query.from('foo_core').to_sql.should == 'SELECT * FROM foo_core'
end
it 'handles queries on mult... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/query/delete_spec.rb | spec/riddle/query/delete_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Query::Delete do
it 'handles a single id' do
query = Riddle::Query::Delete.new 'foo_core', 5
query.to_sql.should == 'DELETE FROM foo_core WHERE id = 5'
end
it 'handles multiple ids' do
query = Riddle::Query::Delete.new 'foo_core... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/riddle/query/insert_spec.rb | spec/riddle/query/insert_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Riddle::Query::Insert do
it 'handles inserts' do
query = Riddle::Query::Insert.new('foo_core', [:id, :deleted], [4, false])
query.to_sql.should == 'INSERT INTO foo_core (id, `deleted`) VALUES (4, 0)'
end
it 'handles replaces' do
query = R... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/status_spec.rb | spec/functional/status_spec.rb | # frozen_string_literal: true
require 'spec_helper'
if Riddle.loaded_version == '0.9.9' || Riddle.loaded_version == '1.10'
describe "Sphinx Status", :live => true do
before :each do
@client = Riddle::Client.new("localhost", 9313)
@status = @client.status
end
it "should return a hash" do
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/parsing_spec.rb | spec/functional/parsing_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Parsing" do
it "handles invalid configuration files" do
Riddle::Configuration.parse!(<<-DOC)
latex_documents = [
#
]
DOC
end
end
| ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/search_spec.rb | spec/functional/search_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "Sphinx Searches", :live => true do
let(:client) { Riddle::Client.new 'localhost', 9313 }
it "should return a single hash if a single query" do
client.query("smith", "people").should be_kind_of(Hash)
end
it "should return an array of hashs if ... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/update_spec.rb | spec/functional/update_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "Sphinx Updates", :live => true do
before :each do
@client = Riddle::Client.new("localhost", 9313)
end
it "should update a single record appropriately" do
# check existing birthday
result = @client.query("Ellie K Ford", "people")
resu... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/persistance_spec.rb | spec/functional/persistance_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "Sphinx Persistance Connection", :live => true do
before :each do
@client = Riddle::Client.new("localhost", 9313)
end
it "should raise errors once already opened" do
@client.open
lambda { @client.open }.should raise_error
@client.cl... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/merging_spec.rb | spec/functional/merging_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "Merging indices", :live => true do
let(:connection) { Mysql2::Client.new :host => '127.0.0.1', :port => 9306 }
let(:path) { "spec/fixtures/sphinx/spec.conf" }
let(:configuration) do
Riddle::Configuration::Parser.new(File.read(path)).parse!
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/connection_spec.rb | spec/functional/connection_spec.rb | # frozen_string_literal: true
require 'spec_helper'
class RiddleSpecConnectionProcError < StandardError; end
describe 'Sphinx Client', :live => true do
let(:client) { Riddle::Client.new 'localhost', 9313 }
after :each do
Riddle::Client.connection = nil
end
describe '.connection' do
it "should use t... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/excerpt_spec.rb | spec/functional/excerpt_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "Sphinx Excepts", :live => true do
let(:client) { Riddle::Client.new "localhost", 9313 }
let(:controller) do
controller = Riddle::Controller.new nil, ''
controller.bin_path = Sphinx.new.bin_path
controller
end
it "should hi... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/escaping_spec.rb | spec/functional/escaping_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'SphinxQL escaping', :live => true do
let(:connection) { Mysql2::Client.new :host => '127.0.0.1', :port => 9306 }
def sphinxql_matching(string)
select = Riddle::Query::Select.new
select.from 'people'
select.matching string
select.to_sql... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/spec/functional/keywords_spec.rb | spec/functional/keywords_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe "Sphinx Keywords", :live => true do
before :each do
@client = Riddle::Client.new("localhost", 9313)
end
it "should return an array of hashes" do
results = @client.keywords("pat", "people")
results.should be_kind_of(Array)
resul... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle.rb | lib/riddle.rb | # frozen_string_literal: true
require 'date'
require 'thread'
require 'socket'
require 'stringio'
require 'timeout'
module Riddle #:nodoc:
@@mutex = Mutex.new
@@escape_pattern = /[\(\)\|\-!@~"&\/\?]/
@@use_encoding = defined?(::Encoding) &&
::Encoding.respond_to?(:default_externa... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/1.10.rb | lib/riddle/1.10.rb | # frozen_string_literal: true
require 'riddle/0.9.9'
Riddle.loaded_version = '1.10'
require 'riddle/1.10/client' | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/0.9.9.rb | lib/riddle/0.9.9.rb | # frozen_string_literal: true
Riddle.loaded_version = '0.9.9'
require 'riddle/0.9.9/client'
require 'riddle/0.9.9/client/filter'
require 'riddle/0.9.9/configuration/searchd'
Riddle.escape_pattern = /[\(\)\|\-!@~"&\/\\\^\$=]/
| ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/auto_version.rb | lib/riddle/auto_version.rb | # frozen_string_literal: true
class Riddle::AutoVersion
def self.configure
controller = Riddle::Controller.new nil, ''
version = ENV['SPHINX_VERSION'] || controller.sphinx_version
case version
when '0.9.8', '0.9.9'
require "riddle/#{version}"
when /1.10/
require 'riddle/1.10'
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/2.1.0.rb | lib/riddle/2.1.0.rb | # frozen_string_literal: true
require 'riddle/0.9.9'
require 'riddle/1.10'
require 'riddle/2.0.1'
Riddle.loaded_version = '2.1.0'
Riddle::Client::Versions[:search] = 0x119
Riddle::Client::Versions[:excerpt] = 0x104
Riddle::Client::RankModes[:expr] = 8
Riddle::Client::RankModes[:total] = 9
Riddle::Client::Attribu... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/2.0.1.rb | lib/riddle/2.0.1.rb | # frozen_string_literal: true
require 'riddle/0.9.9'
require 'riddle/1.10'
Riddle.loaded_version = '2.0.1'
require 'riddle/2.0.1/client'
| ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/query.rb | lib/riddle/query.rb | # frozen_string_literal: true
module Riddle::Query
ESCAPE_CHARACTERS = /[\(\)\|\-!@~\/"\/\^\$\\><&=\?]/
# http://sphinxsearch.com/docs/current/extended-syntax.html
ESCAPE_WORDS = /\b(?:MAYBE|NEAR|PARAGRAPH|SENTENCE|ZONE|ZONESPAN)\b/
MYSQL2_ESCAPE = defined?(Mysql2) && defined?(Mysql::Client)
def self.connec... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/command_failed_error.rb | lib/riddle/command_failed_error.rb | # frozen_string_literal: true
class Riddle::CommandFailedError < StandardError
attr_accessor :command_result
end
| ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/execute_command.rb | lib/riddle/execute_command.rb | # frozen_string_literal: true
class Riddle::ExecuteCommand
WINDOWS = (RUBY_PLATFORM =~ /mswin|mingw/)
def self.call(command, verbose = true)
new(command, verbose).call
end
def initialize(command, verbose)
@command, @verbose = command, verbose
return unless WINDOWS
@command = "start /B #{@co... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/configuration.rb | lib/riddle/configuration.rb | # frozen_string_literal: true
require 'riddle/configuration/section'
require 'riddle/configuration/index_settings'
require 'riddle/configuration/common'
require 'riddle/configuration/distributed_index'
require 'riddle/configuration/index'
require 'riddle/configuration/indexer'
require 'riddle/configuration/realtime_i... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/controller.rb | lib/riddle/controller.rb | # frozen_string_literal: true
module Riddle
NoConfigurationFileError = Class.new StandardError
class Controller
DEFAULT_MERGE_OPTIONS = {:filters => {}}.freeze
attr_accessor :path, :bin_path, :searchd_binary_name, :indexer_binary_name
def initialize(configuration, path)
@configuration = confi... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/client.rb | lib/riddle/client.rb | # frozen_string_literal: true
require 'riddle/client/filter'
require 'riddle/client/message'
require 'riddle/client/response'
module Riddle
class VersionError < StandardError; end
class ResponseError < StandardError
attr_accessor :original
end
class OutOfBoundsError < StandardError; end
# This class w... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/0.9.8.rb | lib/riddle/0.9.8.rb | # frozen_string_literal: true
Riddle.loaded_version = '0.9.8'
| ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/command_result.rb | lib/riddle/command_result.rb | # frozen_string_literal: true
class Riddle::CommandResult
attr_reader :command, :status, :output
attr_accessor :successful
def initialize(command, status, output = nil, successful = nil)
@command, @status, @output = command, status, output
if successful.nil?
@successful = (@status == 0)
els... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/query/insert.rb | lib/riddle/query/insert.rb | # frozen_string_literal: true
class Riddle::Query::Insert
attr_reader :columns, :values
def initialize(index, columns = [], values = [])
@index = index
@columns = columns
@values = values.first.is_a?(Array) ? values : [values]
@replace = false
end
def replace!
@replace = true
self
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/query/delete.rb | lib/riddle/query/delete.rb | # frozen_string_literal: true
class Riddle::Query::Delete
def initialize(index, *ids)
@index = index
@ids = ids.flatten
end
def to_sql
if @ids.length > 1
"DELETE FROM #{@index} WHERE id IN (#{@ids.join(', ')})"
else
"DELETE FROM #{@index} WHERE id = #{@ids.first}"
end
end
e... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/query/select.rb | lib/riddle/query/select.rb | # frozen_string_literal: true
class Riddle::Query::Select
def initialize
@values = []
@indices = []
@matching = nil
@wheres = {}
@where_alls = {}
@where_nots = {}
@where_not_alls = {}
@group_by ... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/1.10/client.rb | lib/riddle/1.10/client.rb | # frozen_string_literal: true
Riddle::Client::Versions[:search] = 0x117
Riddle::Client::Versions[:excerpt] = 0x102
class Riddle::Client
private
# Generation of the message to send to Sphinx for an excerpts request.
def excerpts_message(options)
message = Message.new
message.append [0, excerpt_f... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/0.9.9/client.rb | lib/riddle/0.9.9/client.rb | # frozen_string_literal: true
Riddle::Client::Versions[:search] = 0x116
Riddle::Client::Versions[:update] = 0x102
class Riddle::Client
private
def initialise_connection(available_server)
socket = initialise_socket(available_server)
# Send version
socket.send [1].pack('N'), 0
# Checking version
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/0.9.9/configuration/searchd.rb | lib/riddle/0.9.9/configuration/searchd.rb | # frozen_string_literal: true
module Riddle
class Configuration
class Searchd
NUMBER = 1.class
def valid?
set_listen
!( @listen.nil? || @listen.empty? || @pid_file.nil? )
end
private
def set_listen
@listen = @listen.to_s if @listen.is_a?(NUMBER)
... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/0.9.9/client/filter.rb | lib/riddle/0.9.9/client/filter.rb | # frozen_string_literal: true
class Riddle::Client::Filter
#
private
def append_integer_range(message, range)
message.append_64bit_ints self.values.first, self.values.last
end
def append_array(message, array)
message.append_64bit_ints *array.collect { |val|
case val
when TrueClas... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/configuration/source.rb | lib/riddle/configuration/source.rb | # frozen_string_literal: true
module Riddle
class Configuration
class Source < Riddle::Configuration::Section
attr_accessor :name, :parent, :type
def render
raise ConfigurationError unless valid?
inherited_name = "#{name}"
inherited_name += " : #{parent}" if parent
(... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/configuration/common.rb | lib/riddle/configuration/common.rb | # frozen_string_literal: true
module Riddle
class Configuration
class Common < Riddle::Configuration::Section
def self.settings
[
:lemmatizer_base, :json_autoconv_numbers, :json_autoconv_keynames,
:on_json_attr_error, :rlp_root, :rlp_environment, :rlp_max_batch_size,
:... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
pat/riddle | https://github.com/pat/riddle/blob/748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43/lib/riddle/configuration/index.rb | lib/riddle/configuration/index.rb | # frozen_string_literal: true
module Riddle
class Configuration
class Index < Riddle::Configuration::Section
include Riddle::Configuration::IndexSettings
def self.settings
Riddle::Configuration::IndexSettings.settings + [:source]
end
attr_accessor :parent, :sources
def in... | ruby | MIT | 748ca04d14a9c04b7a5f2d64dbcd4897c1ab3f43 | 2026-01-04T17:45:28.600554Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.