Skip to content

Commit

Permalink
Add setup-devel script for fast development patchwork config
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Ciubotaru <gabriel.ciubotaru@intel.com>
  • Loading branch information
Gabriel Ciubotaru authored and Damien Lespiau committed Nov 8, 2015
1 parent 591591f commit 9dc81df
Show file tree
Hide file tree
Showing 7 changed files with 3,978 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ cscope.*
# test artifacts
/selenium.log
/selenium_screenshots

# created by tools/setup-devel.sh
/venv
/patchwork/settings/db.sqlite
21 changes: 21 additions & 0 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
Developing patchwork
====================

Quick Start
-----------

We have scripts that will get developers started in no time::

$ git clone https://github.com/dlespiau/patchwork/
$ cd patchwork
$ ./tools/setup-devel.sh
$ ./tools/run-devel.sh

``setup-devel.sh`` will:

- Create a virtual environment in the ``venv`` directory,
- Install all the required dependencies in that virtual environment,
- Populate a SQLite database with a few patches,
- Create an ``admin`` account with ``pass`` as password.

``run-devel.sh`` will run the web server serve the patchwork
application. Pointing your browser to http://127.0.0.1:8000/ should
bring up patchwork.

Using virtualenv
----------------

Expand Down
2 changes: 2 additions & 0 deletions docs/requirements-dev-sqlite.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django>=1.8,<1.9
-r requirements-dev.txt
3,840 changes: 3,840 additions & 0 deletions patchwork/fixtures/test_data.xml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions patchwork/settings/dev-sqlite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""
Quick development settings for patchwork project.
Most of these are commented out as they will be installation dependent.
Design based on:
http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/
"""

from base import *
from os.path import join, dirname

#
# Core settings
# https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
#

# Security
#
# You'll need to replace this to a random string. The following python code can
# be used to generate a secret key:
#
# import string, random
# chars = string.letters + string.digits + string.punctuation
# print repr("".join([random.choice(chars) for i in range(0,50)]))

SECRET_KEY = '00000000000000000000000000000000000000000000000000'

# Database
#
# SQLite database is used for development.
# Please see https://docs.djangoproject.com/en/1.7/ref/settings/#databases
# for documentation about database configuration.

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': join(dirname(__file__), 'db.sqlite'),
},
}

DEBUG = True
TEMPLATE_DEBUG = True
ENABLE_XMLRPC = True

27 changes: 27 additions & 0 deletions tools/run-devel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Patchwork - automated patch tracking system
# Copyright (C) 2015 Intel Corporation
#
# This file is part of the Patchwork package.
#
# Patchwork is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Patchwork is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

PORT=8000
CFG=patchwork.settings.dev-sqlite

cd $(dirname $0)/..
. venv/bin/activate
export DJANGO_SETTINGS_MODULE=$CFG
./manage.py runserver ${PORT}
deactivate
39 changes: 39 additions & 0 deletions tools/setup-devel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Patchwork - automated patch tracking system
# Copyright (C) 2015 Intel Corporation

This comment has been minimized.

Copy link
@mpe

mpe Nov 9, 2015

Contributor

This doesn't have a shebang line, so you can't run it as a shell script as the docs suggest, at least not on my system?

Looks like that's due to my shell, it works OK if your shell is bash. But it should probably have a shebang line anyway.

This comment has been minimized.

Copy link
@dlespiau

dlespiau Nov 10, 2015

Owner

Ah! I did see in the review but shrugged it off, it was working after all. Didn't realize it was a bashism. Caught another one (the use of 'source'), fixed both in master. Thanks for the report.

#
# This file is part of the Patchwork package.
#
# Patchwork is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Patchwork is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


CFG=patchwork.settings.dev-sqlite

update_virtualenv()
{
directory=$1
requirements=$2

[ -d "$directory" ] || virtualenv "$directory"
source $directory/bin/activate
pip install --upgrade -r $requirements
}

cd $(dirname $0)/..

update_virtualenv venv docs/requirements-dev-sqlite.txt
export DJANGO_SETTINGS_MODULE=$CFG
./manage.py migrate --noinput
./manage.py loaddata test_data
deactivate

0 comments on commit 9dc81df

Please sign in to comment.