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'

+
+
Installing 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. +

+
+ ### User and Organization Pages User and organization pages live in a special GitHub repository dedicated to diff --git a/site/_docs/windows.md b/site/_docs/windows.md index ec98dcdeda0..ea4c0359f58 100644 --- a/site/_docs/windows.md +++ b/site/_docs/windows.md @@ -10,12 +10,14 @@ knowledge and lessons that have been unearthed by Windows users. ## Installation -Julian Thilo has written up instructions to get -[Jekyll running on Windows][windows-installation] and it seems to work for most -people. The instructions were written for Ruby 2.0.0, but should work for later -versions [prior to 2.2][hitimes-issue]. +A quick way to install Jekyll is to follow the [installation instructions by David Burela](https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/): + + 1. Install a package manager for Windows called [Chocolatey](https://chocolatey.org/install) + 2. Install Ruby via Chocolatey: `choco install ruby -y` + 3. Reopen a command prompt and install Jekyll: `gem install jekyll` -Alternatively David Burela has written instructions on [how to install Jekyll via Chocolatey with 3 command prompt entries](https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/). +For a more conventional way of installing Jekyll you can follow the [installation instruction by Julian Thilo][windows-installation]. The instructions were written for Ruby 2.0.0, but should work for later +versions [prior to 2.2][hitimes-issue]. ## Encoding @@ -44,3 +46,74 @@ with Windows. Add the following to the Gemfile for your site: {% highlight ruby %} gem 'wdm', '~> 0.1.0' if Gem.win_platform? {% endhighlight %} + +### How to install github-pages + +This section is part of an article written by [Jens Willmer][jwillmerPost]. To follow the instructions you need to have [Chocolatey][] installed on your system. If you already have a version of Ruby installed you need to uninstall it before you can continue. + +#### Install Ruby and Ruby development kit + +Open a command prompt and execute the following commands: + + * `choco install ruby -version 2.2.4` + * `choco install ruby2.devkit` - _needed for compilation of json gem_ + +#### Configure Ruby development kit + +The development kit did not set the environment path for Ruby so we need to do it. + + * Open command prompt in `C:\tools\DevKit2` + * Execute `ruby dk.rb init` to create a file called `config.yml` + * Edit the `config.yml` file and include the path to Ruby `- C:/tools/ruby22` + * Execute the following command to set the path: `ruby dk.rb install` + +#### Nokogiri gem installation + +This gem is also needed in the github-pages and to get it running on Windows x64 we have to install a few things. + + +**Note:** In the current [pre release][nokogiriFails] it works out of the box with Windows x64 but this version is not referenced in the github-pages. + + +`cinst -Source "https://go.microsoft.com/fwlink/?LinkID=230477" libxml2`{:.language-ruby} + +`cinst -Source "https://go.microsoft.com/fwlink/?LinkID=230477" libxslt`{:.language-ruby} + +`cinst -Source "https://go.microsoft.com/fwlink/?LinkID=230477" libiconv`{:.language-ruby} + +```language-ruby + gem install nokogiri --^ + --with-xml2-include=C:\Chocolatey\lib\libxml2.2.7.8.7\build\native\include^ + --with-xml2-lib=C:\Chocolatey\lib\libxml2.redist.2.7.8.7\build\native\bin\v110\x64\Release\dynamic\cdecl^ + --with-iconv-include=C:\Chocolatey\lib\libiconv.1.14.0.11\build\native\include^ + --with-iconv-lib=C:\Chocolatey\lib\libiconv.redist.1.14.0.11\build\native\bin\v110\x64\Release\dynamic\cdecl^ + --with-xslt-include=C:\Chocolatey\lib\libxslt.1.1.28.0\build\native\include^ + --with-xslt-lib=C:\Chocolatey\lib\libxslt.redist.1.1.28.0\build\native\bin\v110\x64\Release\dynamic +``` + +#### Install github-pages + + * Open command prompt and install [Bundler][]: `gem install bundler` + * Create a file called `Gemfile` without any extension in your root directory of your blog + * Copy & past the two lines into the file: + + +```language-ruby +source 'http://rubygems.org' +gem 'github-pages' +``` + + * **Note:** We use an unsecure connection because SSL throws exceptions in the version of Ruby + * Open a command prompt and install github-pages: `bundle install` + + +After this process you should have github-pages installed on your system and you can host your blog again with `jekyll s`. \\ +There will be a warning on startup that you should include `gem 'wdm', '>= 0.1.0' if Gem.win_platform?` to your `Gemfile` but I could not get `jekyll s` working if I include that line so for the moment I ignore that warning. + +In the future the installation process of the github-pages should be as simple as the setup of the blog. But as long as the new version of the Nokogiri ([v1.6.8][nokogiriReleases]) is not stable and referenced, it is work to get it up and running on Windows. + +[jwillmerPost]: http://jwillmer.de/blog/tutorial/how-to-install-jekyll-and-pages-gem-on-windows-10-x46 "Installation instructions by Jens Willmer" +[Chocolatey]: https://chocolatey.org/install "Package manager for Windows" +[Bundler]: http://bundler.io/ "Ruby Dependencie Manager" +[nokogiriReleases]: https://github.com/sparklemotion/nokogiri/releases "Nokogiri Releases" +[nokogiriFails]: https://github.com/sparklemotion/nokogiri/issues/1456#issuecomment-206481794 "Nokogiri fails to install on Ruby 2.3 for Windows" diff --git a/site/_posts/2016-06-03-update-on-jekyll-s-google-summer-of-code-projects.markdown b/site/_posts/2016-06-03-update-on-jekyll-s-google-summer-of-code-projects.markdown new file mode 100644 index 00000000000..0f4ce2de4d7 --- /dev/null +++ b/site/_posts/2016-06-03-update-on-jekyll-s-google-summer-of-code-projects.markdown @@ -0,0 +1,19 @@ +--- +layout: news_item +title: "Jekyll's Google Summer of Code Project: The CMS You Always Wanted" +date: "2016-06-03 13:21:02 -0700" +author: parkr +categories: [community] +--- + +This year, Jekyll applied to be a part of [Google Summer of Code](https://summerofcode.withgoogle.com/how-it-works/). Students were able to propose any project related to Jekyll. With a gracious sponsorship from GitHub and the participation of myself, @benbalter and @jldec, Jekyll was able to accept two students for the 2016 season, @mertkahyaoglu and @rush-skills. + +These students are working on a project that fills a huge need for the community: _a graphical solution for managing your site's content._ Current plans include a fully-integrated admin which spins up when you run jekyll serve and provides a friendly web interface for creating and editing your content. The server and web interface will speak a common HTTP interface so either piece could be switched out for, e.g. a server which writes directly to a repository on GitHub. + +The strength of text files as the storage medium for content has been part of Jekyll's success. [Our homepage](/) lauds the absence of a traditional SQL database when using Jekyll – your content should be what demands your time, not pesky database downtime. Unfortunately, understanding of the structure of a Jekyll site takes some work, enough that for some users, it's prohibitive to using Jekyll to accomplish their publishing goals. + +Mert and Ankur both applied to take on this challenge and agreed to split the project, one taking on the web interface and the other taking on the backend. We're very excited to see a fully-functional CMS for Jekyll at the end of the summer produced by these excellent community members, and we hope you'll join us in cheering them on and sharing our gratitude for all their hard work. + +Thanks, as always, for being part of such a wonderful community that made this all possible. I'm honored to work with each of you to create something folks all around the globe find a joy to use. I look forward to our continued work to move Jekyll forward. + +As always, Happy Jekylling!