安装Ruby/DevKit
首先下载以下两个文件进行安装
最新版可从https://rubyinstaller.org/downloads/下载
Ruby安装在D:\Ruby200, DevKit安装在D:\rubydevkit
打开CMD进入到DevKit目录,开始初始化安装
D:\rubydevkit>ruby dk.rb init
[INFO] found RubyInstaller v2.0.0 at d:/Ruby200
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
D:\rubydevkit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'd:/Ruby200'
[INFO] Installing 'd:/Ruby200/lib/ruby/site_ruby/devkit.rb'
替换Gem源
国内线路gem安装可能较慢,建议将官方的gem源修改为国内gem源。
gem sources #列出默认源
gem sources --remove https://rubygems.org/ #移除默认源
gem sources -a https://mirrors.ustc.edu.cn/rubygems/ #添加科大源
安装jekyll
rub安装完成后,就可以通过gem install jekyll
来安装Jekyll了。
D:\rubydevkit>gem install jekyll
Fetching: yajl-ruby-1.1.0-x86-mingw32.gem (100%)
Successfully installed yajl-ruby-1.1.0-x86-mingw32
Fetching: posix-spawn-0.3.6.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed posix-spawn-0.3.6
Fetching: pygments.rb-0.4.2.gem (100%)
Successfully installed pygments.rb-0.4.2
Fetching: highline-1.6.18.gem (100%)
Successfully installed highline-1.6.18
Fetching: commander-4.1.3.gem (100%)
Successfully installed commander-4.1.3
Fetching: safe_yaml-0.7.1.gem (100%)
Successfully installed safe_yaml-0.7.1
Fetching: colorator-0.1.gem (100%)
Successfully installed colorator-0.1
Fetching: jekyll-1.0.1.gem (100%)
Successfully installed jekyll-1.0.1
Parsing documentation for yajl-ruby-1.1.0-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/yajl/1.8/yajl.so, skip
ping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/yajl/1.9/yajl.so, skip
ping
Installing ri documentation for yajl-ruby-1.1.0-x86-mingw32
Parsing documentation for posix-spawn-0.3.6
Installing ri documentation for posix-spawn-0.3.6
Parsing documentation for pygments.rb-0.4.2
Installing ri documentation for pygments.rb-0.4.2
Parsing documentation for highline-1.6.18
Installing ri documentation for highline-1.6.18
Parsing documentation for commander-4.1.3
Installing ri documentation for commander-4.1.3
Parsing documentation for safe_yaml-0.7.1
Installing ri documentation for safe_yaml-0.7.1
Parsing documentation for colorator-0.1
Installing ri documentation for colorator-0.1
Parsing documentation for jekyll-1.0.1
Installing ri documentation for jekyll-1.0.1
Done installing documentation for yajl-ruby, posix-spawn, pygments.rb, highline,
commander, safe_yaml, colorator, jekyll (7 sec).
8 gems installed
完成后,可以使用jekyll -v来检查是否安装成功
D:\rubydevkit>jekyll -v
jekyll 1.0.1
有时由于天朝内网路问题,可能造成以上安装中某一个部分中途退出,再次执行安装时出现以下提示:
D:\rubydevkit>gem install jekyll
ERROR: While executing gem ... (NoMethodError)
undefined method `size' for nil:NilClass
在此只需要将gem目录下cache文件夹内清空,重新安装即可。
如果不知道gem目录的可以使用gem env来查看GEM PATHS值,如下所示d:/Ruby200/lib/ruby/gems/2.0.0
D:\rubydevkit>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.0
- RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [i386-mingw32]
- INSTALLATION DIRECTORY: d:/Ruby200/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: d:/Ruby200/bin/ruby.exe
- EXECUTABLE DIRECTORY: d:/Ruby200/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- d:/Ruby200/lib/ruby/gems/2.0.0
- C:/Documents and Settings/aquan/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://ruby.taobao.org/