Esempio n. 1
0
def main():
    """Primary Legit command dispatch."""

    command = Command.lookup(args.get(0))
    if command:
        arg = args.get(0)
        args.remove(arg)

        command.__call__(args)
        sys.exit()

    elif args.contains(('-h', '--help')):
        display_help()
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    else:
        if settings.git_transparency:
            # Send everything to git
            git_args = list(sys.argv)
            if settings.git_transparency is True:
                settings.git_transparency = os.environ.get("GIT_PYTHON_GIT_EXECUTABLE", 'git')

            git_args[0] = settings.git_transparency

            sys.exit(call(' '.join(git_args), shell=True))

        else:
            show_error(colored.red('Unknown command {0}'.format(args.get(0))))
            display_info()
            sys.exit(1)
Esempio n. 2
0
def main():
    """Primary Legit command dispatch."""

    if (args.get(0) in cmd_map) or (args.get(0) in short_map):
        arg = args.get(0)
        args.remove(arg)

        if arg in short_map:
            arg = short_map.get(arg)

        cmd_map.get(arg).__call__(args)
        sys.exit()

    elif args.contains(('-h', '--help')):
        display_help()
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    else:
        if settings.git_transparency:
            # Send everything to git
            git_args = list(sys.argv)
            if settings.git_transparency is True:
                settings.git_transparency = 'git'

            git_args[0] = settings.git_transparency

            sys.exit(call(' '.join(git_args), shell=True))

        else:
            display_info()
            sys.exit(1)
Esempio n. 3
0
def main():
    """Primary Legit command dispatch."""

    if (args.get(0) in cmd_map) or (args.get(0) in short_map):
        arg = args.get(0)
        args.remove(arg)

        if arg in short_map:
            arg = short_map.get(arg)

        cmd_map.get(arg).__call__(args)
        sys.exit()

    elif args.contains(('-h', '--help')):
        display_help()
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    else:
        if settings.git_transparency:
            # Send everything to git
            git_args = list(sys.argv)
            if settings.git_transparency is True:
                settings.git_transparency = 'git'

            git_args[0] = settings.git_transparency

            sys.exit(call(' '.join(git_args), shell=True))

        else:
            display_info()
            sys.exit(1)
def main():
    invalid_files = args.not_flags.not_files.all
    if any(f for f in args.flags.all if f not in FLAGS):
        usage()
        sys.exit(1)
    if args.contains(('-h', '--help')):
        usage()
        sys.exit()
    if invalid_files:
        print "Invalid files found"  # TODO
        sys.exit(1)
    fix = args.contains(('-f', '--fix'))

    for filename in args.files:
        checker = EditorConfigChecker(fix=fix)
        try:
            props = get_properties(abspath(filename))
        except EditorConfigError, e:
            print e
            continue
        else:
            for error in checker.check(filename, props):
                print "%s: %s" % (filename, error)
Esempio n. 5
0
def main():
    """Primary Tarbell command dispatch."""

    command = Command.lookup(args.get(0))

    if len(args) == 0 or args.contains(('-h', '--help', 'help')):
        display_info(args)
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    elif command:
        arg = args.get(0)
        args.remove(arg)
        command.__call__(args)
        sys.exit()

    else:
        show_error(colored.red('Error! Unknown command `{0}`.\n'
                               .format(args.get(0))))
        display_info(args)
        sys.exit(1)
Esempio n. 6
0
def main():
    """Primary Legit command dispatch."""

    if (args.get(0) in cmd_map) or (args.get(0) in short_map):
        arg = args.get(0)
        args.remove(arg)

        if arg in short_map:
            arg = short_map.get(arg)

        cmd_map.get(arg).__call__(args)
        sys.exit()

    elif args.contains(('-h', '--help')):
        display_help()
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    else:
        display_info()
        sys.exit(1)
