france

https://github.com/francecil

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

本地安装Jekyll

首先安装Ruby及gem

Ruby的安装

  • Ruby官网进行下载
  • RubyInstaller下载ruby 【新手推荐】

我采用的是RubyInstaller,无脑简单
勾选时我配置如下


devkit

  • RubyInstaller页面中往下拉就能看到。选择自己版本的Ruby(我的是2.2.3)对应的devkit:For use with Ruby 2.0 and
    above (x64 - 64bits only)DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
  • 下载并解压到D:/.devkit,然后执行:
    D:>cd devkit
    D:\Devkit>ruby dk.rb init
    [INFO] found RubyInstaller v2.2.3 at D:/Ruby22 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.`

** 在执行install命令前需要配置 DevKit安装目录中的一个 config.yml文件 **

注意最后两行 是一样的,其中 D:/Ruby22-x64 为 Ruby安装根目录
此时再执行 install命令,并安装 cucumber插件:

D:\DevKit64>ruby dk.rb install
[INFO] Installing 'D:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/
[INFO] Installing 'D:/Ruby22-x64/lib/ruby/site_ruby/devkit.rb'
[INFO] Skipping existing gem override for 'D:/Ruby22-x64'
[WARN] Skipping existing DevKit helper library for 'D:/Ruby22-x64'

D:\DevKit64>gem install cucumber
Fetching: multi_test-0.1.2.gem (100%)
Successfully installed multi_test-0.1.2
Fetching: multi_json-1.11.2.gem (100%)
Successfully installed multi_json-1.11.2
Fetching: gherkin3-3.1.1.gem (100%)
Successfully installed gherkin3-3.1.1
Fetching: diff-lcs-1.2.5.gem (100%)
Successfully installed diff-lcs-1.2.5 `

这样就完成devkit的安装了


gem

  • 安装gem,这个也可以去gem的官网进行下载,我选rubygem-2.4.8.zip,解压然后直接安装setup.rb(或者cd到对应文件夹 ruby setup.rb)就行了,安装完成后使用gem -v查看一下是否安装成功。我安装的是2.4.8
  • gem是可以选择源的,默认的源有点慢,可以使用ruby.taobao.org的源,方便快捷
  • 注意,请先查看 gem安装Jekyll 那部分的教程,你会发现下面这边有个问题。

查看当前源
`

C:\Users\Administrator>gem source list
***** CURRENT SOURCES *****
https://rubygems.org/
C:\Users\Administrator>
`
添加新源
C:\Users\Administrator>gem sources -a http://ruby.taobao.org/
http://ruby.taobao.org/ added to sources

删除默认源

gem sources --remove https://rubygems.org/

再次查看的时候保证只有http://ruby.taobao.org/就行了

gem 安装Jekyll

使用命令gem install jekyll就可以安装jekyll及所有需要的依赖
但是我这边出错了

C:\Users\Administrator>gem install jekyll
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (http://ruby.taobao.org/quick/Marshal.4.8/jekyll-2.5.3.gemspec.rz)

估计是淘宝镜像没有那个源,
然后去官网发现如下信息....

在http://ruby.taobao.org/ 主页提示下面信息
我们将于 2015 年 10 月 1 日起停止 http 协议的镜像, 请在配置中使用 https 协议代替
真巧= = 就是我写博客的今天,
所以再按上面gem添加移除源的方式正确配置源:https😕/ruby.taobao.org/ 原来:http😕/ruby.taobao.org/

C:\Users\Administrator>gem sources --remove http://ruby.taobao.org/

C:\Users\Administrator>gem sources -a https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources

C:\Users\Administrator>gem sources -l
*** CURRENT SOURCES ***

https://ruby.taobao.org/

使用命令gem install jekyll就可以了

如果出现错误
Error installing jekyll:
ERROR: Failed to build gem native extension.
说明是DevKit / Win / Ruby 的32、64版本不对应
参考:

http://stackoverflow.com/questions/19583849/temporarily-enhancing-path-to-include-devkit-message-during-rails-installation-o
on window 7 64 bit system

  1. if you want to work with ruby version lesst then ruby 2.0
  2. you need to install DevKit 32 bit from http://rubyinstaller.org/downloads/ on window 7 x64 bit
    if you want to install ruby 2 or greater version on window 7 64 so you need to install DevKit 64 bit with ruby 2 with 64 bit

with DevKit 64 bit on window 7 64 bit system ruby 32 bit will not work

but window 7 64 bit system with Devkit 32 bit and ruby 32 bit will work

** 然后请下载正确版本,建议64位的全部都是64的然后重新配置**

安装完成后使用jekyll -v查看一下是否安装成功了
我的是 2.5.3

gem install rdiscount(转换引擎)
gem install wdm

参考
http://segmentfault.com/a/1190000000406011
http://www.2cto.com/os/201411/351818.html

注意有些网站需要FQ..

posted on 2015-10-01 14:24  france  阅读(360)  评论(3编辑  收藏  举报