mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0423633cfb | ||
|
|
cc21d9cec9 | ||
|
|
928df67775 | ||
|
|
21c563c0ff | ||
|
|
c0f0a72f15 | ||
|
|
268c4a6cbc | ||
|
|
1b32c84e5f | ||
|
|
145afae307 | ||
|
|
8fae81861d | ||
|
|
3b6fb90b31 | ||
|
|
c416495539 | ||
|
|
ebf8be2de1 | ||
|
|
cec9e510f2 | ||
|
|
644a760936 | ||
|
|
09ef65e49b | ||
|
|
4ed03641b7 | ||
|
|
0a733d4fbb | ||
|
|
040040b980 | ||
|
|
96feb89df0 | ||
|
|
cc5996afd2 | ||
|
|
bfdf3e0d9b | ||
|
|
827ec88c99 | ||
|
|
7baf560016 | ||
|
|
aeadbfc6c0 | ||
|
|
7ed3778756 | ||
|
|
be9226b4e8 | ||
|
|
d09684dcb2 | ||
|
|
b46f8d0adf | ||
|
|
43ceaf8c28 | ||
|
|
f99ffe5bf1 | ||
|
|
400a8d7b48 | ||
|
|
d6c972a9ba | ||
|
|
aadf43727e | ||
|
|
fe5f9d80df | ||
|
|
0dabdfb159 | ||
|
|
e23520c793 | ||
|
|
e19e1629ba | ||
|
|
6e208e89e6 | ||
|
|
b962ed63a4 | ||
|
|
c4e452323e | ||
|
|
787f11de71 | ||
|
|
b64345f0a0 | ||
|
|
50637ba0d4 | ||
|
|
e763d4c4b2 | ||
|
|
bd2d9a4642 | ||
|
|
2b9e849bbb |
@@ -23,10 +23,6 @@ env:
|
||||
- TEST_SUITE=test
|
||||
- TEST_SUITE=cucumber
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
template: "%{repository}#%{build_number} (%{branch}) %{message} %{build_url}"
|
||||
|
||||
4
Gemfile
4
Gemfile
@@ -4,7 +4,7 @@ gemspec :name => "jekyll"
|
||||
gem "rake", "~> 10.1"
|
||||
group :development do
|
||||
gem "launchy", "~> 2.3"
|
||||
gem "rubocop", :branch => :master, :github => "bbatsov/rubocop"
|
||||
gem "rubocop", "~> 0.40"
|
||||
gem "pry"
|
||||
|
||||
unless RUBY_ENGINE == "jruby"
|
||||
@@ -55,7 +55,7 @@ end
|
||||
group :jekyll_optional_dependencies do
|
||||
gem "toml", "~> 0.1.0"
|
||||
gem "coderay", "~> 1.1.0"
|
||||
gem "jekyll-docs", path: '../docs' if Dir.exist?('../docs')
|
||||
gem "jekyll-docs", path: '../docs' if Dir.exist?('../docs') && ENV["JEKYLL_VERSION"]
|
||||
gem "jekyll-gist", "~> 1.0"
|
||||
gem "jekyll-feed", "~> 0.1.3"
|
||||
gem "jekyll-coffeescript", "~> 1.0"
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
## 3.1.4 / 2016-05-18
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add `ExcerptDrop` and remove excerpt's ability to refer to itself in Liquid (#4907)
|
||||
* Configuration permalink fix where `collections.posts.permalink` inherits properly from `permalink` only when it doesn't exist (#4910)
|
||||
* Add `Configuration.from` to make it easier to build configs from just a hash
|
||||
* Sorting `site.collections` in Liquid by label (#4910)
|
||||
* Fix bug where `layout` in Liquid would inherit from previously-rendered layouts' metadatas (#4909)
|
||||
* Fix bug where `layout` in Liquid would override in the wrong direction (more-specific layouts' data were overwritten by their parent layouts' data; this has now been reversed) (#4909)
|
||||
|
||||
## 3.1.2 / 2016-02-19
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
@@ -80,6 +80,26 @@ Feature: frontmatter defaults
|
||||
And I should see "main: <p>content of site/special/2013/10/14/about1.html</p>" in "_site/special/2013/10/14/about1.html"
|
||||
And I should see "main: <p>content of site/special/2013/10/14/about2.html</p>" in "_site/special/2013/10/14/about2.html"
|
||||
|
||||
Scenario: Use frontmatter scopes for subdirectories
|
||||
Given I have a _layouts directory
|
||||
And I have a main layout that contains "main: {{ content }}"
|
||||
|
||||
And I have a _posts/en directory
|
||||
And I have the following post under "en":
|
||||
| title | date | content |
|
||||
| helloworld | 2014-09-01 | {{page.lang}} is the current language |
|
||||
And I have a _posts/de directory
|
||||
And I have the following post under "de":
|
||||
| title | date | content |
|
||||
| hallowelt | 2014-09-01 | {{page.lang}} is the current language |
|
||||
|
||||
And I have a configuration file with "defaults" set to "[{scope: {path: "_posts/en"}, values: {layout: "main", lang: "en"}}, {scope: {path: "_posts/de"}, values: {layout: "main", lang: "de"}}]"
|
||||
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "main: <p>en is the current language</p>" in "_site/2014/09/01/helloworld.html"
|
||||
And I should see "main: <p>de is the current language</p>" in "_site/2014/09/01/hallowelt.html"
|
||||
|
||||
Scenario: Override frontmatter defaults by type
|
||||
Given I have a _posts directory
|
||||
And I have the following post:
|
||||
|
||||
@@ -35,3 +35,36 @@ Feature: Layout data
|
||||
When I run jekyll build
|
||||
Then the "_site/index.html" file should exist
|
||||
And I should see "page content\n foo: my custom data" in "_site/index.html"
|
||||
|
||||
Scenario: Inherit custom layout data and clear when not present
|
||||
Given I have a _layouts directory
|
||||
And I have a "_layouts/default.html" file with content:
|
||||
"""
|
||||
---
|
||||
bar: i'm default
|
||||
---
|
||||
{{ content }} foo: '{{ layout.foo }}' bar: '{{ layout.bar }}'
|
||||
"""
|
||||
And I have a "_layouts/special.html" file with content:
|
||||
"""
|
||||
---
|
||||
layout: default
|
||||
foo: my special data
|
||||
bar: im special
|
||||
---
|
||||
{{ content }}
|
||||
"""
|
||||
And I have a "_layouts/page.html" file with content:
|
||||
"""
|
||||
---
|
||||
layout: default
|
||||
bar: im page
|
||||
---
|
||||
{{ content }}
|
||||
"""
|
||||
And I have an "index.html" page with layout "special" that contains "page content"
|
||||
And I have an "jekyll.html" page with layout "page" that contains "page content"
|
||||
When I run jekyll build
|
||||
Then the "_site/index.html" file should exist
|
||||
And I should see "page content\n foo: 'my special data' bar: 'im special'" in "_site/index.html"
|
||||
And I should see "page content\n foo: '' bar: 'im page'" in "_site/jekyll.html"
|
||||
|
||||
@@ -95,18 +95,16 @@ module Jekyll
|
||||
# list of option names and their defaults.
|
||||
#
|
||||
# Returns the final configuration Hash.
|
||||
def configuration(override = {})
|
||||
config = Configuration[Configuration::DEFAULTS]
|
||||
override = Configuration[override].stringify_keys
|
||||
def configuration(override = Hash.new)
|
||||
config = Configuration.new
|
||||
unless override.delete('skip_config_files')
|
||||
config = config.read_config_files(config.config_files(override))
|
||||
end
|
||||
|
||||
# Merge DEFAULTS < _config.yml < override
|
||||
config = Utils.deep_merge_hashes(config, override).stringify_keys
|
||||
set_timezone(config['timezone']) if config['timezone']
|
||||
|
||||
config
|
||||
Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |config|
|
||||
set_timezone(config['timezone']) if config['timezone']
|
||||
end
|
||||
end
|
||||
|
||||
# Public: Set the TZ environment variable to use the timezone specified
|
||||
|
||||
@@ -112,11 +112,12 @@ module Jekyll
|
||||
|
||||
private
|
||||
def server_address(server, opts)
|
||||
address = server.config[:BindAddress]
|
||||
baseurl = "#{opts["baseurl"]}/" if opts["baseurl"]
|
||||
port = server.config[:Port]
|
||||
|
||||
"http://#{address}:#{port}#{baseurl}"
|
||||
"%{prefix}://%{address}:%{port}%{baseurl}" % {
|
||||
:prefix => server.config[:SSLEnable] ? "https" : "http",
|
||||
:baseurl => opts["baseurl"] ? "#{opts["baseurl"]}/" : "",
|
||||
:address => server.config[:BindAddress],
|
||||
:port => server.config[:Port]
|
||||
}
|
||||
end
|
||||
|
||||
#
|
||||
@@ -181,7 +182,7 @@ module Jekyll
|
||||
source_certificate = Jekyll.sanitized_path(opts[:JekyllOptions]["source"], opts[:JekyllOptions]["ssl_cert"])
|
||||
opts[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read(source_certificate))
|
||||
opts[:SSLPrivateKey ] = OpenSSL::PKey::RSA.new(File.read(source_key))
|
||||
opts[:EnableSSL] = true
|
||||
opts[:SSLEnable] = true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -71,7 +71,24 @@ module Jekyll
|
||||
'hard_wrap' => false,
|
||||
'footnote_nr' => 1
|
||||
}
|
||||
}]
|
||||
}.map { |k, v| [k, v.freeze] }].freeze
|
||||
|
||||
class << self
|
||||
# Static: Produce a Configuration ready for use in a Site.
|
||||
# It takes the input, fills in the defaults where values do not
|
||||
# exist, and patches common issues including migrating options for
|
||||
# backwards compatiblity. Except where a key or value is being fixed,
|
||||
# the user configuration will override the defaults.
|
||||
#
|
||||
# user_config - a Hash or Configuration of overrides.
|
||||
#
|
||||
# Returns a Configuration filled with defaults and fixed for common
|
||||
# problems and backwards-compatibility.
|
||||
def from(user_config)
|
||||
Utils.deep_merge_hashes(DEFAULTS, Configuration[user_config].stringify_keys).
|
||||
fix_common_issues.add_default_collections
|
||||
end
|
||||
end
|
||||
|
||||
# Public: Turn all keys into string
|
||||
#
|
||||
@@ -168,6 +185,7 @@ module Jekyll
|
||||
|
||||
begin
|
||||
files.each do |config_file|
|
||||
next if config_file.nil? or config_file.empty?
|
||||
new_config = read_config_file(config_file)
|
||||
configuration = Utils.deep_merge_hashes(configuration, new_config)
|
||||
end
|
||||
@@ -227,7 +245,6 @@ module Jekyll
|
||||
end
|
||||
|
||||
%w(include exclude).each do |option|
|
||||
config[option] ||= []
|
||||
if config[option].is_a?(String)
|
||||
Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
|
||||
" must now be specified as an array, but you specified" \
|
||||
@@ -235,7 +252,7 @@ module Jekyll
|
||||
" as a list of comma-separated values."
|
||||
config[option] = csv_to_array(config[option])
|
||||
end
|
||||
config[option].map!(&:to_s)
|
||||
config[option].map!(&:to_s) if config[option]
|
||||
end
|
||||
|
||||
if (config['kramdown'] || {}).key?('use_coderay')
|
||||
@@ -270,14 +287,22 @@ module Jekyll
|
||||
def add_default_collections
|
||||
config = clone
|
||||
|
||||
# It defaults to `{}`, so this is only if someone sets it to null manually.
|
||||
return config if config['collections'].nil?
|
||||
|
||||
# Ensure we have a hash.
|
||||
if config['collections'].is_a?(Array)
|
||||
config['collections'] = Hash[config['collections'].map { |c| [c, {}] }]
|
||||
end
|
||||
config['collections']['posts'] ||= {}
|
||||
config['collections']['posts']['output'] = true
|
||||
config['collections']['posts']['permalink'] = style_to_permalink(config['permalink'])
|
||||
|
||||
config['collections'] = Utils.deep_merge_hashes(
|
||||
{ 'posts' => {} }, config['collections']
|
||||
).tap do |collections|
|
||||
collections['posts']['output'] = true
|
||||
if config['permalink']
|
||||
collections['posts']['permalink'] ||= style_to_permalink(config['permalink'])
|
||||
end
|
||||
end
|
||||
|
||||
config
|
||||
end
|
||||
|
||||
@@ -209,10 +209,13 @@ module Jekyll
|
||||
|
||||
used = Set.new([layout])
|
||||
|
||||
# Reset the payload layout data to ensure it starts fresh for each page.
|
||||
payload["layout"] = nil
|
||||
|
||||
while layout
|
||||
Jekyll.logger.debug "Rendering Layout:", path
|
||||
payload["content"] = output
|
||||
payload["layout"] = Utils.deep_merge_hashes(payload["layout"] || {}, layout.data)
|
||||
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
|
||||
|
||||
self.output = render_liquid(layout.content,
|
||||
payload,
|
||||
|
||||
@@ -259,7 +259,7 @@ module Jekyll
|
||||
@data = SafeYAML.load_file(path)
|
||||
else
|
||||
begin
|
||||
defaults = @site.frontmatter_defaults.all(url, collection.label.to_sym)
|
||||
defaults = @site.frontmatter_defaults.all(relative_path, collection.label.to_sym)
|
||||
merge_data!(defaults, source: "front matter defaults") unless defaults.empty?
|
||||
|
||||
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
module Jekyll
|
||||
module Drops
|
||||
class Drop < Liquid::Drop
|
||||
NON_CONTENT_METHODS = [:[], :[]=, :inspect, :to_h, :fallback_data].freeze
|
||||
NON_CONTENT_METHODS = [:fallback_data].freeze
|
||||
|
||||
# Get or set whether the drop class is mutable.
|
||||
# Mutability determines whether or not pre-defined fields may be
|
||||
@@ -86,7 +86,7 @@ module Jekyll
|
||||
# Returns an Array of strings which represent method-specific keys.
|
||||
def content_methods
|
||||
@content_methods ||= (
|
||||
self.class.instance_methods(false) - NON_CONTENT_METHODS
|
||||
self.class.instance_methods - Jekyll::Drops::Drop.instance_methods - NON_CONTENT_METHODS
|
||||
).map(&:to_s).reject do |method|
|
||||
method.end_with?("=")
|
||||
end
|
||||
@@ -147,6 +147,12 @@ module Jekyll
|
||||
keys.each(&block)
|
||||
end
|
||||
|
||||
def each(&block)
|
||||
each_key.each do |key|
|
||||
yield key, self[key]
|
||||
end
|
||||
end
|
||||
|
||||
def merge(other, &block)
|
||||
self.dup.tap do |me|
|
||||
if block.nil?
|
||||
|
||||
15
lib/jekyll/drops/excerpt_drop.rb
Normal file
15
lib/jekyll/drops/excerpt_drop.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
class ExcerptDrop < DocumentDrop
|
||||
def layout
|
||||
@obj.doc.data['layout']
|
||||
end
|
||||
|
||||
def excerpt
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -28,7 +28,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def collections
|
||||
@site_collections ||= @obj.collections.values.map(&:to_liquid)
|
||||
@site_collections ||= @obj.collections.values.sort_by(&:label).map(&:to_liquid)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -7,7 +7,7 @@ module Jekyll
|
||||
attr_writer :output
|
||||
|
||||
def_delegators :@doc, :site, :name, :ext, :relative_path, :extname,
|
||||
:render_with_liquid?, :collection, :related_posts
|
||||
:render_with_liquid?, :collection, :related_posts, :url
|
||||
|
||||
# Initialize this Excerpt instance.
|
||||
#
|
||||
@@ -59,10 +59,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def to_liquid
|
||||
doc.data['excerpt'] = nil
|
||||
@to_liquid ||= doc.to_liquid
|
||||
doc.data['excerpt'] = self
|
||||
@to_liquid
|
||||
Jekyll::Drops::ExcerptDrop.new(self)
|
||||
end
|
||||
|
||||
# Returns the shorthand String identifier of this doc.
|
||||
|
||||
@@ -76,7 +76,7 @@ module Jekyll
|
||||
#
|
||||
# Returns an Array of plugin search paths
|
||||
def plugins_path
|
||||
if site.config['plugins_dir'] == Jekyll::Configuration::DEFAULTS['plugins_dir']
|
||||
if site.config['plugins_dir'].eql? Jekyll::Configuration::DEFAULTS['plugins_dir']
|
||||
[site.in_source_dir(site.config['plugins_dir'])]
|
||||
else
|
||||
Array(site.config['plugins_dir']).map { |d| File.expand_path(d) }
|
||||
|
||||
@@ -135,10 +135,13 @@ module Jekyll
|
||||
|
||||
used = Set.new([layout])
|
||||
|
||||
# Reset the payload layout data to ensure it starts fresh for each page.
|
||||
payload["layout"] = nil
|
||||
|
||||
while layout
|
||||
payload['content'] = output
|
||||
payload['page'] = document.to_liquid
|
||||
payload['layout'] = Utils.deep_merge_hashes(payload['layout'] || {}, layout.data)
|
||||
payload['layout'] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
|
||||
|
||||
output = render_liquid(
|
||||
layout.content,
|
||||
|
||||
@@ -53,6 +53,10 @@ module Jekyll
|
||||
target.default_proc = overwrite.default_proc
|
||||
end
|
||||
|
||||
target.each do |key, val|
|
||||
target[key] = val.dup if val.frozen? && duplicable?(val)
|
||||
end
|
||||
|
||||
target
|
||||
end
|
||||
|
||||
@@ -60,6 +64,15 @@ module Jekyll
|
||||
value.is_a?(Hash) || value.is_a?(Drops::Drop)
|
||||
end
|
||||
|
||||
def duplicable?(obj)
|
||||
case obj
|
||||
when nil, false, true, Symbol, Numeric
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
# Read array from the supplied hash favouring the singular key
|
||||
# and then the plural key, and handling any nil entries.
|
||||
#
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Jekyll
|
||||
VERSION = '3.1.2'
|
||||
VERSION = '3.1.4'
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
desc "Release #{name} v#{version}"
|
||||
task :release => :build do
|
||||
unless `git branch` =~ /^\* master$/
|
||||
unless `git branch` =~ /^\* 3\.1-stable$/
|
||||
puts "You must be on the master branch to release!"
|
||||
exit!
|
||||
end
|
||||
|
||||
@@ -4,6 +4,20 @@ title: History
|
||||
permalink: "/docs/history/"
|
||||
---
|
||||
|
||||
## 3.1.4 / 2016-05-18
|
||||
{: #v3-1-4}
|
||||
|
||||
### Bug Fixes
|
||||
{: #bug-fixes-v3-1-4}
|
||||
|
||||
- Add `ExcerptDrop` and remove excerpt's ability to refer to itself in Liquid ([#4907]({{ site.repository }}/issues/4907))
|
||||
- Configuration permalink fix where `collections.posts.permalink` inherits properly from `permalink` only when it doesn't exist ([#4910]({{ site.repository }}/issues/4910))
|
||||
- Add `Configuration.from` to make it easier to build configs from just a hash
|
||||
- Sorting `site.collections` in Liquid by label ([#4910]({{ site.repository }}/issues/4910))
|
||||
- Fix bug where `layout` in Liquid would inherit from previously-rendered layouts' metadatas ([#4909]({{ site.repository }}/issues/4909))
|
||||
- Fix bug where `layout` in Liquid would override in the wrong direction (more-specific layouts' data were overwritten by their parent layouts' data; this has now been reversed) ([#4909]({{ site.repository }}/issues/4909))
|
||||
|
||||
|
||||
## 3.1.2 / 2016-02-19
|
||||
{: #v3-1-2}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.1.2
|
||||
3.1.4
|
||||
|
||||
@@ -21,7 +21,7 @@ require 'minitest/autorun'
|
||||
require 'minitest/reporters'
|
||||
require 'minitest/profile'
|
||||
require 'rspec/mocks'
|
||||
require 'jekyll'
|
||||
require_relative "../lib/jekyll.rb"
|
||||
|
||||
Jekyll.logger = Logger.new(StringIO.new)
|
||||
|
||||
@@ -58,8 +58,30 @@ module Minitest::Assertions
|
||||
end
|
||||
end
|
||||
|
||||
module DirectoryHelpers
|
||||
def dest_dir(*subdirs)
|
||||
test_dir('dest', *subdirs)
|
||||
end
|
||||
|
||||
def source_dir(*subdirs)
|
||||
test_dir('source', *subdirs)
|
||||
end
|
||||
|
||||
def test_dir(*subdirs)
|
||||
File.join(File.dirname(__FILE__), *subdirs)
|
||||
end
|
||||
end
|
||||
|
||||
class JekyllUnitTest < Minitest::Test
|
||||
include ::RSpec::Mocks::ExampleMethods
|
||||
include DirectoryHelpers
|
||||
extend DirectoryHelpers
|
||||
|
||||
def mu_pp obj
|
||||
s = obj.is_a?(Hash) ? JSON.pretty_generate(obj) : obj.inspect
|
||||
s = s.encode Encoding.default_external if defined? Encoding
|
||||
s
|
||||
end
|
||||
|
||||
def mocks_expect(*args)
|
||||
RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect).\
|
||||
@@ -82,9 +104,12 @@ class JekyllUnitTest < Minitest::Test
|
||||
Jekyll::Site.new(site_configuration(overrides))
|
||||
end
|
||||
|
||||
def build_configs(overrides, base_hash = Jekyll::Configuration::DEFAULTS)
|
||||
def default_configuration
|
||||
Marshal.load(Marshal.dump(Jekyll::Configuration::DEFAULTS))
|
||||
end
|
||||
|
||||
def build_configs(overrides, base_hash = default_configuration)
|
||||
Utils.deep_merge_hashes(base_hash, overrides)
|
||||
.fix_common_issues.backwards_compatibilize.add_default_collections
|
||||
end
|
||||
|
||||
def site_configuration(overrides = {})
|
||||
@@ -94,15 +119,10 @@ class JekyllUnitTest < Minitest::Test
|
||||
}))
|
||||
build_configs({
|
||||
"source" => source_dir
|
||||
}, full_overrides)
|
||||
end
|
||||
|
||||
def dest_dir(*subdirs)
|
||||
test_dir('dest', *subdirs)
|
||||
end
|
||||
|
||||
def source_dir(*subdirs)
|
||||
test_dir('source', *subdirs)
|
||||
}, full_overrides).
|
||||
fix_common_issues.
|
||||
backwards_compatibilize.
|
||||
add_default_collections
|
||||
end
|
||||
|
||||
def clear_dest
|
||||
@@ -110,10 +130,6 @@ class JekyllUnitTest < Minitest::Test
|
||||
FileUtils.rm_rf(source_dir('.jekyll-metadata'))
|
||||
end
|
||||
|
||||
def test_dir(*subdirs)
|
||||
File.join(File.dirname(__FILE__), *subdirs)
|
||||
end
|
||||
|
||||
def directory_with_contents(path)
|
||||
FileUtils.rm_rf(path)
|
||||
FileUtils.mkdir(path)
|
||||
|
||||
@@ -105,7 +105,7 @@ class TestCommandsServe < JekyllUnitTest
|
||||
"ssl_key" => "bar"
|
||||
})
|
||||
|
||||
assert result[:EnableSSL]
|
||||
assert result[:SSLEnable]
|
||||
assert_equal result[:SSLPrivateKey ], "c2"
|
||||
assert_equal result[:SSLCertificate], "c1"
|
||||
end
|
||||
|
||||
@@ -1,7 +1,62 @@
|
||||
require 'helper'
|
||||
|
||||
class TestConfiguration < JekyllUnitTest
|
||||
@@defaults = Jekyll::Configuration::DEFAULTS.add_default_collections.freeze
|
||||
@@test_config = {
|
||||
"source" => new(nil).source_dir,
|
||||
"destination" => dest_dir
|
||||
}
|
||||
|
||||
context ".from" do
|
||||
should "create a Configuration object" do
|
||||
assert_instance_of Configuration, Configuration.from({})
|
||||
end
|
||||
|
||||
should "merge input over defaults" do
|
||||
result = Configuration.from({"source" => "blah"})
|
||||
refute_equal result["source"], Configuration::DEFAULTS["source"]
|
||||
assert_equal result["source"], "blah"
|
||||
end
|
||||
|
||||
should "fix common mistakes" do
|
||||
result = Configuration.from({"paginate" => 0})
|
||||
assert_nil result["paginate"], "Expected 'paginate' to be corrected to 'nil', but was #{result["paginate"].inspect}"
|
||||
end
|
||||
|
||||
should "add default collections" do
|
||||
result = Configuration.from({})
|
||||
assert_equal result["collections"], {"posts" => {"output" => true, "permalink" => "/:categories/:year/:month/:day/:title:output_ext"}}
|
||||
end
|
||||
|
||||
should "NOT backwards-compatibilize" do
|
||||
assert Configuration.from("watch" => true)["watch"], "Expected the 'watch' key to not be removed."
|
||||
end
|
||||
end
|
||||
|
||||
context "#add_default_collections" do
|
||||
should "no-op if collections is nil" do
|
||||
result = Configuration[{"collections" => nil}].add_default_collections
|
||||
assert_nil result["collections"]
|
||||
end
|
||||
|
||||
should "turn an array into a hash" do
|
||||
result = Configuration[{"collections" => %w{methods}}].add_default_collections
|
||||
assert_instance_of Hash, result["collections"]
|
||||
assert_equal result["collections"], {"posts" => {"output" => true}, "methods" => {}}
|
||||
end
|
||||
|
||||
should "only assign collections.posts.permalink if a permalink is specified" do
|
||||
result = Configuration[{"permalink" => "pretty", "collections" => {}}].add_default_collections
|
||||
assert_equal result["collections"], {"posts" => {"output" => true, "permalink" => "/:categories/:year/:month/:day/:title/"}}
|
||||
|
||||
result = Configuration[{"permalink" => nil, "collections" => {}}].add_default_collections
|
||||
assert_equal result["collections"], {"posts" => {"output" => true}}
|
||||
end
|
||||
|
||||
should "forces posts to output" do
|
||||
result = Configuration[{"collections" => {"posts" => {"output" => false}}}].add_default_collections
|
||||
assert_equal result["collections"]["posts"]["output"], true
|
||||
end
|
||||
end
|
||||
|
||||
context "#stringify_keys" do
|
||||
setup do
|
||||
@@ -154,27 +209,27 @@ class TestConfiguration < JekyllUnitTest
|
||||
end
|
||||
context "loading configuration" do
|
||||
setup do
|
||||
@path = File.join(Dir.pwd, '_config.yml')
|
||||
@path = source_dir('_config.yml')
|
||||
@user_config = File.join(Dir.pwd, "my_config_file.yml")
|
||||
end
|
||||
|
||||
should "fire warning with no _config.yml" do
|
||||
allow(SafeYAML).to receive(:load_file).with(@path) { raise SystemCallError, "No such file or directory - #{@path}" }
|
||||
allow($stderr).to receive(:puts).with("Configuration file: none".yellow)
|
||||
assert_equal @@defaults, Jekyll.configuration({})
|
||||
assert_equal site_configuration, Jekyll.configuration(@@test_config)
|
||||
end
|
||||
|
||||
should "load configuration as hash" do
|
||||
allow(SafeYAML).to receive(:load_file).with(@path).and_return(Hash.new)
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@path}")
|
||||
assert_equal @@defaults, Jekyll.configuration({})
|
||||
assert_equal site_configuration, Jekyll.configuration(@@test_config)
|
||||
end
|
||||
|
||||
should "fire warning with bad config" do
|
||||
allow(SafeYAML).to receive(:load_file).with(@path).and_return(Array.new)
|
||||
allow($stderr).to receive(:puts).and_return(("WARNING: ".rjust(20) + "Error reading configuration. Using defaults (and options).").yellow)
|
||||
allow($stderr).to receive(:puts).and_return("Configuration file: (INVALID) #{@path}".yellow)
|
||||
assert_equal @@defaults, Jekyll.configuration({})
|
||||
assert_equal site_configuration, Jekyll.configuration(@@test_config)
|
||||
end
|
||||
|
||||
should "fire warning when user-specified config file isn't there" do
|
||||
@@ -193,8 +248,8 @@ class TestConfiguration < JekyllUnitTest
|
||||
context "loading config from external file" do
|
||||
setup do
|
||||
@paths = {
|
||||
:default => File.join(Dir.pwd, '_config.yml'),
|
||||
:other => File.join(Dir.pwd, '_config.live.yml'),
|
||||
:default => source_dir('_config.yml'),
|
||||
:other => source_dir('_config.live.yml'),
|
||||
:toml => source_dir('_config.dev.toml'),
|
||||
:empty => ""
|
||||
}
|
||||
@@ -203,24 +258,31 @@ class TestConfiguration < JekyllUnitTest
|
||||
should "load default plus posts config if no config_file is set" do
|
||||
allow(SafeYAML).to receive(:load_file).with(@paths[:default]).and_return({})
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:default]}")
|
||||
assert_equal @@defaults, Jekyll.configuration({})
|
||||
assert_equal site_configuration, Jekyll.configuration(@@test_config)
|
||||
end
|
||||
|
||||
should "load different config if specified" do
|
||||
allow(SafeYAML).to receive(:load_file).with(@paths[:other]).and_return({"baseurl" => "http://wahoo.dev"})
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}")
|
||||
assert_equal Utils.deep_merge_hashes(@@defaults, { "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] })
|
||||
Jekyll.configuration({ "config" => @paths[:other] })
|
||||
assert_equal \
|
||||
site_configuration({ "baseurl" => "http://wahoo.dev" }),
|
||||
Jekyll.configuration(@@test_config.merge({ "config" => @paths[:other] }))
|
||||
end
|
||||
|
||||
should "load default config if path passed is empty" do
|
||||
allow(SafeYAML).to receive(:load_file).with(@paths[:default]).and_return({})
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:default]}")
|
||||
assert_equal @@defaults, Jekyll.configuration({ "config" => @paths[:empty] })
|
||||
assert_equal \
|
||||
site_configuration,
|
||||
Jekyll.configuration(@@test_config.merge({ "config" => [@paths[:empty]] }))
|
||||
end
|
||||
|
||||
should "successfully load a TOML file" do
|
||||
Jekyll.logger.log_level = :warn
|
||||
assert_equal @@defaults.clone.merge({ "baseurl" => "/you-beautiful-blog-you", "title" => "My magnificent site, wut" }), Jekyll.configuration({ "config" => [@paths[:toml]] })
|
||||
assert_equal \
|
||||
site_configuration({ "baseurl" => "/you-beautiful-blog-you", "title" => "My magnificent site, wut" }),
|
||||
Jekyll.configuration(@@test_config.merge({ "config" => [@paths[:toml]] }))
|
||||
Jekyll.logger.log_level = :info
|
||||
end
|
||||
|
||||
@@ -233,7 +295,9 @@ class TestConfiguration < JekyllUnitTest
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:default]}")
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}")
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:toml]}")
|
||||
assert_equal @@defaults, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other], @paths[:toml]] })
|
||||
assert_equal \
|
||||
site_configuration,
|
||||
Jekyll.configuration(@@test_config.merge({ "config" => [@paths[:default], @paths[:other], @paths[:toml]] }))
|
||||
end
|
||||
|
||||
should "load multiple config files and last config should win" do
|
||||
@@ -241,7 +305,63 @@ class TestConfiguration < JekyllUnitTest
|
||||
allow(SafeYAML).to receive(:load_file).with(@paths[:other]).and_return({"baseurl" => "http://wahoo.dev"})
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:default]}")
|
||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}")
|
||||
assert_equal Utils.deep_merge_hashes(@@defaults, { "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] })
|
||||
assert_equal \
|
||||
site_configuration({ "baseurl" => "http://wahoo.dev" }),
|
||||
Jekyll.configuration(@@test_config.merge({ "config" => [@paths[:default], @paths[:other]] }))
|
||||
end
|
||||
end
|
||||
|
||||
context "#add_default_collections" do
|
||||
should "not do anything if collections is nil" do
|
||||
conf = Configuration[default_configuration].tap {|c| c['collections'] = nil }
|
||||
assert_equal conf.add_default_collections, conf
|
||||
assert_nil conf.add_default_collections['collections']
|
||||
end
|
||||
|
||||
should "converts collections to a hash if an array" do
|
||||
conf = Configuration[default_configuration].tap {|c| c['collections'] = ['docs'] }
|
||||
assert_equal conf.add_default_collections, conf.merge({
|
||||
"collections" => {
|
||||
"docs" => {},
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext"
|
||||
}}})
|
||||
end
|
||||
|
||||
should "force collections.posts.output = true" do
|
||||
conf = Configuration[default_configuration].tap {|c| c['collections'] = {'posts' => {'output' => false}} }
|
||||
assert_equal conf.add_default_collections, conf.merge({
|
||||
"collections" => {
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext"
|
||||
}}})
|
||||
end
|
||||
|
||||
should "set collections.posts.permalink if it's not set" do
|
||||
conf = Configuration[default_configuration]
|
||||
assert_equal conf.add_default_collections, conf.merge({
|
||||
"collections" => {
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext"
|
||||
}}})
|
||||
end
|
||||
|
||||
should "leave collections.posts.permalink alone if it is set" do
|
||||
posts_permalink = "/:year/:title/"
|
||||
conf = Configuration[default_configuration].tap do |c|
|
||||
c['collections'] = {
|
||||
"posts" => { "permalink" => posts_permalink }
|
||||
}
|
||||
end
|
||||
assert_equal conf.add_default_collections, conf.merge({
|
||||
"collections" => {
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => posts_permalink
|
||||
}}})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -122,7 +122,7 @@ class TestDocument < JekyllUnitTest
|
||||
@site = fixture_site({
|
||||
"collections" => ["slides"],
|
||||
"defaults" => [{
|
||||
"scope"=> {"path"=>"slides", "type"=>"slides"},
|
||||
"scope"=> {"path"=>"_slides", "type"=>"slides"},
|
||||
"values"=> {
|
||||
"nested"=> {
|
||||
"key"=>"value123",
|
||||
|
||||
36
test/test_excerpt_drop.rb
Normal file
36
test/test_excerpt_drop.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
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']
|
||||
@excerpt_drop = @excerpt.to_liquid
|
||||
end
|
||||
|
||||
should "have the right thing" do
|
||||
assert @doc.is_a? Jekyll::Document
|
||||
assert @doc_drop.is_a? Jekyll::Drops::DocumentDrop
|
||||
assert @excerpt.is_a? Jekyll::Excerpt
|
||||
assert @excerpt_drop.is_a? Jekyll::Drops::ExcerptDrop
|
||||
end
|
||||
|
||||
should "not have an excerpt" do
|
||||
assert_nil @excerpt.data['excerpt']
|
||||
assert @excerpt_drop.class.invokable? 'excerpt'
|
||||
assert_nil @excerpt_drop['excerpt']
|
||||
end
|
||||
|
||||
should "inherit the layout for the drop but not the excerpt" do
|
||||
assert_nil @excerpt.data['layout']
|
||||
assert_equal @excerpt_drop['layout'], @doc_drop['layout']
|
||||
end
|
||||
|
||||
should "inherit values from the document" do
|
||||
assert_equal @excerpt_drop.keys.sort, @doc_drop.keys.sort
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -4,9 +4,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
|
||||
context "A site with full front matter defaults" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"path" => "contacts",
|
||||
@@ -16,7 +14,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages.find { |page| page.relative_path == "/contacts/bar.html" }
|
||||
@not_affected = @site.pages.find { |page| page.relative_path == "about.html" }
|
||||
@@ -30,9 +28,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
|
||||
context "A site with front matter type pages and an extension" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"path" => "index.html"
|
||||
@@ -41,7 +37,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
})
|
||||
|
||||
@site.process
|
||||
@affected = @site.pages.find { |page| page.relative_path == "index.html" }
|
||||
@@ -56,9 +52,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
|
||||
context "A site with front matter defaults with no type" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"path" => "win"
|
||||
@@ -67,7 +61,8 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
})
|
||||
|
||||
@site.process
|
||||
@affected = @site.posts.docs.find { |page| page.relative_path =~ /win\// }
|
||||
@not_affected = @site.pages.find { |page| page.relative_path == "about.html" }
|
||||
@@ -81,9 +76,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
|
||||
context "A site with front matter defaults with no path and a deprecated type" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"type" => "page"
|
||||
@@ -92,7 +85,8 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
})
|
||||
|
||||
@site.process
|
||||
@affected = @site.pages
|
||||
@not_affected = @site.posts.docs
|
||||
@@ -106,9 +100,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
|
||||
context "A site with front matter defaults with no path" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"type" => "pages"
|
||||
@@ -117,7 +109,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages
|
||||
@not_affected = @site.posts.docs
|
||||
@@ -131,9 +123,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
|
||||
context "A site with front matter defaults with no path or type" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
},
|
||||
@@ -141,7 +131,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages
|
||||
@not_affected = @site.posts
|
||||
@@ -155,15 +145,13 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
||||
|
||||
context "A site with front matter defaults with no scope" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages
|
||||
@not_affected = @site.posts
|
||||
|
||||
@@ -4,9 +4,8 @@ class TestGeneratedSite < JekyllUnitTest
|
||||
context "generated sites" do
|
||||
setup do
|
||||
clear_dest
|
||||
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
|
||||
|
||||
@site = fixture_site(config)
|
||||
@site = fixture_site
|
||||
@site.process
|
||||
@index = File.read(dest_dir('index.html'))
|
||||
end
|
||||
@@ -64,8 +63,7 @@ OUTPUT
|
||||
context "generating limited posts" do
|
||||
setup do
|
||||
clear_dest
|
||||
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5})
|
||||
@site = fixture_site(config)
|
||||
@site = fixture_site("limit_posts" => 5)
|
||||
@site.process
|
||||
@index = File.read(dest_dir('index.html'))
|
||||
end
|
||||
@@ -77,24 +75,13 @@ OUTPUT
|
||||
should "ensure limit posts is 0 or more" do
|
||||
assert_raises ArgumentError do
|
||||
clear_dest
|
||||
config = Jekyll::Configuration::DEFAULTS.merge({
|
||||
'source' => source_dir,
|
||||
'destination' => dest_dir,
|
||||
'limit_posts' => -1
|
||||
})
|
||||
@site = fixture_site(config)
|
||||
@site = fixture_site("limit_posts" => -1)
|
||||
end
|
||||
end
|
||||
|
||||
should "acceptable limit post is 0" do
|
||||
clear_dest
|
||||
config = Jekyll::Configuration::DEFAULTS.merge({
|
||||
'source' => source_dir,
|
||||
'destination' => dest_dir,
|
||||
'limit_posts' => 0
|
||||
})
|
||||
|
||||
assert Site.new(config), "Couldn't create a site with the given limit_posts."
|
||||
assert fixture_site("limit_posts" => 0), "Couldn't create a site with limit_posts=0."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,42 +3,42 @@ require 'helper'
|
||||
class TestSite < JekyllUnitTest
|
||||
context "configuring sites" do
|
||||
should "have an array for plugins by default" do
|
||||
site = Site.new(Jekyll::Configuration::DEFAULTS)
|
||||
site = Site.new default_configuration
|
||||
assert_equal [File.join(Dir.pwd, '_plugins')], site.plugins
|
||||
end
|
||||
|
||||
should "look for plugins under the site directory by default" do
|
||||
site = Site.new(site_configuration)
|
||||
assert_equal [File.join(source_dir, '_plugins')], site.plugins
|
||||
assert_equal [source_dir('_plugins')], site.plugins
|
||||
end
|
||||
|
||||
should "have an array for plugins if passed as a string" do
|
||||
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => '/tmp/plugins'}))
|
||||
site = Site.new(site_configuration({ 'plugins_dir' => '/tmp/plugins' }))
|
||||
assert_equal ['/tmp/plugins'], site.plugins
|
||||
end
|
||||
|
||||
should "have an array for plugins if passed as an array" do
|
||||
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => ['/tmp/plugins', '/tmp/otherplugins']}))
|
||||
site = Site.new(site_configuration({ 'plugins_dir' => ['/tmp/plugins', '/tmp/otherplugins'] }))
|
||||
assert_equal ['/tmp/plugins', '/tmp/otherplugins'], site.plugins
|
||||
end
|
||||
|
||||
should "have an empty array for plugins if nothing is passed" do
|
||||
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => []}))
|
||||
site = Site.new(site_configuration({ 'plugins_dir' => [] }))
|
||||
assert_equal [], site.plugins
|
||||
end
|
||||
|
||||
should "have an empty array for plugins if nil is passed" do
|
||||
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => nil}))
|
||||
assert_equal [], site.plugins
|
||||
should "have the default for plugins if nil is passed" do
|
||||
site = Site.new(site_configuration({ 'plugins_dir' => nil }))
|
||||
assert_equal [source_dir('_plugins')], site.plugins
|
||||
end
|
||||
|
||||
should "expose default baseurl" do
|
||||
site = Site.new(Jekyll::Configuration::DEFAULTS)
|
||||
site = Site.new(default_configuration)
|
||||
assert_equal Jekyll::Configuration::DEFAULTS['baseurl'], site.baseurl
|
||||
end
|
||||
|
||||
should "expose baseurl passed in from config" do
|
||||
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'baseurl' => '/blog'}))
|
||||
site = Site.new(site_configuration({ 'baseurl' => '/blog' }))
|
||||
assert_equal '/blog', site.baseurl
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user