Merge pull request #1557 from mojombo/require-gems-plugins

Add `gems` for better plugin management
This commit is contained in:
Matt Rogers 2013-10-23 07:39:43 -07:00
commit 23ad7fa4bd
6 changed files with 21 additions and 8 deletions

View File

@ -225,3 +225,11 @@ Feature: Site configuration
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html" And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html" And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
Scenario: Add a gem-based plugin
Given I have an "index.html" file that contains "Whatever"
And I have a configuration file with "gems" set to "[jekyll_test_plugin]"
When I run jekyll
Then the _site directory should exist
And I should see "Whatever" in "_site/index.html"
And I should see "this is a test" in "_site/test.txt"

View File

@ -47,6 +47,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1") s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1")
s.add_development_dependency('coveralls', "~> 0.7.0") s.add_development_dependency('coveralls', "~> 0.7.0")
s.add_development_dependency('activesupport', '~> 3.2.13') s.add_development_dependency('activesupport', '~> 3.2.13')
s.add_development_dependency('jekyll_test_plugin')
# = MANIFEST = # = MANIFEST =
s.files = %w[ s.files = %w[

View File

@ -12,6 +12,7 @@ module Jekyll
'layouts' => '_layouts', 'layouts' => '_layouts',
'data_source' => '_data', 'data_source' => '_data',
'keep_files' => ['.git','.svn'], 'keep_files' => ['.git','.svn'],
'gems' => [],
'timezone' => nil, # use the local timezone 'timezone' => nil, # use the local timezone
@ -26,7 +27,7 @@ module Jekyll
'pygments' => true, 'pygments' => true,
'relative_permalinks' => true, # backwards-compatibility with < 1.0 'relative_permalinks' => true, # backwards-compatibility with < 1.0
# will be set to false once 1.1 hits # will be set to false once 2.0 hits
'markdown' => 'maruku', 'markdown' => 'maruku',
'permalink' => 'date', 'permalink' => 'date',

View File

@ -3,7 +3,7 @@ module Jekyll
attr_accessor :config, :layouts, :posts, :pages, :static_files, attr_accessor :config, :layouts, :posts, :pages, :static_files,
:categories, :exclude, :include, :source, :dest, :lsi, :pygments, :categories, :exclude, :include, :source, :dest, :lsi, :pygments,
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, :permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts,
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts :show_drafts, :keep_files, :baseurl, :data, :file_read_opts, :gems
attr_accessor :converters, :generators attr_accessor :converters, :generators
@ -13,7 +13,7 @@ module Jekyll
def initialize(config) def initialize(config)
self.config = config.clone self.config = config.clone
%w[safe lsi pygments baseurl exclude include future show_drafts limit_posts keep_files].each do |opt| %w[safe lsi pygments baseurl exclude include future show_drafts limit_posts keep_files gems].each do |opt|
self.send("#{opt}=", config[opt]) self.send("#{opt}=", config[opt])
end end
@ -77,6 +77,9 @@ module Jekyll
require f require f
end end
end end
self.gems.each do |gem|
require gem
end
end end
self.converters = instantiate_subclasses(Jekyll::Converter) self.converters = instantiate_subclasses(Jekyll::Converter)
@ -388,7 +391,7 @@ module Jekyll
def relative_permalinks_deprecation_method def relative_permalinks_deprecation_method
if config['relative_permalinks'] && has_relative_page? if config['relative_permalinks'] && has_relative_page?
$stderr.puts # Places newline after "Generating..." $stderr.puts # Places newline after "Generating..."
Jekyll.logger.warn "Deprecation:", "Starting in 1.1, permalinks for pages" + Jekyll.logger.warn "Deprecation:", "Starting in 2.0, permalinks for pages" +
" in subfolders must be relative to the" + " in subfolders must be relative to the" +
" site source directory, not the parent" + " site source directory, not the parent" +
" directory. Check http://jekyllrb.com/docs/upgrading/"+ " directory. Check http://jekyllrb.com/docs/upgrading/"+

View File

@ -42,7 +42,7 @@ rebuild each time a file changes, just add the `--watch` flag at the end.
### Absolute Permalinks ### Absolute Permalinks
In Jekyll v1.0, we introduced absolute permalinks for pages in subdirectories. In Jekyll v1.0, we introduced absolute permalinks for pages in subdirectories.
Until v1.1, it is **opt-in**. Starting with v1.1, however, absolute permalinks Until v2.0, it is **opt-in**. Starting with v2.0, however, absolute permalinks
will become **opt-out**, meaning Jekyll will default to using absolute permalinks will become **opt-out**, meaning Jekyll will default to using absolute permalinks
instead of relative permalinks. instead of relative permalinks.
@ -50,9 +50,9 @@ instead of relative permalinks.
* To continue using relative permalinks, set `relative_permalinks: true` in your configuration file. * To continue using relative permalinks, set `relative_permalinks: true` in your configuration file.
<div class="note warning" id="absolute-permalinks-warning"> <div class="note warning" id="absolute-permalinks-warning">
<h5 markdown="1">Absolute permalinks will be default in v1.1 and on</h5> <h5 markdown="1">Absolute permalinks will be default in v2.0 and on</h5>
<p markdown="1"> <p markdown="1">
Starting with Jekyll v1.1.0, `relative_permalinks` will default to `false`, Starting with Jekyll v2.0, `relative_permalinks` will default to `false`,
meaning all pages will be built using the absolute permalink behaviour. meaning all pages will be built using the absolute permalink behaviour.
The switch will still exist until v2.0. The switch will still exist until v2.0.
</p> </p>