Пример #1
0
def load_sample_data(environment, force=False):
    """load sample data if required."""
    if force is False:
        # first check if it has already been loaded
        output_lines = _manage_py(['dumpdata', 'publicweb'])
        if output_lines[0] != '[]':
            print "Environment '", environment, "' already has sample data loaded."
            return

    _manage_py(['loaddata', "sample_data.json"])
Пример #2
0
def load_sample_data(environment, force=False):
    """load sample data if required."""
    if force is False:
        # first check if it has already been loaded
        output_lines = _manage_py(['dumpdata', 'publicweb'])
        if output_lines[0] != '[]':
            print "Environment '", environment, "' already has sample data loaded."
            return

    _manage_py(['loaddata', "sample_data.json"])
Пример #3
0
def setup_group_permissions():
    """
    Programatically create the django.auth Group objects
    we depend on, and allocate them the permissions we
    think they should have .
    """
    print "### Setting up group permissions"
    command = ['setup_group_permissions']
    if tasklib.env['verbose']:
        command.append('--verbosity=2')
    _manage_py(command)
Пример #4
0
def _conditionally_load_data(environment, force, name, manage_cmd, fixture_suffix):
    if force is False:
        needs_initializing = int(_manage_py([manage_cmd])[0].strip())
        if not needs_initializing:
            print "Environment '", environment, "' already has ", name, " initialized."
            return
    local_fixtures_directory = os.path.join(
        tasklib.env['django_dir'], 'publicweb', 'fixtures')
    fixture_path = os.path.join(
        local_fixtures_directory, environment + fixture_suffix + '.json')
    if os.path.exists(fixture_path):
        _manage_py(['loaddata', fixture_path])
    else:
        _manage_py(['loaddata', "default" + fixture_suffix + ".json"])
Пример #5
0
def _conditionally_load_data(environment, force, name, manage_cmd,
                             fixture_suffix):
    if force is False:
        needs_initializing = int(_manage_py([manage_cmd])[0].strip())
        if not needs_initializing:
            print "Environment '", environment, "' already has ", name, " initialized."
            return
    local_fixtures_directory = os.path.join(tasklib.env['django_dir'],
                                            'publicweb', 'fixtures')
    fixture_path = os.path.join(local_fixtures_directory,
                                environment + fixture_suffix + '.json')
    if os.path.exists(fixture_path):
        _manage_py(['loaddata', fixture_path])
    else:
        _manage_py(['loaddata', "default" + fixture_suffix + ".json"])
Пример #6
0
def run_jenkins():
    """ make sure the local settings is correct and the database exists """
    env['verbose'] = True
    # don't want any stray pyc files causing trouble
    _rm_all_pyc()
    _install_django_jenkins()
    create_private_settings()
    link_local_settings('jenkins')
    clean_db()
    update_db()
    collect_static_files()
    build_webassets()
    install_javascript_modules()
    _manage_py_jenkins()
    run_javascript_tests()
    _manage_py([
        'merge_coverage_files',
        'coverage.xml',
        'cobertura-coverage.xml',
        '--output=coverage-merged.xml',
        '--path=../../reports'
    ])
Пример #7
0
def update_search_index():
    _manage_py(['update_index'])
Пример #8
0
def build_webassets():
    print "### Build assets"
    _manage_py(['assets', 'clean'])
    _manage_py(['assets', 'build'])
Пример #9
0
def collect_static_files():
    """ Collect static files """
    _manage_py(['collectstatic', '--noinput'])
Пример #10
0
def update_search_index():
    _manage_py(['update_index'])
Пример #11
0
def build_webassets():
    _manage_py(['assets', 'clean'])
    _manage_py(['assets', 'build'])
Пример #12
0
def build_webassets():
    _manage_py(['assets', 'clean'])
    _manage_py(['assets', 'build'])
Пример #13
0
def collect_static_files():
    """ Collect static files """
    _manage_py(["collectstatic", "--noinput"])
Пример #14
0
def build_webassets():
    print "### Build assets"
    _manage_py(["assets", "clean"])
    _manage_py(["assets", "build"])