def main(argv):
    """main"""

    verbose = script_utils.has_verbose_flag(argv)

    # get full path to the directory with manage.py in it.
    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()

    command = "coverage erase"
    if verbose:
        print command
    os.system(command)
    command = "python " + manage_py + " clean_pyc"
    if verbose:
        print command
    os.system(command)
    command = "coverage run --source=" + manage_dir + "apps " + manage_py + " test"
    if verbose:
        print command
    os.system(command)
    command = "coverage html"
    if verbose:
        print command
    os.system(command)
示例#2
0
def main(argv):
    """main"""

    verbose = script_utils.has_verbose_flag(argv)
    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()

    # Ensure dump_dir/ exists, creating it if not found.
    dump_dir = os.path.dirname(manage_dir + "dumped_data" + os.sep)
    if not os.path.exists(dump_dir):
        if verbose:
            print "Creating " + dump_dir
        os.makedirs(dump_dir)

    #Loop through all state_types, dump the data, then write it out.
    for state_pair in state_pairs:
        command = "python " + manage_py + " dumpdata --indent=2 " + state_pair[0]
        if verbose:
            print command
        (status, output) = commands.getstatusoutput(command)
        if status:
            print "Error obtaining " + state_pair[0] + " skipping. (" + output + ")"
        else:
            output_file = os.path.join(dump_dir, state_pair[1] + ".json")
            print "Writing " + output_file
            with open(output_file, "w") as out:
                out.write(output)
示例#3
0
def init(request):
    """
    handle top level pages.
    """
    os.system("python " + script_utils.manage_py_dir() + "scripts/initialize_instance.py -t default -d &")

    return HttpResponse("init called")
示例#4
0
文件: coverage.py 项目: csdl/makahiki
def main(argv):
    """main"""

    verbose = script_utils.has_verbose_flag(argv)

    # get full path to the directory with manage.py in it.
    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()

    command = "coverage erase"
    if verbose:
        print command
    os.system(command)
    command = "python " + manage_py + " clean_pyc"
    if verbose:
        print command
    os.system(command)
    command = "coverage run --source=" + manage_dir + "apps " + manage_py + " test"
    if verbose:
        print command
    os.system(command)
    command = "coverage html"
    if verbose:
        print command
    os.system(command)
示例#5
0
def main(argv):
    """main"""

    verbose = script_utils.has_verbose_flag(argv)
    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()

    # Ensure dump_dir/ exists, creating it if not found.
    dump_dir = os.path.dirname(manage_dir + "dumped_data" + os.sep)
    if not os.path.exists(dump_dir):
        if verbose:
            print "Creating " + dump_dir
        os.makedirs(dump_dir)

    #Loop through all state_types, dump the data, then write it out.
    for state_pair in state_pairs:
        command = "python " + manage_py + " dumpdata --indent=2 " + state_pair[
            0]
        if verbose:
            print command
        (status, output) = commands.getstatusoutput(command)
        if status:
            print "Error obtaining " + state_pair[
                0] + " skipping. (" + output + ")"
        else:
            output_file = os.path.join(dump_dir, state_pair[1] + ".json")
            print "Writing " + output_file
            with open(output_file, "w") as out:
                out.write(output)
示例#6
0
def main():
    """main function."""

    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()
    fixture_path = manage_dir + "fixtures"

    os.system("python " + manage_py + " loaddata %s" % os.path.join(fixture_path, "base_*.json"))
    os.system("python " + manage_py + " loaddata %s" % os.path.join(fixture_path, "demo_*.json"))
    os.system("python " + manage_py + " loaddata %s" % os.path.join(fixture_path, "test_*.json"))
def main():
    """main function."""

    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()
    fixture_path = manage_dir + "fixtures"

    os.system("python " + manage_py +
              " loaddata %s" % os.path.join(fixture_path, "base_*.json"))
    os.system("python " + manage_py +
              " loaddata %s" % os.path.join(fixture_path, "demo_*.json"))
    os.system("python " + manage_py +
              " loaddata %s" % os.path.join(fixture_path, "test_*.json"))
