Permalink
Browse files

Merge pull request #75 from yoniYalovitsky/patch-1

Added basic bash functions with pre-coding steps
  • Loading branch information...
2 parents f57905f + dec2720 commit 9bb6daa81daad1077ccc110bdc70fbfb2363cf00 @MeirKriheli MeirKriheli committed Mar 19, 2013
Showing with 66 additions and 6 deletions.
  1. +1 −1 docs/devel/source/index.rst
  2. +62 −5 docs/devel/source/{ide.rst → tips.rst}
  3. +3 −0 docs/devel/source/workflow.rst
View
2 docs/devel/source/index.rst
@@ -39,7 +39,7 @@ Contents:
environment/index
workflow
css_docs
- ide
+ tips
Indices and tables
==================
View
67 docs/devel/source/ide.rst → docs/devel/source/tips.rst
@@ -1,13 +1,18 @@
-===============
+.. _devel_tips:
+
+=========================
+Development Tips
+=========================
+
IDE setup
-===============
+=========
Basically you should lookup for virtualenv configuration of your preferred
development environment.
Eclipse with PyDev
-======================
+~~~~~~~~~~~~~~~~~~
Start by creating a new **PyDev** Project.
@@ -26,7 +31,7 @@ Start by creating a new **PyDev** Project.
In the opened window, click "New", and in the opened window "browse". Navigate
to your virtualenv and select the `python` executable in your `Scripts` folder
- (for MS Windows) or `bin` (on Linux).
+ (for MS Windows) or `bin` (on Linux).
.. image:: pydev_interpreter.png
@@ -54,7 +59,7 @@ You should have something like:
Click "OK".
* Create a run configuration for your project (to make sure it'll find the
database, etc.):
-
+
* Right click the project, select "Run As" | "Run configurations".
* Right click "PyDev Django" and select "New".
* Give it a name (e.g. "oknesset Django")
@@ -64,3 +69,55 @@ You should have something like:
``runserver --noreload``.
* Click "Run", you should be able to open your browser and access
http://localhost:8000 . You can use this run configration from now on.
+
+
+
+Useful bash functions
+===================================
+
+You can use some variation on these functions when beginning a development session (only after you finished the initial setup).
+To use these, paste these functions into your ``~/.bashrc`` file and change the ``~/oknesset/`` in oknesset_activate to the directory where you installed the project's virtualencv. These functions will now be available to you in all future bash sessions, but to get it working in already opened tabs, you'll need to type ``source ~/.bashrc``.
+
+A possible session might include:
+
+* Open a bash tab and run ``oknesset_update`` to pull the new code and db, install any new dependencies and run the tests to check that everything is ok.
+* Run ``oknesset_runserver`` in the same tab to launch the development site.
+* Open another tab and run ``oknesset_activate`` to enter the Open Knesset directory (and virtualenv) to do any manual work on the files.
+* Assuming you have the documentation tools set up and have changed some .rst files, run ``oknesset_makedocs`` to recreate the html pages.
+
+.. code-block:: bash
+
+ oknesset_activate () { #Just enter the Open-Knesset directory and activate the virtualenv
+ cd ~/oknesset/ #or wherever you put it
+
+ source bin/activate
+ cd Open-Knesset
+ }
+
+ oknesset_update () { #Pull the new code and prepare the environment
+ oknesset_activate
+
+ wget http://oknesset-devdb.s3.amazonaws.com/dev.db.bz2
+ mv dev.db dev.db.old
+ bzip2 -d dev.db.bz2
+ git pull git@github.com:hasadna/Open-Knesset.git master
+
+ cd ..
+ pip install -r requirements.txt
+ cd Open-Knesset
+
+ ./manage.py migrate
+ ./manage.py test
+ }
+
+ oknesset_runserver () { #start the local server
+ oknesset_activate
+ ./manage.py runserver
+ }
+
+ oknesset_makedocs () { #make the documentation html
+ oknesset_activate
+ pushd docs/devel >/dev/null
+ make html
+ popd >/dev/null
+ }
View
3 docs/devel/source/workflow.rst
@@ -47,6 +47,7 @@ running this command event in case of no changes):
`pip install -r Open-Knesset/requirements.txt`
+
Run migrations and tests
--------------------------------
@@ -61,6 +62,8 @@ group to see if that's something you should worry about.
.. _oknesset-dev: https://groups.google.com/forum/#!forum/oknesset-dev
+See :ref:`devel_tips` for a few bash functions that may help.
+
While Coding
==============

0 comments on commit 9bb6daa

Please sign in to comment.