Skip to content
This repository

Remove Spork and Guard #117

Closed
wants to merge 1 commit into from

8 participants

Dan Croak Joe Ferris Jason Morrison Joshua Clayton Joel Oliveira Harlow Ward Greg Lazarev Adarsh Pandit
Dan Croak
Owner

Use Zeus or Commands instead:

https://github.com/burke/zeus
https://github.com/rails/commands

They are superior to Spork for the following reasons:

  • You don't have to commit anything into your Gemfile, spec/spec_helper, or version control.
  • They improve the Rails bootup speed of rails server, runner, generate, console, and rake tasks... not just tests.
Joe Ferris
Owner

I tried zeus, but I'm still using spork because:

  • On projects I've tried it on, the tests don't pass using zeus.
  • You have to type zeus rspec, etc, and there doesn't seem to be a good solution yet like there is with bundler's binstubs.
  • zeus says that it requires memory patches

I love the idea of zeus and I think we'll end up using it over spork, but I think a more pragmatic approach would be to leave spork in until we've had general success with zeus. I want suspenders to contain "no-questions-asked, you should use this gem, and it will work" kind of things. I don't think zeus is across that line yet.

Are other people using zeus? Is it working well for you?

Dan Croak
Owner

On projects I've tried it on, the tests don't pass using zeus.

Interesting. Can you remember an example? I don't think I've had that issue.

You have to type zeus rspec, etc, and there doesn't seem to be a good solution yet like there is with bundler's binstubs.

I've just been doing alias s="zeus rspec". Is there a downside to that?

Are other people using zeus?

/cc @jasonm @gylaz

Jason Morrison

Zeus has been working great for me for a few weeks. I also alias/function-wrap for command line terseness (and to fix the occasional stty barf):

z() { zeus $*; stty sane }
alias zcuc='zeus cucumber'
Jason Morrison

I have run it on 1.9.2-p290 and 1.9.3-p194 without falcon patches with 4GB ram and no out-of-memory issues, keeping sessions open for days and across laptop sleeps.

Joshua Clayton

Are other people using zeus? Is it working well for you?

I've been playing with zeus on Swoop. It's alright, but I have a few observations.

  1. Unless I've done something wrong, zeus init creates a zeus.json file in the repo. Not sure if this means I need to modify the .gitignore or if the file should just be committed. I like that there's less interaction between zeus and the rest of the files; however, with spork (and guard) there's a total of two files that need to be changed (spec/spec_helper.rb and Guardfile) so I'm not sure there's a huge win around "[not having] to commit anything into your Gemfile, spec/spec_helper, or version control".
  2. It doesn't use zeus when running tests from within vim. This is actually the huge one for me. Because I can run rspec path/to/my_spec.rb with spork and everything works, my tests are always fast and I can run them from within my editor. Using zeus means I can't run tests from vim using vim-turbux and tslime. @croaky, @rook, does this work for you guys who're actually running the tests inside vim? If there's a way to change the binary (instead of just running rspec), that'd resolve this issue. UPDATE: running let g:turbux_command_rspec="zeus rspec" seems to work, although there's no better public interface.
  3. zeus rake is totally broken on Swoop (seeing undefined method 'display_error_message' for class 'Rake::Application'). I haven't spent time debugging this, though.

I have run it on 1.9.2-p290 and 1.9.3-p194 without falcon patches with 4GB ram and no out-of-memory issues, keeping sessions open for days and across laptop sleeps.

I'm also running it on 1.9.2-p290 without any memory patches and I've had no memory issues crop up. I do kill zeus at the end of the day, typically.

It's easy to accidentally change a file in Spork's prefork block and then lose a half hour to debugging why your tests are failing before realizing you need to restart Spork.

I've found that a proper Guardfile works wonders. It'll restart spork when certain files change and only requires one modification out of the box (watching config/routes.rb).

All in all, I love the idea of zeus but have found that spork is still much more effective in me doing my job (again, mostly surrounding running tests).

Dan Croak
Owner

zeus init creates a zeus.json file in the repo. Not sure if this means I need to modify the .gitignore or if the file should just be committed.

I've got zeus.json in my global ~/.gitignore.

https://github.com/croaky/dotfiles/blob/run-specs-directly-from-vim/vimrc#L89-126

Using zeus means I can't run tests from vim using vim-turbux and tslime. @croaky, @rook, does this work for you guys who're actually running the tests inside vim?

I'm not using tslime yet. This is what I did for using zeus and running tests from inside vim:

https://github.com/croaky/dotfiles/blob/run-specs-directly-from-vim/vimrc#L89-126

zeus rake is totally broken on Swoop (seeing undefined method 'display_error_message' for class 'Rake::Application'). I haven't spent time debugging this, though.

Maybe a related thing: I've changed the first line of spec/spec_helper.rb to force the Rails env to test (= instead of ||=). Otherwise, I was getting undefined constantFactoryGirl`. There's some load order or environment stuff I'm not sure I totally understand yet.

Jason Morrison
Dan Croak croaky Remove Spork and Guard
Use Zeus or Commands instead:

https://github.com/burke/zeus
https://github.com/rails/commands

They are superior to Spork for the following reasons:

