Skip to content

sanjayk/guard-spork

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guard::Spork

Spork guard allows to automatically & intelligently start/reload your RSpec/Cucumber Spork server(s).

  • Compatible with Spork 0.8.4 & 0.9.0.rc3

  • Tested on Ruby 1.8.6, 1.8.7 & 1.9.2.

Install

Please be sure to have Guard installed before continue.

Install the gem:

gem install guard-spork

Add it to your Gemfile (inside test group):

gem 'guard-spork'

Add guard definition to your Guardfile with:

guard init spork

Usage

Please read Guard usage doc

Guardfile

Spork guard can be really be adapated to all kind of projects. Please read Guard doc for more info about Guardfile DSL.

!!! IMPORTANT: place Spork guard before rspec/cucumber guards !!!

Rails app

guard 'spork' do
  watch('config/application.rb')
  watch('config/environment.rb')
  watch(%r{^config/environments/.*\.rb$})
  watch(%r{^config/initializers/.*\.rb$})
  watch('spec/spec_helper.rb')
end

Running specs over Spork

Pass the :drb => true option to guard-rspec and/or guard-cucumber to run them over the Spork DRb server:

guard 'rspec', :drb => true do
  ...
end

guard 'cucumber', :drb => true do
  ...
end

Options

Spork guard automatically detect RSpec/Cucumber/Bundler presence but you can disable any of them with the corresponding options:

guard 'spork', :cucumber => false, :bundler => false do
  ...
end

Available options:

:wait => 30            # Seconds to wait server launch, default 20
:cucumber => false
:rspec => false
:bundler => false      # don't use "bundle exec"
:rspec_port => xxxx    # default 8989
:cucumber_port => xxxx # default 8990

Common troubleshooting

If you can start Spork manually but get the following error message when using Spork guard:

Starting Spork for RSpec ERROR: Could not start Spork for RSpec. Make sure you can use it manually first.

Try to increase the value of the :wait option before any further investigation.

Development

Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.

Authors

Thibaud Guillaume-Gentil

About

Guard::Spork automatically manage Spork DRb servers

Resources

License

Stars

Watchers

Forks

Packages

No packages published