You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+36-5Lines changed: 36 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -13,13 +13,20 @@ _(Older Mac or Windows PC? See [instructions for Docker Toolbox](https://github.
13
13
14
14
_(Running Linux? See [instructions for Docker CE on Linux](https://github.com/RefugeRestrooms/refugerestrooms/wiki/How-to-use-Docker-CE-on-Linux-with-Refuge-Restrooms).)_
15
15
16
-
### 3 Build the Docker Container
17
-
Build the container from any [terminal](https://github.com/RefugeRestrooms/refugerestrooms/wiki/What-is-a-Terminal-(or-%22Terminal-Emulator%22)%3F-How-do-I-run-text-based-commands-on-my-computer%3F) program with:
16
+
### 3 Build the Docker Containers
17
+
Build the containers from any [terminal](https://github.com/RefugeRestrooms/refugerestrooms/wiki/What-is-a-Terminal-(or-%22Terminal-Emulator%22)%3F-How-do-I-run-text-based-commands-on-my-computer%3F) program with:
18
18
```
19
19
docker-compose build
20
20
```
21
21
22
-
### 4 Run the Docker Container
22
+
Optional: list the containers you just built:
23
+
```
24
+
docker ps
25
+
```
26
+
27
+
You should see two containers: refugerestrooms_web and postgres.
28
+
29
+
### 4 Run the Docker Containers
23
30
24
31
You can now run the app with:
25
32
```
@@ -40,16 +47,40 @@ If you need to run commands on the Docker container directly, run this:
40
47
```
41
48
docker-compose run web bash
42
49
```
43
-
_(This will give you a full interactive terminal session running on the Docker machine. You can (for example) run `bundle update` to update the Gems in the Gemfile to more recent versions.)_
50
+
_(This will give you a full interactive terminal session running on the Docker machine. For example, run `bundle update` to update the Gems in the Gemfile to more recent versions, or `rails console` to access web objects like `Restroom.first`.)_
44
51
45
52
Occasionally, you might need to rebuild the Docker machine so it picks up major updates (such as a new version of Ruby, or an updated Gemfile). To do so, run `docker-compose down` and `docker-compose build`.
46
53
54
+
If you want to access the postgres container to reach the psql command line do
55
+
56
+
```
57
+
docker-compose run db bash
58
+
psql -h refugerestrooms_db_1 -U postgres
59
+
```
60
+
61
+
or equivalently:
62
+
```
63
+
docker-compose run db psql -h refugerestrooms_db_1 -U postgres
64
+
```
65
+
47
66
### 6 Run the Tests
48
67
```
49
-
docker-compose run -e "RAILS_ENV=test" web rake db:test:prepare spec
68
+
docker-compose run -e "RAILS_ENV=test" web rake db:migrate:reset spec
50
69
```
51
70
_(If you want to know if your changes pass our automated testing, before even submitting your changes to RefugeRestrooms on Github, this will let you know.)_
52
71
72
+
If you want to run an individual spec, first log in to the container, then the spec. E.g.:
73
+
```
74
+
docker-compose run web bash
75
+
rspec spec/models/restroom_spec.rb
76
+
```
77
+
78
+
This is equivalent, but slower during a code-test-code-test development cycle:
79
+
80
+
```
81
+
docker-compose run web rspec spec/models/restroom_spec.rb
0 commit comments