* You don't have to commit anything into your Gemfile, spec/spec_helper,
  or version control.
* They improve the Rails bootup speed of rails server, runner, generate,
  console, and rake tasks... not just tests.
97a35f8
Dan Croak
Owner

I've rebased master into this branch and edited the commit message / PR description.

Note that this thread has focused on Zeus but the commit is restricted to removing Spork and Guard, not replacing them with an alternative. In my opinion, enough of us are using Spork/Guard alternatives such as Zeus (and perhaps soon Rails' commands http://github.com/rails/commands) that Suspenders shouldn't be forcing Spork/Guard.

What do people think?

Joel Oliveira
Harlow Ward

:+1: to removing Spork/Guard. I've enjoyed using Zeus too.

Joe Ferris
Owner

Some thoughts:

  • Running individual tests without spork or zeus is way too slow, so we should only remove spork if we're moving to something else. Nothing has been proposed besides zeus, so I think it's inevitable that this conversation is coupled to the idea of switching to zeus.
  • If we're switching to zeus, adding zeus init or whatever to script/setup would be helpful.
  • Every developer should almost always be using the same thing on each project. Having some people use zeus and others use whatever else exists will introduce "works on my machine" issues that waste time and decrease confidence; this is why I think it's important that we have something in suspenders.
  • While pairing with developers in San Francisco, I witnessed an abnormally high number of segfaults, failures to reload after changing models, and deadlocked servers. I'd like to hear opinions from the San Francisco developers as to whether or not zeus is ready.
Dan Croak
Owner

@jferris Good points.

While pairing with developers in San Francisco, I witnessed an abnormally high number of segfaults, failures to reload after changing models, and deadlocked servers. I'd like to hear opinions from the San Francisco developers as to whether or not zeus is ready.

I haven't personally seen those issues. I saw some problems after my first go-round with Zeus 3-4 months ago but have been updating with each release.

My sample size is small, though. I'm coding far less often the others here and been using it on smaller (Thrively, Schedule) projects. I've also only been running Ruby 1.9.3 (via chruby). It's worked fine inside of tmux. Not sure what else in my setup might be relevant.

It's definitely ready to be used on the two projects I mentioned. Folks recently on larger codebases: is it ready on those projects? /cc @brittballard @adarshpandit @gylaz @salbertson @masonforest @jessieay

Greg Lazarev
Collaborator

@jferris If I remember correctly, the segfaults weren't directly tied to zeus. I think there's something going on with Threadflip's setup/codebase that caused problems.

Otherwise, the only problems I've experienced with zeus is that sometimes it will hang -- when zeus tries to reload files (and it takes a second or two) and I run specs at the same time -- then I just restart zeus.

I'm +1 on zeus though.

Adarsh Pandit
Owner
Dan Croak croaky referenced this pull request
Closed

Runing Tests #126

Dan Croak
Owner

Final judgement from Joe in internal Technical Research Trello card:

I'd like to declare this as the successor to spork. It seems like new projects just aren't using spork; they're either using zeus or relying on fast boot time for small apps on 1.9.3.

It may be dethroned shortly by spring, but it seems like zeus is kind of the hill for now.

Merged as 704a47b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Dec 31, 2012
Dan Croak croaky Remove Spork and Guard
Use Zeus or Commands instead:

https://github.com/burke/zeus
https://github.com/rails/commands

They are superior to Spork for the following reasons:

* You don't have to commit anything into your Gemfile, spec/spec_helper,
  or version control.
* They improve the Rails bootup speed of rails server, runner, generate,
  console, and rake tasks... not just tests.
97a35f8
This page is out of date. Refresh to see the latest.
4 lib/suspenders/app_builder.rb
@@ -163,10 +163,6 @@ def configure_capybara_webkit
163 163 end
164 164 end
165 165
166   - def setup_guard_spork
167   - copy_file 'Guardfile', 'Guardfile'
168   - end
169   -
170 166 def generate_clearance
171 167 generate 'clearance:install'
172 168 end
1  lib/suspenders/generators/app_generator.rb
@@ -128,7 +128,6 @@ def configure_app
128 128 build :configure_action_mailer
129 129 build :configure_time_zone
130 130 build :configure_time_formats
131   -
132 131 build :add_email_validator
133 132 build :setup_default_rake_task
134 133 build :setup_clearance
2  templates/Gemfile_additions
@@ -12,8 +12,6 @@ group :development do
12 12 end
13 13
14 14 group :development, :test do
15   - gem 'guard'
16   - gem 'guard-spork'
17 15 gem 'rspec-rails'
18 16 gem 'sham_rack'
19 17 end
12 templates/Guardfile
... ... @@ -1,12 +0,0 @@
1   -guard 'spork' do
2   - watch 'config/application.rb'
3   - watch 'config/environment.rb'
4   - watch %r{^config/environments/.*\.rb$}
5   - watch %r{^config/initializers/.*\.rb$}
6   - watch 'config/routes.rb'
7   - watch 'Gemfile.lock'
8   - watch 'spec/factories.rb'
9   - watch 'spec/spec_helper.rb'
10   - watch %r{^spec/support/.*\.rb$}
11   - watch 'config/locales/.*'
12   -end

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.