Esempio n. 7
0
File: cli.py Progetto: eads/tarbell
def main():
    """Primary Tarbell command dispatch."""

    command = Command.lookup(args.get(0))

    if len(args) == 0 or args.contains(('-h', '--help', 'help')):
        display_info(args)
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    elif command:
        arg = args.get(0)
        args.remove(arg)
        command.__call__(args)
        sys.exit()

    else:
        show_error(
            colored.red('Error! Unknown command `{0}`.\n'.format(args.get(0))))
        display_info(args)
        sys.exit(1)
Esempio n. 8
0
def main():
    """Primary Legit command dispatch."""

    if (args.get(0) in cmd_map) or (args.get(0) in short_map):
        arg = args.get(0)
        args.remove(arg)

        if arg in short_map:
            arg = short_map.get(arg)

        cmd_map.get(arg).__call__(args)
        sys.exit()

    elif args.contains(('-h', '--help')):
        display_help()
        sys.exit(1)

    elif args.contains(('-v', '--version')):
        display_version()
        sys.exit(1)

    else:
        display_info()
        sys.exit(1)
Esempio n. 9
0
def tarbell_generate(args, skip_args=False, extra_context=None):
    """Generate static files."""

    output_root = None
    with ensure_settings(args) as settings, ensure_project(args) as site:
        if not skip_args:
            output_root = list_get(args, 0, False)
        if not output_root:
            output_root = tempfile.mkdtemp(prefix="{0}-".format(site.project.__name__))

        if args.contains('--context'):
            site.project.CONTEXT_SOURCE_FILE = args.value_after('--context')

        site.generate_static_site(output_root, extra_context)
        puts("\nCreated site in {0}".format(output_root))
        return output_root
Esempio n. 10
0
File: cli.py Progetto: eads/tarbell
def tarbell_generate(args, skip_args=False, extra_context=None):
    """Generate static files."""

    output_root = None
    with ensure_settings(args) as settings, ensure_project(args) as site:
        if not skip_args:
            output_root = list_get(args, 0, False)
        if not output_root:
            output_root = tempfile.mkdtemp(
                prefix="{0}-".format(site.project.__name__))

        if args.contains('--context'):
            site.project.CONTEXT_SOURCE_FILE = args.value_after('--context')

        site.generate_static_site(output_root, extra_context)
        puts("\nCreated site in {0}".format(output_root))
        return output_root
Esempio n. 11
0
            if r.status_code == 0:
                puts(colored.magenta('Done.'))
            else:
                error_occurred = True
                puts(colored.red('There was an error running the closure compiler'))
                puts(r.std_out)
                puts(r.std_err)

    run_time = time.time() - start
    if not error_occurred:
        puts(colored.green('Build successfully completed in %g seconds.' % run_time))
    else:
        puts(colored.red('An error occurred :('))


if args.contains('--watch'):
    loop = True
    while loop:
        try:
            updated_last_modified = get_mtime()
            if last_modified is None or last_modified < updated_last_modified:
                puts(colored.yellow('Change detected'))
                last_modified = updated_last_modified
                build()

            time.sleep(3)
        except KeyboardInterrupt:
            puts(colored.red("Quitting..."))
            loop = False
else:
    build()
Esempio n. 12
0
from clint import args
from clint.textui import puts, colored, indent

errors = []
def record_error(message, e):
  errors.append([message, e])

# ========================================================================
# Arguments
# ========================================================================

# Defaults
db_type  = 'memory'
test = {'database': True, 'email': True}

if args.contains('--database'):
  arg = args.grouped['--database'][0]
  if arg == 'heroku':
    db_type = 'heroku'
  if arg == 'sqlite':
    db_type = 'sqlite'
if args.contains('--test'):
  test_args = args.grouped['--test']
  if 'all' in test_args:
    pass
  elif 'database' not in test_args:
    test['database'] = False
  elif 'email' not in test_args:
    test['email'] = False

puts('Testing:')