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
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/observing_spec.rb
Ruby
mit
88
master
3,881
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::Observing do include Elastictastic::TestHelpers let(:id) { '123' } let(:post) { Post.new } let(:persisted_post) do Post.new.tap do |post| post.elasticsearch_hit = { '_id' => id, '_index' => 'default' } end end befo...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/multi_search_spec.rb
Ruby
mit
88
master
4,612
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::MultiSearch do include Elastictastic::TestHelpers let(:request_components) do [].tap do |components| FakeWeb.last_request.body.each_line do |line| components << Elastictastic.json_decode(line) unless line.strip.empty? ...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/mass_assignment_security_spec.rb
Ruby
mit
88
master
354
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::MassAssignmentSecurity do let(:post) { Post.new(:title => 'hey guy', :comments_count => 3) } it 'should allow allowed attributes' do post.title.should == 'hey guy' end it 'should not allow forbidden attributes' do post.comme...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/parent_child_spec.rb
Ruby
mit
88
master
10,345
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::ParentChild do include Elastictastic::TestHelpers describe 'mappings' do it 'should put _parent in mapping' do Post.mapping['post']['_parent'].should == { 'type' => 'blog' } end end describe 'child instance' do let...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/bulk_persistence_strategy_spec.rb
Ruby
mit
88
master
12,945
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::BulkPersistenceStrategy do include Elastictastic::TestHelpers let(:last_request) { FakeWeb.last_request } let(:bulk_requests) do last_request.body.split("\n").map do |request| Elastictastic.json_decode(request) end end ...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/scope_spec.rb
Ruby
mit
88
master
16,799
require File.expand_path('../spec_helper', __FILE__) # This spec describes the behavior of Elastictastic when interacting with # ElasticSearch to perform searches and related lookups. For behavior relating # to the construction of search scopes, see spec/examples/search_spec describe Elastictastic::Scope do include ...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/middleware_spec.rb
Ruby
mit
88
master
2,145
require File.expand_path('../spec_helper', __FILE__) require 'stringio' describe Elastictastic::Middleware::LogRequests do include Elastictastic::TestHelpers let(:io) { StringIO.new } let(:logger) { Logger.new(io) } let(:config) do Elastictastic::Configuration.new.tap do |config| config.logger = log...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/rotor_spec.rb
Ruby
mit
88
master
4,674
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::Rotor do let(:client) { Elastictastic::Client.new(config) } let(:last_request) { FakeWeb.last_request } context 'without backoff' do let(:config) do Elastictastic::Configuration.new.tap do |config| config.hosts = ['ht...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/multi_get_spec.rb
Ruby
mit
88
master
4,076
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::MultiGet do include Elastictastic::TestHelpers let(:last_request_body) { Elastictastic.json_decode(last_request.body) } before do stub_es_mget( nil, nil, ['1', 'post', 'default'], ['2', 'post', 'my_index'], ['3',...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/validation_spec.rb
Ruby
mit
88
master
1,711
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::Validations do include Elastictastic::TestHelpers let(:post) { Post.new(:title => 'INVALID') } describe 'with invalid data' do it 'should not be valid' do post.should_not be_valid end it 'should not persist to Elast...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/spec_helper.rb
Ruby
mit
88
master
339
require File.expand_path('../../environment', __FILE__) require 'fakeweb' require File.expand_path('../../support/fakeweb_request_history', __FILE__) RSpec.configure do |config| config.before(:all) do FakeWeb.allow_net_connect = false end config.after(:each) do FakeWeb.requests.clear FakeWeb.clean_...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/optimistic_locking_spec.rb
Ruby
mit
88
master
17,922
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::OptimisticLocking do include Elastictastic::TestHelpers shared_examples_for 'updatable scope' do let :post do scope.new.tap do |post| post.id = '123abc' post.version = 1 post.persisted! end end...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/callbacks_spec.rb
Ruby
mit
88
master
3,572
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::Callbacks do include Elastictastic::TestHelpers let(:MyModel) do Class.new do def self.name 'MyModel' end include Elastictastic::Document before_save :before_save_ran! before_create :before_cre...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/properties_spec.rb
Ruby
mit
88
master
3,934
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::Properties do describe '::mapping' do let(:mapping) { Post.mapping } let(:properties) { mapping['post']['properties'] } it 'should set basic field' do properties.should have_key('title') end it 'should default ty...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/document_spec.rb
Ruby
mit
88
master
19,883
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::Document do include Elastictastic::TestHelpers let(:last_request) { FakeWeb.last_request } let(:last_request_body) { Elastictastic.json_decode(last_request.body) } describe '#save' do context 'new object' do let!(:id) { st...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/search_spec.rb
Ruby
mit
88
master
13,414
require File.expand_path('../spec_helper', __FILE__) # # Here we describe the functionality for constructing queries, which is (sort of) # what the Search module does. See spec/examples/scope_spec to test running the # search and dealing with the results # describe Elastictastic::Search do include Elastictastic::Tes...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/examples/dirty_spec.rb
Ruby
mit
88
master
9,563
require File.expand_path('../spec_helper', __FILE__) describe Elastictastic::Dirty do include Elastictastic::TestHelpers let(:post) do Post.new.tap do |post| post.elasticsearch_hit = { '_id' => '1', '_type' => 'post', '_index' => 'default', '_source' => source } ...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/models/post_observer.rb
Ruby
mit
88
master
326
class PostObserver < Elastictastic::Observer %w(create update save destroy).each do |lifecycle| %w(before after).each do |phase| module_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{phase}_#{lifecycle}(post) post.observers_that_ran << :#{phase}_#{lifecycle} end RUBY end en...
github
brewster/elastictastic
https://github.com/brewster/elastictastic
spec/models/post.rb
Ruby
mit
88
master
816
class Post include Elastictastic::Document field :title field :comments_count, :type => 'integer' field :score, :type => 'integer' field :tags, :index => 'analyzed' do field :non_analyzed, :index => 'not_analyzed' end field :created_at, :type => 'date' field :published_at, :type => 'date' embed ...
github
crohr/rest-client-components
https://github.com/crohr/rest-client-components
rest-client-components.gemspec
Ruby
mit
88
master
1,987
Gem::Specification.new do |s| s.name = "rest-client-components" s.version = "1.5.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Cyril Rohr"] s.date = "2015-04-03" s.description = "RestClient on steroids ! ...
github
crohr/rest-client-components
https://github.com/crohr/rest-client-components
Rakefile
Ruby
mit
88
master
1,343
require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |s| s.name = "rest-client-components" s.summary = %Q{RestClient on steroids ! Easily add one or more Rack middleware around RestClient to add functionalities such as transparent caching (Rack::Cache), transparent logging, etc.} s.email = "cyr...
github
crohr/rest-client-components
https://github.com/crohr/rest-client-components
spec/components_spec.rb
Ruby
mit
88
master
12,124
require File.dirname(__FILE__) + '/spec_helper' require File.dirname(__FILE__) + '/../lib/restclient/components' require 'logger' require 'rack/cache' require 'time' describe "Components for RestClient" do before(:each) do RestClient.reset end it "should automatically have the Compatibility component enabl...
github
crohr/rest-client-components
https://github.com/crohr/rest-client-components
examples/parsing.rb
Ruby
mit
88
master
829
# In this example, we automatically parse the response body if the Content-Type looks like JSON require File.dirname(__FILE__) + '/../lib/restclient/components' require 'json' module Rack class JSON def initialize app @app = app end def call(env) status, header, body = @app.call env ...
github
crohr/rest-client-components
https://github.com/crohr/rest-client-components
examples/beautify_html.rb
Ruby
mit
88
master
423
# this examples uses Rack::Tidy to automatically tidy the HTML responses returned require File.dirname(__FILE__) + '/../lib/restclient/components' require 'rack/tidy' # gem install rack-tidy URL = "http://coderack.org/users/webficient/entries/38-racktidy" puts "Without rack-tidy" response = RestClient.get URL puts res...
github
crohr/rest-client-components
https://github.com/crohr/rest-client-components
examples/caching.rb
Ruby
mit
88
master
3,975
require 'restclient/components' require 'rack/cache' require 'json' require 'logger' require 'time' require 'digest/sha1' require 'sinatra/base' def server(base=Sinatra::Base, &block) app = Sinatra.new(base, &block) pid = fork do app.run!(:port => 7890, :host => "localhost") end pid end pid = server do...
github
crohr/rest-client-components
https://github.com/crohr/rest-client-components
lib/restclient/components.rb
Ruby
mit
88
master
7,080
require 'restclient' require 'rack' module RestClient module Rack class Compatibility def initialize(app) @app = app end def call(env) status, header, body = @app.call(env) net_http_response = RestClient::MockNetHTTPResponse.new(body, status, header) content = "...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
Rakefile
Ruby
mit
88
master
206
# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'rubocop/rake_task' RSpec::Core::RakeTask.new(:spec) RuboCop::RakeTask.new task default: %i[spec rubocop]
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
llm-docs-builder.gemspec
Ruby
mit
88
master
2,108
# frozen_string_literal: true require_relative 'lib/llm_docs_builder/version' Gem::Specification.new do |spec| spec.name = 'llm-docs-builder' spec.version = LlmDocsBuilder::VERSION spec.authors = ['Maciej Mensfeld'] spec.email = %w[maciej@mensfeld.pl] spec.summary = 'Build and optimize documentation for LL...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/token_estimator_spec.rb
Ruby
mit
88
master
2,185
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::TokenEstimator do describe '#estimate' do let(:estimator) { described_class.new } it 'estimates tokens using 4 characters per token heuristic' do content = 'test' * 100 # 400 characters expected_tokens = (400 / 4.0).round # 100 tokens ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/llm_docs_builder_spec.rb
Ruby
mit
88
master
13,797
# frozen_string_literal: true RSpec.describe LlmDocsBuilder do it 'has a version number' do expect(LlmDocsBuilder::VERSION).not_to be nil end describe '.generate_from_docs' do let(:temp_dir) { Dir.mktmpdir } before do # Create sample markdown files File.write(File.join(temp_dir, 'README...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/generator_spec.rb
Ruby
mit
88
master
25,167
# frozen_string_literal: true require 'llm_docs_builder/generator' require 'tempfile' require 'fileutils' RSpec.describe LlmDocsBuilder::Generator do let(:temp_dir) { Dir.mktmpdir } let(:generator) { described_class.new(temp_dir) } after do FileUtils.rm_rf(temp_dir) end describe '#initialize' do i...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/validator_spec.rb
Ruby
mit
88
master
2,165
# frozen_string_literal: true require 'llm_docs_builder/validator' RSpec.describe LlmDocsBuilder::Validator do describe 'edge cases' do it 'detects title that is too long' do content = "# #{'A' * 90}\n\nContent here" validator = described_class.new(content) expect(validator.valid?).to be fals...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/text_compressor_spec.rb
Ruby
mit
88
master
7,076
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::TextCompressor do subject(:compressor) { described_class.new } describe '#compress' do context 'with remove_stopwords option' do it 'removes common stopwords from prose' do content = 'This is a simple guide to the API. The API provides...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/bulk_transformer_spec.rb
Ruby
mit
88
master
6,064
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::BulkTransformer do let(:temp_dir) { Dir.mktmpdir } before do # Create nested directory structure with markdown files FileUtils.mkdir_p(File.join(temp_dir, 'docs', 'api')) FileUtils.mkdir_p(File.join(temp_dir, 'guides')) # Main README ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/parser_spec.rb
Ruby
mit
88
master
5,677
# frozen_string_literal: true require 'llm_docs_builder/parser' require 'tempfile' require 'fileutils' RSpec.describe LlmDocsBuilder::Parser do let(:temp_file) { Tempfile.new(['llms', '.txt']) } after do temp_file.close temp_file.unlink end describe '#parse' do it 'parses basic llms.txt with tit...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/config_spec.rb
Ruby
mit
88
master
3,931
# frozen_string_literal: true require 'llm_docs_builder/config' require 'tempfile' require 'yaml' RSpec.describe LlmDocsBuilder::Config do describe '#dig' do it 'accesses nested configuration values' do config_file = Tempfile.new(['config', '.yml']) config_file.write(YAML.dump({ 'nested' => { 'key' ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/markdown_transformer_html_spec.rb
Ruby
mit
88
master
5,360
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::MarkdownTransformer do describe '#transform' do it 'normalises remote HTML content into markdown before applying other transformers' do html = <<~HTML <!doctype html> <html> <body> <h2>Subscriptions</h2> ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/html_to_markdown_converter_spec.rb
Ruby
mit
88
master
24,639
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::HtmlToMarkdownConverter do subject(:converter) { described_class.new } describe '#convert' do it 'converts common HTML elements into markdown' do html = <<~HTML <html> <body> <h1>Sample Title</h1> <p>T...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/output_formatter_spec.rb
Ruby
mit
88
master
5,232
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::OutputFormatter do describe '.format_bytes' do it 'formats bytes when less than 1 KB' do expect(described_class.format_bytes(512)).to eq('512 bytes') end it 'formats kilobytes when less than 1 MB' do expect(described_class.format_b...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/url_fetcher_spec.rb
Ruby
mit
88
master
5,344
# frozen_string_literal: true require 'llm_docs_builder/url_fetcher' RSpec.describe LlmDocsBuilder::UrlFetcher do let(:user_agent) { 'Test-Agent/1.0' } describe '#fetch' do it 'configures HTTP client with SSL for HTTPS URLs' do http = instance_double(Net::HTTP) expect(Net::HTTP).to receive(:new)....
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/comparator_spec.rb
Ruby
mit
88
master
10,170
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::Comparator do let(:url) { 'https://example.com/docs/page.html' } let(:human_content) { "<html><body>#{'x' * 1000}</body></html>" } let(:ai_content) { 'x' * 500 } describe '#compare' do context 'when comparing remote versions with different User-...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/cli_spec.rb
Ruby
mit
88
master
19,202
# frozen_string_literal: true require 'llm_docs_builder/cli' RSpec.describe LlmDocsBuilder::CLI do describe '.run class method' do it 'creates instance and calls run' do expect_any_instance_of(described_class).to receive(:run).with(['version']) described_class.run(['version']) end end descr...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/spec_helper.rb
Ruby
mit
88
master
870
# frozen_string_literal: true require 'bundler/setup' require 'llm_docs_builder' require 'simplecov' require 'tempfile' require 'tmpdir' require 'open3' require 'fileutils' SimpleCov.start do add_filter '/spec/' enable_coverage :branch primary_coverage :line end unless ENV['SIMPLECOV'] == 'false' RSpec.configu...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/transformers/base_transformer_spec.rb
Ruby
mit
88
master
846
# frozen_string_literal: true require 'llm_docs_builder/transformers/base_transformer' RSpec.describe LlmDocsBuilder::Transformers::BaseTransformer do # Create a test class that includes the module let(:test_class) do Class.new do include LlmDocsBuilder::Transformers::BaseTransformer end end le...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/transformers/whitespace_transformer_spec.rb
Ruby
mit
88
master
4,338
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::Transformers::WhitespaceTransformer do subject(:transformer) { described_class.new } describe '#transform' do context 'with normalize_whitespace option' do it 'removes trailing whitespace from lines' do content = "Line 1 \nLine 2 \n...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/transformers/content_cleanup_transformer_spec.rb
Ruby
mit
88
master
8,035
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::Transformers::ContentCleanupTransformer do subject(:transformer) { described_class.new } describe '#transform' do context 'with remove_frontmatter option' do it 'removes YAML frontmatter' do content = <<~MD --- layo...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/transformers/link_transformer_spec.rb
Ruby
mit
88
master
5,930
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::Transformers::LinkTransformer do subject(:transformer) { described_class.new } describe '#transform' do let(:content) do <<~MD # Documentation Check out [the guide](./guide.md) for more info. Visit [our website](https:...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/transformers/heading_transformer_spec.rb
Ruby
mit
88
master
9,063
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::Transformers::HeadingTransformer do subject(:transformer) { described_class.new } describe '#transform' do context 'when normalize_headings is false' do let(:options) { { normalize_headings: false } } it 'returns content unchanged' do ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/transformers/enhancement_transformer_spec.rb
Ruby
mit
88
master
7,188
# frozen_string_literal: true RSpec.describe LlmDocsBuilder::Transformers::EnhancementTransformer do subject(:transformer) { described_class.new } describe '#transform' do context 'with generate_toc option' do it 'generates table of contents from headings' do content = <<~MD # Main Tit...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/compression_features_spec.rb
Ruby
mit
88
master
6,742
# frozen_string_literal: true RSpec.describe 'Compression Features Integration' do let(:temp_dir) { Dir.mktmpdir } let(:test_file) { File.join(temp_dir, 'test.md') } after do FileUtils.rm_rf(temp_dir) end describe 'Token Optimization Features' do let(:sample_content) do <<~MD --- ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/comparator_network_spec.rb
Ruby
mit
88
master
1,322
# frozen_string_literal: true require 'llm_docs_builder' RSpec.describe 'Comparator Network Integration' do it 'fetches and compares real documentation from Karafka', :network do comparator = LlmDocsBuilder::Comparator.new('https://karafka.io/docs/') result = comparator.compare # Basic result structur...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/bulk_transform_command_spec.rb
Ruby
mit
88
master
2,421
# frozen_string_literal: true RSpec.describe 'bulk-transform command' do let(:cli_path) { File.expand_path('../../bin/llm-docs-builder', __dir__) } let(:temp_dir) { Dir.mktmpdir } after do FileUtils.rm_rf(temp_dir) end def run_cli(*args) cmd = "bundle exec #{cli_path} #{args.join(' ')}" stdout,...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/version_command_spec.rb
Ruby
mit
88
master
765
# frozen_string_literal: true RSpec.describe 'version command' do let(:cli_path) { File.expand_path('../../bin/llm-docs-builder', __dir__) } def run_cli(*args) cmd = "bundle exec #{cli_path} #{args.join(' ')}" stdout, stderr, status = Open3.capture3(cmd) [stdout, stderr, status] end it 'displays ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/parse_command_spec.rb
Ruby
mit
88
master
1,399
# frozen_string_literal: true RSpec.describe 'parse command' do let(:cli_path) { File.expand_path('../../bin/llm-docs-builder', __dir__) } let(:temp_dir) { Dir.mktmpdir } after do FileUtils.rm_rf(temp_dir) end def run_cli(*args) cmd = "bundle exec #{cli_path} #{args.join(' ')}" stdout, stderr, ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/validate_command_spec.rb
Ruby
mit
88
master
1,409
# frozen_string_literal: true RSpec.describe 'validate command' do let(:cli_path) { File.expand_path('../../bin/llm-docs-builder', __dir__) } let(:temp_dir) { Dir.mktmpdir } after do FileUtils.rm_rf(temp_dir) end def run_cli(*args) cmd = "bundle exec #{cli_path} #{args.join(' ')}" stdout, stder...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/transform_command_spec.rb
Ruby
mit
88
master
1,901
# frozen_string_literal: true RSpec.describe 'transform command' do let(:cli_path) { File.expand_path('../../bin/llm-docs-builder', __dir__) } let(:temp_dir) { Dir.mktmpdir } after do FileUtils.rm_rf(temp_dir) end def run_cli(*args) cmd = "bundle exec #{cli_path} #{args.join(' ')}" stdout, stde...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
spec/integrations/generate_command_spec.rb
Ruby
mit
88
master
15,847
# frozen_string_literal: true RSpec.describe 'generate command' do let(:cli_path) { File.expand_path('../../bin/llm-docs-builder', __dir__) } let(:temp_dir) { Dir.mktmpdir } after do FileUtils.rm_rf(temp_dir) end def run_cli(*args) cmd = "bundle exec #{cli_path} #{args.join(' ')}" stdout, stder...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder.rb
Ruby
mit
88
master
5,729
# frozen_string_literal: true require 'zeitwerk' require 'pathname' require 'find' autoload(:Nokogiri, 'nokogiri') autoload(:CGI, 'cgi') loader = Zeitwerk::Loader.for_gem loader.inflector.inflect('cli' => 'CLI') loader.setup # Build and optimize documentation for LLMs # # This gem provides tools for generating llms...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/parser.rb
Ruby
mit
88
master
5,383
# frozen_string_literal: true module LlmDocsBuilder # Parses llms.txt files into structured data # # Reads and parses llms.txt files according to the llms.txt specification, # extracting the title, description, and structured sections (Documentation, # Examples, Optional) with their links. # # @example P...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/bulk_transformer.rb
Ruby
mit
88
master
4,268
# frozen_string_literal: true require 'fileutils' module LlmDocsBuilder # Bulk transforms multiple markdown files to be AI-friendly # # Processes all markdown files in a directory recursively, creating LLM-friendly versions # alongside the originals. Supports exclusion patterns and maintains directory structu...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/text_compressor.rb
Ruby
mit
88
master
5,683
# frozen_string_literal: true module LlmDocsBuilder # Advanced text compression techniques for reducing token count # # Provides more aggressive text compression methods including stopword removal, # duplicate content detection, and sentence deduplication. These methods are more # aggressive than basic markd...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/token_estimator.rb
Ruby
mit
88
master
1,858
# frozen_string_literal: true module LlmDocsBuilder # Estimates token count for text content using character-based approximation # # Provides token estimation without requiring external tokenizer dependencies. # Uses the common heuristic that ~4 characters equals 1 token for English text, # which works reaso...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/markdown_transformer.rb
Ruby
mit
88
master
5,587
# frozen_string_literal: true module LlmDocsBuilder # Transforms markdown files to be AI-friendly # # Orchestrates a pipeline of specialized transformers to process markdown content. # Each transformer is responsible for a specific aspect of the transformation. # # @example Transform with base URL # tr...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/html_to_markdown_converter.rb
Ruby
mit
88
master
24,745
# frozen_string_literal: true module LlmDocsBuilder # A lightweight HTML → Markdown converter using only Nokogiri's public API. # # Design goals: # - Traverse with Nokogiri and keep logic small, readable, and predictable # - Preserve the existing public behavior covered by specs # - Convert tables into Mar...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/config.rb
Ruby
mit
88
master
11,577
# frozen_string_literal: true require 'yaml' module LlmDocsBuilder # Simple configuration loader for llm-docs-builder.yml files # # Loads YAML configuration files and provides a simple interface for accessing configuration # values. Automatically looks for config files in the current directory if none specifi...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/cli.rb
Ruby
mit
88
master
14,702
# frozen_string_literal: true require 'optparse' module LlmDocsBuilder # Command-line interface for llms-txt gem # # Provides commands for generating, transforming, parsing, and validating llms.txt files. # All file paths must be specified using flags (-d/--docs) for consistency. # # @example Run the CLI ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/validator.rb
Ruby
mit
88
master
6,667
# frozen_string_literal: true module LlmDocsBuilder # Validates llms.txt content against the llms.txt specification # # Ensures that llms.txt content follows proper formatting rules including: # - Required H1 title header # - Optional description blockquote # - Proper section ordering (Documentation, Examp...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/generator.rb
Ruby
mit
88
master
14,249
# frozen_string_literal: true module LlmDocsBuilder # Simple generator that creates llms.txt from existing markdown documentation # # Takes a documentation directory or file and generates a properly formatted llms.txt file by # analyzing markdown files, extracting titles and descriptions, and organizing them b...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/comparator.rb
Ruby
mit
88
master
6,562
# frozen_string_literal: true module LlmDocsBuilder # Compares content sizes between human and AI versions # # Helps quantify context window savings by comparing: # - Remote URL with different User-Agents (human vs AI bot) # - Remote URL with local markdown file # # @example Compare remote versions # ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/url_fetcher.rb
Ruby
mit
88
master
4,124
# frozen_string_literal: true require 'net/http' require 'uri' module LlmDocsBuilder # Lightweight HTTP client for fetching remote documentation pages. # # Provides common functionality needed by multiple commands (transform, compare) # including strict scheme validation, redirect handling and sensible timeou...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/output_formatter.rb
Ruby
mit
88
master
5,278
# frozen_string_literal: true module LlmDocsBuilder # Formats output for CLI display # # Provides formatting utilities for displaying comparison results, # byte sizes, and numbers in a user-friendly way. # # @api private class OutputFormatter # Threshold percentage below which we consider there's no ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/helpers.rb
Ruby
mit
88
master
207
# frozen_string_literal: true module LlmDocsBuilder module Helpers end end require_relative 'helpers/squeeze_blank_lines_outside_fences' require_relative 'helpers/prune_trailing_unsafe_link_separator'
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/html_detector.rb
Ruby
mit
88
master
5,032
# frozen_string_literal: true module LlmDocsBuilder # Detects whether input should be treated as HTML and related snippet checks class HtmlDetector # Detect if loaded content is HTML instead of markdown # # @param content [String] raw content # @param snippet [String, nil] optional precomputed snip...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/errors.rb
Ruby
mit
88
master
1,244
# frozen_string_literal: true module LlmDocsBuilder # Namespace used to encapsulate all the internal errors of LlmDocsBuilder module Errors # Base class for all the LlmDocsBuilder internal errors BaseError = Class.new(StandardError) # Raised when llms.txt generation fails due to configuration issues, ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/transformers/content_cleanup_transformer.rb
Ruby
mit
88
master
3,792
# frozen_string_literal: true module LlmDocsBuilder module Transformers # Transformer for content cleanup operations # # Handles removal of various markdown elements that don't provide # value for LLM consumption (frontmatter, comments, badges, etc.). # # @api public class ContentCleanupT...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/transformers/heading_transformer.rb
Ruby
mit
88
master
2,787
# frozen_string_literal: true module LlmDocsBuilder module Transformers # Normalizes headings to include hierarchical context # # Transforms markdown headings to include parent context, making each section # self-contained for RAG systems. This is particularly useful when documents # are chunked ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/transformers/base_transformer.rb
Ruby
mit
88
master
1,643
# frozen_string_literal: true module LlmDocsBuilder # Provides content transformation functionality # # This module contains specialized transformers for modifying markdown content, # including cleanup operations, link processing, heading normalization, and # content enhancement for AI consumption. # # @...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/transformers/enhancement_transformer.rb
Ruby
mit
88
master
3,231
# frozen_string_literal: true module LlmDocsBuilder module Transformers # Transformer for document enhancements # # Adds helpful features like table of contents and custom instructions # to improve LLM navigation and context understanding. # # @api public class EnhancementTransformer ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/transformers/whitespace_transformer.rb
Ruby
mit
88
master
1,290
# frozen_string_literal: true module LlmDocsBuilder module Transformers # Transformer for whitespace normalization # # Reduces excessive blank lines and trailing whitespace to make # content more compact for LLM consumption. # # @api public class WhitespaceTransformer include BaseTr...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/transformers/link_transformer.rb
Ruby
mit
88
master
2,724
# frozen_string_literal: true module LlmDocsBuilder module Transformers # Transformer for link-related operations # # Handles expansion of relative links to absolute URLs and # conversion of HTML URLs to markdown format. # # @api public class LinkTransformer include BaseTransformer ...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/helpers/squeeze_blank_lines_outside_fences.rb
Ruby
mit
88
master
2,333
# frozen_string_literal: true module LlmDocsBuilder module Helpers # Reduces consecutive blank lines outside of code fences # # @param text [String] input text to process # @param max_blank [Integer] maximum number of consecutive blank lines to allow # @param fence_chars [Array<String>] character...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/helpers/prune_trailing_unsafe_link_separator.rb
Ruby
mit
88
master
778
# frozen_string_literal: true module LlmDocsBuilder # Helper methods for content transformation # # @api private module Helpers # Removes trailing pipe characters and whitespace from array of string parts # # @param parts [Array<String>] array of string parts to process # @return [void] def...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/html_to_markdown/table_markup_renderer.rb
Ruby
mit
88
master
19,947
# frozen_string_literal: true module LlmDocsBuilder module HtmlToMarkdown # Handles conversion of HTML table markup to Markdown table format class TableMarkupRenderer # Initialize a new table markup renderer # # @param inline_collapser [Proc] callable for collapsing inline content # @...
github
mensfeld/llm-docs-builder
https://github.com/mensfeld/llm-docs-builder
lib/llm_docs_builder/html_to_markdown/figure_code_block_renderer.rb
Ruby
mit
88
master
6,241
# frozen_string_literal: true module LlmDocsBuilder # Provides HTML to Markdown conversion functionality # # This module contains specialized renderers for converting HTML elements # to Markdown format, with support for complex structures like tables, # figures, and syntax-highlighted code blocks. # # @a...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
wasabi.gemspec
Ruby
mit
88
main
1,040
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "wasabi/version" Gem::Specification.new do |s| s.name = "wasabi" s.version = Wasabi::VERSION s.authors = ["Daniel Harrington"] s.email = ["me@rubiii.com"] s.homepage = "https://github.com/savonrb/#{s.name}"...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
Gemfile
Ruby
mit
88
main
332
# frozen_string_literal: true source 'https://rubygems.org' gemspec gem 'faraday', ENV['FARADAY_VERSION'] || '~> 2.8' gem 'httpi' gem 'rake', '~> 13.0' gem 'rspec', '~> 3.7.0' gem 'coveralls', '~> 0.8', require: false gem 'method_profiler', require: false gem 'simplecov', require: false gem 'rubocop-packaging', req...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/spec_helper.rb
Ruby
mit
88
main
354
# frozen_string_literal: true require "bundler" Bundler.require :default, :development unless RUBY_PLATFORM =~ /java/ require "simplecov" require "coveralls" Coveralls.wear! end support_files = File.expand_path("spec/support/**/*.rb") Dir[support_files].each { |file| require file } RSpec.configure do |config|...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/resolver_spec.rb
Ruby
mit
88
main
2,210
# frozen_string_literal: true require "spec_helper" describe Wasabi::Resolver do describe "#resolve" do # TODO: remove_after_httpi context "HTTPI" do it "resolves remote documents" do expect(HTTPI).to receive(:get) { HTTPI::Response.new(200, {}, "wsdl") } xml = Wasabi::Resolver.new("h...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document_spec.rb
Ruby
mit
88
main
1,889
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do subject { Wasabi::Document.new fixture(:authentication).read } it "accepts a URL" do path = 'http://example.com?wsdl' stubs = Faraday::Adapter::Test::Stubs.new stubs.get(path) do [200, {'Content-Type': 'applicatio...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/wasabi_spec.rb
Ruby
mit
88
main
280
# frozen_string_literal: true require "spec_helper" describe Wasabi do describe ".document" do it "should return a new Wasabi::Document" do document = Wasabi.document fixture(:authentication).read expect(document).to be_a(Wasabi::Document) end end end
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/rpc_spec.rb
Ruby
mit
88
main
608
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: rpc_operation.wsdl" do subject { Wasabi::Document.new(fixture(:rpc_operation).read) } describe "#operations" do subject { super().operations } it do should include( { e...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/soap12_spec.rb
Ruby
mit
88
main
328
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: soap12.wsdl" do subject { Wasabi::Document.new fixture(:soap12).read } describe '#endpoint' do subject { super().endpoint } it { should == URI("http://blogsite.example.com/endpoint12") } end ...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/encoded_endpoint_spec.rb
Ruby
mit
88
main
396
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: encoded_endpoint.wsdl" do subject { Wasabi::Document.new fixture(:encoded_endpoint).read } describe '#endpoint' do subject { super().endpoint } it { is_expected.to eq URI("http://localhost/soapservi...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/inherited_spec.rb
Ruby
mit
88
main
1,694
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: inherited.xml" do subject { Wasabi::Document.new fixture(:inherited).read } describe '#type_definitions' do subject { super().type_definitions } it do should include([["Account", "Id"], "ID"])...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/namespaced_actions_spec.rb
Ruby
mit
88
main
1,611
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: namespaced_actions.wsdl" do subject { Wasabi::Document.new fixture(:namespaced_actions).read } describe '#namespace' do subject { super().namespace } it { should == "http://api.example.com/api/" } ...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/authentication_spec.rb
Ruby
mit
88
main
985
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: authentication.wsdl" do subject { Wasabi::Document.new fixture(:authentication).read } describe '#namespace' do subject { super().namespace } it { should == "http://v1_0.ws.auth.order.example.com/" ...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/two_bindings_spec.rb
Ruby
mit
88
main
763
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: two_bindings.wsdl" do subject { Wasabi::Document.new fixture(:two_bindings).read } describe '#element_form_default' do subject { super().element_form_default } it { should == :unqualified } end ...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/geotrust_spec.rb
Ruby
mit
88
main
1,631
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: geotrust.wsdl" do let(:document) { Wasabi::Document.new(fixture(:geotrust).read) } describe '#namespace' do subject { document.namespace } it { should eq "http://api.geotrust.com/webtrust/query" } ...
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/economic_spec.rb
Ruby
mit
88
main
304
# frozen_string_literal: true require 'spec_helper' describe Wasabi::Document do context 'with: economic.wsdl' do subject { Wasabi::Document.new fixture(:economic).read } it 'has an ok parse-time for huge wsdl files' do expect(subject.operations.count).to eq(1511) end end end
github
savonrb/wasabi
https://github.com/savonrb/wasabi
spec/wasabi/document/multiple_namespaces_spec.rb
Ruby
mit
88
main
1,677
# frozen_string_literal: true require "spec_helper" describe Wasabi::Document do context "with: multiple_namespaces.wsdl" do subject { Wasabi::Document.new fixture(:multiple_namespaces).read } describe '#namespace' do subject { super().namespace } it { is_expected.to eq "http://example.com/act...