WindowsでJekyll環境構築

jekyllをご存知でしょうか?そこいら中に記事があるので詳細はググればわかりますが、簡単にいえば静的HTMLのジェネレータフレームワークです。

Rubyで作成されていますのでgemで簡単にインストールできます。

がちょっとハマったので備忘録。。

環境

  • Windows8.1

インストール

まずはRUBYを入れます。Windows用のRubyはいろいろありますが、

http://rubyinstaller.org/downloads/

こちらからWindows用のMSIをダウンロードしインストールします。

C:\Ruby21-x64にインストールした後には環境変数PATHにC:\Ruby21-x64\binを追加します。

そのままgemでインストールしようとすると以下のエラーが出ます

C:\>gem install jekyll
ERROR:	Error installing jekyll:
The 'yajl-ruby' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

どうやらMakeできなよと怒られたようです

DevelopmentKitなるものを同じページからダウンロードします。

DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

現在だとこれになります。

これをC直下にc:\devkitというフォルダを作成しその中に解凍します

その後以下のコマンドを実行

C:\devkit>ruby dk.rb init
[INFO] found RubyInstaller v2.1.3 at C:/Ruby21-x64
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.
C:\devkit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby21-x64'
[INFO] Installing 'C:/Ruby21-x64/lib/ruby/site_ruby/devkit.rb'

これで準備が整いました

あとはgemでインストール

