Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pellegrino/guard-spork

Guard::Spork automatically manage Spork DRb servers
https://github.com/pellegrino/guard-spork

Last synced: 3 months ago
JSON representation

Guard::Spork automatically manage Spork DRb servers

Awesome Lists containing this project

README

        

= Guard::Spork
http://travis-ci.org/guard/guard-spork.png

Guard::Spork allows to automatically & intelligently start/reload your RSpec/Cucumber {Spork}[https://github.com/timcharper/spork] server(s).

- Compatible with Spork 0.8.4 & 0.9.0.rcXX.
- Tested on Ruby 1.8.6, 1.8.7, REE, 1.9.2, JRuby & Rubinius.

== Install

Please be sure to have {Guard}[https://github.com/guard/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}[https://github.com/guard/guard#readme].

== Guardfile

Please read {Guard doc}[https://github.com/guard/guard#readme] for more info about the 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 :cli => "--drb" option to {Guard::RSpec}[https://github.com/guard/guard-rspec] and/or {Guard::Cucumber}[https://github.com/guard/guard-cucumber] to run them over the Spork DRb server:

guard 'rspec', :cli => "--drb" do
...
end

guard 'cucumber', :cli => "--drb" do
...
end

== Options

Guard::Spork 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

You can provide additional environment variables for RSpec and Cucumber with the :rspec_env and :cucumber_env options:

guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'cucumber' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
...
end

Available options:

:wait => 30 # Seconds to wait for the server to starts, default: 20
:cucumber => false
:rspec => false
:bundler => false # Don't use "bundle exec"
:rspec_port => 1234 # Default: 8989
:cucumber_port => 4321 # Default: 8990
:rspec_env => { 'RAILS_ENV' => 'foo' } # Default: nil
:cucumber_env => { 'RAILS_ENV' => 'bar' } # Default: nil

== Common troubleshooting

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

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

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

== Development

- Source hosted at {GitHub}[https://github.com/guard/guard-spork]
- Report issues/Questions/Feature requests on {GitHub Issues}[https://github.com/guard/guard-spork/issues]

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}[https://github.com/thibaudgg]