Ok handle the plugins_path stuff in the PluginManager.
This commit is contained in:
parent
4a4c8846f4
commit
1863057b7e
|
@ -52,10 +52,8 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def require_plugin_files
|
def require_plugin_files
|
||||||
# If safe mode is off, load in any Ruby files under the plugins
|
|
||||||
# directory.
|
|
||||||
unless site.safe
|
unless site.safe
|
||||||
site.plugins.each do |plugins|
|
plugins_path.each do |plugins|
|
||||||
Dir[File.join(plugins, "**", "*.rb")].sort.each do |f|
|
Dir[File.join(plugins, "**", "*.rb")].sort.each do |f|
|
||||||
require f
|
require f
|
||||||
end
|
end
|
||||||
|
@ -63,5 +61,16 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Setup the plugin search path
|
||||||
|
#
|
||||||
|
# Returns an Array of plugin search paths
|
||||||
|
def plugins_path
|
||||||
|
if (site.config['plugins'] == Jekyll::Configuration::DEFAULTS['plugins'])
|
||||||
|
[Jekyll.sanitized_path(site.source, site.config['plugins'])]
|
||||||
|
else
|
||||||
|
Array(site.config['plugins']).map { |d| File.expand_path(d) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,8 @@ module Jekyll
|
||||||
attr_accessor :config, :layouts, :posts, :pages, :static_files,
|
attr_accessor :config, :layouts, :posts, :pages, :static_files,
|
||||||
:exclude, :include, :source, :dest, :lsi, :highlighter,
|
:exclude, :include, :source, :dest, :lsi, :highlighter,
|
||||||
:permalink_style, :time, :future, :safe, :plugins, :limit_posts,
|
:permalink_style, :time, :future, :safe, :plugins, :limit_posts,
|
||||||
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts, :gems
|
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts, :gems,
|
||||||
|
:plugin_manager
|
||||||
|
|
||||||
attr_accessor :converters, :generators
|
attr_accessor :converters, :generators
|
||||||
|
|
||||||
|
@ -19,9 +20,11 @@ module Jekyll
|
||||||
|
|
||||||
self.source = File.expand_path(config['source'])
|
self.source = File.expand_path(config['source'])
|
||||||
self.dest = File.expand_path(config['destination'])
|
self.dest = File.expand_path(config['destination'])
|
||||||
self.plugins = plugins_path(config['plugins'])
|
|
||||||
self.permalink_style = config['permalink'].to_sym
|
self.permalink_style = config['permalink'].to_sym
|
||||||
|
|
||||||
|
self.plugin_manager = Jekyll::PluginManager.new(self)
|
||||||
|
self.plugins = plugin_manager.plugins_path
|
||||||
|
|
||||||
self.file_read_opts = {}
|
self.file_read_opts = {}
|
||||||
self.file_read_opts[:encoding] = config['encoding'] if config['encoding']
|
self.file_read_opts[:encoding] = config['encoding'] if config['encoding']
|
||||||
|
|
||||||
|
@ -63,7 +66,7 @@ module Jekyll
|
||||||
def setup
|
def setup
|
||||||
ensure_not_in_dest
|
ensure_not_in_dest
|
||||||
|
|
||||||
Jekyll::PluginManager.new(self).conscientious_require
|
plugin_manager.conscientious_require
|
||||||
|
|
||||||
self.converters = instantiate_subclasses(Jekyll::Converter)
|
self.converters = instantiate_subclasses(Jekyll::Converter)
|
||||||
self.generators = instantiate_subclasses(Jekyll::Generator)
|
self.generators = instantiate_subclasses(Jekyll::Generator)
|
||||||
|
@ -80,19 +83,6 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: Setup the plugin search path
|
|
||||||
#
|
|
||||||
# path_from_site - the plugin path from the Site configuration
|
|
||||||
#
|
|
||||||
# Returns an Array of plugin search paths
|
|
||||||
def plugins_path(path_from_site)
|
|
||||||
if (path_from_site == Jekyll::Configuration::DEFAULTS['plugins'])
|
|
||||||
[Jekyll.sanitized_path(source, path_from_site)]
|
|
||||||
else
|
|
||||||
Array(path_from_site).map { |d| File.expand_path(d) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Read Site data from disk and load it into internal data structures.
|
# Read Site data from disk and load it into internal data structures.
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
|
|
Loading…
Reference in New Issue