|
| 1 | +# Development Setup |
| 2 | + |
| 3 | +Generally speaking, you only need to clone the project and install |
| 4 | +the dependencies with [Bundler](http://bundler.io/). You can either |
| 5 | +get a full RSpec development environment using |
| 6 | +[rspec-dev](https://github.com/rspec/rspec-dev#README) or you can |
| 7 | +set up this project individually. |
| 8 | + |
| 9 | +## Using rspec-dev |
| 10 | + |
| 11 | +See the [rspec-dev README](https://github.com/rspec/rspec-dev#README) |
| 12 | +for setup instructions. |
| 13 | + |
| 14 | +The rspec-dev project contains many rake tasks for helping manage |
| 15 | +an RSpec development environment, making it easy to do things like: |
| 16 | + |
| 17 | +* Change branches across all repos |
| 18 | +* Update all repos with the latest code from `master` |
| 19 | +* Cut a new release across all repos |
| 20 | +* Push out updated build scripts to all repos |
| 21 | + |
| 22 | +These sorts of tasks are essential for the RSpec maintainers but will |
| 23 | +probably be unnecessary complexity if you're just contributing to one |
| 24 | +repository. If you are getting setup to make your first contribution, |
| 25 | +we recommend you take the simpler route of setting up <%= project_name %> |
| 26 | +individually. |
| 27 | + |
| 28 | +## Setting up <%= project_name %> individually |
| 29 | + |
| 30 | +Clone the repo: |
| 31 | + |
| 32 | +``` |
| 33 | +$ git clone [email protected]:rspec/ <%= project_name %>.git |
| 34 | +``` |
| 35 | + |
| 36 | +Install the dependencies using [Bundler](http://bundler.io/): |
| 37 | + |
| 38 | +``` |
| 39 | +$ cd <%= project_name %> |
| 40 | +$ bundle install |
| 41 | +``` |
| 42 | + |
| 43 | +For reasons discussed below, our CI builds avoid loading Bundler at runtime |
| 44 | +by using Bundler's [`--standalone option`](http://myronmars.to/n/dev-blog/2012/03/faster-test-boot-times-with-bundler-standalone). |
| 45 | +While not strictly necessary (many/most of our contributors do not do this!), |
| 46 | +if you want to exactly reproduce our CI builds you'll want to do the same: |
| 47 | + |
| 48 | +``` |
| 49 | +$ bundle install --standalone --binstubs |
| 50 | +``` |
| 51 | + |
| 52 | +The `--binstubs` option creates the `bin/rspec` file that, like `bundle exec rspec`, will load |
| 53 | +all the versions specified in `Gemfile.lock` without loading bundler at runtime! |
| 54 | + |
| 55 | +## Gotcha: Version mismatch from sibling repos |
| 56 | + |
| 57 | +The [../Gemfile] is designed to be flexible and support using |
| 58 | +the other RSpec repositories either from a local sibling directory |
| 59 | +(e.g. `../rspec-<subproject>`) or, if there is no such directory, |
| 60 | +directly from git. This generally does the "right thing", but can |
| 61 | +be a gotcha in some situations. For example, if you are setting up |
| 62 | +`rspec-core`, and you happen to have an old clone of `rspec-expectations` |
| 63 | +in a sibling directory, it'll be used even though it might be months or |
| 64 | +years out of date, which can cause confusing failures. |
| 65 | + |
| 66 | +To avoid this problem, you can either `export USE_GIT_REPOS=1` to force |
| 67 | +the use of `:git` dependencies instead of local dependencies, or update |
| 68 | +the code in the sibling directory. rspec-dev contains rake tasks to |
| 69 | +help you keep all repos in sync. |
| 70 | + |
| 71 | +# Running the build |
| 72 | + |
| 73 | +The [Travis CI build](travis-ci.org/rspec/<%= project_name %>) |
| 74 | +runs many verification steps to prevent regressions and |
| 75 | +ensure high-quality code. To run the Travis build locally, run: |
| 76 | + |
| 77 | +``` |
| 78 | +$ script/run_build |
| 79 | +``` |
| 80 | + |
| 81 | +Let's break this down into the individual steps that are part of the build. |
| 82 | + |
| 83 | +## Running the spec suite |
| 84 | + |
| 85 | +``` |
| 86 | +$ bundle exec rspec |
| 87 | + |
| 88 | +# or, if you installed your bundle with `--standalone --binstubs`: |
| 89 | + |
| 90 | +$ bin/rspec |
| 91 | +``` |
0 commit comments