示例#1
0
def ensure_working_directory_and_repo_exist():
    """We need to ensure we have a working directory to use, and have a clone
    of the standards repo
    """
    if env['environment'] == 'staging':
        owner = 'apache'
    elif env['environment'] == 'production':
        owner = 'www-data'
    else:
        owner = None
    working_dir = path.join(env['django_dir'], 'working')
    exports_dir = path.join(working_dir, 'exports')
    html_dir = path.join(working_dir, 'html')
    repo_dir = path.join(working_dir, 'repo')
    _create_dir_if_not_exists(working_dir, owner=owner)
    _create_dir_if_not_exists(exports_dir, owner=owner)
    _create_dir_if_not_exists(html_dir, owner=owner)

    # and now delete the old exports and html directory contents in case we
    # need to redo the html
    _check_call_wrapper('rm -rf ' + exports_dir + '/* ' + html_dir + '/*',
                        shell=True)

    # check if repo exists - if not do git clone
    if not path.exists(repo_dir):
        sys.path.append(env['django_settings_dir'])
        from settings import STANDARD_GITHUB_REPO
        github_repo = 'https://github.com/' + STANDARD_GITHUB_REPO
        _check_call_wrapper(['git', 'clone', github_repo, repo_dir])
def ensure_working_directory_and_repo_exist():
    """We need to ensure we have a working directory to use, and have a clone
    of the standards repo
    """
    if env['environment'] == 'staging':
        owner = 'apache'
    elif env['environment'] == 'production':
        owner = 'www-data'
    else:
        owner = None
    working_dir = path.join(env['django_dir'], 'working')
    exports_dir = path.join(working_dir, 'exports')
    html_dir = path.join(working_dir, 'html')
    repo_dir = path.join(working_dir, 'repo')
    _create_dir_if_not_exists(working_dir, owner=owner)
    _create_dir_if_not_exists(exports_dir, owner=owner)
    _create_dir_if_not_exists(html_dir, owner=owner)

    # and now delete the old exports and html directory contents in case we
    # need to redo the html
    _check_call_wrapper('rm -rf ' + exports_dir + '/* ' + html_dir + '/*', shell=True)

    # check if repo exists - if not do git clone
    if not path.exists(repo_dir):
        sys.path.append(env['django_settings_dir'])
        from settings import STANDARD_GITHUB_REPO
        github_repo = 'https://github.com/' + STANDARD_GITHUB_REPO
        _check_call_wrapper(['git', 'clone', github_repo, repo_dir])
示例#3
0
def ensure_static_is_writable():
    if env['environment'] in ('staging', 'production'):
        if env['environment'] == 'staging':
            owner = 'apache'
        elif env['environment'] == 'production':
            owner = 'www-data'
        static_path = path.join(env['django_dir'], 'static')
        _check_call_wrapper(['chown', '-R', owner, static_path])
def ensure_static_is_writable():
    if env['environment'] in ('staging', 'production'):
        if env['environment'] == 'staging':
            owner = 'apache'
        elif env['environment'] == 'production':
            owner = 'www-data'
        static_path = path.join(env['django_dir'], 'static')
        _check_call_wrapper(['chown', '-R', owner, static_path])
示例#5
0
def install_javascript_modules():
    print "### Installing javascript modules"
    javascript_dir = os.path.join(env['vcs_root_dir'], 'javascript')

    # If the directory already exists get rid of it and reinstall to keep
    # things clean.
    npm_dir = os.path.join(javascript_dir, 'node_modules')
    if os.path.exists(npm_dir):
        _check_call_wrapper(['rm', '-r', npm_dir])

    _check_call_wrapper(['npm', 'install'], cwd=javascript_dir)
示例#6
0
def run_javascript_tests():
    print "### Running Javascript tests"
    javascript_dir = os.path.join(env['vcs_root_dir'], 'javascript')

    _check_call_wrapper(['grunt', 'test'], cwd=javascript_dir)