C:\devkit>gem install jekyll
Temporarily enhancing PATH to include DevKit...
Building native extensions.	This could take a while...
Successfully installed yajl-ruby-1.1.0
Fetching: posix-spawn-0.3.9.gem (100%)
Building native extensions.	This could take a while...
Successfully installed posix-spawn-0.3.9
Fetching: pygments.rb-0.6.0.gem (100%)
Successfully installed pygments.rb-0.6.0
Fetching: redcarpet-3.2.0.gem (100%)
Building native extensions.	This could take a while...
Successfully installed redcarpet-3.2.0
Fetching: blankslate-2.1.2.4.gem (100%)
Successfully installed blankslate-2.1.2.4
Fetching: parslet-1.5.0.gem (100%)
Successfully installed parslet-1.5.0
Fetching: toml-0.1.1.gem (100%)
Successfully installed toml-0.1.1
Fetching: jekyll-paginate-1.1.0.gem (100%)
Successfully installed jekyll-paginate-1.1.0
Fetching: jekyll-gist-1.1.0.gem (100%)
Successfully installed jekyll-gist-1.1.0
Fetching: coffee-script-source-1.8.0.gem (100%)
Successfully installed coffee-script-source-1.8.0
Fetching: execjs-2.2.2.gem (100%)
Successfully installed execjs-2.2.2
Fetching: coffee-script-2.3.0.gem (100%)
Successfully installed coffee-script-2.3.0
Fetching: jekyll-coffeescript-1.0.1.gem (100%)
Successfully installed jekyll-coffeescript-1.0.1
Fetching: sass-3.4.5.gem (100%)
Successfully installed sass-3.4.5
Fetching: jekyll-sass-converter-1.2.1.gem (100%)
Successfully installed jekyll-sass-converter-1.2.1
Fetching: ffi-1.9.6-x64-mingw32.gem (100%)
Successfully installed ffi-1.9.6-x64-mingw32
Fetching: rb-inotify-0.9.5.gem (100%)
Successfully installed rb-inotify-0.9.5
Fetching: rb-fsevent-0.9.4.gem (100%)
Successfully installed rb-fsevent-0.9.4
Fetching: hitimes-1.2.2.gem (100%)
Building native extensions.	This could take a while...
Successfully installed hitimes-1.2.2
Fetching: timers-4.0.1.gem (100%)
Successfully installed timers-4.0.1
Fetching: celluloid-0.16.0.gem (100%)
Successfully installed celluloid-0.16.0
Fetching: listen-2.7.11.gem (100%)
Successfully installed listen-2.7.11
Fetching: jekyll-watch-1.1.1.gem (100%)
Successfully installed jekyll-watch-1.1.1
Fetching: fast-stemmer-1.0.2.gem (100%)
Building native extensions.	This could take a while...
Successfully installed fast-stemmer-1.0.2
Fetching: classifier-reborn-2.0.1.gem (100%)
Successfully installed classifier-reborn-2.0.1
Fetching: jekyll-2.4.0.gem (100%)
Successfully installed jekyll-2.4.0
Parsing documentation for blankslate-2.1.2.4
Installing ri documentation for blankslate-2.1.2.4
Parsing documentation for celluloid-0.16.0
Installing ri documentation for celluloid-0.16.0
Parsing documentation for classifier-reborn-2.0.1
Installing ri documentation for classifier-reborn-2.0.1
Parsing documentation for coffee-script-2.3.0
Installing ri documentation for coffee-script-2.3.0
Parsing documentation for coffee-script-source-1.8.0
Installing ri documentation for coffee-script-source-1.8.0
Parsing documentation for execjs-2.2.2
Installing ri documentation for execjs-2.2.2
Parsing documentation for fast-stemmer-1.0.2
Installing ri documentation for fast-stemmer-1.0.2
Parsing documentation for ffi-1.9.6-x64-mingw32
Installing ri documentation for ffi-1.9.6-x64-mingw32
Parsing documentation for hitimes-1.2.2
Installing ri documentation for hitimes-1.2.2
Parsing documentation for jekyll-2.4.0
Installing ri documentation for jekyll-2.4.0
Parsing documentation for jekyll-coffeescript-1.0.1
Installing ri documentation for jekyll-coffeescript-1.0.1
Parsing documentation for jekyll-gist-1.1.0
Installing ri documentation for jekyll-gist-1.1.0
Parsing documentation for jekyll-paginate-1.1.0
Installing ri documentation for jekyll-paginate-1.1.0
Parsing documentation for jekyll-sass-converter-1.2.1
Installing ri documentation for jekyll-sass-converter-1.2.1
Parsing documentation for jekyll-watch-1.1.1
Installing ri documentation for jekyll-watch-1.1.1
Parsing documentation for listen-2.7.11
Installing ri documentation for listen-2.7.11
Parsing documentation for parslet-1.5.0
Installing ri documentation for parslet-1.5.0
Parsing documentation for posix-spawn-0.3.9
Installing ri documentation for posix-spawn-0.3.9
Parsing documentation for pygments.rb-0.6.0
Installing ri documentation for pygments.rb-0.6.0
Parsing documentation for rb-fsevent-0.9.4
Installing ri documentation for rb-fsevent-0.9.4
Parsing documentation for rb-inotify-0.9.5
Installing ri documentation for rb-inotify-0.9.5
Parsing documentation for redcarpet-3.2.0
Installing ri documentation for redcarpet-3.2.0
Parsing documentation for sass-3.4.5
Installing ri documentation for sass-3.4.5
Parsing documentation for timers-4.0.1
Installing ri documentation for timers-4.0.1
Parsing documentation for toml-0.1.1
Installing ri documentation for toml-0.1.1
Parsing documentation for yajl-ruby-1.1.0
Installing ri documentation for yajl-ruby-1.1.0
Done installing documentation for blankslate, celluloid, classifier-reborn, coff
ee-script, coffee-script-source, execjs, fast-stemmer, ffi, hitimes, jekyll, jek
yll-coffeescript, jekyll-gist, jekyll-paginate, jekyll-sass-converter, jekyll-wa
tch, listen, parslet, posix-spawn, pygments.rb, rb-fsevent, rb-inotify, redcarpe
t, sass, timers, toml, yajl-ruby after 16 seconds
26 gems installed

Windows8のWindows Defenderではまったので

Windows8にWindowsDefenderをプロキシ経由で使っていると更新時にエラーが出て更新できません

どうやらIEのプロキシ設定を自動で読み込んでくれない模様

http://win.just4fun.biz/Windows設定関連/プロキシ経由のWindows%20Updateができない場合の対処.html

こちらを参考に

管理者権限でコマンドプロンプトを開き

netsh winhttp import proxy source=ie

これでオK