mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
35 Commits
3.5-stable
...
url-drop-o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed2d30dc88 | ||
|
|
3088032128 | ||
|
|
56436f46fe | ||
|
|
34967978c2 | ||
|
|
b35c0d8607 | ||
|
|
a6efa48883 | ||
|
|
12832af98e | ||
|
|
f8d06f20aa | ||
|
|
143367c5ca | ||
|
|
592daf4ce2 | ||
|
|
82c219a2e7 | ||
|
|
590dd6cf80 | ||
|
|
8f1959bbc4 | ||
|
|
8a017b5a2a | ||
|
|
96724af03e | ||
|
|
4493f2a58b | ||
|
|
93169f60c3 | ||
|
|
7b255baac2 | ||
|
|
188bc71713 | ||
|
|
897cdbb427 | ||
|
|
ec84bec6d6 | ||
|
|
819491b99c | ||
|
|
00a1d70e8f | ||
|
|
66c39d3bf9 | ||
|
|
e25c4af590 | ||
|
|
1a592c5757 | ||
|
|
a54906c78a | ||
|
|
56546a28fd | ||
|
|
c0c1185c56 | ||
|
|
c2b240e9b5 | ||
|
|
da65e94728 | ||
|
|
2b28f9fd57 | ||
|
|
026f8280e0 | ||
|
|
33cb629079 | ||
|
|
f904a7201e |
5
Gemfile
5
Gemfile
@@ -27,8 +27,8 @@ group :test do
|
||||
gem "rspec"
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 0.49.1"
|
||||
gem "test-dependency-theme", :path => File.expand_path("./test/fixtures/test-dependency-theme", File.dirname(__FILE__))
|
||||
gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__))
|
||||
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
|
||||
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
|
||||
|
||||
gem "jruby-openssl" if RUBY_ENGINE == "jruby"
|
||||
end
|
||||
@@ -53,6 +53,7 @@ end
|
||||
group :benchmark do
|
||||
if ENV["BENCHMARK"]
|
||||
gem "benchmark-ips"
|
||||
gem "benchmark-memory"
|
||||
gem "rbtrace"
|
||||
gem "ruby-prof"
|
||||
gem "stackprof"
|
||||
|
||||
@@ -1,13 +1,35 @@
|
||||
## 3.5.2 / 2017-08-12
|
||||
## HEAD
|
||||
|
||||
### Development Fixes
|
||||
|
||||
* Strip unnecessary leading whitespace in template (#6228)
|
||||
* Users should be installing patch versions. (#6198)
|
||||
* fix tests (#6240)
|
||||
* Define path with __dir__ (#6087)
|
||||
* exit site.process sooner (#6239)
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
* Ignore final newline in folded YAML string (#6054)
|
||||
* Add URL checks to Doctor (#5760)
|
||||
* Fix serving files that clash with directories (#6222) (#6231)
|
||||
* Bump supported Ruby version to `>= 2.1.0` (#6220)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Backport #6281 for v3.5.x: Fix `Drop#key?` so it can handle a nil argument (#6288)
|
||||
* Backport #6280 for v3.5.x: Guard against type error in `absolute_url` (#6287)
|
||||
* Backport #6266 for v3.5.x: Memoize the return value of `Document#url` (#6301)
|
||||
* Backport #6273 for v3.5.x: delegate `StaticFile#to_json` to `StaticFile#to_liquid` (#6302)
|
||||
* Backport #6226 for v3.5.x: `Reader#read_directories`: guard against an entry not being a directory (#6304)
|
||||
* Backport #6247 for v3.5.x: kramdown: symbolize keys in-place (#6303)
|
||||
* `Deprecator`: fix typo for `--serve` command (#6229)
|
||||
* `Reader#read_directories`: guard against an entry not being a directory (#6226)
|
||||
* kramdown: symbolize keys in-place (#6247)
|
||||
* Call to_s on site.url before attempting to concatenate strings (#6253)
|
||||
|
||||
### Documentation
|
||||
|
||||
* Fix a typo in `custom-404-page.md` (#6218)
|
||||
* Docs: fix links to issues in History.markdown (#6255)
|
||||
|
||||
### Site Enhancements
|
||||
|
||||
* Adding DevKit helpers (#6225)
|
||||
|
||||
## 3.5.1 / 2017-07-17
|
||||
|
||||
@@ -29,7 +51,7 @@
|
||||
* add plugins for multiple page pagination (#6055)
|
||||
* Update minimum Ruby version in installation.md (#6164)
|
||||
* [docs] Add information about finding a collection in `site.collections` (#6165)
|
||||
* Add {%raw%} to Liquid example on site (#6179)
|
||||
* Add `{% raw %}` to Liquid example on site (#6179)
|
||||
* Added improved Pug plugin - removed 404 Jade plugin (#6174)
|
||||
* Linking the link (#6210)
|
||||
* Small correction in documentation for includes (#6193)
|
||||
|
||||
2
Rakefile
2
Rakefile
@@ -4,7 +4,7 @@ require "rdoc"
|
||||
require "date"
|
||||
require "yaml"
|
||||
|
||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
||||
$LOAD_PATH.unshift File.expand_path("lib", __dir__)
|
||||
require "jekyll/version"
|
||||
|
||||
Dir.glob("rake/**.rake").each { |f| import f }
|
||||
|
||||
36
benchmark/reduce-vs-each-with-object
Executable file
36
benchmark/reduce-vs-each-with-object
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "benchmark/ips"
|
||||
require "benchmark/memory"
|
||||
|
||||
GC.disable
|
||||
|
||||
PERIOD = "."
|
||||
PROPERTY_AS_HASH = ["hello", "there_oh", "friends"]
|
||||
property = "hello.there_oh.friends"
|
||||
item = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
|
||||
|
||||
def candidate(property, item)
|
||||
property.to_s.split(".".freeze).each_with_object(item) do |attribute, memo|
|
||||
memo = memo[attribute]
|
||||
end
|
||||
end
|
||||
|
||||
def control(property, item)
|
||||
property.to_s.split(".").reduce(item) do |subvalue, attribute|
|
||||
subvalue[attribute]
|
||||
end
|
||||
end
|
||||
|
||||
Benchmark.ips do |x|
|
||||
x.report("candidate") { candidate(property, item) }
|
||||
x.report("control") { control(property, item) }
|
||||
x.compare!
|
||||
end
|
||||
|
||||
Benchmark.memory do |x|
|
||||
x.report("candidate") { candidate(property, item) }
|
||||
x.report("control") { control(property, item) }
|
||||
x.compare!
|
||||
end
|
||||
@@ -212,5 +212,7 @@ As of v1.3.0, Jekyll uses the `listen` gem to watch for changes when the `--watc
|
||||
Add the following to the Gemfile for your site if you have issues with auto-regeneration on Windows alone:
|
||||
|
||||
```ruby
|
||||
gem 'wdm', '~> 0.1.0' if Gem.win_platform?
|
||||
gem 'wdm', '~> 0.1.1' if Gem.win_platform?
|
||||
```
|
||||
|
||||
You may first have to download and install the [Ruby DevKit](https://rubyinstaller.org/downloads/) by following [the instructions here](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit).
|
||||
|
||||
@@ -53,7 +53,7 @@ More info on configuring Apache Error Pages can found in [official documentation
|
||||
|
||||
The procedure is just as simple as configuring Apache servers, but slightly different.
|
||||
|
||||
Add the following to the ngnix configuration file, `nginx.conf`, which is usually located inside `/etc/nginx/` or `/etc/nginx/conf/`:
|
||||
Add the following to the nginx configuration file, `nginx.conf`, which is usually located inside `/etc/nginx/` or `/etc/nginx/conf/`:
|
||||
|
||||
```
|
||||
server {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
STDOUT.sync = true
|
||||
|
||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
||||
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
||||
|
||||
require "jekyll"
|
||||
require "mercenary"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# coding: utf-8
|
||||
|
||||
lib = File.expand_path("../lib", __FILE__)
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require "jekyll/version"
|
||||
|
||||
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
||||
s.specification_version = 2 if s.respond_to? :specification_version=
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.rubygems_version = "2.2.2"
|
||||
s.required_ruby_version = ">= 2.0.0"
|
||||
s.required_ruby_version = ">= 2.1.0"
|
||||
|
||||
s.name = "jekyll"
|
||||
s.version = Jekyll::VERSION
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$LOAD_PATH.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
|
||||
$LOAD_PATH.unshift __dir__ # For use/testing when no gem is installed
|
||||
|
||||
# Require all of the Ruby files in the given directory.
|
||||
#
|
||||
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift File.dirname(__FILE__) # For use/testing when no gem is insta
|
||||
#
|
||||
# Returns nothing.
|
||||
def require_all(path)
|
||||
glob = File.join(File.dirname(__FILE__), path, "*.rb")
|
||||
glob = File.join(__dir__, path, "*.rb")
|
||||
Dir[glob].sort.each do |f|
|
||||
require f
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require "addressable/uri"
|
||||
|
||||
module Jekyll
|
||||
module Commands
|
||||
class Doctor < Command
|
||||
@@ -36,6 +38,7 @@ module Jekyll
|
||||
!deprecated_relative_permalinks(site),
|
||||
!conflicting_urls(site),
|
||||
!urls_only_differ_by_case(site),
|
||||
proper_site_url?(site),
|
||||
].all?
|
||||
end
|
||||
|
||||
@@ -91,6 +94,15 @@ module Jekyll
|
||||
urls_only_differ_by_case
|
||||
end
|
||||
|
||||
def proper_site_url?(site)
|
||||
url = site.config["url"]
|
||||
[
|
||||
url_exists?(url),
|
||||
url_valid?(url),
|
||||
url_absolute(url),
|
||||
].all?
|
||||
end
|
||||
|
||||
private
|
||||
def collect_urls(urls, things, destination)
|
||||
things.each do |thing|
|
||||
@@ -110,6 +122,29 @@ module Jekyll
|
||||
(memo[dest.downcase] ||= []) << dest
|
||||
end
|
||||
end
|
||||
|
||||
def url_exists?(url)
|
||||
return true unless url.nil? || url.empty?
|
||||
Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, "\
|
||||
"you may encounter problems with some plugins."
|
||||
false
|
||||
end
|
||||
|
||||
def url_valid?(url)
|
||||
Addressable::URI.parse(url)
|
||||
true
|
||||
rescue
|
||||
Jekyll.logger.warn "Warning:", "The site URL does not seem to be valid, "\
|
||||
"check the value of `url` in your config file."
|
||||
false
|
||||
end
|
||||
|
||||
def url_absolute(url)
|
||||
return true if Addressable::URI.parse(url).absolute?
|
||||
Jekyll.logger.warn "Warning:", "Your site URL does not seem to be absolute, "\
|
||||
"check the value of `url` in your config file."
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ source "https://rubygems.org"
|
||||
#
|
||||
# This will help ensure the proper Jekyll version is running.
|
||||
# Happy Jekylling!
|
||||
gem "jekyll", "#{Jekyll::VERSION}"
|
||||
gem "jekyll", "~> #{Jekyll::VERSION}"
|
||||
|
||||
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||
gem "minima", "~> 2.0"
|
||||
@@ -81,7 +81,7 @@ gem "minima", "~> 2.0"
|
||||
|
||||
# If you have any plugins, put them here!
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-feed", "~> 0.6"
|
||||
gem "jekyll-feed", "~> 0.6"
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
@@ -113,7 +113,7 @@ RUBY
|
||||
end
|
||||
|
||||
def site_template
|
||||
File.expand_path("../../site_template", File.dirname(__FILE__))
|
||||
File.expand_path("../../site_template", __dir__)
|
||||
end
|
||||
|
||||
def scaffold_path
|
||||
|
||||
@@ -234,7 +234,7 @@ module Jekyll
|
||||
|
||||
private
|
||||
def mime_types
|
||||
file = File.expand_path("../mime.types", File.dirname(__FILE__))
|
||||
file = File.expand_path("../mime.types", __dir__)
|
||||
WEBrick::HTTPUtils.load_mime_types(file)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ module Jekyll
|
||||
|
||||
def search_file(req, res, basename)
|
||||
# /file.* > /file/index.html > /file.html
|
||||
super || super(req, res, "#{basename}.html")
|
||||
super || super(req, res, ".html") || super(req, res, "#{basename}.html")
|
||||
end
|
||||
|
||||
# rubocop:disable Style/MethodName
|
||||
|
||||
@@ -5,7 +5,7 @@ module Jekyll
|
||||
def process(args)
|
||||
arg_is_present? args, "--server", "The --server command has been replaced by the \
|
||||
'serve' subcommand."
|
||||
arg_is_present? args, "--serve", "The --server command has been replaced by the \
|
||||
arg_is_present? args, "--serve", "The --serve command has been replaced by the \
|
||||
'serve' subcommand."
|
||||
arg_is_present? args, "--no-server", "To build Jekyll without launching a server, \
|
||||
use the 'build' subcommand."
|
||||
@@ -46,6 +46,5 @@ module Jekyll
|
||||
Jekyll.logger.warn "Defaults:", "Please update your front-matter defaults to use \
|
||||
'type: #{current}'."
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -203,7 +203,7 @@ module Jekyll
|
||||
#
|
||||
# Returns the computed URL for the document.
|
||||
def url
|
||||
@url ||= URL.new({
|
||||
@url = URL.new({
|
||||
:template => url_template,
|
||||
:placeholders => url_placeholders,
|
||||
:permalink => permalink,
|
||||
|
||||
@@ -71,7 +71,7 @@ module Jekyll
|
||||
def []=(key, val)
|
||||
if respond_to?("#{key}=")
|
||||
public_send("#{key}=", val)
|
||||
elsif respond_to?(key.to_s)
|
||||
elsif respond_to? key
|
||||
if self.class.mutable?
|
||||
@mutations[key] = val
|
||||
else
|
||||
@@ -105,7 +105,7 @@ module Jekyll
|
||||
if self.class.mutable
|
||||
@mutations.key?(key)
|
||||
else
|
||||
!key.nil? && (respond_to?(key) || fallback_data.key?(key))
|
||||
respond_to?(key) || fallback_data.key?(key)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ module Jekyll
|
||||
# Returns the absolute URL as a String.
|
||||
def absolute_url(input)
|
||||
return if input.nil?
|
||||
return input if Addressable::URI.parse(input.to_s).absolute?
|
||||
return input if Addressable::URI.parse(input).absolute?
|
||||
site = @context.registers[:site]
|
||||
return relative_url(input).to_s if site.config["url"].nil?
|
||||
Addressable::URI.parse(
|
||||
|
||||
@@ -73,13 +73,11 @@ module Jekyll
|
||||
render
|
||||
cleanup
|
||||
write
|
||||
print_stats
|
||||
print_stats if config["profile"]
|
||||
end
|
||||
|
||||
def print_stats
|
||||
if @config["profile"]
|
||||
puts @liquid_renderer.stats_table
|
||||
end
|
||||
puts @liquid_renderer.stats_table
|
||||
end
|
||||
|
||||
# Reset Site details.
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
module Jekyll
|
||||
class StaticFile
|
||||
extend Forwardable
|
||||
|
||||
attr_reader :relative_path, :extname, :name, :data
|
||||
|
||||
def_delegator :to_liquid, :to_json, :to_json
|
||||
|
||||
class << self
|
||||
# The cache of last modification times [path] -> mtime.
|
||||
def mtimes
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "addressable/uri"
|
||||
|
||||
# Public: Methods that generate a URL for a resource such as a Post or a Page.
|
||||
@@ -83,30 +85,18 @@ module Jekyll
|
||||
# That should be :month and :day, but our key extraction regexp isn't
|
||||
# smart enough to know that so we have to make it an explicit
|
||||
# possibility.
|
||||
def possible_keys(key)
|
||||
if key.end_with?("_")
|
||||
[key, key.chomp("_")]
|
||||
else
|
||||
[key]
|
||||
end
|
||||
end
|
||||
|
||||
def generate_url_from_drop(template)
|
||||
template.gsub(%r!:([a-z_]+)!) do |match|
|
||||
pool = possible_keys(match.sub(":".freeze, "".freeze))
|
||||
key = match[1..-1]
|
||||
key = match[1..-2] if !@placeholders.key?(key) && key.end_with?("_")
|
||||
|
||||
winner = pool.find { |key| @placeholders.key?(key) }
|
||||
if winner.nil?
|
||||
unless @placeholders.key?(key)
|
||||
raise NoMethodError,
|
||||
"The URL template doesn't have #{pool.join(" or ")} keys. "\
|
||||
"The URL template doesn't have #{key} key. "\
|
||||
"Check your permalink template!"
|
||||
end
|
||||
|
||||
value = @placeholders[winner]
|
||||
value = "" if value.nil?
|
||||
replacement = self.class.escape_path(value)
|
||||
|
||||
match.sub(":#{winner}", replacement)
|
||||
match.sub(":" + key, self.class.escape_path(@placeholders[key].to_s))
|
||||
end.gsub(%r!//!, "/".freeze)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Jekyll
|
||||
VERSION = "3.5.2".freeze
|
||||
VERSION = "3.5.1".freeze
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# in the templates via {{ site.myvariable }}.
|
||||
title: Your awesome title
|
||||
email: your-email@example.com
|
||||
description: > # this means to ignore newlines until "baseurl:"
|
||||
description: >- # this means to ignore newlines until "baseurl:"
|
||||
Write an awesome description for your new site here. You can edit this
|
||||
line in _config.yml. It will appear in your document head meta (for
|
||||
Google search results) and in your feed.xml site description.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'pry'
|
||||
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
|
||||
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
||||
require 'jekyll'
|
||||
|
||||
TEST_DIR = File.expand_path(File.join(File.dirname(__FILE__), *%w{ .. test }))
|
||||
TEST_DIR = File.expand_path("../test", __dir__)
|
||||
|
||||
def fixture_site(overrides = {})
|
||||
Jekyll::Site.new(site_configuration(overrides))
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
require "bundler/setup"
|
||||
require "json"
|
||||
require "stackprof"
|
||||
require File.expand_path("../../lib/jekyll", __FILE__)
|
||||
require File.expand_path("../lib/jekyll", __dir__)
|
||||
|
||||
MODE = ARGV.first || "cpu"
|
||||
PROF_OUTPUT_FILE = File.expand_path("../../tmp/stackprof-#{MODE}-#{Time.now.strftime("%Y%m%d%H%M")}.dump", __FILE__)
|
||||
PROF_OUTPUT_FILE = File.expand_path("../tmp/stackprof-#{MODE}-#{Time.now.strftime("%Y%m%d%H%M")}.dump", __dir__)
|
||||
|
||||
puts "Stackprof Mode: #{MODE}"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
require 'json'
|
||||
require 'open-uri'
|
||||
|
||||
config = File.expand_path "../lib/jekyll/mime.types", File.dirname(__FILE__)
|
||||
config = File.expand_path "../lib/jekyll/mime.types", __dir__
|
||||
|
||||
# Create an array of vendored mimetype => [extensions]
|
||||
mimes = {}
|
||||
|
||||
@@ -13,7 +13,7 @@ if ENV["CI"]
|
||||
require "simplecov"
|
||||
SimpleCov.start
|
||||
else
|
||||
require File.expand_path("../simplecov_custom_profile", __FILE__)
|
||||
require File.expand_path("simplecov_custom_profile", __dir__)
|
||||
SimpleCov.start "gem" do
|
||||
add_filter "/vendor/gem"
|
||||
add_filter "/vendor/bundle"
|
||||
@@ -63,7 +63,7 @@ end
|
||||
|
||||
module DirectoryHelpers
|
||||
def root_dir(*subdirs)
|
||||
File.join(File.dirname(File.dirname(__FILE__)), *subdirs)
|
||||
File.expand_path(File.join("..", *subdirs), __dir__)
|
||||
end
|
||||
|
||||
def dest_dir(*subdirs)
|
||||
|
||||
8
test/source/_config_folded.yml
Normal file
8
test/source/_config_folded.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
folded_string: >
|
||||
This string of text will ignore
|
||||
newlines till the next key.
|
||||
foo: bar
|
||||
clean_folded_string: >-
|
||||
This string of text will ignore
|
||||
newlines till the next key.
|
||||
baz: foo
|
||||
@@ -494,4 +494,36 @@ class TestConfiguration < JekyllUnitTest
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context "folded YAML string" do
|
||||
setup do
|
||||
@tester = Configuration.new
|
||||
end
|
||||
|
||||
should "ignore newlines in that string entirely from a sample file" do
|
||||
config = Jekyll.configuration(
|
||||
@tester.read_config_file(
|
||||
source_dir("_config_folded.yml")
|
||||
)
|
||||
)
|
||||
assert_equal(
|
||||
config["folded_string"],
|
||||
"This string of text will ignore newlines till the next key.\n"
|
||||
)
|
||||
assert_equal(
|
||||
config["clean_folded_string"],
|
||||
"This string of text will ignore newlines till the next key."
|
||||
)
|
||||
end
|
||||
|
||||
should "ignore newlines in that string entirely from the template file" do
|
||||
config = Jekyll.configuration(
|
||||
@tester.read_config_file(
|
||||
File.expand_path("../lib/site_template/_config.yml", File.dirname(__FILE__))
|
||||
)
|
||||
)
|
||||
assert_includes config["description"], "an awesome description"
|
||||
refute_includes config["description"], "\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,11 +6,11 @@ class TestConvertible < JekyllUnitTest
|
||||
setup do
|
||||
@convertible = OpenStruct.new(
|
||||
"site" => Site.new(Jekyll.configuration(
|
||||
"source" => File.expand_path("../fixtures", __FILE__)
|
||||
"source" => File.expand_path("fixtures", __dir__)
|
||||
))
|
||||
)
|
||||
@convertible.extend Jekyll::Convertible
|
||||
@base = File.expand_path("../fixtures", __FILE__)
|
||||
@base = File.expand_path("fixtures", __dir__)
|
||||
end
|
||||
|
||||
should "parse the front matter correctly" do
|
||||
|
||||
@@ -13,10 +13,6 @@ class TestDrop < JekyllUnitTest
|
||||
@drop = @document.to_liquid
|
||||
end
|
||||
|
||||
should "reject 'nil' key" do
|
||||
refute @drop.key?(nil)
|
||||
end
|
||||
|
||||
should "raise KeyError if key is not found and no default provided" do
|
||||
assert_raises KeyError do
|
||||
@drop.fetch("not_existing_key")
|
||||
|
||||
@@ -439,10 +439,6 @@ class TestFilters < JekyllUnitTest
|
||||
filter = make_filter_mock({ "url" => Value.new(proc { "http://example.org" }) })
|
||||
assert_equal "http://example.org#{page_url}", filter.absolute_url(page_url)
|
||||
end
|
||||
|
||||
should "not raise a TypeError when passed a hash" do
|
||||
assert @filter.absolute_url({ "foo" => "bar" })
|
||||
end
|
||||
end
|
||||
|
||||
context "relative_url filter" do
|
||||
|
||||
@@ -9,7 +9,7 @@ class TestNewCommand < JekyllUnitTest
|
||||
end
|
||||
|
||||
def site_template
|
||||
File.expand_path("../lib/site_template", File.dirname(__FILE__))
|
||||
File.expand_path("../lib/site_template", __dir__)
|
||||
end
|
||||
|
||||
context "when args contains a path" do
|
||||
@@ -34,7 +34,7 @@ class TestNewCommand < JekyllUnitTest
|
||||
refute_exist @full_path
|
||||
capture_output { Jekyll::Commands::New.process(@args) }
|
||||
assert_exist gemfile
|
||||
assert_match(%r!gem "jekyll", "#{Jekyll::VERSION}"!, File.read(gemfile))
|
||||
assert_match(%r!gem "jekyll", "~> #{Jekyll::VERSION}"!, File.read(gemfile))
|
||||
assert_match(%r!gem "github-pages"!, File.read(gemfile))
|
||||
end
|
||||
|
||||
|
||||
@@ -174,9 +174,5 @@ class TestStaticFile < JekyllUnitTest
|
||||
}
|
||||
assert_equal expected, @static_file.to_liquid.to_h
|
||||
end
|
||||
|
||||
should "jsonify its liquid drop instead of itself" do
|
||||
assert_equal @static_file.to_liquid.to_json, @static_file.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user