Jekyll 2.4에서 3.x로 업그레이드

Mar 4, 2017

Jekyll을 2.4에서 3.x로 업그레이드했다.

# 현재 설치된 버전 확인
bundle show jekyll

/Library/Ruby/Gems/2.0.0/gems/jekyll-2.4.0

# 최신 버전 의존성 확인
gem dependency jekyll -v 3.4.1

Gem jekyll-3.4.1
  addressable (~> 2.4)
  colorator (~> 1.0)
  jekyll-sass-converter (~> 1.0)
  jekyll-watch (~> 1.1)
  kramdown (~> 1.3)
  liquid (~> 3.0)
  mercenary (~> 0.3.3)
  pathutil (~> 0.9)
  rouge (~> 1.7)
  safe_yaml (~> 1.0)

Gemfile을 수정한다.

gem 'jekyll', '~> 3.4.1'

수정 후 변경된 gem을 설치한다.

bundle install

...

Bundle complete! 1 Gemfile dependency, 18 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Bundle에 설치된 Gem을 확인했다.

bundle show

Gems included by the bundle:
  * addressable (2.4.0)
  * bundler (1.10.6)
  * colorator (1.1.0)
  * ffi (1.9.10)
  * forwardable-extended (2.6.0)
  * jekyll (3.4.1)
  * jekyll-sass-converter (1.5.0)
  * jekyll-watch (1.5.0)
  * kramdown (1.11.1)
  * liquid (3.0.6)
  * listen (3.0.8)
  * mercenary (0.3.6)
  * pathutil (0.14.0)
  * rb-fsevent (0.9.7)
  * rb-inotify (0.9.7)
  * rouge (1.10.1)
  * safe_yaml (1.0.4)
  * sass (3.4.22)

Jekyll을 실행했는데, 이런 에러가 발생했다.

bundle exec jekyll serve

...
  Dependency Error: Yikes! It looks like you don't have /Users/kichuljung/workspace/kichul_blog/_plugins/html_filters.rb or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- nokogiri' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/! 
jekyll 3.4.1 | Error:  /Users/kichuljung/workspace/kichul_blog/_plugins/html_filters.rb

Post 목록에서 내용이 길 경우 내용을 잘라주는 플러그인에서 nokogiri gem을 설치하지 않아서 발생한 문제다. 그래서 Gemfile에서 nokogiri gem 주석을 해제했다. 그리고 다시 bundle install을 실행했다.

그리고 다시 Jekyll을 실행했는데, 또 에러가 발생했다.

bundle exec jekyll serve

...

Deprecation: You appear to have pagination turned on, but you haven\'t included the \`jekyll-paginate\` gem. Ensure you have `gems: [jekyll-paginate]` in your configuration file.

...

pagenate 설정이 되어 있어서, jekyll-paginate를 _config.yml 설정에 추가했다.

# 이미 설정된 내용
paginate: 5
paginate_path: "posts/page:num/"

# gem 설정을 추가
gems: ['jekyll-sitemap', 'jekyll-paginate']

Gemfile에 다음 내용을 추가했다.

gem 'jekyll-paginate', '~>1.1.0'

다시 bundle install을 하고, Jekyll을 실행했지만, 또 에러가 발생했다.

...

Dependency Error: Yikes! It looks like you don't have redcarpet or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- redcarpet' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/! 
  Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2013-08-05-About-Ajax.md':
                    redcarpet
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    redcarpet

.config.yml 파일에서 redcarpet 쓰는 부분을 모두 제거했다.

markdown: redcarpet

...

redcarpet:
    extensions: [
      "no_intra_emphasis",
      "fenced_code_blocks",
      "autolink",
      "tables"
      # "with_toc_data" # 맥에서 한글로 섹션명을 썼을 때 에러가 발생한다.
    ]

이렇게 하니 모두 정상적으로 동작했다.

Upgrading from 2.x to 3.x에서 3.x부터 없어진 기능을 볼 수 있다.

See Also