一. 安装Ruby
1.1 安装Ruby
下载ruby: http://rubyinstaller.org/downloads/
我这里下载的是: rubyinstaller-2.1.5-x64.exe
next, next, next(尽量全选, 选择添加到Path环境变量).
我自己的安装路径:
D:\Ruby21-x64
(如果手动添加Path环境变量, 则变量是D:\Ruby21-x64\bin)
验证, 输入如下命令行(蓝色字体):
C:\Users\Administrator>ruby -v
1.2 修改下载镜像
http://rubygems.org/ 是被和谐的, 所以要修改下载源, 修改淘宝提供的镜像
依次输入如下3条命令:
C:\Users\Administrator>gem sources --remove http://rubygems.org/
C:\Users\Administrator>gem sources -a http://ruby.taobao.org/
C:\Users\Administrator>gem sources -l
1.3 输入一堆命令
更新ruby和gems系统:
C:\Users\Administrator>gem update --system
安装rspec组件"
C:\Users\Administrator>gem install rspec
安装httparty组件
C:\Users\Administrator>gem install httparty
安装wdm组件
C:\Users\Administrator>gem install wdm
二. 安装DevKit
2.1 解压DevKit
下载DevKit: http://rubyinstaller.org/downloads/
我这里下载的是: DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
解压DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe, 我这里解压到目录 D:\DevKit-64.
2.2 修改配置
打开D:\DevKit-64\config.yml文件, 修改文件内容为如下: (这里的路径就是对应你的Ruby的安装路径了, 而且要注意格式)
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- D:/Ruby21-x64
- D:/Ruby21-x64
2.3 安装DevKit和cucumber插件
打开cmd.exe, CD到D:\DevKit-64, 依次输入如下命令:
D:\DevKit-64>ruby dk.rb init
D:\DevKit-64>ruby dk.rb review
D:\DevKit-64>ruby dk.rb install
D:\DevKit-64>gem install cucumber
三. 安装Jekyll
输入如下命令:
D:\DevKit-64>gem install jekyll
四. 安装Pygments
Jekyll 里默认的语法高亮插件是Pygments.
Jekyll 还有另一个高亮引擎名为 Rouge(原生Ruby的程序 https://github.com/jneen/rouge).
Pygments安装步骤:
4.1 安装Python
我安装的是Python2.7最新版. http://www.python.org/download/
4.2 安装easy_install
https://pypi.python.org/pypi/setuptools#installation-instructions 来查看详细的安装指南。
对于 Windows 7 的机器,下载 ez_setup.py 并保存.
下载地址: https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
保存后运行:(我保存在D盘)
C:\Users\Administrator>python “D:\ez_setup.py”
添加目录"D:\Python27\Scripts"到环境变量PATH.
确保 easy_install 已经正确安装, 输入命令:
C:\Users\Administrator>easy_install --version
会输出: setuptools xxx
4.3 安装Pygments
输入命令:
C:\Users\Administrator>easy_install Pygments
五. Jekyll使用
依次输入如下命令:
C:\Users\Administrator>D:
D:>jekyll new TestJekyll
D:>cd TestJekyll
D:\TestJekyll>jekyll serve
这里输出报了一个警告
D:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164:
warning: cannot close fd before spawn 'which' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
(但可以正常运行.)
然后在浏览器输入地址: http://localhost:4000/ 你就可以看到你想看的.
六. 小结
安装过程中可能会遇到各种各样的错误. 谷歌一下就知道.
参考:
http://jekyllrb.com/
http://memleak.in/2014/08/27/jekyll-windows-github/
一些jekyll 模板
http://jekyllthemes.org/
https://github.com/jekyll/jekyll/wiki/Sites
折腾!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!