03 June 2016

安装 Ruby

https://www.ruby-lang.org/zh_cn/

https://bitnami.com/stack/ruby/installer

查看版本要求在 2.0.0 以上

ruby --version

安装 Bundler

gem install bundler

因为墙的缘故,gem的默认库连接不上:

$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org

创建本地版本库

git init xxx
cd xxx
git checkout -b gh-pages  # 如果本地库是一个 Project pages site

用 Bundler 安装 Jekyll

创建文件 Gemfile 包含以下两行:

source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins

安装:

$ bundle install

出现问题:

json:

  1. 将下载的 DevKit 包含到 path 中
  2. 按照网页操作: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

在解压后的 DevKit 文件夹下运行:

$ ruby dk.rb init

修改 config.yml 文件如下(假定 ruby安装在 C:/ruby21-x64)

# ---
 - C:/ruby21-x64
# - C:/ruby192dev

运行:

$ ruby dk.rb install

安装 json:

$ gem install json --platform=ruby

生成本地静态网站

$ bundle exec jekyll new . --force

相关资料:

https://help.github.com/articles/good-resources-for-learning-git-and-github/

https://help.github.com/articles/git-cheatsheet/

浏览本地网站

$ bundle exec jekyll serve

打开 http://localhost:4000

保持最新的 Jekyll

$ bundel update


blog comments powered by Disqus