Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 176 lines (110 sloc) 3.938 kB
04b6e2e @jferris Rename repo to "guides", split into 3 guides
jferris authored
1 Protocol
2 ========
3
4 A guide for getting things done.
5
6 Set up laptop
7 -------------
8
9 Set up your laptop with [this script](/thoughtbot/laptop)
10 and [these dotfiles](/thoughtbot/dotfiles).
11
12 Create Rails app
13 ----------------
14
15 Get Suspenders.
16
17 gem install suspenders
18
19 Create the app.
20
21 suspenders app --heroku true --github organization/app
22
23 Set up Rails app
24 ----------------
25
26 Get the code.
27
28 git clone git@github.com:organization/app.git
29
30 Set up the app's dependencies.
31
32 cd project
33 bundle --binstubs
34 rake db:setup
35
36 Add Heroku remotes for staging and production environments.
37
38 git remote add staging git@heroku.com:<app>-staging.git
39 git remote add production git@heroku.com:<app>-production.git
40
41 Use [Heroku config](/ddollar/heroku-config) to get `ENV`
42 variables.
43
44 heroku config:pull -r staging
45
46 Delete extra lines in `.env`, leaving only those needed for app to function
47 properly. For example: `BRAINTREE_MERCHANT_ID` and `S3_SECRET`.
48
49 Use [Foreman](http://goo.gl/oy4uw) to run the app locally.
50
51 foreman start
52
53 It uses your `.env` file and `Procfile` to run processes just like Heroku's
54 [Cedar](https://devcenter.heroku.com/articles/cedar/) stack.
55
56 Write a feature
57 ---------------
58
59 Create a local feature branch based off master.
60
61 git checkout master
62 git pull --rebase
63 git checkout -b your-initials-new-feature
64
65 Rebase frequently to incorporate upstream changes.
66
67 git fetch origin
68 git rebase origin/master
69 <resolve conflicts>
70
71 When feature is complete and tests pass, commit the changes.
72
73 rake
74 git add -A
75 git status
76 git commit -v
77
78 Write a [good commit message](http://goo.gl/w11us).
79
80 Present-tense summary under 50 characters
81
82 * More information about commit (under 72 characters).
83 * More information about commit (under 72 characters).
84
85 Share your branch.
86
87 git push origin [branch]
88
89 Submit a [Github pull request](http://goo.gl/Kmdee).
90
91 Ask for a code review in [Campfire](http://campfirenow.com).
92
93 Review code
94 -----------
95
96 A team member other than the author reviews the pull request.
97
98 They make comments and ask questions directly on lines of code in the Github
99 web interface or in Campfire.
100
101 For changes which they can make themselves, they check out the branch.
102
103 git checkout <branch>
104 rake db:migrate
105 rake
106 git diff staging/master..HEAD
107
108 They make small changes right in the branch, test the feature in browser,
109 run tests, commit, and push.
110
111 When satisfied, they comment on the pull request `Ready to merge.`
112
113 Merge
114 -----
115
116 Rebase interactively. Squash commits like "Fix whitespace" into one or a
117 small number of valuable commit(s). Edit commit messages to reveal intent.
118
119 git rebase -i origin/master
120 rake
121
122 View a list of new commits. View changed files. Merge branch into master.
123
124 git log origin/master..[branch]
125 git diff --stat origin/master
126 git checkout master
127 git merge [branch] --ff-only
128 git push
129
130 Delete your remote feature branch.
131
132 git push origin :[branch]
133
134 Delete your local feature branch.
135
136 git branch -d [branch]
137
138 Deploy
139 ------
140
141 View a list of new commits. View changed files. Deploy to
142 [Heroku](https://devcenter.heroku.com/articles/quickstart) staging.
143
144 git fetch staging
145 git log staging/master..master
146 git diff --stat staging/master
147 git push staging
148
149 Run migrations (if necessary).
150
151 heroku run rake db:migrate -r staging
152
153 Restart the dynos if migrations were run.
154
155 heroku restart -r staging
156
157 [Introspect](http://goo.gl/tTgVF) to make sure everything's ok.
158
159 watch heroku ps -r staging
160
161 Test the feature in browser.
162
163 Deploy to production.
164
165 git fetch production
166 git log production/master..master
167 git diff --stat production/master
168 git push production
169 heroku run rake db:migrate -r production
170 heroku restart -r production
171 watch heroku ps -r production
172
173 Watch logs and metrics dashboards.
174
175 Close pull request and comment `Merged.`
Something went wrong with that request. Please try again.