Пример #1
0
def find_projects():
    sanitized_root_dir = os.path.expanduser(ROOT_DIR.rstrip('/'))
    projects = []

    # Recursively find config file in ROOT_DIR
    printer.verbose("Scanning {} for {} files".format(sanitized_root_dir, CONFIG_FILE_NAME))
    for root, dirs, files in os.walk(sanitized_root_dir):
        for file in files:
            if file == CONFIG_FILE_NAME or file == CONFIG_FILE_NAME_DEPRECATED:
                file_path = os.path.join(root, file)
                project = load_project(root)
                conf_malformed = True if project['conf'] is None else False
                conf_deprecated = file == CONFIG_FILE_NAME_DEPRECATED

                text = "\tFound ~/{}".format(os.path.relpath(file_path, sanitized_root_dir))

                if conf_malformed:
                    text += ' (malformed)'
                elif conf_deprecated:
                    text += ' (deprecated conf file format)'

                if conf_malformed or conf_deprecated:
                    printer.warning(text)
                else:
                    printer.info(text)

                projects.append(project)

    # Sort projects by name alphabetically
    return sorted(projects, key=itemgetter('name'))
Пример #2
0
def find_projects():
    sanitized_root_dir = os.path.expanduser(ROOT_DIR.rstrip('/'))
    projects = []

    # Recursively find config file in ROOT_DIR
    printer.verbose("Scanning {} for {} files".format(sanitized_root_dir,
                                                      CONFIG_FILE_NAME))
    for root, dirs, files in os.walk(sanitized_root_dir):
        for file in files:
            if file == CONFIG_FILE_NAME or file == CONFIG_FILE_NAME_DEPRECATED:
                file_path = os.path.join(root, file)
                project = load_project(root)
                conf_malformed = True if project['conf'] is None else False
                conf_deprecated = file == CONFIG_FILE_NAME_DEPRECATED

                text = "\tFound ~/{}".format(
                    os.path.relpath(file_path, sanitized_root_dir))

                if conf_malformed:
                    text += ' (malformed)'
                elif conf_deprecated:
                    text += ' (deprecated conf file format)'

                if conf_malformed or conf_deprecated:
                    printer.warning(text)
                else:
                    printer.info(text)

                projects.append(project)

    # Sort projects by name alphabetically
    return sorted(projects, key=itemgetter('name'))
Пример #3
0
            if e != 0:
                printer.error("Custom command finished with non-zero ({}) exit value, aborting deploy.".format(e))
                return False

            print()

    # The End
    printer.success("\n{} successfully deployed. Have an A1 day!".format(project_path))
    printer.pexec('git', 'git {} log --oneline -1'.format(git_args).replace('  ', ' '))

    return True


# Here goes the code
try:
    sanitized_root_dir = os.path.expanduser(ROOT_DIR.rstrip('/'))

    # Command line argument
    parser = argparse.ArgumentParser(description='Easily deploy projects')
    # Script args
    parser.add_argument('--self-update', action='store_true', dest='self_update')
    parser.add_argument('path', nargs='?')
    parser.add_argument('--project', default='ask_for_it')
    parser.add_argument('-a', '--all', action='store_true')
    parser.add_argument('--no-color', action='store_true', dest='no_color')
    parser.add_argument('--not-verbose', action='store_true', dest='not_verbose')
    parser.add_argument('--git-work-tree', dest='git_work_tree')
    parser.add_argument('--git-dir', dest='git_dir')
    # Plugin-specific args
    parser.add_argument('--env', default='prod')  # Symfony
    args = parser.parse_args()
Пример #4
0
                return False

            print()

    # The End
    printer.success(
        "\n{} successfully deployed. Have an A1 day!".format(project_path))
    printer.pexec(
        'git', 'git {} log --oneline -1'.format(git_args).replace('  ', ' '))

    return True


# Here goes the code
try:
    sanitized_root_dir = os.path.expanduser(ROOT_DIR.rstrip('/'))

    # Command line argument
    parser = argparse.ArgumentParser(description='Easily deploy projects')
    # Script args
    parser.add_argument('--self-update',
                        action='store_true',
                        dest='self_update')
    parser.add_argument('path', nargs='?')
    parser.add_argument('--project', default='ask_for_it')
    parser.add_argument('-a', '--all', action='store_true')
    parser.add_argument('--no-color', action='store_true', dest='no_color')
    parser.add_argument('--not-verbose',
                        action='store_true',
                        dest='not_verbose')
    parser.add_argument('--git-work-tree', dest='git_work_tree')