diff --git a/.rubocop.yml b/.rubocop.yml index fbe07db35bc..8149e36a3f7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,10 +15,7 @@ AllCops: - lib/jekyll/renderer.rb - lib/jekyll/site.rb - lib/jekyll/static_file.rb - - lib/jekyll/theme.rb - - lib/jekyll/url.rb - lib/jekyll/utils.rb - - lib/jekyll.rb - bin/**/* - benchmark/**/* - script/**/* diff --git a/Gemfile b/Gemfile index 54983415f45..253826aa58f 100644 --- a/Gemfile +++ b/Gemfile @@ -86,4 +86,5 @@ group :site do gem "jekyll-sitemap" gem "jekyll-seo-tag", "~> 1.1" gem "jekyll-avatar" + gem "jekyll-mentions" end diff --git a/History.markdown b/History.markdown index 3f63fda8262..36f579bc8b3 100644 --- a/History.markdown +++ b/History.markdown @@ -84,6 +84,8 @@ * Rubocop: Readers (#4932) * rubocop: jekyll/lib/frontmatter_defaults.rb (#4974) * rubocop: features/step_definitions.rb (#4956) + * Rubocop theme and url jekyll libs (#4959) + * Rubocop jekyll.rb (#4966) ### Site Enhancements @@ -128,6 +130,10 @@ * Corrected pagination docs for hidden: true feature (#4903) * Remove a Broken Link for Refheap Plugin (#4971) * Instructions on how to install github-gem on Windows (#4975) + * Minor tweak to fix missing apostrophne (#4962) + * Instructions on how to install github-gem on Windows (v2) (#4977) + * Fix inaccurate HTTP response header field name (#4976) + * Add post about GSoC project (#4980) ## 3.1.6 / 2016-05-19 diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 676f6e715ab..db1e40cd60b 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -6,79 +6,79 @@ # # Returns nothing. def require_all(path) - glob = File.join(File.dirname(__FILE__), path, '*.rb') + glob = File.join(File.dirname(__FILE__), path, "*.rb") Dir[glob].sort.each do |f| require f end end # rubygems -require 'rubygems' +require "rubygems" # stdlib require "pathutil" -require 'forwardable' -require 'fileutils' -require 'time' -require 'English' -require 'pathname' -require 'logger' -require 'set' +require "forwardable" +require "fileutils" +require "time" +require "English" +require "pathname" +require "logger" +require "set" # 3rd party -require 'safe_yaml/load' -require 'liquid' -require 'kramdown' -require 'colorator' +require "safe_yaml/load" +require "liquid" +require "kramdown" +require "colorator" SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll # internal requires - autoload :Cleaner, 'jekyll/cleaner' - autoload :Collection, 'jekyll/collection' - autoload :Configuration, 'jekyll/configuration' - autoload :Convertible, 'jekyll/convertible' - autoload :Deprecator, 'jekyll/deprecator' - autoload :Document, 'jekyll/document' - autoload :Draft, 'jekyll/draft' - autoload :EntryFilter, 'jekyll/entry_filter' - autoload :Errors, 'jekyll/errors' - autoload :Excerpt, 'jekyll/excerpt' - autoload :External, 'jekyll/external' - autoload :FrontmatterDefaults, 'jekyll/frontmatter_defaults' - autoload :Hooks, 'jekyll/hooks' - autoload :Layout, 'jekyll/layout' - autoload :CollectionReader, 'jekyll/readers/collection_reader' - autoload :DataReader, 'jekyll/readers/data_reader' - autoload :LayoutReader, 'jekyll/readers/layout_reader' - autoload :PostReader, 'jekyll/readers/post_reader' - autoload :PageReader, 'jekyll/readers/page_reader' - autoload :StaticFileReader, 'jekyll/readers/static_file_reader' - autoload :LogAdapter, 'jekyll/log_adapter' - autoload :Page, 'jekyll/page' - autoload :PluginManager, 'jekyll/plugin_manager' - autoload :Publisher, 'jekyll/publisher' - autoload :Reader, 'jekyll/reader' - autoload :Regenerator, 'jekyll/regenerator' - autoload :RelatedPosts, 'jekyll/related_posts' - autoload :Renderer, 'jekyll/renderer' - autoload :LiquidRenderer, 'jekyll/liquid_renderer' - autoload :Site, 'jekyll/site' - autoload :StaticFile, 'jekyll/static_file' - autoload :Stevenson, 'jekyll/stevenson' - autoload :Theme, 'jekyll/theme' - autoload :ThemeBuilder, 'jekyll/theme_builder' - autoload :URL, 'jekyll/url' - autoload :Utils, 'jekyll/utils' - autoload :VERSION, 'jekyll/version' + autoload :Cleaner, "jekyll/cleaner" + autoload :Collection, "jekyll/collection" + autoload :Configuration, "jekyll/configuration" + autoload :Convertible, "jekyll/convertible" + autoload :Deprecator, "jekyll/deprecator" + autoload :Document, "jekyll/document" + autoload :Draft, "jekyll/draft" + autoload :EntryFilter, "jekyll/entry_filter" + autoload :Errors, "jekyll/errors" + autoload :Excerpt, "jekyll/excerpt" + autoload :External, "jekyll/external" + autoload :FrontmatterDefaults, "jekyll/frontmatter_defaults" + autoload :Hooks, "jekyll/hooks" + autoload :Layout, "jekyll/layout" + autoload :CollectionReader, "jekyll/readers/collection_reader" + autoload :DataReader, "jekyll/readers/data_reader" + autoload :LayoutReader, "jekyll/readers/layout_reader" + autoload :PostReader, "jekyll/readers/post_reader" + autoload :PageReader, "jekyll/readers/page_reader" + autoload :StaticFileReader, "jekyll/readers/static_file_reader" + autoload :LogAdapter, "jekyll/log_adapter" + autoload :Page, "jekyll/page" + autoload :PluginManager, "jekyll/plugin_manager" + autoload :Publisher, "jekyll/publisher" + autoload :Reader, "jekyll/reader" + autoload :Regenerator, "jekyll/regenerator" + autoload :RelatedPosts, "jekyll/related_posts" + autoload :Renderer, "jekyll/renderer" + autoload :LiquidRenderer, "jekyll/liquid_renderer" + autoload :Site, "jekyll/site" + autoload :StaticFile, "jekyll/static_file" + autoload :Stevenson, "jekyll/stevenson" + autoload :Theme, "jekyll/theme" + autoload :ThemeBuilder, "jekyll/theme_builder" + autoload :URL, "jekyll/url" + autoload :Utils, "jekyll/utils" + autoload :VERSION, "jekyll/version" # extensions - require 'jekyll/plugin' - require 'jekyll/converter' - require 'jekyll/generator' - require 'jekyll/command' - require 'jekyll/liquid_extensions' + require "jekyll/plugin" + require "jekyll/converter" + require "jekyll/generator" + require "jekyll/command" + require "jekyll/liquid_extensions" require "jekyll/filters" class << self @@ -94,19 +94,20 @@ def env # options with anything in _config.yml, and adding the given options on top. # # override - A Hash of config directives that override any options in both - # the defaults and the config file. See Jekyll::Configuration::DEFAULTS for a + # the defaults and the config file. + # See Jekyll::Configuration::DEFAULTS for a # list of option names and their defaults. # # Returns the final configuration Hash. - def configuration(override = Hash.new) + def configuration(override = {}) config = Configuration.new - unless override.delete('skip_config_files') + unless override.delete("skip_config_files") config = config.read_config_files(config.config_files(override)) end # Merge DEFAULTS < _config.yml < override - Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |config| - set_timezone(config['timezone']) if config['timezone'] + Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |obj| + set_timezone(obj["timezone"]) if obj["timezone"] end end @@ -115,9 +116,11 @@ def configuration(override = Hash.new) # timezone - the IANA Time Zone # # Returns nothing + # rubocop:disable Style/AccessorMethodName def set_timezone(timezone) - ENV['TZ'] = timezone + ENV["TZ"] = timezone end + # rubocop:enable Style/AccessorMethodName # Public: Fetch the logger instance for this Jekyll process. # @@ -154,11 +157,11 @@ def sites def sanitized_path(base_directory, questionable_path) return base_directory if base_directory.eql?(questionable_path) - questionable_path.insert(0, '/') if questionable_path.start_with?('~') + questionable_path.insert(0, "/") if questionable_path.start_with?("~") clean_path = File.expand_path(questionable_path, "/") - clean_path.sub!(/\A\w\:\//, '/') + clean_path.sub!(%r!\A\w:/!, "/") - if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/')) + if clean_path.start_with?(base_directory.sub(%r!\A\w:/!, "/")) clean_path else File.join(base_directory, clean_path) @@ -166,17 +169,17 @@ def sanitized_path(base_directory, questionable_path) end # Conditional optimizations - Jekyll::External.require_if_present('liquid-c') + Jekyll::External.require_if_present("liquid-c") end end require "jekyll/drops/drop" require "jekyll/drops/document_drop" -require_all 'jekyll/commands' -require_all 'jekyll/converters' -require_all 'jekyll/converters/markdown' -require_all 'jekyll/drops' -require_all 'jekyll/generators' -require_all 'jekyll/tags' - -require 'jekyll-sass-converter' +require_all "jekyll/commands" +require_all "jekyll/converters" +require_all "jekyll/converters/markdown" +require_all "jekyll/drops" +require_all "jekyll/generators" +require_all "jekyll/tags" + +require "jekyll-sass-converter" diff --git a/lib/jekyll/theme.rb b/lib/jekyll/theme.rb index ed9cc68dd74..4cd2d1634c9 100644 --- a/lib/jekyll/theme.rb +++ b/lib/jekyll/theme.rb @@ -27,7 +27,7 @@ def sass_path def configure_sass return unless sass_path - require 'sass' + require "sass" Sass.load_paths << sass_path end @@ -38,7 +38,7 @@ def path_for(folder) return unless resolved_dir path = Jekyll.sanitized_path(root, resolved_dir) - path if Dir.exists?(path) + path if File.directory?(path) end def realpath_for(folder) @@ -50,7 +50,8 @@ def realpath_for(folder) def gemspec @gemspec ||= Gem::Specification.find_by_name(name) rescue Gem::LoadError - raise Jekyll::Errors::MissingDependencyException, "The #{name} theme could not be found." + raise Jekyll::Errors::MissingDependencyException, + "The #{name} theme could not be found." end end end diff --git a/lib/jekyll/url.rb b/lib/jekyll/url.rb index 09975e3d404..ba1abbd40a0 100644 --- a/lib/jekyll/url.rb +++ b/lib/jekyll/url.rb @@ -1,4 +1,4 @@ -require 'uri' +require "uri" # Public: Methods that generate a URL for a resource such as a Post or a Page. # @@ -67,10 +67,10 @@ def generate_url(template) def generate_url_from_hash(template) @placeholders.inject(template) do |result, token| - break result if result.index(':').nil? + break result if result.index(":").nil? if token.last.nil? - # Remove leading '/' to avoid generating urls with `//` - result.gsub(/\/:#{token.first}/, '') + # Remove leading "/" to avoid generating urls with `//` + result.gsub(%r!/:#{token.first}!, "") else result.gsub(/:#{token.first}/, self.class.escape_path(token.last)) end @@ -78,21 +78,21 @@ def generate_url_from_hash(template) end def generate_url_from_drop(template) - template.gsub(/:([a-z_]+)/.freeze) do |match| - replacement = @placeholders.public_send(match.sub(':'.freeze, ''.freeze)) + template.gsub(/:([a-z_]+)/) do |match| + replacement = @placeholders.public_send(match.sub(":".freeze, "".freeze)) if replacement.nil? - ''.freeze + "".freeze else self.class.escape_path(replacement) end - end.gsub(/\/\//.freeze, '/'.freeze) + end.gsub(%r!//!, "/".freeze) end # Returns a sanitized String URL, stripping "../../" and multiples of "/", # as well as the beginning "/" so we can enforce and ensure it. def sanitize_url(str) - "/" + str.gsub(/\/{2,}/, "/").gsub(/\.+\/|\A\/+/, "") + "/" + str.gsub(%r!/{2,}!, "/").gsub(%r!\.+/|\A/+!, "") end # Escapes a path to be a valid URL path segment @@ -106,7 +106,7 @@ def sanitize_url(str) # # Returns the escaped path. def self.escape_path(path) - # Because URI.escape doesn't escape '?', '[' and ']' by default, + # Because URI.escape doesn't escape "?", "[" and "]" by default, # specify unsafe string (except unreserved, sub-delims, ":", "@" and "/"). # # URI path segment is defined in RFC 3986 as follows: @@ -116,7 +116,7 @@ def self.escape_path(path) # pct-encoded = "%" HEXDIG HEXDIG # sub-delims = "!" / "$" / "&" / "'" / "(" / ")" # / "*" / "+" / "," / ";" / "=" - URI.escape(path, /[^a-zA-Z\d\-._~!$&'()*+,;=:@\/]/).encode('utf-8') + URI.escape(path, %r{[^a-zA-Z\d\-._~!$&'()*+,;=:@\/]}).encode("utf-8") end # Unescapes a URL path segment @@ -130,7 +130,7 @@ def self.escape_path(path) # # Returns the unescaped path. def self.unescape_path(path) - URI.unescape(path.encode('utf-8')) + URI.unescape(path.encode("utf-8")) end end end diff --git a/site/_config.yml b/site/_config.yml index e284a81bedd..0b69dc98089 100644 --- a/site/_config.yml +++ b/site/_config.yml @@ -32,3 +32,4 @@ gems: - jekyll-sitemap - jekyll-seo-tag - jekyll-avatar + - jekyll-mentions diff --git a/site/_docs/configuration.md b/site/_docs/configuration.md index 1ff520de481..9e828d1d082 100644 --- a/site/_docs/configuration.md +++ b/site/_docs/configuration.md @@ -383,7 +383,7 @@ before your site is served.
-## Custom WEBRick Headers +## Custom WEBrick Headers You can provide custom headers for your site by adding them to `_config.yml` @@ -397,9 +397,10 @@ webrick: ### Defaults -We only provide one default and that's a Content-Type header that disables -caching in development so that you don't have to fight with Chrome's aggressive -caching when you are in development mode. +We provide by default `Content-Type` and `Cache-Control` response headers: one +dynamic in order to specify the nature of the data being served, the other +static in order to disable caching so that you don't have to fight with Chrome's +aggressive caching when you are in development mode. ## Specifying a Jekyll environment at build time @@ -462,7 +463,7 @@ defaults: -Here, we are scoping the `values` to any file that exists in the scopes path. Since the path is set as an empty string, it will apply to **all files** in your project. You probably don't want to set a layout on every file in your project - like css files, for example - so you can also specify a `type` value under the `scope` key. +Here, we are scoping the `values` to any file that exists in the path `scope`. Since the path is set as an empty string, it will apply to **all files** in your project. You probably don't want to set a layout on every file in your project - like css files, for example - so you can also specify a `type` value under the `scope` key. {% highlight yaml %} defaults: diff --git a/site/_docs/github-pages.md b/site/_docs/github-pages.md index b67d4873d1b..b4a0b02ecd4 100644 --- a/site/_docs/github-pages.md +++ b/site/_docs/github-pages.md @@ -81,6 +81,16 @@ gem 'github-pages' +github-pages
gem on Windows
+ While Windows is not officially supported, it is possible
+ to install github-pages
gem on Windows.
+ Special instructions can be found on our
+ Windows-specific docs page.
+