Пример #1
0
def _cmd_build_template(args, promote=False):
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']
    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None
    parse_templates(args.templates, repo_info, next_custom, promote)
Пример #2
0
def cmd_current(cfg, args):
    """
    Generates the current version string, depending on the state of the
    repository and prints it to the stdout.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']
    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None
    term.out(build_version_string(cfg, repo_info, False, next_custom))
Пример #3
0
def cmd_current(cfg, args):
    """
    Generates the current version string, depending on the state of the
    repository and prints it to the stdout.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']
    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None
    term.out(build_version_string(cfg, repo_info, False, next_custom))
Пример #4
0
def __cmd_build_template(cfg, args, preview=False):
    """
    Internal-only function used for avoiding code duplication between
    template-operating functions.

    See cmd_build_template and cmd_preview_template for the full docs.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']
    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None
    parse_templates(cfg, args.templates, repo_info, next_custom, preview)
Пример #5
0
def __cmd_build_template(cfg, args, preview=False):
    """
    Internal-only function used for avoiding code duplication between
    template-operating functions.

    See cmd_build_template and cmd_preview_template for the full docs.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']
    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None
    parse_templates(cfg, args.templates, repo_info, next_custom, preview)
Пример #6
0
def cmd_clean(args):
    next_store = KVStore(NEXT_STORE_FILE)
    if len(args.tag) > 0:
        tag = args.tag
    else:
        repo_info = get_repo_info()
        tag = repo_info['last-tag']

    has_custom = next_store.has(tag)
    next_custom = next_store.get(tag) if has_custom else None

    if has_custom:
        next_store.rm(tag).save()
        print "Cleaned up custom string version \"" + next_custom + \
              "\" for tag \"" + tag + "\""
    else:
        print "No custom string version found for tag \"" + tag + "\""
Пример #7
0
def cmd_clean(cfg, args):
    """
    Removes the user-defined next stable version for the most recent and
    reachable tag or for the tag specified by the @param args parameter.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    if len(args.tag) > 0:
        tag = args.tag
    else:
        repo_info = get_repo_info()
        tag = repo_info['last-tag']

    has_custom = next_store.has(tag)
    next_custom = next_store.get(tag) if has_custom else None

    if has_custom:
        next_store.rm(tag).save()
        term.out("Cleaned up custom string version \"" + next_custom +
                 "\" for tag \"" + tag + "\"")
    else:
        term.out("No custom string version found for tag \"" + tag + "\"")
Пример #8
0
def cmd_clean(cfg, args):
    """
    Removes the user-defined next stable version for the most recent and
    reachable tag or for the tag specified by the @param args parameter.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    if len(args.tag) > 0:
        tag = args.tag
    else:
        repo_info = get_repo_info()
        tag = repo_info['last-tag']

    has_custom = next_store.has(tag)
    next_custom = next_store.get(tag) if has_custom else None

    if has_custom:
        next_store.rm(tag).save()
        term.out("Cleaned up custom string version \"" + next_custom +
                 "\" for tag \"" + tag + "\"")
    else:
        term.out("No custom string version found for tag \"" + tag + "\"")
Пример #9
0
def cmd_info(cfg, args):
    """
    Generates version string and repository information and prints it to the
    stdout.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']

    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None

    if has_next_custom:
        nvn = term.next(next_custom)
    else:
        nvn = "none, defaulting to " + \
              term.next("-" + cfg['default_meta_pr_in_next_no_next']) + \
              " suffix"

    term.out("Most recent tag: " + term.tag(last_tag))

    if repo_info['pr'] is None and repo_info['count'] > 0:
        term.out("Using NEXT defined as: " + nvn)
        term.out("(Pre-release metadata: none)")
    elif repo_info['pr'] is not None:
        term.out("(NEXT defined as: " + nvn + ")")
        term.out("Using pre-release metadata: " +
                 term.tag(str(repo_info['pr'])))

    term.out("Current build ID: " + term.tag(repo_info['full-build-id']))

    promoted = build_version_string(cfg, repo_info, True, next_custom)
    term.out(
        "Current version: " + "v" +
        term.ver(build_version_string(
            cfg, repo_info, False, next_custom)) +
        (" => v" + term.prom(promoted) if len(promoted) > 0 else '')
    )
Пример #10
0
def cmd_info(cfg, args):
    """
    Generates version string and repository information and prints it to the
    stdout.
    """
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']

    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None

    if has_next_custom:
        nvn = term.next(next_custom)
    else:
        nvn = "none, defaulting to " + \
              term.next("-" + cfg['default_meta_pr_in_next_no_next']) + \
              " suffix"

    term.out("Most recent tag: " + term.tag(last_tag))

    if repo_info['pr'] is None and repo_info['count'] > 0:
        term.out("Using NEXT defined as: " + nvn)
        term.out("(Pre-release metadata: none)")
    elif repo_info['pr'] is not None:
        term.out("(NEXT defined as: " + nvn + ")")
        term.out("Using pre-release metadata: " +
                 term.tag(str(repo_info['pr'])))

    term.out("Current build ID: " + term.tag(repo_info['full-build-id']))

    promoted = build_version_string(cfg, repo_info, True, next_custom)
    term.out(
        "Current version: " + "v" +
        term.ver(build_version_string(
            cfg, repo_info, False, next_custom)) +
        (" => v" + term.prom(promoted) if len(promoted) > 0 else '')
    )
Пример #11
0
def cmd_info(args):
    next_store = KVStore(NEXT_STORE_FILE)
    repo_info = get_repo_info()
    last_tag = repo_info['last-tag']

    has_next_custom = next_store.has(last_tag)
    next_custom = next_store.get(last_tag) if has_next_custom else None

    if has_next_custom:
        nvn = color_next(next_custom)
    else:
        nvn = "none defined, using " + color_next("-" + cfg['next_suffix']) + \
              " suffix"

    print "Most recent tag: " + color_tag(last_tag)
    print "NEXT defined as: " + nvn
    print "Current build ID: " + color_tag(repo_info['full-build-id'])
    promoted = build_version_string(repo_info, True, next_custom)
    print "Current version: " + \
          color_version(
              "v" + build_version_string(repo_info, False, next_custom) +
              (" => v" + promoted if len(promoted) > 0 else '')
          )