I’ve had bad luck with ruby stuff; once in a while, something in my setup for Octopress breaks and I can’t build this blog. For example, this time I had issues with pygments.rb package, which provides colorizing for source code blocks.
Updated on 2013-04-28: I’m lucky enough to have had this issue not only in Arch Linux, but on OS X as well (after all, cross-platform tools tend to have the same cross-platform issues, right?). The latest pygments.rb-0.5.0 is still the same.
rake generate showed this:
12345678910111213
/home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pygments.rb-0.2.13/lib/pygments/ffi.rb:7:in `start': wrong number of arguments (2 for 1) (ArgumentError)
from /home/user/src/octopress/plugins/pygments_code.rb:5:in `<top (required)>'
from /home/user/src/octopress/plugins/code_block.rb:44:in `require'
from /home/user/src/octopress/plugins/code_block.rb:44:in `<top (required)>'
from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:76:in `require'
from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:76:in `block in setup'
from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:75:in `each'
from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:75:in `setup'
from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:30:in `initialize'
from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:224:in `new'
from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:224:in `<top (required)>'
from /home/user/.rbenv/versions/1.9.3-p194/bin/jekyll:23:in `load'
from /home/user/.rbenv/versions/1.9.3-p194/bin/jekyll:23:in `<main>'
Running bundle update didn’t help. I found out the newest version of pygments.rb was 0.4.2. How to install it? Running gem install -V pygments.rb did the trick. But octopress didn’t use the update. To fix that, edit the Gemfile:
1
gem 'pygments.rb', '~> 0.4.2'
, then run bundle update. The issue remains though:
1234
/home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pygments.rb-0.4.2/lib/pygments/popen.rb:22:in `start': wrong number of arguments (2 for 1) (ArgumentError)
from /home/user/src/octopress/plugins/pygments_code.rb:5:in `<top (required)>'
from /home/user/src/octopress/plugins/code_block.rb:44:in `require'
from /home/user/src/octopress/plugins/code_block.rb:44:in `<top (required)>'
Long story short, I found somewhere this fix. Open the file where the error pops up (/home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pygments.rb-0.4.2/lib/pygments/popen.rb), comment line 22, and these lines:
That’s not the end, this time another error prevents the build:
12345678
/home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pygments.rb-0.4.2/lib/pygments/popen.rb:253:in`rescue in mentos': EPIPE (MentosError) from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pygments.rb-0.4.2/lib/pygments/popen.rb:205:in `mentos' from /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pygments.rb-0.4.2/lib/pygments/popen.rb:194:in `highlight'from/home/user/src/octopress/plugins/pygments_code.rb:26:in`pygments' from /home/user/src/octopress/plugins/pygments_code.rb:16:in `highlight' from /home/user/src/octopress/plugins/backtick_code_block.rb:37:in `block in render_code_block'from/home/user/src/octopress/plugins/backtick_code_block.rb:13:in`gsub' from /home/user/src/octopress/plugins/backtick_code_block.rb:13:in `render_code_block'
Open this file /home/user/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/pygments.rb-0.4.2/lib/pygments/mentos.py and in the first line replace #!/usr/bin/env python with #!/usr/bin/env python2. This is required in Arch Linux, because the python command points to Python 3. Phew, it works again!