Skip to content

Commit

Permalink
Merge pull request #1557 from mojombo/require-gems-plugins
Browse files Browse the repository at this point in the history
Add `gems` for better plugin management
  • Loading branch information
mattr- committed Oct 23, 2013
2 parents 58ae8bc + 6945996 commit 23ad7fa
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,2 +1,2 @@
source 'https://rubygems.org'
gemspec
gemspec
8 changes: 8 additions & 0 deletions features/site_configuration.feature
Expand Up @@ -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 "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"

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"
1 change: 1 addition & 0 deletions jekyll.gemspec
Expand Up @@ -47,6 +47,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1")
s.add_development_dependency('coveralls', "~> 0.7.0")
s.add_development_dependency('activesupport', '~> 3.2.13')
s.add_development_dependency('jekyll_test_plugin')

# = MANIFEST =
s.files = %w[
Expand Down
3 changes: 2 additions & 1 deletion lib/jekyll/configuration.rb
Expand Up @@ -12,6 +12,7 @@ class Configuration < Hash
'layouts' => '_layouts',
'data_source' => '_data',
'keep_files' => ['.git','.svn'],
'gems' => [],

'timezone' => nil, # use the local timezone

Expand All @@ -26,7 +27,7 @@ class Configuration < Hash
'pygments' => true,

'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',
'permalink' => 'date',
Expand Down
9 changes: 6 additions & 3 deletions lib/jekyll/site.rb
Expand Up @@ -3,7 +3,7 @@ class Site
attr_accessor :config, :layouts, :posts, :pages, :static_files,
:categories, :exclude, :include, :source, :dest, :lsi, :pygments,
: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

Expand All @@ -13,7 +13,7 @@ class Site
def initialize(config)
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])
end

Expand Down Expand Up @@ -77,6 +77,9 @@ def setup
require f
end
end
self.gems.each do |gem|
require gem
end
end

self.converters = instantiate_subclasses(Jekyll::Converter)
Expand Down Expand Up @@ -388,7 +391,7 @@ def aggregate_post_info(post)
def relative_permalinks_deprecation_method
if config['relative_permalinks'] && has_relative_page?
$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" +
" site source directory, not the parent" +
" directory. Check http://jekyllrb.com/docs/upgrading/"+
Expand Down
6 changes: 3 additions & 3 deletions site/docs/upgrading.md
Expand Up @@ -42,17 +42,17 @@ rebuild each time a file changes, just add the `--watch` flag at the end.
### Absolute Permalinks

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
instead of relative permalinks.

* To use absolute permalinks, set `relative_permalinks: false` 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">
<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">
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.
The switch will still exist until v2.0.
</p>
Expand Down

0 comments on commit 23ad7fa

Please sign in to comment.