Rubocop cleanup for lib/jekyll/plugin_manager.rb
This commit is contained in:
parent
3a04093e51
commit
65e78b3280
|
@ -21,7 +21,6 @@ AllCops:
|
||||||
- lib/jekyll/layout.rb
|
- lib/jekyll/layout.rb
|
||||||
- lib/jekyll/liquid_renderer/table.rb
|
- lib/jekyll/liquid_renderer/table.rb
|
||||||
- lib/jekyll/liquid_renderer.rb
|
- lib/jekyll/liquid_renderer.rb
|
||||||
- lib/jekyll/plugin_manager.rb
|
|
||||||
- lib/jekyll/reader.rb
|
- lib/jekyll/reader.rb
|
||||||
- lib/jekyll/readers/layout_reader.rb
|
- lib/jekyll/readers/layout_reader.rb
|
||||||
- lib/jekyll/readers/page_reader.rb
|
- lib/jekyll/readers/page_reader.rb
|
||||||
|
|
|
@ -24,7 +24,9 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def require_gems
|
def require_gems
|
||||||
Jekyll::External.require_with_graceful_fail(site.gems.select { |gem| plugin_allowed?(gem) })
|
Jekyll::External.require_with_graceful_fail(
|
||||||
|
site.gems.select { |gem| plugin_allowed?(gem) }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.require_from_bundler
|
def self.require_from_bundler
|
||||||
|
@ -33,7 +35,8 @@ module Jekyll
|
||||||
|
|
||||||
Bundler.setup
|
Bundler.setup
|
||||||
required_gems = Bundler.require(:jekyll_plugins)
|
required_gems = Bundler.require(:jekyll_plugins)
|
||||||
Jekyll.logger.debug("PluginManager:", "Required #{required_gems.map(&:name).join(', ')}")
|
message = "Required #{required_gems.map(&:name).join(", ")}"
|
||||||
|
Jekyll.logger.debug("PluginManager:", message)
|
||||||
ENV["JEKYLL_NO_BUNDLER_REQUIRE"] = "true"
|
ENV["JEKYLL_NO_BUNDLER_REQUIRE"] = "true"
|
||||||
|
|
||||||
true
|
true
|
||||||
|
@ -57,7 +60,7 @@ module Jekyll
|
||||||
# Returns an array of strings, each string being the name of a gem name
|
# Returns an array of strings, each string being the name of a gem name
|
||||||
# that is allowed to be used.
|
# that is allowed to be used.
|
||||||
def whitelist
|
def whitelist
|
||||||
@whitelist ||= Array[site.config['whitelist']].flatten
|
@whitelist ||= Array[site.config["whitelist"]].flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
# Require all .rb files if safe mode is off
|
# Require all .rb files if safe mode is off
|
||||||
|
@ -76,16 +79,17 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns an Array of plugin search paths
|
# Returns an Array of plugin search paths
|
||||||
def plugins_path
|
def plugins_path
|
||||||
if site.config['plugins_dir'] == Jekyll::Configuration::DEFAULTS['plugins_dir']
|
if site.config["plugins_dir"] == Jekyll::Configuration::DEFAULTS["plugins_dir"]
|
||||||
[site.in_source_dir(site.config['plugins_dir'])]
|
[site.in_source_dir(site.config["plugins_dir"])]
|
||||||
else
|
else
|
||||||
Array(site.config['plugins_dir']).map { |d| File.expand_path(d) }
|
Array(site.config["plugins_dir"]).map { |d| File.expand_path(d) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def deprecation_checks
|
def deprecation_checks
|
||||||
pagination_included = (site.config['gems'] || []).include?('jekyll-paginate') || defined?(Jekyll::Paginate)
|
pagination_included = (site.config["gems"] || []).include?("jekyll-paginate") ||
|
||||||
if site.config['paginate'] && !pagination_included
|
defined?(Jekyll::Paginate)
|
||||||
|
if site.config["paginate"] && !pagination_included
|
||||||
Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
|
Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
|
||||||
"turned on, but you haven't included the `jekyll-paginate` gem. " \
|
"turned on, but you haven't included the `jekyll-paginate` gem. " \
|
||||||
"Ensure you have `gems: [jekyll-paginate]` in your configuration file."
|
"Ensure you have `gems: [jekyll-paginate]` in your configuration file."
|
||||||
|
|
Loading…
Reference in New Issue