From 0f07aa0d3ebcf519877b4494237e2994fffb619d Mon Sep 17 00:00:00 2001 From: lemonez <36384768+lemonez@users.noreply.github.com> Date: Fri, 20 Aug 2021 10:26:52 -0700 Subject: [PATCH 01/10] Add YAML syntax highlighting to README.md (#237) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ef19d60..651e58b 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Redirects including a trailing slash will generate a corresponding subdirectory For example... -```text +```yaml redirect_from: - /post/123456789/my-amazing-post ``` @@ -81,7 +81,7 @@ redirect_from: While... -```text +```yaml redirect_from: - /post/123456789/my-amazing-post/ ``` @@ -96,7 +96,7 @@ These pages will contain an HTTP-REFRESH meta tag which redirect to your URL. You can also specify just **one url** like this: -```text +```yaml title: My other awesome post redirect_from: /post/123456798/ ``` From 993a507751e7e520d333921bd17d76a51a150c07 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Sun, 22 Aug 2021 12:24:09 +0530 Subject: [PATCH 02/10] Add workflow file for Continuous Integration --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..320b9c8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: Continuous Integration + +on: + pull_request: + branches: + - master + +jobs: + ci: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + name: 'Ruby ${{ matrix.ruby_version }}' + runs-on: 'ubuntu-latest' + + strategy: + fail-fast: false + matrix: + ruby_version: + - 2.5 + - 2.7 + - 3.0 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - name: "Set up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - name: Execute tests + run: bash script/test + - name: Check Style Offenses + run: bash script/fmt + - name: Test Gem build + run: bundle exec rake build + + ghp: + if: "!contains(github.event.commits[0].message, '[ci skip]')" + name: Ruby 2.7 with GitHub Pages Gem + runs-on: 'ubuntu-latest' + env: + GH_PAGES: true + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 5 + - name: "Set up Ruby 2.7" + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - name: Execute tests + run: bash script/test From e51c1417bba212df033d20594a71970fdeebb674 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 26 Aug 2021 20:25:07 +0530 Subject: [PATCH 03/10] Refactor Redirectable mixin to reduce allocations (#241) Merge pull request 241 --- lib/jekyll-redirect-from/redirectable.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/jekyll-redirect-from/redirectable.rb b/lib/jekyll-redirect-from/redirectable.rb index 741ddc4..4512a03 100644 --- a/lib/jekyll-redirect-from/redirectable.rb +++ b/lib/jekyll-redirect-from/redirectable.rb @@ -7,21 +7,15 @@ module Redirectable # Returns a string representing the relative path or URL # to which the document should be redirected def redirect_to - if to_liquid["redirect_to"].is_a?(Array) - to_liquid["redirect_to"].compact.first - else - to_liquid["redirect_to"] - end + meta_data = to_liquid["redirect_to"] + meta_data.is_a?(Array) ? meta_data.compact.first : meta_data end # Returns an array representing the relative paths to other # documents which should be redirected to this document def redirect_from - if to_liquid["redirect_from"].is_a?(Array) - to_liquid["redirect_from"].compact - else - [to_liquid["redirect_from"]].compact - end + meta_data = to_liquid["redirect_from"] + meta_data.is_a?(Array) ? meta_data.compact : [meta_data].compact end end end From 03b70baf0f2715116383cd98e051e68c7cf5b177 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Thu, 26 Aug 2021 10:55:08 -0400 Subject: [PATCH 04/10] Update history to reflect merge of #241 [ci skip] --- History.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/History.markdown b/History.markdown index 39d7f89..165de26 100644 --- a/History.markdown +++ b/History.markdown @@ -9,6 +9,10 @@ * fix Gemfile to correctly install jekyll 3.9 (#224) * Refactor specs for RedirectPage (#222) +### Bug Fixes + + * Refactor Redirectable mixin to reduce allocations (#241) + ## 0.16.0 / 2020-01-26 ### Minor Enhancements From 0de03e3f9a09b9c2f7f8acbdacd51003bbd1b54a Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Fri, 27 Aug 2021 10:44:23 +0530 Subject: [PATCH 05/10] Run CI workflow on the `master` branch as well --- .github/workflows/ci.yml | 3 +++ .travis.yml | 19 ------------------- README.md | 2 +- 3 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 320b9c8..a3b910c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ name: Continuous Integration on: + push: + branches: + - master pull_request: branches: - master diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 20df1f0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: ruby -cache: bundler -rvm: - - &latest_ruby 2.7 - - 2.5 -env: - - JEKYLL_VERSION="~> 3.9" -matrix: - include: - - # GitHub Pages - rvm: 2.7.1 - env: GH_PAGES=true - - rvm: *latest_ruby - env: JEKYLL_VERSION="~> 4.0" - -before_install: -- gem update --system -before_script: bundle update -script: script/cibuild diff --git a/README.md b/README.md index 651e58b..ba340d5 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ impractical to create new pages in the proper subdirectories so they, e.g. Instead of dealing with maintaining those pages for redirection, let `jekyll-redirect-from` handle it for you. -[![Build Status](https://travis-ci.org/jekyll/jekyll-redirect-from.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-redirect-from) +[![Build Status](https://github.com/jekyll/jekyll-redirect-from/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jekyll/jekyll-redirect-from/actions/workflows/ci.yml) ## How it Works From de551ddaacc66b949c96adb3c2a5e8bb42fc1594 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Fri, 17 Sep 2021 19:49:10 +0530 Subject: [PATCH 06/10] Lock to RuboCop v1.18.x (#242) Merge pull request 242 --- .rubocop.yml | 29 +++++++++++++++++++++++++++- .rubocop_todo.yml | 37 ++++++++++++------------------------ jekyll-redirect-from.gemspec | 4 ++-- script/fmt | 2 +- 4 files changed, 43 insertions(+), 29 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index abb6557..dc87809 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,33 @@ inherit_gem: rubocop-jekyll: .rubocop.yml AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 + SuggestExtensions: false Exclude: - vendor/**/* + +Layout/LineEndStringConcatenationIndentation: + Enabled: true + +Lint/EmptyInPattern: + Enabled: false + +Naming/InclusiveLanguage: + Enabled: false +Naming/MemoizedInstanceVariableName: + Exclude: + - 'lib/jekyll-redirect-from/page_without_a_file.rb' + +Performance/MapCompact: + Enabled: true +Performance/RedundantEqualityComparisonBlock: + Enabled: true +Performance/RedundantSplitRegexpArgument: + Enabled: true + +Style/InPatternThen: + Enabled: false +Style/MultilineInPatternThen: + Enabled: false +Style/QuotedSymbols: + Enabled: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6b63e0b..b870d5e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,40 +1,27 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-12-06 11:51:19 +0100 using RuboCop version 0.61.1. +# on 2021-09-17 12:49:45 UTC using RuboCop version 1.18.4. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 12 -# Configuration parameters: CountComments, Max, ExcludedMethods. -# ExcludedMethods: refine -Metrics/BlockLength: - Exclude: - - 'spec/integrations_spec.rb' - - 'spec/jekyll_redirect_from/generator_spec.rb' - - 'spec/jekyll_redirect_from/redirect_page_spec.rb' - - 'spec/jekyll_redirect_from/redirectable_spec.rb' - - 'spec/spec_helper.rb' - # Offense count: 3 -# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Layout/LineLength: - Exclude: - - 'spec/jekyll_redirect_from/generator_spec.rb' - - 'spec/jekyll_redirect_from/redirect_page_spec.rb' + Max: 105 -# Offense count: 1 -# Configuration parameters: EnforcedStyleForLeadingUnderscores. -# SupportedStylesForLeadingUnderscores: disallowed, required, optional -Naming/MemoizedInstanceVariableName: +# Offense count: 2 +# Configuration parameters: AllowedMethods. +# AllowedMethods: enums +Lint/ConstantDefinitionInBlock: Exclude: - - 'lib/jekyll-redirect-from/page_without_a_file.rb' + - 'spec/jekyll_redirect_from/generator_spec.rb' # Offense count: 2 -# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: io, id, to, by, on, in, at, ip, db -Naming/MethodParameterName: +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: Exclude: - - 'lib/jekyll-redirect-from/redirect_page.rb' + - 'spec/jekyll_redirect_from/generator_spec.rb' diff --git a/jekyll-redirect-from.gemspec b/jekyll-redirect-from.gemspec index e670c0b..c838419 100644 --- a/jekyll-redirect-from.gemspec +++ b/jekyll-redirect-from.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r!^(test|spec|features)/!) spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.4.0" + spec.required_ruby_version = ">= 2.5.0" spec.add_runtime_dependency "jekyll", ">= 3.3", "< 5.0" @@ -27,5 +27,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "jekyll-sitemap", "~> 1.0" spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "rspec", "~> 3.5" - spec.add_development_dependency "rubocop-jekyll", "~> 0.10" + spec.add_development_dependency "rubocop-jekyll", "~> 0.12.0" end diff --git a/script/fmt b/script/fmt index c5351ec..913591a 100755 --- a/script/fmt +++ b/script/fmt @@ -1,7 +1,7 @@ #!/bin/bash set -e -echo "Rubocop $(bundle exec rubocop --version)" +echo "RuboCop $(bundle exec rubocop --version)" bundle exec rubocop -D -E $@ success=$? if ((success != 0)); then From 06701e5220a50a769fec803586c2471ee691dff7 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Fri, 17 Sep 2021 10:19:12 -0400 Subject: [PATCH 07/10] Update history to reflect merge of #242 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 165de26..6541da0 100644 --- a/History.markdown +++ b/History.markdown @@ -8,6 +8,7 @@ * fix Gemfile to correctly install jekyll 3.9 (#224) * Refactor specs for RedirectPage (#222) + * Lock to RuboCop v1.18.x (#242) ### Bug Fixes From 4f93bd2a5ee94e79d708d1c029da0ef76e575eaa Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 23 Sep 2021 23:05:04 +0530 Subject: [PATCH 08/10] Test gem install in GH Actions CI --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3b910c..b6072a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,8 +34,10 @@ jobs: run: bash script/test - name: Check Style Offenses run: bash script/fmt - - name: Test Gem build - run: bundle exec rake build + - name: Test gem build + run: bundle exec gem build jekyll-redirect-from.gemspec + - name: Test gem install + run: bundle exec gem install jekyll-redirect-from --local --verbose ghp: if: "!contains(github.event.commits[0].message, '[ci skip]')" From 07cba489c2e72eafbcb5b10e5d9694f06082c6c6 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 27 Sep 2021 20:50:08 +0530 Subject: [PATCH 09/10] Clean up gemspec (#243) Merge pull request 243 --- jekyll-redirect-from.gemspec | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/jekyll-redirect-from.gemspec b/jekyll-redirect-from.gemspec index c838419..56ba1e9 100644 --- a/jekyll-redirect-from.gemspec +++ b/jekyll-redirect-from.gemspec @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "English" require_relative "lib/jekyll-redirect-from/version" Gem::Specification.new do |spec| @@ -8,15 +7,11 @@ Gem::Specification.new do |spec| spec.version = JekyllRedirectFrom::VERSION spec.authors = ["Parker Moore"] spec.email = ["parkrmoore@gmail.com"] - spec.summary = "Seamlessly specify multiple redirection URLs " \ - "for your pages and posts" + spec.summary = "Seamlessly specify multiple redirection URLs for your pages and posts" spec.homepage = "https://github.com/jekyll/jekyll-redirect-from" spec.license = "MIT" - spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) - - spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r!^(test|spec|features)/!) + spec.files = `git ls-files lib`.split("\n").concat(%w(LICENSE.txt README.md History.markdown)) spec.require_paths = ["lib"] spec.required_ruby_version = ">= 2.5.0" From 6a751b274300ece194d8ba7cea934c396dff6163 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Mon, 27 Sep 2021 11:20:09 -0400 Subject: [PATCH 10/10] Update history to reflect merge of #243 [ci skip] --- History.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/History.markdown b/History.markdown index 6541da0..2fcdd8e 100644 --- a/History.markdown +++ b/History.markdown @@ -9,6 +9,7 @@ * fix Gemfile to correctly install jekyll 3.9 (#224) * Refactor specs for RedirectPage (#222) * Lock to RuboCop v1.18.x (#242) + * Clean up gemspec (#243) ### Bug Fixes