~u5218464/schooltool-book/schooltool-book

« back to all changes in this revision

Viewing changes to i18n/hi/build/html/_sources/dev_sandbox.txt

  • Committer: Karun Agarwal
  • Date: 2014-05-22 10:02:44 UTC
  • Revision ID: u5218464@anu.edu.au-20140522100244-0lv39nttpudy41cp
added new branch to make translations for schooltool-book to hindi

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Developing SchoolTool
 
2
=====================
 
3
 
 
4
SchoolTool uses Bazaar_ VCS.  Be sure to install it first::
 
5
 
 
6
  ~$ sudo apt-get install bzr
 
7
 
 
8
Install `build dependencies`_ like compilers, development libraries and fonts::
 
9
 
 
10
  ~$ sudo make ubuntu-environment
 
11
 
 
12
.. _Bazaar: http://bazaar-vcs.org/
 
13
 
 
14
 
 
15
Quickstart
 
16
----------
 
17
 
 
18
"But I just want to look at it!"
 
19
 
 
20
This is not a preferred way to develop SchoolTool, but it will give you a quick taste::
 
21
 
 
22
  ~$ bzr co lp:schooltool schooltool
 
23
  ~$ cd schooltool
 
24
 
 
25
The **schooltool** package just contains the "core" functionality of SchoolTool: gets the server up and running, lets you define the structure of the school and the calendar.
 
26
 
 
27
To *use* SchoolTool for anything (beyond calendaring) you need plugins.
 
28
 
 
29
Enable plugins (optional).
 
30
 
 
31
To enable plugins, edit buildout.cfg to contain::
 
32
 
 
33
  [package]
 
34
  eggs += schooltool
 
35
          schooltool.gradebook
 
36
          schooltool.lyceum.journal
 
37
          schooltool.intervention
 
38
 
 
39
Build and run schooltool::
 
40
 
 
41
  ~/schooltool$ make run
 
42
 
 
43
Open http://localhost:7080/ in your browser.
 
44
 
 
45
If you want to change enabled plugins, edit buildout.cfg, and run SchoolTool again::
 
46
 
 
47
  ~/schooltool$ make run
 
48
 
 
49
 
 
50
Setting up a development sandbox
 
51
--------------------------------
 
52
 
 
53
Set your buildout eggs and cache directories
 
54
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
55
 
 
56
Create ~/.buildout/default.cfg and add::
 
57
 
 
58
  [buildout]
 
59
  eggs-directory = /home/*your-user*/.buildout/eggs
 
60
  download-cache = /home/*your-user*/.buildout/cache
 
61
  extends-cache = /home/*your-user*/.buildout/extends
 
62
 
 
63
Buildout does not understand the unix ~ notation, so use the full
 
64
path.
 
65
 
 
66
Create the cache directories::
 
67
 
 
68
  ~$ mkdir -p ~/.buildout/eggs
 
69
  ~$ mkdir -p ~/.buildout/cache
 
70
  ~$ mkdir -p ~/.buildout/extends
 
71
 
 
72
 
 
73
Create the shared repository
 
74
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
75
 
 
76
Create the bzr shared repository::
 
77
 
 
78
  ~$ mkdir schooltool_sandbox
 
79
  ~$ bzr init-repo schooltool_sandbox
 
