/zeus

Boot any rails app in under a second.

Primary LanguageGoMIT LicenseMIT

Zeus

Build Status

Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.

This screencast gives a quick overview of how to use zeus with Rails.

Watch the screencast!

Zeus is also covered in RailsCasts episode 412.

More technically speaking, Zeus is a language-agnostic application checkpointer for non-multithreaded applications. Currently only ruby is targeted, but explicit support for other languages is on the horizon.

Requirements (for use with Rails)

  • OS X 10.7+ OR Linux 2.6.13+
  • Rails 3.x
  • Compatible Ruby installation

For Ruby 1.9.3+, GC patches are not actually 100% necessary, especially if you have a lot of memory. Feel free to give it a shot first without, but if you're suddenly out of RAM, switching to the GC-patched Ruby will fix it.

Please note: Zeus requires your project to be running on a file system that supports FSEvents or inotify.

Installation

Install the gem.

gem install zeus

Q: "I should put it in my Gemfile, right?"

A: No. You can, but running bundle exec zeus instead of zeus adds precious seconds to commands that otherwise would be quite a bit faster. Zeus was built to be run from outside of bundler.

If using RSpec, you may need to disable require 'rspec/autotest' or require 'rspec/autorun'. If you're using MiniTest you'll want to disable require 'minitest/autorun' as well. (see #134 for more information).

Usage

Start the server:

zeus start

The server will print a list of available commands.

Run some commands in another shell:

zeus console
zeus server
zeus test test/unit/widget_test.rb
zeus test spec/widget_spec.rb
zeus generate model omg
zeus rake -T
zeus runner omg.rb

Limitations

You need to restart zeus if you make changes to various initialization files. Examples of these files include:

  • FactoryGirl factories
  • RSpec support files

Related gems

  • Spork - a DRb server that forks before each run to ensure a clean testing state
  • Commands - a persistent console that runs Rails commands without reloading the env
  • Spring - like Zeus but in pure Ruby, totally automatic, alpha and limited compatibility

If you're switching from Spork, be sure to read the wiki page on Spork.

Customizing Zeus Commands

To add/modify commands, see docs/ruby/modifying.md.

Contributing

To get started hacking on Zeus itself, see docs/overview.md.

See also the handy contribution guide at contributing.md.

Rails 2.3 Support

The default plan bundled with zeus only supports Rails 3.x. There is a project (currently WIP) to provide Rails 2.3 support at https://github.com/tyler-smith/zeus-rails23.