Project

General

Profile

Development cycle » History » Version 12

Ward Vandewege, 09/21/2011 03:07 PM

1 1 Tom Clegg
h1. Development cycle
2
3 4 Tom Clegg
h2. Getting the code base
4
5 12 Ward Vandewege
 git clone git@git.clinicalfuture.com:tapestry.git
6 4 Tom Clegg
7 1 Tom Clegg
h2. Writing and contributing code
8
9
Start a branch like username/master or username/rails3
10
11
 git branch example/rails3
12
git checkout example/rails3
13
14
Do something trivial like
15
16
* add app/views/pages/specimen_collection.html.erb
17
* add link to it in app/views/pages/home.html.erb
18
19 3 Tom Clegg
Commit it.  If you refer to the issue# in the comment, redmine will notice this and do smart things (e.g., link to the commit from the issue page).
20 1 Tom Clegg
21
 git add ...
22 3 Tom Clegg
git commit -m 'description of stuff (closes #123)'
23 1 Tom Clegg
24
Push it
25
26
 git push
27
28
Generate a pull request
29
30 12 Ward Vandewege
 git request-pull e68ab19^ git@git.clinicalfuture.com:tapestry.git e68ab19
31 1 Tom Clegg
32
Send the pull request to someone like Ward
33
34 2 Ward Vandewege
h2. Merging code from other contributors/branches
35 1 Tom Clegg
36 4 Tom Clegg
Fetch latest code in other developers branches
37 1 Tom Clegg
38 4 Tom Clegg
 git fetch
39 1 Tom Clegg
40 4 Tom Clegg
List remote branches
41
42
 git branch -a
43
44 1 Tom Clegg
Switch to the other branch
45 2 Ward Vandewege
46 1 Tom Clegg
 git checkout origin/example/rails3
47 2 Ward Vandewege
48
(git will complain about being in a detached head state, but that's fine - just don't commit to this state)
49
50
Now look around, test
51 1 Tom Clegg
52 2 Ward Vandewege
 git log
53
54 4 Tom Clegg
Switch to production branch (set up with @git checkout --track origin/rails3@ if you haven't already) and make sure it's up-to-date
55 2 Ward Vandewege
56
 git checkout rails3
57 4 Tom Clegg
git pull origin rails3
58 2 Ward Vandewege
59 5 Tom Clegg
See what hasn't been merged
60
61
 git cherry -v rails3 origin/example/rails3
62
63 1 Tom Clegg
Cherry-pick a commit
64
65
 git cherry-pick e68ab19
66
67 2 Ward Vandewege
Or merge the entire remote tree (this will fetch and merge but not yet commit)
68
69
 git merge --no-commit origin/tomc/rails3
70
 
71
When you're happy, 
72
73
 git commit
74
75
Or rewind
76
77
 git reset --hard rails3
78
79
Finally, push
80 1 Tom Clegg
81
 git push
82 5 Tom Clegg
83
h2. Deploying to my-dev
84
85 6 Tom Clegg
Basics
86
87
 sudo gem install capistrano
88
89 10 Tom Clegg
Make sure "ssh root@www-dev.sum" puts you in root@www-dev and that *you have an SSH agent available.*  You might need in @~/.ssh/config@:
90 1 Tom Clegg
91 6 Tom Clegg
 Host www-dev.sum
92 1 Tom Clegg
  HostName www-dev
93 6 Tom Clegg
94
Check out production branch
95
96
 git checkout rails3
97
98
Deploy to www-dev
99
100
 cap deploy
101
102 11 Ward Vandewege
The capistrano task will run any required db migrations automatically. If you ever need to run them manually, you can do this (on www-dev):
103 6 Tom Clegg
104 1 Tom Clegg
 ssh root@www-dev.sum sh -c "'cd /var/www/my-dev.personalgenomes.org/current && RAILS_ENV=staging rake db:migrate'"
105 9 Tom Clegg
106 7 Tom Clegg
h2. Deploying to production server
107
108 10 Tom Clegg
Make sure "ssh root@www-prod.sum" puts you in root@www-prod and that you have a working SSH agent.
109 7 Tom Clegg
110
Check out production branch
111
112
 git checkout rails3
113
114
Deploy to www-prod
115
116
 cap deploy -f Capfile.production
117
118 11 Ward Vandewege
The capistrano task will run any required db migrations automatically. If you ever need to run them manually, you can do this (on www-prod):
119 7 Tom Clegg
120 9 Tom Clegg
 ssh root@www-prod.sum sh -c "'cd /var/www/my.personalgenomes.org/current && RAILS_ENV=production rake db:migrate'"