Remove Spork and Guard #117

Closed
wants to merge 1 commit into
from

8 participants

@croaky
thoughtbot, inc. member

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.
@jferris
thoughtbot, inc. member

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?

@croaky
thoughtbot, inc. member

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

@jasonm

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'
@jasonm

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.

@joshuaclayton
thoughtbot, inc. member

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).

@croaky
thoughtbot, inc. member

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.

@jasonm
@croaky 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
@croaky
thoughtbot, inc. member

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?

@jayroh
@harlow

👍 to removing Spork/Guard. I've enjoyed using Zeus too.

@jferris
thoughtbot, inc. member

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.
@croaky
thoughtbot, inc. member

@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

@gylaz
thoughtbot, inc. member

@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
@croaky croaky referenced this pull request Jan 17, 2013
Closed

Runing Tests #126

@croaky croaky closed this Feb 24, 2013
@croaky
thoughtbot, inc. member

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