def main(argv):
    """main function."""

    instance_type = None
    heroku_app = None
    manage_py = script_utils.manage_py_command()
    manage_command = "python " + manage_py
    fixture_path = script_utils.manage_py_dir() + "fixtures"

    try:
        opts, args = getopt.getopt(argv, "t:r:h:d", ["type=", "heroku=", "help", "data"])
    except getopt.GetoptError:
        script_utils.exit_with_help(__doc__)

    if not opts:
        script_utils.exit_with_help(__doc__)

    for opt in opts:
        if opt[0] == "-h" or opt[0] == "--help":
            script_utils.exit_with_help(__doc__)
        if opt[0] == "-t" or opt[0] == "--type":
            instance_type = opt[1]
        if opt[0] == "-r" or opt[0] == "--heroku":
            heroku_app = opt[1]
            manage_command = "heroku run --app %s python makahiki/manage.py" % heroku_app
        if opt[0] == "-d" or opt[0] == "--data":
            data_only = True

    if not instance_type in ("default", "demo", "test", "uh12"):
        script_utils.exit_with_help(__doc__)

    _ = args

    if not data_only:
        if not heroku_app:
            script_utils.install_requirements()
        else:
            script_utils.create_heroku_app(heroku_app)
            script_utils.push_to_heroku(heroku_app)

        script_utils.reset_db(heroku_app)

    script_utils.syncdb(manage_command)

    #script_utils.copy_static_media(heroku_app)

    script_utils.load_data(manage_command, instance_type, fixture_path)

    print "initialize_instance completed."
示例#9
0
def main(argv):
    """Compile Less main function. Usage: compile_less.py [-v | --verbose]"""
    verbose = script_utils.has_verbose_flag(argv)
    page_names = ['landing', 'status', 'admin']
    less_path = script_utils.manage_py_dir() + "static/less"
    os.chdir(less_path)
    theme_names = glob.glob('theme-*.less')
    for theme in theme_names:
        theme_name, _ = os.path.splitext(theme)
        if verbose:
            print "Compiling %s.less" % theme_name
        os.system("lessc -x --yui-compress %s.less > ../css/%s.css" %
                  (theme_name, theme_name))
    for page in page_names:
        if verbose:
            print "Compiling %s.less" % page
        os.system("lessc -x --yui-compress %s.less > ../css/%s.css" %
                  (page, page))
示例#10
0
def main(argv):
    """Compile Less main function. Usage: compile_less.py [-v | --verbose]"""
    verbose = script_utils.has_verbose_flag(argv)
    page_names = ['landing',
                  'status',
                  'admin']
    less_path = script_utils.manage_py_dir() + "static/less"
    os.chdir(less_path)
    theme_names = glob.glob('theme-*.less')
    for theme in theme_names:
        theme_name, _ = os.path.splitext(theme)
        if verbose:
            print "Compiling %s.less" % theme_name
        os.system("lessc -x --yui-compress %s.less > ../css/%s.css" % (theme_name, theme_name))
    for page in page_names:
        if verbose:
            print "Compiling %s.less" % page
        os.system("lessc -x --yui-compress %s.less > ../css/%s.css" % (page, page))
示例#11
0
def main(argv):
    """Verify main function. Usage: verify.py [-v | --verbose]"""

    current_dir = os.getcwd()
    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()

    verbose = script_utils.has_verbose_flag(argv)

    if verbose:
        print "running pep8"
    pep8_command = os.path.join("scripts", "run_pep8.sh")
    status = os.system("cd " + manage_dir + "; " + pep8_command)
    if status:
        sys.exit(1)

    if verbose:
        print "running pylint"
    pylint_command = os.path.join("scripts", "run_pylint.sh")
    status = os.system("cd " + manage_dir + "; " + pylint_command)
    if status:
        sys.exit(1)

    if verbose:
        print "cleaning"
    os.system("python " + manage_py + " clean_pyc")

    if verbose:
        print "running tests"
    status = os.system("python " + manage_py + " test")
    if status:
        sys.exit(1)

    if verbose:
        print "building docs"
    status = os.system("cd " + manage_dir + "; " +
                       "cd ../doc; make clean html; cd " + current_dir)
    if status:
        sys.exit(1)
示例#12
0
def main(argv):
    """Verify main function. Usage: verify.py [-v | --verbose]"""

    current_dir = os.getcwd()
    manage_dir = script_utils.manage_py_dir()
    manage_py = script_utils.manage_py_command()

    verbose = script_utils.has_verbose_flag(argv)

    if verbose:
        print "running pep8"
    pep8_command = os.path.join("scripts", "run_pep8.sh")
    status = os.system("cd " + manage_dir + "; " + pep8_command)
    if status:
        sys.exit(1)

    if verbose:
        print "running pylint"
    pylint_command = os.path.join("scripts", "run_pylint.sh")
    status = os.system("cd " + manage_dir + "; " + pylint_command)
    if status:
        sys.exit(1)

    if verbose:
        print "cleaning"
    os.system("python " + manage_py + " clean_pyc")

    if verbose:
        print "running tests"
    status = os.system("python " + manage_py + " test")
    if status:
        sys.exit(1)

    if verbose:
        print "building docs"
    status = os.system("cd " + manage_dir + "; " + "cd ../doc; make clean html; cd " + current_dir)
    if status:
        sys.exit(1)