Support plugins being a list of directories to scan.

This commit is contained in:
Beau Simensen 2011-11-21 21:09:39 -06:00
parent 9fbf90ce59
commit ab08acace9
1 changed files with 11 additions and 3 deletions

View File

@ -18,7 +18,13 @@ module Jekyll
self.safe = config['safe']
self.source = File.expand_path(config['source'])
self.dest = File.expand_path(config['destination'])
self.plugins = File.expand_path(config['plugins'])
self.plugins = if config['plugins'].respond_to?('each')
# If plugins is an array, process it.
config['plugins'].each { |directory| File.expand_path(directory) }
else
# Otherwise process a single entry as an array.
[File.expand_path(config['plugins'])]
end
self.lsi = config['lsi']
self.pygments = config['pygments']
self.permalink_style = config['permalink'].to_sym
@ -72,10 +78,12 @@ module Jekyll
# If safe mode is off, load in any Ruby files under the plugins
# directory.
unless self.safe
Dir[File.join(self.plugins, "**/*.rb")].each do |f|
self.plugins.each do |plugins|
Dir[File.join(plugins, "**/*.rb")].each do |f|
require f
end
end
end
self.converters = Jekyll::Converter.subclasses.select do |c|
!self.safe || c.safe