Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

Fix Rake 11.3 and Jekyll 0.12.1 Warning Under Ruby 2.7.1

Permalink

After upgrade ruby to 2.7.1, I found my old octopress give below two warning:

/usr/local/lib/ruby/gems/2.7.0/gems/rake-11.3.0/lib/rake/application.rb:378: warning: deprecated Object#=~ is called on Proc; it always returns nil

Just need change application.rb:378 as below to fix it.

- opt.select { |o| o =~ /^-/ }.map(&:downcase).sort.reverse
+ opt.select { |o| o.is_a?(String) && o =~ /^-/ }.map(&:downcase).sort.reverse

Another warning is:

/usr/local/lib/ruby/gems/2.7.0/gems/jekyll-0.12.1/lib/jekyll/post.rb:140: warning: URI.escape is obsolete

Just change as below:

- "categories" => categories.map { |c| URI.escape(c) }.join('/'),
+ "categories" => categories.map { |c| URI.encode_www_form_component(c) }.join('/'),

Comments