17 February 2015

Tags: octopress | ruby | windows |

blog_post_image_штдшту

I’ve been using Octopress on Mac OS X (i.e. have no problem). But, recently I’ve decided to run my blog on Windows machine and felt pain. Ahh, Octopress uses bunch of native extentions which actually cause a lot of cross-platform issues. My first attempt was to try JRuby due to his better Windows support, but got this:

$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Installing rake (10.4.2)
Installing RedCloth (4.2.9)
Using blankslate (2.1.2.4)
Installing hitimes (1.2.2)
Installing timers (4.0.1)
Installing celluloid (0.16.0)
Installing chunky_png (1.3.3)
Installing fast-stemmer (1.0.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
        D:/Tools/JRuby/jruby-1.7.0/bin/jruby.exe extconf.rb NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

   (root) at D:/Tools/JRuby/jruby-1.7.0/lib/ruby/shared/mkmf.rb:8  require at org/jruby/RubyKernel.java:1019
   (root) at D:/Tools/JRuby/jruby-1.7.0/lib/ruby/shared/rubygems/custom_require.rb:1
   (root) at extconf.rb:1


Gem files will remain installed in D:/Tools/JRuby/jruby-1.7.0/lib/ruby/gems/shared/gems/fast-stemmer-1.0.2 for inspection.
Results logged to D:/Tools/JRuby/jruby-1.7.0/lib/ruby/gems/shared/gems/fast-stemmer-1.0.2/ext/gem_make.out
An error occurred while installing fast-stemmer (1.0.2), and Bundler cannot continue.
Make sure that `gem install fast-stemmer -v '1.0.2'` succeeds before bundling.

There is JRuby version of fast-stemmer gem called jruby-stemmer. But, I’m not ready to maitain this. That’s why I’ve decided to use RubyInstaller.

Install Ruby on Windows and SSL issues

  1. Download (rubyinstaller-2.1.5-x64.exe in my case) and install RubyInstaller. I installed in d:\Tools\Ruby\Ruby21-x64\ folder.

  2. Check rubygems via running gem update and you should get the next error:

$ gem update
Updating installed gems
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

It’s well known rubygems issues with ready to use solution:

$ gem which rubygems
D:/Tools/Ruby/Ruby21-x64/lib/ruby/2.1.0/rubygems.rb
$ copy AddTrustExternalCARoot-2048.pem D:\Tools\Ruby\Ruby21-x64\lib\ruby\2.1.0\rubygems\ssl_certs

Prepapre environment for Octopress

Now it’s time to clone Octopress blog and run it. Unfortunatelly, there are some minor issues which still must be fixed.

Fix Octopress native extentions issues

We know that Octopress uses native extentions thats why we have to additionally install Development Kit

See my Development Kit config.yml:

# 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:/Tools/Ruby/Ruby21-x64

Install Python

The default syntax highlighting engine in Octopress/Jekyll is Pygments. It’s requires Python v.2.7.x. Simply download Python v.2.7.8 and add it on system PATH.

Final steps

I assume that blog was previously cloned. Now, we should perform “traditional” Ruby project ceremony:

References


comments powered by Disqus