Commit | Line | Data |
---|---|---|
5a40e1ec WKG |
1 | .. _hacking-howto: |
2 | ||
00fdc7bd WKG |
3 | =============== |
4 | Hacking HOWTO | |
5 | =============== | |
6 | ||
5a40e1ec WKG |
7 | |
8 | So you want to hack on GNU MediaGoblin? | |
9 | ======================================= | |
56d507b6 | 10 | |
9d952fdc WKG |
11 | First thing to do is check out the `Web site |
12 | <http://mediagoblin.org>`_ where we list all the project | |
13 | infrastructure including: | |
56d507b6 WKG |
14 | |
15 | * the mailing list | |
16 | * the IRC channel | |
17 | * the bug tracker | |
18 | ||
19 | Additionally, we have information on how to get involved, who to talk | |
20 | to, what needs to be worked on, and other things besides! | |
21 | ||
22 | ||
c66d0f5c WKG |
23 | How to set up and maintain an environment for hacking |
24 | ===================================================== | |
56d507b6 | 25 | |
56d507b6 | 26 | |
c66d0f5c WKG |
27 | Getting requirements |
28 | -------------------- | |
56d507b6 | 29 | |
c66d0f5c WKG |
30 | First, you need to have the following installed before you can build |
31 | an environment for hacking on GNU MediaGoblin: | |
56d507b6 | 32 | |
c66d0f5c | 33 | * Python 2.6 or 2.7 - http://www.python.org/ |
56d507b6 | 34 | |
c66d0f5c | 35 | You'll need Python as well as the dev files for building modules. |
56d507b6 | 36 | |
c66d0f5c WKG |
37 | * python-lxml - http://lxml.de/ |
38 | * git - http://git-scm.com/ | |
39 | * MongoDB - http://www.mongodb.org/ | |
40 | ||
41 | If you're running Debian GNU/Linux or a Debian-derived distribution | |
42 | such as Mint or Ubuntu, running the following should install these | |
43 | requirements:: | |
44 | ||
5740a0d6 WKG |
45 | sudo apt-get install mongodb git-core python python-dev \ |
46 | python-lxml | |
c66d0f5c WKG |
47 | |
48 | ||
49 | Running bootstrap and buildout | |
50 | ------------------------------ | |
51 | ||
52 | After installing the requirements, follow these steps: | |
53 | ||
54 | 1. Clone the repository:: | |
55 | ||
56 | git clone http://git.gitorious.org/mediagoblin/mediagoblin.git | |
56d507b6 | 57 | |
719f82ba | 58 | 2. Bootstrap and run buildout:: |
56d507b6 | 59 | |
c66d0f5c WKG |
60 | cd mediagoblin |
61 | python bootstrap.py && ./bin/buildout | |
62 | ||
63 | ||
64 | That's it! Using this method, buildout should create a ``user_dev`` | |
65 | directory, in which certain things will be stored (media, beaker | |
66 | session stuff, etc). You can change this, but for development | |
67 | purposes this default should be fine. | |
68 | ||
69 | ||
70 | .. Note:: | |
71 | ||
72 | We used `zc.buildout <http://www.buildout.org/>`_ because it | |
73 | involves fewer steps to get things running and less knowledge of | |
74 | Python packaging. However, if you prefer to use `virtualenv | |
75 | <http://pypi.python.org/pypi/virtualenv>`_, that should work just | |
76 | fine. | |
56d507b6 WKG |
77 | |
78 | ||
c66d0f5c WKG |
79 | Updating dependencies |
80 | --------------------- | |
56d507b6 | 81 | |
c66d0f5c | 82 | While hacking on GNU MediaGoblin over time, you'll eventually have to |
5740a0d6 | 83 | update your development environment. To do that, run:: |
56d507b6 | 84 | |
c66d0f5c | 85 | ./bin/buildout |
56d507b6 WKG |
86 | |
87 | ||
5740a0d6 WKG |
88 | Wiping your environment for a clean-slate |
89 | ----------------------------------------- | |
90 | ||
9d952fdc WKG |
91 | .. Note:: |
92 | ||
93 | Unless you're doing development and working on and testing creating | |
94 | a new instance, you will probably never have to do this. Will | |
95 | plans to do this work and thus he documented it. | |
96 | ||
97 | ||
5740a0d6 WKG |
98 | Delete the following directories: |
99 | ||
100 | * bin/ | |
101 | * develop-eggs/ | |
102 | * eggs/ | |
103 | * mediagoblin.egg-info/ | |
104 | * parts/ | |
105 | * user_dev/ | |
106 | ||
9d952fdc WKG |
107 | FIXME - how to drop data from mongodb? we should probably write a |
108 | script. | |
5740a0d6 WKG |
109 | |
110 | ||
dae6add9 CAW |
111 | Running the server |
112 | ================== | |
113 | ||
114 | Run:: | |
115 | ||
c66d0f5c | 116 | ./bin/paster serve mediagoblin.ini --reload |
dae6add9 CAW |
117 | |
118 | ||
56d507b6 WKG |
119 | Running the test suite |
120 | ====================== | |
121 | ||
122 | Run:: | |
123 | ||
c66d0f5c | 124 | ./bin/nosetests |
56d507b6 WKG |
125 | |
126 | ||
5740a0d6 WKG |
127 | What's where |
128 | ============ | |
129 | ||
130 | After you've run buildout, you're faced with the following directory | |
131 | tree:: | |
132 | ||
133 | mediagoblin/ | |
134 | |- mediagoblin/ source code | |
135 | | |- tests/ | |
136 | | |- templates/ | |
137 | | |- auth/ | |
138 | | \- submit/ | |
139 | |- docs/ documentation | |
140 | | | |
141 | | the rest of these directories are generated by | |
142 | | buildout. | |
143 | | | |
144 | |- bin/ scripts | |
145 | |- develop-eggs/ | |
146 | |- eggs/ | |
147 | |- mediagoblin.egg-info/ | |
148 | |- parts/ | |
149 | |- user_dev/ sessions, etc | |
150 | ||
151 | ||
152 | ||
5a40e1ec WKG |
153 | Quickstart for Django programmers |
154 | ================================= | |
155 | ||
156 | FIXME - write this | |
157 | ||
158 | ||
159 | Bite-sized bugs to start with | |
160 | ============================= | |
161 | ||
162 | FIXME - write this | |
9d952fdc WKG |
163 | |
164 | ||
165 | Tips for people new to coding | |
166 | ============================= | |
167 | ||
168 | Python | |
169 | ------ | |
170 | ||
171 | GNU MediaGoblin is written using a programming language called `Python | |
172 | <http://python.org/>`_. | |
173 | ||
174 | There are two different incompatible iterations of Python which I'll | |
175 | refer to as Python 2 and Python 3. GNU MediaGoblin is written in | |
176 | Python 2 and requires Python 2.6 or 2.7. At some point, we might | |
177 | switch to Python 3, but that's a future thing. | |
178 | ||
179 | You can learn how to code in Python 2 from several excellent books | |
180 | that are freely available on the Internet: | |
181 | ||
182 | * `Learn Python the Hard Way <http://learnpythonthehardway.org/>`_ | |
183 | * `Dive Into Pyton <http://diveintopython.org/>`_ | |
184 | * `Python for Software Design <http://www.greenteapress.com/thinkpython/>`_ | |
185 | * `A Byte of Python <http://www.swaroopch.com/notes/Python>`_ | |
186 | ||
187 | These are all excellent texts. | |
188 | ||
189 | FIXME - are there good quality Python tutorial videos? | |
190 | ||
191 | ||
192 | Libraries | |
193 | --------- | |
194 | ||
195 | GNU MediaGoblin uses a variety of libraries in order to do what it | |
196 | does. These libraries are listed in the :ref:`beardomatic-chapter` | |
197 | along with links to the project Web sites and documentation for the | |
198 | libraries. | |
199 | ||
200 | There are a variety of Python-related conferences every year that have | |
201 | sessions covering many aspects of these libraries. You can find them | |
202 | at `Python Miro Community <http://python.mirocommunity.org>`_ [0]_. | |
203 | ||
204 | .. [0] This is a shameless plug. Will Kahn-Greene runs Python Miro | |
205 | Community. | |
206 | ||
207 | If you have questions or need help, find us on the mailing list and on | |
208 | IRC. |