🤖🚫 AI-free content. This post is 100% written by a human, as is everything on my blog. Enjoy!

Headless, a Ruby wrapper for Xvfb

July 4, 2011 in Projects

Description

Headless is a Ruby wrapper for Xvfb, the virtual framebuffer.

Virtual framebuffers are used to run graphical software on a “headless”, i.e. display-less, server.

Headless makes it possible to create and release framebuffers straight from Ruby code. This is useful if you only need the framebuffer for a certain part or branch of the script.

require 'rubygems'
require 'headless'

Object notation

headless = Headless.new
# ... code using the framebuffer
headless.destroy

Block notation

Headless.ly do |headless|
  # ... code using the framebuffer
end

Examples

Acceptance tests with a real browser

TODO

PDF generation

TODO

Installation

Headless requires an installed xvfb.

Ubuntu

sudo apt-get install xvfb

All systems

gem install headless

Buy me a coffee Liked the post? Treat me to a coffee