Create an instance of this class.
site - the instance of Jekyll::Site we’re concerned with
Returns nothing
# File lib/jekyll/plugin_manager.rb, line 10 def initialize(site) @site = site end
Require all the plugins which are allowed.
Returns nothing
# File lib/jekyll/plugin_manager.rb, line 17 def conscientious_require require_plugin_files require_gems end
Check whether a gem plugin is allowed to be used during this build.
gem_name - the name of the gem
Returns true if the gem name is in the whitelist or if the site is not
in safe mode.
# File lib/jekyll/plugin_manager.rb, line 39 def plugin_allowed?(gem_name) !site.safe || whitelist.include?(gem_name) end
Public: Setup the plugin search path
Returns an Array of plugin search paths
# File lib/jekyll/plugin_manager.rb, line 67 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
Require each of the gem plugins specified.
Returns nothing.
# File lib/jekyll/plugin_manager.rb, line 25 def require_gems site.gems.each do |gem| if plugin_allowed?(gem) require gem end end end
Require all .rb files if safe mode is off
Returns nothing.
# File lib/jekyll/plugin_manager.rb, line 54 def require_plugin_files unless site.safe plugins_path.each do |plugins| Dir[File.join(plugins, "**", "*.rb")].sort.each do |f| require f end end end end
Generated with the Darkfish Rdoc Generator 2.