thoughtworks/pacto — pull request #105 by maxlinc (2014-02-27 21:06:15+00:00)
Title: Pacto server

Adds a Pacto server for testing and polyglot usage. The Dummy server wouldn't be necessary anymore, except EventMachine is buggy on JRuby so I kept it for JRuby testing only. Other Rubies use the new Pacto::Server.

This PR adds:
- A pacto-server gem
- A pacto-server command
- A with_pacto test helper

I haven't done documentation or samples yet. I'm opening the PR for feedback on the code.

Quick usage guide:
Command line:
`bundle exec pacto-server -h` shows the options. `bundle exec ruby bin/pacto-server -sv -l -x spec/integration/data/ --strip-port --stub` will start up a server with the sample contracts.

Helper:
```ruby
opts = {:port => 5000} # similar opts to what's show with -h above
with_pacto(opts) do
# do something with a pacto server running
# it's running in concurrently in the same process with EventMachine
# so you can access Pacto and use the rspec expectations like:
MyClient.invoke_service
expect(Pacto).to have_validated(:get, 'http://example.com/my_service')
end

Some of the stranger options, like --recursive_loading and --strip-port might go away if we implement https://github.com/thoughtworks/pacto/issues/84 or other ideas to simplify loading and common usage patterns.