Пример #1
0
#!/usr/bin/env python
# Clear and initialize exampledb. Creates a database with the standard users, but no other devilry data.

if __name__ == '__main__':
    from os import mkdir
    from os.path import exists
    from shutil import rmtree
    from common import require_djangoproject, depends, Command

    require_djangoproject()
    depends(Command('clear_exampledb'))

    if exists('deliverystore'):
        rmtree('deliverystore')
        print "Removed deliverystore/"
    mkdir('deliverystore')
Пример #2
0
    help=(
        "Number of deliveries. If it is a range separated by '-', "
        "a random number of deliveries in this range is used. Defaults "
        "to '0-4'"
    ),
)
parser.add_argument("--completionlist", action="store_true", help="Print completionlist for bash completion.")
args = parser.parse_args()

if args.completionlist:
    print "--num_students --num_examiners --duckburghusers --deliverycountrange"
    exit(0)


require_djangoproject()
depends(Command("init_exampledb"), Command("load_grandmauser"))
if args.duckburghusers:
    depends(Command("load_duckburghusers"))

logging.basicConfig(level=logging.INFO, format="%(levelname)7s: %(message)s")


scriptsdir = getscriptsdir()
create_testgroups_cmd = join(scriptsdir, "create_testgroups.py")


def create_testgroups(period, assignments, **shared_kwargs):
    logging.info(str(period))
    for kwargs in assignments:
        kw = dict()
        kw.update(shared_kwargs)
Пример #3
0
                    help='Load duckburgh users.')
parser.add_argument("--deliverycountrange", default='0-4',
                    help=("Number of deliveries. If it is a range separated by '-', "
                          "a random number of deliveries in this range is used. Defaults "
                          "to '0-4'"))
parser.add_argument('--completionlist', action='store_true',
                   help='Print completionlist for bash completion.')
args = parser.parse_args()

if args.completionlist:
    print "--num_students --num_examiners --duckburghusers --deliverycountrange"
    exit(0)


require_djangoproject()
depends(Command('init_exampledb'),
        Command('load_grandmauser'))
if args.duckburghusers:
    depends(Command('load_duckburghusers'))

logging.basicConfig(level=logging.INFO, format='%(levelname)7s: %(message)s')






scriptsdir = getscriptsdir()
create_testgroups_cmd = join(scriptsdir, 'create_testgroups.py')

def create_testgroups(period, assignments, **shared_kwargs):
    logging.info(str(period))
Пример #4
0
#!/usr/bin/env python
# Completely clean and rebuild the docs. Depends on docs_clean, docs_autogenerate_restful and docs_sphinx_build.

from common import depends, Command, forwardable_args


depends(Command('docs_clean'),
        Command('docs_autogenerate_restful'),
        Command('docs_sphinx_build', *forwardable_args()))
#!/usr/bin/env python
# Make an example database. Clears the current database.


from devilry.apps.core.testhelpers import TestHelper
from common import depends, Command, require_djangoproject


require_djangoproject()
depends(Command('init_exampledb'),
        Command('load_grandmauser'))

testhelper = TestHelper()
testhelper.load_generic_scenario()
#
#   cd ../../
#   git clone [email protected]:devilry/devilry-django.git devilry-docwebsite
#   git checkout --track origin/gh-pages
#
# After running this script, you must manually commit and push
# devilry.github.com.

from os import system, chdir, getcwd
from os.path import join
from shutil import rmtree, copytree
from tempfile import mkdtemp

from common import get_docs_buildhtml_dir, depends, Command

depends(Command('docs'),
        Command('docs_js'))


repo_rw_url = '[email protected]:devilry/devilry-django.git'
version = 'dev'
indir = get_docs_buildhtml_dir()

try:
    tempdir = mkdtemp()
    print 'Created temp dir', tempdir

    print 'Checking out devilry repo to tempdir.'
    chdir(tempdir)
    system("git clone --branch gh-pages {0} devilry".format(repo_rw_url))

    repocheckoutdir = join(tempdir, 'devilry')
#!/usr/bin/env python
# Create the simplified database (replaces current db) and dump it to the fixture used in tests.

if __name__ == '__main__':
    from os.path import join
    from common import require_djangoproject, depends, Command, getreporoot, dumpfixture

    require_djangoproject()
    depends(Command('simplifiedtestdb'))
    fixturepath = join(getreporoot(), 'devilry', 'simplified', 'fixtures',
                       'simplified', 'data.json')
    dumpfixture(fixturepath, 'core', 'auth.user', 'grade_approved',
                'grade_default', 'grade_rstschema')
#
#   cd ../../
#   git clone [email protected]:devilry/devilry-django.git devilry-docwebsite
#   git checkout --track origin/gh-pages
#
# After running this script, you must manually commit and push
# devilry.github.com.

from os import system, chdir, getcwd
from os.path import join
from shutil import rmtree, copytree
from tempfile import mkdtemp

from common import get_docs_buildhtml_dir, depends, Command

depends(Command('docs'), Command('docs_js'))

repo_rw_url = '[email protected]:devilry/devilry-django.git'
version = 'dev'
indir = get_docs_buildhtml_dir()

try:
    tempdir = mkdtemp()
    print 'Created temp dir', tempdir

    print 'Checking out devilry repo to tempdir.'
    chdir(tempdir)
    system("git clone --branch gh-pages {0} devilry".format(repo_rw_url))

    repocheckoutdir = join(tempdir, 'devilry')
    chdir(repocheckoutdir)
Пример #9
0
#!/usr/bin/env python
# Check test coverage and create a html-report of the results

from common import depends, Command, require_djangoproject, getcwd, append_pythonexec_to_command
from subprocess import call
from os.path import join
from sys import argv

htmlout = join(getcwd(), 'coverage_html_report')
require_djangoproject()
depends(Command('coverage', *argv[1:]))

command = ["coverage", "html", "-i", "-d", htmlout]
call(append_pythonexec_to_command(command))
#!/usr/bin/env python
# Create the simplified database (replaces current db) and dump it to the fixture used in tests.

if __name__ == '__main__':
    from os.path import join
    from common import require_djangoproject, depends, Command, getreporoot, dumpfixture

    require_djangoproject()
    depends(Command('simplifiedtestdb'))
    fixturepath = join(getreporoot(), 'devilry', 'simplified', 'fixtures',
                       'simplified', 'data.json')
    dumpfixture(fixturepath, 'core', 'auth.user',
                'grade_approved', 'grade_default', 'grade_rstschema')