Reinstall Ruby Environment for Octopress Using ArchLinux and RVM

When reinstalling- or switching your ArchLinux you’ll need to re-setup you whole Ruby environment, otherwise it’s just NOT going to work. I’m using RVM for this, because I need to install a specific Ruby version (1.9.3) AND I have other projects too.

Install RVM

  • Install Curl:
$ sudo pacman -S curl
$ curl -L https://get.rvm.io | bash -s stable --ruby
  • Now edit .bashrc:
$ nano .bashrc 

Paste this at the end:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
  • Check requirements:
$ rvm requirements
Checking requirements for arch.
Requirements installation successful.
  • Install libyaml:
sudo pacman -S libyaml

Install Ruby

  • Login bash:
$ /bin/bash --login
  • Now install the specific Ruby version of your needings:
$ rvm install ruby-1.9.3-p194
  • Use default Ruby
$ rvm use 1.9.3-p194
  • Install latest gems:
$ rvm rubygems latest

Fetch Octopress and reconfig

  • Now it’s time to fetch your project:
$ git clone ssh://[email protected]/~/git/server.git/ (for example)
  • Gem install bundler:
$ gem install bundler
  • Now intstall the bundler by:
$ bundle install

Git

The whole thing is now ready for use, you’ll just need to enter your emailaddress and name in Git for commiting

  • Enter a name:
$ git config --global user.name "Techswag"
  • Enter an emailaddress:
$ git config --global user.email "webm[email protected]" 

First commit

$ rake generate
$ git add .
$ git commit -am "this is my first commit after reinstalling." 
$ git push

Error

ArchLinux is using Python 3.x and this setup is using 2.x. It might be an issue when rake generate that your log is full of these warnings:

devel/octopress/plugins/pygments_code.rb:27:in `rescue in pygments': Pygments can't parse unknown language: text. (RuntimeError)
  from devel/octopress/plugins/pygments_code.rb:24:in `pygments'
  from devel/octopress/plugins/pygments_code.rb:14:in `highlight'
  from devel/octopress/plugins/backtick_code_block.rb:37:in `block in render_code_block'
  from devel/octopress/plugins/backtick_code_block.rb:13:in `gsub'
  from devel/octopress/plugins/backtick_code_block.rb:13:in `render_code_block'
  from devel/octopress/plugins/octopress_filters.rb:12:in `pre_filter'
  from devel/octopress/plugins/octopress_filters.rb:28:in `pre_render'
  from devel/octopress/plugins/post_filters.rb:112:in `block in pre_render'
  from devel/octopress/plugins/post_filters.rb:111:in `each'
  from devel/octopress/plugins/post_filters.rb:111:in `pre_render'
  from devel/octopress/plugins/post_filters.rb:166:in `do_layout'

It’s a know issue on ArchLinux (conflict version of Python): https://github.com/tmm1/pygments.rb/issues/45

Change:

~/.rvm/gems/ruby-1.9.3-p394/gems/pygments.rb-0.3.4/lib/pygments/mentos.py
1
2
#!/usr/bin/env python
# -*- coding: utf-8 -*-

Into:

~/.rvm/gems/ruby-1.9.3-p394/gems/pygments.rb-0.3.4/lib/pygments/mentos.py
1
2
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

Comments