Giter VIP home page Giter VIP logo

guard-spork's Introduction

Guard::Spork Build Status

Guard::Spork allows to automatically & intelligently start/reload your RSpec/Cucumber/Test::Unit Spork server(s).

  • Compatible with Spork 0.8.4 & 0.9.0.rcX.
  • Tested against Ruby 1.8.7, 1.9.2, REE and the latest versions Rubinius.

Install

Please be sure to have Guard installed before continue.

Install the gem:

$ gem install guard-spork

Add it to your Gemfile (inside development group):

group :development do
  gem 'guard-spork'
end

Add guard definition to your Guardfile with:

$ guard init spork

Usage

Please read the Guard usage documentation.

Guardfile

Please read Guard doc for more info about the Guardfile DSL.

IMPORTANT: place Spork guard before RSpec/Cucumber/Test::Unit 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('Gemfile')
  watch('Gemfile.lock')
  watch('spec/spec_helper.rb') { :rspec }
  watch('test/test_helper.rb') { :test_unit }
  watch(%r{features/support/}) { :cucumber }
end

Running specs over Spork

Pass the :cli => "--drb" option to Guard::RSpec and/or Guard::Cucumber to run them over the Spork DRb server:

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

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

For MiniTest Guard you should pass the :drb => true option:

guard 'minitest', :drb => true do
  # ...
end

Options

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

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

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

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

Available options:

:wait => 60                                # Seconds to wait for the server to start, default: 30
:cucumber => false
:rspec => false
:test_unit => false
:bundler => false                          # Don't use "bundle exec"
:test_unit_port => 1233                    # Default: 8988
:rspec_port => 1234                        # Default: 8989
:cucumber_port => 4321                     # Default: 8990
:test_unit_env => { 'RAILS_ENV' => 'baz' } # Default: nil
:rspec_env => { 'RAILS_ENV' => 'foo' }     # Default: nil
:cucumber_env => { 'RAILS_ENV' => 'bar' }  # Default: nil
:aggressive_kill => false                  # Default: true, will search Spork pids from `ps aux` and kill them all on start.
:notify_on_start => true                   # Default: false, will notify as soon as starting begins.

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 => 60 option before any further investigation. It's possible that this error is the result of an unnecessary /test directory in the root of your application. Removing the /test directory entirely may resolve this error.

Development

Pull requests are very welcome! Please try to follow these simple "rules", though:

  • Please create a topic branch for every separate change you make.
  • Make sure your patches are well tested.
  • Update the README (if applicable).
  • Please do not change the version number.

For questions please join us on our Google group or on #guard (irc.freenode.net).

Author

Thibaud Guillaume-Gentil

guard-spork's People

Contributors

alanpeabody avatar aspiers avatar gix avatar irohiroki avatar jacortinas avatar mange avatar michaelbearne avatar mordaroso avatar mrkcor avatar murdoch avatar netzpirat avatar nixme avatar pauljamesrussell avatar pjg avatar reidreid46 avatar rymai avatar semaperepelitsa avatar tanordheim avatar thibaudgg avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.