80
 
 
81
(http://bazaar-vcs.org/SharedRepositoryTutorial)
 
82
 
 
83
 
 
84
Working on a project
 
85
--------------------
 
86
 
 
87
For a list of projects, see::
 
88
 
 
89
  https://launchpad.net/schooltool-project
 
90
 
 
91
Get the project you want to work on
 
92
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
93
 
 
94
Let's assume you worked on schooltool.gradebook super ajax feature and your launchpad
 
95
username is "ideveloper".  Parts you are expected to change depending on who you are or what you
 
96
are working on are underlined::
 
97
 
 
98
  ~$ cd schooltool_sandbox
 
99
  ~/schooltool_sandbox$ bzr branch lp:schooltool.gradebook schooltool.gradebook_super_ajax
 
100
                                                                               -----------
 
101
  ~/schooltool_sandbox$ cd schooltool.gradebook_super_ajax
 
102
 
 
103
It's slow for the first copy of the project.  Shared repository at least speeds up the second branch.
 
104
 
 
105
Ensure you have all needed dev tools::
 
106
 
 
107
  ~/schooltool_sandbox/schooltool.gradebook_super_ajax$ sudo make ubuntu-environment
 
108
 
 
109
Now, build the project::
 
110
 
 
111
  ~/schooltool_sandbox/schooltool.gradebook_super_ajax$ make
 
112
 
 
113
Congratulations, you can run the server now::
 
114
 
 
115
  ~/schooltool_sandbox/schooltool.gradebook_super_ajax$ make run
 
116
 
 
117
 
 
118
Develop your feature
 
119
~~~~~~~~~~~~~~~~~~~~
 
120
 
 
121
Push your branch to Launchpad::
 
122
 
 
123
  ~/schooltool_sandbox/schooltool.gradebook$ bzr push lp:~ideveloper/schooltool/schooltool.gradebook_super_ajax
 
124
                                                          ----------            -------------------------------
 
125
 
 
126
Now you can begin your work.  Commit using ``bzr ci`` diff using ``bzr diff`` update your branch using ``bzr pull``.  Commit often and in small chunks.
 
127
 
 
128
Don't forget to update the eggs from time to time to the latest released versions::
 
129
 
 
130
  ~/schooltool_sandbox/schooltool.gradebook_super_ajax$ make update
 
131
 
 
132
 
 
133
Publishing your changes
 
134
~~~~~~~~~~~~~~~~~~~~~~~
 
135
 
 
136
If you worked on a bugfix, now is a good time to link your branch to the bug in Launchpad::
 
137
 
 
138
  https://code.launchpad.net/~ideveloper/schooltool/schooltool.gradebook_super_ajax
 
139
                             -----------            -------------------------------
 
140
 
 
141
Finally, propose a merge (to development focus branch) in the Launchpad branch's page (same link above).
 
142
 
 
143
Once it's reviewed, the feature will be merged to trunk and new development eggs will be released.
 
144
 
 
145
 
 
146
General guidelines
 
147
------------------
 
148
 
 
149
**Create a new branch for every feature**
 
150
 
 
151
Having every feature and every bugfix in a separate branch allows
 
152
reviewing checkins **easier**, because every branch has only 1 goal. If a
 
153
bugfix is not complete or it **did not pass the review** - you can
 
154
**continue working** on it in that **same branch** so all the related changes
 
155
are in the same place and not 20 unrelated checkins apart.  And most importantly,
 
156
they are **not mixed with other features**.  It also makes the **backporting** to
 
157
older SchoolTool versions a lot easier for the maintainers.
 
158
 
 
159
**Work on a single plugin at a time**
 
160
 
 
161
Have a separate checkout directory for each project.  Do not modify buildout.cfg
 
162
unless you really need to.  Avoid cross-dependencies between plugins.  Select carefully
 
163
to which plugin the feature should logically belong to.  Keep things simple.  Thanks!
 
164
 
 
165
**Commit often.  Write tests.**
 
166
 
 
167
Commit often and in small chunks.  Write/update unit and functional tests to
 
168
pass with each commit.  The more you practice this rule, the fewer bugs you'll
 
169
eventually make.
 
170
 
 
171
If you're fixing an unobvious bug, it's a good idea to write a test that ensures the
 
172
bug won't be reimplemented again.
 
173
 
 
174
 
 
175
Developing multiple plugins at the same time
 
176
-----------------------------------------------------
 
177
 
 
178
WARNING: we recommend avoiding this scenario when possible.
 
179
 
 
180
Let's assume you want to work on both SchoolTool core and the Gradebook plugin.
 
181
 
 
182
First, check out branches (lp:schooltool and lp:schooltool.gradebook) to your sandbox::
 
183
 
 
184
  ~/schooltool_sandbox$ bzr branch lp:schooltool schooltool_dev
 
185
  ~/schooltool_sandbox$ bzr branch lp:schooltool.gradebook schooltool.gradebook_dev
 
186
 
 
187
Edit ``buildout.cfg`` in the directory you run the server from (say, schooltool.gradebook_dev).
 
188
 
 
189
Change develop to include both SchoolTool and Gradebook::
 
190
 
 
191
  develop = . ../schooltool_dev
 
192
 
 
193
Check if all desired eggs are included::
 
194
 
 
195
  [schooltool]
 
196
  eggs += schooltool
 
197
          schooltool.gradebook
 
198
  <...>
 
199
 
 
200
Push both directories to separate branches in Launchpad, request merges on both at the
 
201
same time.  I believe it's obvious that dealing with multiple branch merging increases
 
202
chances of human error.
 
203
 
 
204
 
 
205
.. _build dependencies:
 
206
 
 
207
Build dependencies
 
208
------------------
 
209
 
 
210
On Ubuntu you can simply ``sudo make ubuntu-environment``. On other systems,
 
211
below is what you need:
 
212
 
 
213
Build essentials::
 
214
 
 
215
  $ apt-get install build-essential gettext
 
216
 
 
217
Contains gcc, make and other tools needed to build software.
 
218
 
 
219
Python 2.6 or 2.7 with development headers::
 
220
 
 
221
  $ apt-get install python-dev
 
222
 
 
223
Development libraries::
 
224
 
 
225
  $ apt-get install libicu-dev libxslt1-dev libfreetype6-dev libjpeg-dev enscript
 
226
 
 
227
You also need virtualenv and both Ubuntu and Liberation fonts::
 
228
 
 
229
  $ apt-get install python-virtualenv ttf-ubuntu-font-family ttf-liberation