One of the first things that made me love Ruby and (Rails by association), and move away from Java was speed. I don’t mean performance or load times. I mean the velocity at which I could build and deliver quality software. I hate waiting. Waiting for pages to load, waiting for code to compile, waiting for tests to run… waiting is one of the most annoying things about software development.
In the beginning Rails was fast.The time it took to develop web applications decreased significantly. But as Rails got bigger and more complex, and the things I built with Ruby and Rails got more sophisticated, I noticed things start to slow down. Boot times increased. Running tests no longer took seconds, but minutes. I (and many others in the Rails community) began to look for tools to help speed up development. One tool in particular has become a favorite of mine and among my comrades here at Grand Rounds.
Zeus! Zeus is a Ruby gem that helps you to significantly speed up development time in Rails. Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
All you need is Ruby and Rails installed in order to use it. Make sure you are using Ruby 1.9.3 or later. With Rails you should be on version 3.x or later. With the prerequesits, you just need to install Zeus itself, which can be installed like any other Ruby Gem:
After you’ve installed it, you can use the zeus command to start it up:
You’ll see zeus come up and it’ll list the available commands:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
If you find that you don’t use one or more of the commands, you can remove them by editing the zeus.json config file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Now that you got Zeus installed and running, it’s time to experience the awesome! Nearly all of the commands you normally run in Rails, you can now run in zeus. Note, that you no longer need to prefix the commands with bundle exec when using zeus. Here’s a list of all the commands available:
1 2 3 4 5 6 7 8 9 10
When you start up your server with zeus, you’ll notice that it seems to come up instantly. That’s because zeus has pre-loaded the environment and the Rails app.
1 2 3 4 5 6 7 8
You’ll see the same kind of speed when you’re starting up Rails console. You get the irb prompt in less than a second:
1 2 3
Beyond the normal server commands, zeus also speeds up running tests, or in my case specs.
You’ll notice that there is virtually no load time. The specs start running right away.
You may also want to remove the auto commands from spec_helper.rb They are known to cause issues when running with zeus: