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
jekyll/jekyll
https://github.com/jekyll/jekyll
Gemfile
Ruby
mit
51,392
master
3,126
# frozen_string_literal: true source "https://rubygems.org" gemspec :name => "jekyll" gem "rake", "~> 13.0" group :development do gem "launchy", "~> 2.3" gem "pry" gem "pry-byebug" unless RUBY_ENGINE == "jruby" end # group :test do gem "activesupport", "< 7.1.0" gem "cucumber", "~> 9.0" gem "httpclien...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
Rakefile
Ruby
mit
51,392
master
4,383
# frozen_string_literal: true require "rubygems" require "rake" require "rdoc" require "date" require "yaml" $LOAD_PATH.unshift File.expand_path("lib", __dir__) require "jekyll/version" require "bundler/gem_tasks" Dir.glob("rake/**.rake").each { |f| import f } #######################################################...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
jekyll.gemspec
Ruby
mit
51,392
master
2,465
# frozen_string_literal: true require "English" require_relative "lib/jekyll/version" Gem::Specification.new do |s| s.name = "jekyll" s.version = Jekyll::VERSION s.license = "MIT" s.authors = ["Tom Preston-Werner", "Parker Moore", "Matt Rogers"] s.email = ["maintainers@jek...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_kramdown.rb
Ruby
mit
51,392
master
6,443
# frozen_string_literal: true require "helper" require "rouge" class TestKramdown < JekyllUnitTest def fixture_converter(config) site = fixture_site( Utils.deep_merge_hashes( { "markdown" => "kramdown", }, config ) ) Jekyll::Cache.clear site.find_convert...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_publisher.rb
Ruby
mit
51,392
master
1,217
# frozen_string_literal: true require "helper" class TestPublisher < JekyllUnitTest context "default configuration" do setup do site = fixture_site collection = Jekyll::Collection.new(site, "methods") @thing = Jekyll::Document.new( source_dir("methods/method.md"), :site =...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_excerpt_drop.rb
Ruby
mit
51,392
master
1,203
# frozen_string_literal: true require "helper" class TestExcerptDrop < JekyllUnitTest context "an excerpt drop" do setup do @site = fixture_site @site.read @doc = @site.docs_to_write.find { |d| !d.data["layout"].nil? } @doc_drop = @doc.to_liquid @excerpt = @doc.data["excerpt"] ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_layout_reader.rb
Ruby
mit
51,392
master
2,598
# frozen_string_literal: true require "helper" class TestLayoutReader < JekyllUnitTest context "reading layouts" do setup do config = Jekyll::Configuration::DEFAULTS.merge("source" => source_dir, "destination" => dest_dir) @site = fixture_sit...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_site_drop.rb
Ruby
mit
51,392
master
470
# frozen_string_literal: true require "helper" class TestSiteDrop < JekyllUnitTest context "a site drop" do setup do @site = fixture_site( "collections" => ["thanksgiving"] ) @site.process @drop = @site.to_liquid.site end should "respond to `key?`" do assert_respon...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_document.rb
Ruby
mit
51,392
master
20,078
# frozen_string_literal: true require "helper" class TestDocument < JekyllUnitTest def assert_equal_value(key, one, other) assert_equal(one[key], other[key]) end def setup_encoded_document(filename) site = fixture_site("collections" => ["encodings"]) site.process Document.new(site.in_source_dir...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_path_manager.rb
Ruby
mit
51,392
master
1,150
# frozen_string_literal: true require "helper" class TestPathManager < JekyllUnitTest context "PathManager" do setup do @source = Dir.pwd end should "return frozen copy of base if questionable path is nil" do assert_equal @source, Jekyll::PathManager.sanitized_path(@source, nil) asser...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_page_without_a_file.rb
Ruby
mit
51,392
master
5,517
# frozen_string_literal: true require "helper" class TestPageWithoutAFile < JekyllUnitTest def setup_page(*args, base: source_dir, klass: PageWithoutAFile) dir, file = args if file.nil? file = dir dir = "" end klass.new(@site, base, dir, file) end def render_and_write @site.rend...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_commands_serve.rb
Ruby
mit
51,392
master
10,344
# frozen_string_literal: true require "webrick" require "mercenary" require "helper" require "httpclient" require "openssl" require "tmpdir" class TestCommandsServe < JekyllUnitTest def custom_opts(what) @cmd.send( :webrick_opts, what ) end def start_server(opts) @thread = Thread.new do ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_tag_include_relative.rb
Ruby
mit
51,392
master
3,719
# frozen_string_literal: true require "helper" class TestTagIncludeRelative < TagUnitTest context "include_relative tag with variable and liquid filters" do setup do site = fixture_site.tap do |s| s.read s.render end post = site.posts.docs.find do |p| p.basename.eql? "...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_tag_include.rb
Ruby
mit
51,392
master
8,408
# frozen_string_literal: true require "helper" class TestTagInclude < TagUnitTest context "include tag with parameters" do context "with symlink'd include" do should "not allow symlink includes" do FileUtils.mkdir_p("tmp") File.write("tmp/pages-test", "SYMLINK TEST") assert_raises ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_coffeescript.rb
Ruby
mit
51,392
master
1,315
# frozen_string_literal: true require "helper" class TestCoffeeScript < JekyllUnitTest context "converting CoffeeScript" do setup do External.require_with_graceful_fail("jekyll-coffeescript") @site = fixture_site @site.process @test_coffeescript_file = dest_dir("js/coffeescript.js") ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_regenerator.rb
Ruby
mit
51,392
master
9,843
# frozen_string_literal: true require "helper" class TestRegenerator < JekyllUnitTest context "The site regenerator" do setup do FileUtils.rm_rf(source_dir(".jekyll-metadata")) @site = fixture_site( "collections" => { "methods" => { "output" => true, }, ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_liquid_renderer.rb
Ruby
mit
51,392
master
1,761
# frozen_string_literal: true require "helper" class TestLiquidRenderer < JekyllUnitTest context "profiler" do setup do @site = Site.new(site_configuration) @renderer = @site.liquid_renderer end should "return a table with profiling results" do @site.process output = @renderer....
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_drop.rb
Ruby
mit
51,392
master
4,468
# frozen_string_literal: true require "helper" class DropFixture < Jekyll::Drops::Drop mutable true attr_accessor :lipsum def foo "bar" end def fallback_data @fallback_data ||= { "baz" => "buzz" } end end class TestDrop < JekyllUnitTest context "Drops" do setup do @site = fixture_s...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_log_adapter.rb
Ruby
mit
51,392
master
4,662
# frozen_string_literal: true require "helper" class TestLogAdapter < JekyllUnitTest class LoggerDouble attr_accessor :level def debug(*); end def info(*); end def warn(*); end def error(*); end end context "#log_level=" do should "set the writers logging level" do subject = J...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_win_tz.rb
Ruby
mit
51,392
master
1,011
# frozen_string_literal: true require "helper" class TestWinTz < JekyllUnitTest [["America/New_York", "WTZ+05:00"], ["Europe/Paris", "WTZ-01:00"]].each do |tz, expected| should "use base offset in winter for #{tz}" do result = Jekyll::Utils::WinTZ.calculate(tz, Time.utc(2021, 1, 1)) assert_equal exp...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_excerpt.rb
Ruby
mit
51,392
master
10,194
# frozen_string_literal: true require "helper" class TestExcerpt < JekyllUnitTest def setup_post(file) Document.new(@site.in_source_dir(File.join("_posts", file)), :site => @site, :collection => @site.posts).tap(&:read) end def do_render(document) @site.layouts =...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_filters.rb
Ruby
mit
51,392
master
53,556
# frozen_string_literal: true require "helper" class TestFilters < JekyllUnitTest class JekyllFilter include Jekyll::Filters attr_accessor :site, :context def initialize(opts = {}) @site = Jekyll::Site.new(opts.merge("skip_config_files" => true)) @context = Liquid::Context.new(@site.site_pa...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_data_reader.rb
Ruby
mit
51,392
master
1,574
# frozen_string_literal: true require "helper" class TestDataReader < JekyllUnitTest context "#sanitize_filename" do setup do @reader = DataReader.new(fixture_site) end should "remove evil characters" do assert_equal "helpwhathaveIdone", @reader.sanitize_filename( "help/what^&$^#*(!...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_collections.rb
Ruby
mit
51,392
master
10,354
# frozen_string_literal: true require "helper" class TestCollections < JekyllUnitTest context "an evil collection" do setup do @collection = Jekyll::Collection.new(fixture_site, "../../etc/password") end should "sanitize the label name" do assert_equal "....etcpassword", @collection.label ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_generated_site.rb
Ruby
mit
51,392
master
3,243
# frozen_string_literal: true require "helper" class TestGeneratedSite < JekyllUnitTest context "generated sites" do setup do clear_dest @site = fixture_site @site.process @index = File.read( dest_dir("index.html"), **Utils.merged_file_read_opts(@site, {}) ) en...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_convertible.rb
Ruby
mit
51,392
master
2,746
# frozen_string_literal: true require "helper" require "ostruct" class TestConvertible < JekyllUnitTest context "YAML front matter" do setup do @convertible = OpenStruct.new( "site" => Site.new(Jekyll.configuration( "source" => File.expand_path("fixtures", __dir__) ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_ansi.rb
Ruby
mit
51,392
master
554
# frozen_string_literal: true require "helper" class TestAnsi < JekyllUnitTest context nil do setup do @subject = Jekyll::Utils::Ansi end Jekyll::Utils::Ansi::COLORS.each_key do |color| should "respond_to? #{color}" do assert_respond_to(@subject, color) end end should...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_tag_post_url.rb
Ruby
mit
51,392
master
3,801
# frozen_string_literal: true require "helper" class TestTagPostUrl < TagUnitTest context "simple page with post linking" do setup do content = <<~CONTENT --- title: Post linking --- {% post_url 2008-11-21-complex %} CONTENT render_content(content, "permalink"...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_static_file.rb
Ruby
mit
51,392
master
6,097
# frozen_string_literal: true require "helper" class TestStaticFile < JekyllUnitTest def make_dummy_file(filename) File.write(source_dir(filename), "some content") end def modify_dummy_file(filename) string = "some content" offset = string.size File.write(source_dir(filename), "more content", o...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/helper.rb
Ruby
mit
51,392
master
8,164
# frozen_string_literal: true $stdout.puts "# -------------------------------------------------------------" $stdout.puts "# SPECS AND TESTS ARE RUNNING WITH WARNINGS OFF." $stdout.puts "# SEE: https://github.com/Shopify/liquid/issues/730" $stdout.puts "# SEE: https://github.com/jekyll/jekyll/issues/4719" $stdout.puts...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_doctor_command.rb
Ruby
mit
51,392
master
1,492
# frozen_string_literal: true require "helper" require "jekyll/commands/doctor" class TestDoctorCommand < JekyllUnitTest context "URLs only differ by case" do setup do clear_dest end should "return success on a valid site/page" do @site = Site.new(Jekyll.configuration( ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_tag_link.rb
Ruby
mit
51,392
master
5,048
# frozen_string_literal: true require "helper" class TestTagLink < TagUnitTest def render_content_with_collection(content, collection_label) render_content( content, "collections" => { collection_label => { "output" => true } }, "read_collections" => true ) end context "post cont...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_commands_serve_servlet.rb
Ruby
mit
51,392
master
1,241
# frozen_string_literal: true require "webrick" require "helper" require "net/http" class TestCommandsServeServlet < JekyllUnitTest def get(path) TestWEBrick.mount_server do |_server, addr, port| http = Net::HTTP.new(addr, port) req = Net::HTTP::Get.new(path) http.request(req) { |response| yi...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_front_matter_defaults.rb
Ruby
mit
51,392
master
6,172
# frozen_string_literal: true require "helper" class TestFrontMatterDefaults < JekyllUnitTest context "A site with full front matter defaults" do setup do @site = fixture_site( "defaults" => [{ "scope" => { "path" => "contacts", "type" => "page", }, ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_plugin_manager.rb
Ruby
mit
51,392
master
5,789
# frozen_string_literal: true require "helper" class TestPluginManager < JekyllUnitTest def with_no_gemfile FileUtils.mv "Gemfile", "Gemfile.old" yield ensure FileUtils.mv "Gemfile.old", "Gemfile" end def with_bundle_gemfile FileUtils.mv "Gemfile", "AlternateGemfile" yield ensure Fi...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_theme_data_reader.rb
Ruby
mit
51,392
master
3,042
# frozen_string_literal: true require "helper" class TestThemeDataReader < JekyllUnitTest context "site without a theme" do setup do @site = fixture_site("theme" => nil) @site.reader.read_data assert @site.data["greetings"] assert @site.data["categories"]["dairy"] end should "sh...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_related_posts.rb
Ruby
mit
51,392
master
1,974
# frozen_string_literal: true require "helper" class TestRelatedPosts < JekyllUnitTest context "building related posts without lsi" do setup do @site = fixture_site end should "use the most recent posts for related posts" do @site.reset @site.read last_post = @site.posts.la...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_sass.rb
Ruby
mit
51,392
master
1,041
# frozen_string_literal: true require "helper" class TestSass < JekyllUnitTest context "importing partials" do setup do @site = Jekyll::Site.new(Jekyll.configuration( "source" => source_dir, "destination" => dest_dir ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_tag_highlight.rb
Ruby
mit
51,392
master
8,200
# frozen_string_literal: true require "helper" class TestTagHighlight < TagUnitTest def render_content_with_text_to_highlight(code) content = <<~CONTENT --- title: This is a test --- This document has some highlighted code in it. {% highlight text %} #{code} {% endhig...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_page.rb
Ruby
mit
51,392
master
13,747
# frozen_string_literal: true require "helper" class TestPage < JekyllUnitTest def setup_page(*args) dir, file = args if file.nil? file = dir dir = "" end @page = Page.new(@site, source_dir, dir, file) end def do_render(page) layouts = { "default" => Layout.new(@site, sour...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_site.rb
Ruby
mit
51,392
master
25,154
# frozen_string_literal: true require "helper" class TestSite < JekyllUnitTest def with_image_as_post tmp_image_path = File.join(source_dir, "_posts", "2017-09-01-jekyll-sticker.jpg") FileUtils.cp File.join(Dir.pwd, "docs", "img", "jekyll-sticker.jpg"), tmp_image_path yield ensure FileUtils.rm tmp...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_new_command.rb
Ruby
mit
51,392
master
4,351
# frozen_string_literal: true require "helper" require "jekyll/commands/new" class TestNewCommand < JekyllUnitTest def dir_contents(path) Dir["#{path}/**/*"].each do |file| file.gsub! path, "" end end def site_template File.expand_path("../lib/site_template", __dir__) end def blank_templ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_liquid_extensions.rb
Ruby
mit
51,392
master
884
# frozen_string_literal: true require "helper" class TestLiquidExtensions < JekyllUnitTest context "looking up a variable in a Liquid context" do class SayHi < Liquid::Tag include Jekyll::LiquidExtensions def initialize(_tag_name, markup, _tokens) @markup = markup.strip end def...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_path_sanitization.rb
Ruby
mit
51,392
master
2,471
# frozen_string_literal: true require "helper" class TestPathSanitization < JekyllUnitTest context "on Windows with absolute source" do setup do @source = "C:/Users/xmr/Desktop/mpc-hc.org" @dest = "./_site/" allow(Dir).to receive(:pwd).and_return("C:/Users/xmr/Desktop/mpc-hc.org") end ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_theme_assets_reader.rb
Ruby
mit
51,392
master
3,370
# frozen_string_literal: true require "helper" class TestThemeAssetsReader < JekyllUnitTest def setup @site = fixture_site( "theme" => "test-theme", "theme-color" => "black" ) assert @site.theme end def assert_file_with_relative_path(haystack, relative_path) assert haystack.an...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_theme.rb
Ruby
mit
51,392
master
2,476
# frozen_string_literal: true require "helper" class TestTheme < JekyllUnitTest def setup @theme = Theme.new("test-theme") end context "initializing" do should "normalize the theme name" do theme = Theme.new(" Test-Theme ") assert_equal "test-theme", theme.name end should "know the...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/simplecov_custom_profile.rb
Ruby
mit
51,392
master
231
# frozen_string_literal: true require "simplecov" SimpleCov.profiles.define "gem" do add_filter "/test/" add_filter "/features/" add_filter "/autotest/" add_group "Binaries", "/bin/" add_group "Libraries", "/lib/" end
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_url.rb
Ruby
mit
51,392
master
3,114
# frozen_string_literal: true require "helper" class TestURL < JekyllUnitTest context "The URL class" do should "throw an exception if neither permalink or template is specified" do assert_raises ArgumentError do URL.new(:placeholders => {}) end end should "replace placeholders in t...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_utils.rb
Ruby
mit
51,392
master
15,069
# frozen_string_literal: true require "helper" class TestUtils < JekyllUnitTest context "The `Utils.deep_merge_hashes` method" do setup do clear_dest @site = fixture_site @site.process end should "merge a drop into a hash" do data = { "page" => {} } merged = Utils.deep_mer...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_entry_filter.rb
Ruby
mit
51,392
master
5,723
# frozen_string_literal: true require "helper" class TestEntryFilter < JekyllUnitTest context "Filtering entries" do setup do @site = fixture_site end should "filter entries" do ent1 = %w(foo.markdown bar.markdown baz.markdown #baz.markdown# .baz.markdown foo.markdown~ .htac...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_cleaner.rb
Ruby
mit
51,392
master
2,901
# frozen_string_literal: true require "helper" class TestCleaner < JekyllUnitTest context "directory in keep_files" do setup do clear_dest FileUtils.mkdir_p(dest_dir("to_keep/child_dir")) FileUtils.touch(File.join(dest_dir("to_keep"), "index.html")) FileUtils.touch(File.join(dest_dir("t...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_theme_drop.rb
Ruby
mit
51,392
master
1,395
# frozen_string_literal: true require "helper" class TestThemeDrop < JekyllUnitTest should "be initialized only for gem-based themes" do assert_nil fixture_site.to_liquid.theme end context "a theme drop" do setup do @drop = fixture_site("theme" => "test-theme").to_liquid.theme end should...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_command.rb
Ruby
mit
51,392
master
680
# frozen_string_literal: true require "helper" class TestCommand < JekyllUnitTest context "when calling .add_build_options" do should "add common options" do cmd = Object.new mocks_expect(cmd).to receive(:option).at_least(:once) Command.add_build_options(cmd) end end context "when cal...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_configuration.rb
Ruby
mit
51,392
master
18,547
# frozen_string_literal: true require "helper" require "colorator" class TestConfiguration < JekyllUnitTest test_config = { "source" => new(nil).source_dir, "destination" => dest_dir, } context ".from" do should "create a Configuration object" do assert_instance_of Configuration, Configu...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/test_post_reader.rb
Ruby
mit
51,392
master
1,274
# frozen_string_literal: true require "helper" class TestPostReader < JekyllUnitTest context "#read_publishable" do setup do @site = Site.new(site_configuration) @post_reader = PostReader.new(@site) @dir = "" @magic_dir = "_posts" @matcher = Document::DATE_FILENAME_MATCHER end ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
test/source/_plugins/custom_block.rb
Ruby
mit
51,392
master
328
# frozen_string_literal: true # For testing excerpt handling of custom tags module Jekyll class DoNothingBlock < Liquid::Block end class DoNothingOther < Liquid::Tag end end Liquid::Template.register_tag("do_nothing", Jekyll::DoNothingBlock) Liquid::Template.register_tag("do_nothing_other", Jekyll::DoNothin...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/parse-include-tag-params.rb
Ruby
mit
51,392
master
2,527
#!/usr/bin/env ruby # frozen_string_literal: true # For pull request: https://github.com/jekyll/jekyll/pull/8192 require 'benchmark/ips' require 'bundler/setup' require 'memory_profiler' require 'jekyll' CONTEXT = {"bar"=>"The quick brown fox"} MARKUP_1 = %Q(foo=bar lorem="ipsum \\"dolor\\"" alpha='beta \\'gamma\\''...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/capture-assign.rb
Ruby
mit
51,392
master
540
#!/usr/bin/env ruby require "liquid" require "benchmark/ips" puts "Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" puts "Liquid #{Liquid::VERSION}" template1 = '{% capture foobar %}foo{{ bar }}{% endcapture %}{{ foo }}{{ foobar }}' template2 = '{% assign foobar = "foo" | append: bar %}{{ foobar }}' def render(template) ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/conditional_liquid.rb
Ruby
mit
51,392
master
3,773
#!/usr/bin/env ruby # frozen_string_literal: true require "liquid" require "benchmark/ips" # Test if processing content string without any Liquid constructs, via Liquid, # is slower than checking whether constructs exist ( using `String#include?` ) # and return-ing the "plaintext" content string as is.. # # Ref: http...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/regexp-vs-include.rb
Ruby
mit
51,392
master
1,625
#!/usr/bin/env ruby require 'benchmark/ips' # For this pull request, which changes Page#dir # https://github.com/jekyll/jekyll/pull/4403 CONTENT_CONTAINING = <<-HTML.freeze <!DOCTYPE HTML> <html lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="UTF-8"> <...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/sanitize-url.rb
Ruby
mit
51,392
master
643
#!/usr/bin/env ruby require "benchmark/ips" PATH = "/../../..../...//.....//lorem/ipsum//dolor///sit.xyz" def sanitize_with_regex "/" + PATH.gsub(%r!/{2,}!, "/").gsub(%r!\.+/|\A/+!, "") end def sanitize_with_builtin "/#{PATH}".gsub("..", "/").gsub("./", "").squeeze("/") end if sanitize_with_regex == sanitize_w...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/path-manager.rb
Ruby
mit
51,392
master
1,695
# frozen_string_literal: true require 'benchmark/ips' require 'jekyll' class FooPage def initialize(dir:, name:) @dir = dir @name = name end def slow_path File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r!\A/!, "") end def fast_path Jekyll::PathManager.join(@dir, @name).sub(%r!...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/static-drop-vs-forwarded.rb
Ruby
mit
51,392
master
1,722
#!/usr/bin/env ruby # frozen_string_literal: true require "forwardable" require "colorator" require "liquid" require "benchmark/ips" require "memory_profiler" # Set up (memory) profiler class Profiler def self.run yield new(ARGV[0] || 10_000) end def initialize(count) @count = count.to_i end def ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/schwartzian_transform.rb
Ruby
mit
51,392
master
3,534
#!/usr/bin/env ruby # frozen_string_literal: true # # The Ruby documentation for #sort_by describes what's called a Schwartzian transform: # # > A more efficient technique is to cache the sort keys (modification times in this case) # > before the sort. Perl users often call this approach a Schwartzian transform, afte...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
benchmark/find-filter-vs-where-first-filters.rb
Ruby
mit
51,392
master
1,365
#!/usr/bin/env ruby # frozen_string_literal: true require 'benchmark/ips' require_relative '../lib/jekyll' puts '' print 'Setting up... ' SITE = Jekyll::Site.new( Jekyll.configuration({ "source" => File.expand_path("../docs", __dir__), "destination" => File.expand_path("../docs/_site", _...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
rake/rubocop.rake
Ruby
mit
51,392
master
579
# frozen_string_literal: true namespace :rubocop do desc "Format existing `.rubocop.yml` to improve readability" task :format_config do require_relative "./task_utils/rubocop_config_formatter" config_file = File.expand_path("../.rubocop.yml", __dir__) if File.exist?(config_file) print " Configur...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
rake/site.rake
Ruby
mit
51,392
master
3,959
# frozen_string_literal: true ############################################################################# # # Site tasks - https://jekyllrb.com # ############################################################################# namespace :site do task :generated_pages => [:history, :latest_version, :conduct, :contrib...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
rake/profile.rake
Ruby
mit
51,392
master
1,964
# frozen_string_literal: true require "jekyll" namespace :profile do desc "Profile allocations from a build session" task :memory, [:file, :mode] do |_t, args| args.with_defaults(file: "memprof.txt", mode: "lite") build_phases = [:reset, :read, :generate, :render, :cleanup, :write] safe_mode = fal...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
rake/task_utils/rubocop_config_formatter.rb
Ruby
mit
51,392
master
3,236
# frozen_string_literal: true require "yaml" module Jekyll module TaskUtils class RuboCopConfigFormatter def initialize(config_file) @registry = Hash.new { |hsh, k| hsh[k] = [] } @buffer = +"" @config = sort_hash_by_key(YAML.safe_load_file(config_file)) @config...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
rubocop/jekyll/assert_equal_literal_actual.rb
Ruby
mit
51,392
master
4,525
# frozen_string_literal: true module RuboCop module Cop module Jekyll # Checks for `assert_equal(exp, act, msg = nil)` calls containing literal values as # second argument. The second argument should ideally be a method called on the tested # instance. # # @example # # bad ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
rubocop/jekyll/no_puts_allowed.rb
Ruby
mit
51,392
master
487
# frozen_string_literal: true module RuboCop module Cop module Jekyll class NoPutsAllowed < Base MSG = "Avoid using `puts` to print things. Use `Jekyll.logger` instead." RESTRICT_ON_SEND = %i[puts].freeze def_node_search :puts_called?, <<-PATTERN (send nil? :puts _) ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
rubocop/jekyll/no_p_allowed.rb
Ruby
mit
51,392
master
466
# frozen_string_literal: true module RuboCop module Cop module Jekyll class NoPAllowed < Base MSG = "Avoid using `p` to print things. Use `Jekyll.logger` instead." RESTRICT_ON_SEND = %i[p].freeze def_node_search :p_called?, <<-PATTERN (send _ :p _) PATTERN ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll.rb
Ruby
mit
51,392
master
6,745
# frozen_string_literal: true $LOAD_PATH.unshift __dir__ # For use/testing when no gem is installed # Require all of the Ruby files in the given directory. # # path - The String relative path from here to the directory. # # Returns nothing. def require_all(path) glob = File.join(__dir__, path, "*.rb") Dir[glob].s...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/plugin.rb
Ruby
mit
51,392
master
2,244
# frozen_string_literal: true module Jekyll class Plugin PRIORITIES = { :low => -10, :highest => 100, :lowest => -100, :normal => 0, :high => 10, }.freeze # def self.inherited(const) catch_inheritance(const) do |const_| catch_inheritance(const_) ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/static_file.rb
Ruby
mit
51,392
master
5,813
# frozen_string_literal: true module Jekyll class StaticFile extend Forwardable attr_reader :relative_path, :extname, :type, # Returns the type of the collection if present, nil otherwise. :name def_delegator :to_liquid, :to_json, :to_json class << self # The ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/configuration.rb
Ruby
mit
51,392
master
10,115
# frozen_string_literal: true module Jekyll class Configuration < Hash # Default options. Overridden by values in _config.yml. # Strings rather than symbols are used for compatibility with YAML. DEFAULTS = { # Where things are "source" => Dir.pwd, "destination" => F...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/path_manager.rb
Ruby
mit
51,392
master
3,022
# frozen_string_literal: true module Jekyll # A singleton class that caches frozen instances of path strings returned from its methods. # # NOTE: # This class exists because `File.join` allocates an Array and returns a new String on every # call using **the same arguments**. Caching the result means redu...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/errors.rb
Ruby
mit
51,392
master
710
# frozen_string_literal: true module Jekyll module Errors FatalException = Class.new(::RuntimeError) InvalidThemeName = Class.new(FatalException) DropMutationException = Class.new(FatalException) InvalidPermalinkError = Class.new(FatalException) InvalidYAMLFrontMatterError = Class.n...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/theme_builder.rb
Ruby
mit
51,392
master
2,941
# frozen_string_literal: true module Jekyll class ThemeBuilder SCAFFOLD_DIRECTORIES = %w( assets _data _layouts _includes _sass ).freeze attr_reader :name, :path, :code_of_conduct def initialize(theme_name, opts) @name = theme_name.to_s.tr(" ", "_").squeeze("_") @path = Pathname.n...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/convertible.rb
Ruby
mit
51,392
master
7,352
# frozen_string_literal: true # Convertible provides methods for converting a pagelike item # from a certain type of markup into actual content # # Requires # self.site -> Jekyll::Site # self.content # self.content= # self.data= # self.ext= # self.output= # self.name # self.path # self.type -> :page,...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/plugin_manager.rb
Ruby
mit
51,392
master
3,667
# frozen_string_literal: true module Jekyll class PluginManager attr_reader :site # Create an instance of this class. # # site - the instance of Jekyll::Site we're concerned with # # Returns nothing def initialize(site) @site = site end # Require all the plugins which are ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/stevenson.rb
Ruby
mit
51,392
master
1,139
# frozen_string_literal: true module Jekyll class Stevenson < ::Logger def initialize formatter = proc do |_, _, _, msg| msg.to_s end super($stdout, :formatter => formatter) end def add(severity, message = nil, progname = nil) severity ||= UNKNOWN @logdev = logdevic...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/cleaner.rb
Ruby
mit
51,392
master
3,248
# frozen_string_literal: true module Jekyll # Handles the cleanup of a site's destination before it is built. class Cleaner HIDDEN_FILE_REGEX = %r!/\.{1,2}$!.freeze attr_reader :site def initialize(site) @site = site end # Cleans up the site's destination directory def cleanup! ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/reader.rb
Ruby
mit
51,392
master
6,909
# frozen_string_literal: true module Jekyll class Reader attr_reader :site def initialize(site) @site = site end # Read Site data from disk and load it into internal data structures. # # Returns nothing. def read @site.layouts = LayoutReader.new(site).read read_directo...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/log_adapter.rb
Ruby
mit
51,392
master
4,544
# frozen_string_literal: true module Jekyll class LogAdapter attr_reader :writer, :messages, :level LOG_LEVELS = { :debug => ::Logger::DEBUG, :info => ::Logger::INFO, :warn => ::Logger::WARN, :error => ::Logger::ERROR, }.freeze # Public: Create a new instance of a log writ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/cache.rb
Ruby
mit
51,392
master
4,809
# frozen_string_literal: true require "digest" module Jekyll class Cache # class-wide base cache @base_cache = {} # class-wide directive to write cache to disk is enabled by default @disk_cache_enabled = true class << self attr_accessor :cache_dir # class-wide cache location attr_...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/document.rb
Ruby
mit
51,392
master
16,729
# frozen_string_literal: true module Jekyll class Document include Comparable extend Forwardable attr_reader :path, :site, :extname, :collection, :type attr_accessor :content, :output def_delegator :self, :read_post_data, :post_read YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\....
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/command.rb
Ruby
mit
51,392
master
4,256
# frozen_string_literal: true module Jekyll class Command class << self # A list of subclasses of Jekyll::Command def subclasses @subclasses ||= [] end # Keep a list of subclasses of Jekyll::Command every time it's inherited # Called automatically. # # base - th...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/related_posts.rb
Ruby
mit
51,392
master
1,073
# frozen_string_literal: true module Jekyll class RelatedPosts class << self attr_accessor :lsi end attr_reader :post, :site def initialize(post) @post = post @site = post.site Jekyll::External.require_with_graceful_fail("classifier-reborn") if site.lsi end def buil...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/regenerator.rb
Ruby
mit
51,392
master
5,067
# frozen_string_literal: true module Jekyll class Regenerator attr_reader :site, :metadata, :cache attr_accessor :disabled private :disabled, :disabled= def initialize(site) @site = site # Read metadata from file read_metadata # Initialize cache to an empty hash clear...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/profiler.rb
Ruby
mit
51,392
master
1,231
# frozen_string_literal: true module Jekyll class Profiler TERMINAL_TABLE_STYLES = { :alignment => :right, :border_top => false, :border_bottom => false, }.freeze private_constant :TERMINAL_TABLE_STYLES def self.tabulate(table_rows) require "terminal-table" rows...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/page_excerpt.rb
Ruby
mit
51,392
master
557
# frozen_string_literal: true module Jekyll class PageExcerpt < Excerpt attr_reader :doc alias_method :id, :relative_path EXCERPT_ATTRIBUTES = (Page::ATTRIBUTES_FOR_LIQUID - %w(excerpt)).freeze private_constant :EXCERPT_ATTRIBUTES def to_liquid @to_liquid ||= doc.to_liquid(EXCERPT_ATTRIBU...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/publisher.rb
Ruby
mit
51,392
master
660
# frozen_string_literal: true module Jekyll class Publisher def initialize(site) @site = site end def publish?(thing) can_be_published?(thing) && !hidden_in_the_future?(thing) end def hidden_in_the_future?(thing) thing.respond_to?(:date) && !@site.future && !co...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/theme.rb
Ruby
mit
51,392
master
2,487
# frozen_string_literal: true module Jekyll class Theme extend Forwardable attr_reader :name def_delegator :gemspec, :version, :version def initialize(name) @name = name.downcase.strip Jekyll.logger.debug "Theme:", name Jekyll.logger.debug "Theme source:", root end def ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/deprecator.rb
Ruby
mit
51,392
master
2,048
# frozen_string_literal: true module Jekyll module Deprecator extend self def process(args) arg_is_present? args, "--server", "The --server command has been replaced by the \ 'serve' subcommand." arg_is_present? args, "--serve", "The --serve command has been replaced by...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/inclusion.rb
Ruby
mit
51,392
master
702
# frozen_string_literal: true module Jekyll class Inclusion attr_reader :site, :name, :path private :site def initialize(site, base, name) @site = site @name = name @path = PathManager.join(base, name) end def render(context) @template ||= site.liquid_renderer.file(path)...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/hooks.rb
Ruby
mit
51,392
master
2,894
# frozen_string_literal: true module Jekyll module Hooks DEFAULT_PRIORITY = 20 # compatibility layer for octopress-hooks users PRIORITY_MAP = { :low => 10, :normal => 20, :high => 30, }.freeze # initial empty hooks @registry = { :site => { :after_in...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/url.rb
Ruby
mit
51,392
master
5,694
# frozen_string_literal: true # Public: Methods that generate a URL for a resource such as a Post or a Page. # # Examples # # URL.new({ # :template => /:categories/:title.html", # :placeholders => {:categories => "ruby", :title => "something"} # }).to_s # module Jekyll class URL # options - One of :p...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/external.rb
Ruby
mit
51,392
master
2,349
# frozen_string_literal: true module Jekyll module External class << self # # Gems that, if installed, should be loaded. # Usually contain subcommands. # def blessed_gems %w( jekyll-compose jekyll-docs jekyll-import ) end # ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/converter.rb
Ruby
mit
51,392
master
1,533
# frozen_string_literal: true module Jekyll class Converter < Plugin # Public: Get or set the highlighter prefix. When an argument is specified, # the prefix will be set. If no argument is specified, the current prefix # will be returned. # # highlighter_prefix - The String prefix (default: nil)....