|
1 | 1 | # Developer setup
|
2 | 2 |
|
| 3 | +## Preparation |
| 4 | + |
| 5 | +### With virtual battery |
| 6 | + |
| 7 | +* Build an initial local image with Docker |
| 8 | + ```sh |
| 9 | + docker build --rm -t pact_broker:dev . |
| 10 | + ``` |
| 11 | + |
| 12 | +* Spin up a container with mounted volume and open an interactive shell session |
| 13 | + ```sh |
| 14 | + docker run --rm -v $(PWD):/app -w /app -it pact_broker:dev bash |
| 15 | + ``` |
| 16 | + |
| 17 | +### With native install |
| 18 | + |
3 | 19 | * You will need to install Ruby 2.5, and preferably a ruby version manager. I recommend using [chruby][chruby] and [ruby-install][ruby-install].
|
4 | 20 | * Install bundler (the Ruby gem dependency manager) `gem install bundler`
|
5 | 21 | * Check out the pact_broker repository and cd into it.
|
6 | 22 | * Run `bundle install`. If you have not got mysql or postgres installed locally, comment out the `mysql2` and `pg` development dependency lines in `pact_broker.gemspec`, as these are only really required on Travis.
|
7 |
| -* Run `bundle exec rake pact_broker:dev:setup`. This will create an example application that you can run locally, that uses the local source code. |
8 |
| -* To run the example: |
9 | 23 |
|
10 |
| - cd dev |
11 |
| - bundle install |
12 |
| - bundle exec rackup |
| 24 | +## Running a local application |
13 | 25 |
|
| 26 | +* Run `bundle exec rake pact_broker:dev:setup`. This will create an example application that you can run locally, that uses the local source code. |
| 27 | +* To run the example: |
| 28 | + ```sh |
| 29 | + cd dev |
| 30 | + bundle install |
| 31 | + bundle exec rackup |
| 32 | + ``` |
14 | 33 | * The application will be available on `http://localhost:9292`
|
15 | 34 |
|
16 | 35 | ## Running the tests
|
17 | 36 |
|
18 |
| -To run everything (specs, pact verifications, vulnerability scan...): |
19 |
| - |
20 |
| -`bundle exec rake` |
21 |
| - |
22 |
| -To run a smaller subset of the tests: |
23 |
| - |
24 |
| -`bundle exec rake spec` |
25 |
| - |
26 |
| -To run the "quick tests" (skip the lengthy migration specs) |
27 |
| - |
28 |
| -`bundle exec rake spec:quick` |
29 |
| - |
30 |
| -To run a single spec: |
31 |
| - |
32 |
| -`bundle exec rspec path_to_your_spec.rb` |
| 37 | +* To run everything (specs, pact verifications, vulnerability scan...): |
| 38 | + ```sh |
| 39 | + bundle exec rake |
| 40 | + ``` |
| 41 | +* To run a smaller subset of the tests: |
| 42 | + ```sh |
| 43 | + bundle exec rake spec |
| 44 | + ``` |
| 45 | +* To run the "quick tests" (skip the lengthy migration specs) |
| 46 | + ```sh |
| 47 | + bundle exec rake spec:quick |
| 48 | + ``` |
| 49 | +* To run a single spec: |
| 50 | + ```sh |
| 51 | + bundle exec rspec path_to_your_spec.rb |
| 52 | + ``` |
33 | 53 |
|
34 | 54 | [chruby]: https://github.com/postmodern/chruby
|
35 | 55 | [ruby-install]: https://github.com/postmodern/ruby-install
|
0 commit comments