Exemplo n.º 1
0
def mangle_paths(conf):
    if is_processed('project_paths', conf):
        return conf
    else:
        public_site_output = {
            'manual': os.path.join(conf.paths.public, get_branch()),
            'meta-driver': os.path.join(conf.paths.public, get_branch()),
            'ecosystem': conf.paths.public,
            'about': conf.paths.public,
            'mms': conf.paths.public,
        }

        try:
            conf.paths.public_site_output = public_site_output[conf.project.name]
        except KeyError:
            conf.paths.public_site_output = conf.paths.public

        if conf.project.name == 'mms':
            conf.paths.mms = AttributeDict({
                'hosted': os.path.join(conf.paths.public, 'hosted', get_branch()),
                'saas': os.path.join(conf.paths.public, 'saas')
            })

        conf.system.processed.project_paths = True
        return conf
Exemplo n.º 2
0
def mangle_paths(conf):
    if is_processed('project_paths', conf):
        return conf
    else:
        public_site_output = {
            'manual': os.path.join(conf.paths.public, get_branch()),
            'meta-driver': os.path.join(conf.paths.public, get_branch()),
            'ecosystem': conf.paths.public,
            'about': conf.paths.public,
            'mms': conf.paths.public,
            'training': conf.paths.public,
        }

        try:
            conf.paths.public_site_output = public_site_output[conf.project.name]
        except KeyError:
            conf.paths.public_site_output = conf.paths.public

        if conf.project.name == 'mms':
            conf.paths.mms = AttributeDict({
                'hosted': os.path.join(conf.paths.public, 'hosted', get_branch()),
                'saas': os.path.join(conf.paths.public, 'saas')
            })
            if conf.git.branches.current not in conf.git.branches.published:
                conf.paths.mms.saas = '-'.join([conf.paths.mms.saas, conf.git.branches.current])
        elif conf.project.name == 'training':
            conf.paths.training = AttributeDict({
                'instructor': os.path.join(conf.paths.public, 'instructor'),
                'student': os.path.join(conf.paths.public, 'student')
            })

        conf.system.processed.project_paths = True
        return conf
Exemplo n.º 3
0
def mangle_paths(conf):
    if is_processed('project_paths', conf):
        return conf
    else:
        public_site_output = {
            'manual': os.path.join(conf.paths.public, get_branch()),
            'meta-driver': os.path.join(conf.paths.public, get_branch()),
            'ecosystem': conf.paths.public,
            'about': conf.paths.public,
            'mms': conf.paths.public,
        }

        try:
            conf.paths.public_site_output = public_site_output[conf.project.name]
        except KeyError:
            conf.paths.public_site_output = conf.paths.public

        if conf.project.name == 'mms':
            conf.paths.mms = AttributeDict({
                'hosted': os.path.join(conf.paths.public, 'hosted', get_branch()),
                'saas': os.path.join(conf.paths.public, 'saas')
            })

        conf.system.processed.project_paths = True
        return conf
Exemplo n.º 4
0
def mangle_paths(conf):
    if is_processed('project_paths', conf):
        return conf
    else:
        public_site_output = {
            'manual': os.path.join(conf.paths.public, get_branch()),
            'meta-driver': os.path.join(conf.paths.public, get_branch()),
            'ecosystem': conf.paths.public,
            'about': conf.paths.public,
            'mms': conf.paths.public,
            'training': conf.paths.public,
        }

        try:
            conf.paths.public_site_output = public_site_output[conf.project.name]
        except KeyError:
            conf.paths.public_site_output = conf.paths.public

        if conf.project.name == 'mms':
            conf.paths.mms = AttributeDict({
                'hosted': os.path.join(conf.paths.public, 'hosted', get_branch()),
                'saas': os.path.join(conf.paths.public, 'saas')
            })
            if conf.git.branches.current not in conf.git.branches.published:
                conf.paths.mms.saas = '-'.join([conf.paths.mms.saas, conf.git.branches.current])
        elif conf.project.name == 'training':
            conf.paths.training = AttributeDict({
                'instructor': os.path.join(conf.paths.public, 'instructor'),
                'student': os.path.join(conf.paths.public, 'student')
            })

        conf.system.processed.project_paths = True
        return conf
Exemplo n.º 5
0
def gennerate_translation_integration_targets(language, conf):
    dependencies = [l + "-" + language for l in conf["targets"]]
    dependencies_debug = [dep + "-debug" for dep in dependencies]

    for dep in conf["doc-root"]:
        dependencies.append(os.path.join(paths.public, dep))

    dependencies.extend(proccess_branch_root(conf))

    package_target = "-".join(["package", language])
    publish_target = "-".join(["publish", language])

    m.target(package_target)
    m.job("fab stage.package:" + language)

    m.target(package_target + "-debug")
    m.job("fab log.set:debug stage.package:" + language)

    m.target(publish_target + "-debug", dependencies_debug)

    m.target(publish_target)
    m.job("fab sphinx.target:{0}".format(",".join(dependencies)))
    m.msg("[build]: deployed branch {0} successfully to {1}".format(get_branch(), paths.public))
    m.newline()

    m.target(".PHONY", [publish_target + "-debug", package_target + "-debug", publish_target, package_target])
Exemplo n.º 6
0
def status():
    rows = [
        ["name", "branch", "local version", "latest version"]
    ]
    for name in elements:
        rows.append([name, git.get_branch(name), bower.get_local(name)["version"], bower.get_latest_version(name)])
    print AsciiTable(rows).table
Exemplo n.º 7
0
def discover_config_file():
    root_dirs = [
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')),
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..')),
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')),
                  os.path.abspath(os.path.dirname(__file__)),
                ]

    conf_dirs = [ 'config', 'bin' ]

    conf_file_names = ['build_conf.yaml', 'docs_meta.yaml']

    cur_branch = get_branch()
    for project_root_dir in root_dirs:
        cached_file = os.path.join(project_root_dir, 'build', cur_branch, 'conf-cache.json')

        if os.path.exists(cached_file):
            cached_conf = BuildConfiguration(cached_file)

            if cached_conf.git.commit == get_commit():
                return None, None, cached_conf, True

        for path, filename in itertools.product(conf_dirs, conf_file_names):
            conf_file = os.path.join(path, filename)
            abs_conf_file = os.path.join(project_root_dir, conf_file)

            if not os.path.exists(abs_conf_file):
                continue
            else:
                conf = BuildConfiguration(abs_conf_file)

                return project_root_dir, conf_file, conf, False

    raise ConfigurationError('no conf file found')
Exemplo n.º 8
0
def get_versions(conf=None):
    conf = lazy_conf(conf)

    o = []

    current_branch = get_branch()
    if current_branch not in conf.git.branches.published:
        current_version_index = 0
    else:
        current_version_index = conf.git.branches.published.index(current_branch)

    for idx, version in enumerate(conf.version.published):
        v = {}

        branch = conf.git.branches.published[idx]
        v['path'] = get_path(conf, branch)

        v['text'] = version
        if version == conf.version.stable:
            v['text'] += ' (current)'

        if version == conf.version.upcoming:
            v['text'] += ' (upcoming)'

        v['current'] = True if idx == current_version_index else False

        o.append(v)

    return o
Exemplo n.º 9
0
def discover_config_file():
    root_dirs = [
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')),
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..')),
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')),
                  os.path.abspath(os.path.dirname(__file__)),
                ]

    conf_dirs = [ 'config', 'bin' ]

    conf_file_names = ['build_conf.yaml', 'docs_meta.yaml']

    cur_branch = get_branch()
    for project_root_dir in root_dirs:
        for path, filename in itertools.product(conf_dirs, conf_file_names):
            conf_file = os.path.join(path, filename)
            abs_conf_file = os.path.join(project_root_dir, conf_file)

            if not os.path.exists(abs_conf_file):
                continue
            else:
                conf = BuildConfiguration(abs_conf_file)

                return project_root_dir, conf_file, conf

    raise ConfigurationError('no conf file found in {0}'.format(os.getcwd()))
Exemplo n.º 10
0
def gennerate_translation_integration_targets(language, conf):
    dependencies = [l + '-' + language for l in conf['targets']]
    dependencies_debug = [dep + "-debug" for dep in dependencies]

    for dep in conf['doc-root']:
        dependencies.append(os.path.join(paths.public, dep))

    dependencies.extend(proccess_branch_root(conf))

    package_target = '-'.join(['package', language])
    publish_target = '-'.join(['publish', language])

    m.target(package_target)
    m.job('fab stage.package:' + language)

    m.target(package_target + '-debug')
    m.job('fab log.set:debug stage.package:' + language)

    m.target(publish_target + '-debug', dependencies_debug)

    m.target(publish_target)
    m.job('fab sphinx.target:{0}'.format(','.join(dependencies)))
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(
        get_branch(), paths.public))
    m.newline()

    m.target('.PHONY', [
        publish_target + '-debug', package_target + '-debug', publish_target,
        package_target
    ])
Exemplo n.º 11
0
def get_versions(conf=None):
    conf = lazy_conf(conf)

    o = []

    current_branch = get_branch()
    if current_branch not in conf.git.branches.published:
        current_version_index = 0
    else:
        current_version_index = conf.git.branches.published.index(current_branch)

    for idx, version in enumerate(conf.version.published):
        v = {}

        branch = conf.git.branches.published[idx]
        v['path'] = get_path(conf, branch)

        v['text'] = version
        if version == conf.version.stable:
            v['text'] += ' (current)'

        if version == conf.version.upcoming:
            v['text'] += ' (upcoming)'

        v['current'] = True if idx == current_version_index else False

        o.append(v)

    return o
Exemplo n.º 12
0
def discover_config_file():
    root_dirs = [
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')),
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..')),
                  os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')),
                  os.path.abspath(os.path.dirname(__file__)),
                ]

    conf_dirs = [ 'config', 'bin' ]

    conf_file_names = ['build_conf.yaml', 'docs_meta.yaml']

    cur_branch = get_branch()
    for project_root_dir in root_dirs:
        for path, filename in itertools.product(conf_dirs, conf_file_names):
            conf_file = os.path.join(path, filename)
            abs_conf_file = os.path.join(project_root_dir, conf_file)

            if not os.path.exists(abs_conf_file):
                continue
            else:
                conf = BuildConfiguration(abs_conf_file)

                return project_root_dir, conf_file, conf

    raise ConfigurationError('no conf file found in {0}'.format(os.getcwd()))
Exemplo n.º 13
0
def gennerate_translation_integration_targets(language, conf):
    dependencies = [ l + '-' + language for l in conf['targets'] ]
    dependencies_debug = [ dep + "-debug" for dep in dependencies ]

    for dep in conf['doc-root']:
        dependencies.append(os.path.join(paths['public'], dep))

    dependencies.extend(proccess_branch_root(conf))

    package_target = '-'.join(['package', language])
    publish_target = '-'.join(['publish', language])

    m.target(package_target)
    m.job('fab stage.package:' + language)

    m.target(package_target + '-debug')
    m.job('fab log.set:debug stage.package:' + language)

    m.target(publish_target + '-debug', dependencies_debug)

    m.target(publish_target)
    m.job('fab sphinx.target:{0}'.format(','.join(dependencies)))
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(get_branch(), paths['public']))
    m.newline()

    m.target('.PHONY', [publish_target + '-debug', package_target + '-debug', publish_target, package_target])
Exemplo n.º 14
0
def generate_meta(conf):
    m = MakefileCloth()

    m.section_break('branch/release meta', block='rel')
    if 'manual' in conf.git.branches and conf.project.name != 'primer':
        m.var('manual-branch', conf.git.branches.manual, block='rel')
        m.var('current-if-not-manual', conf.git.branches.manual, block='rel')
    m.var('current-branch', str(get_branch()), block='rel')
    m.var('last-commit', str(get_commit()), block='rel')

    m.section_break('file system paths', block='paths')
    m.var('output', conf.paths.output, block='paths')
    m.var('public-output', conf.paths.public, block='paths')
    m.var('branch-output', conf.paths.branch_output, block='paths')
    m.var('rst-include', conf.paths.includes, block='paths')
    m.var('branch-source', conf.paths.branch_source, block='paths')
    m.var('public-branch-output', conf.paths.branch_staging, block='paths')

    generated_makefiles = []

    if 'static' in conf.system.make:
        m.section_break('static makefile includes')

        for mfile in conf.system.make.static:
            if mfile.startswith('/'):
                m.include(mfile[1:], ignore=False)
            else:
                m.include(os.path.join(os.path.abspath(os.path.join(__file__, '../../makefiles')), mfile))

    m.newline()

    m.section_break('generated makefiles')

    for target in conf.system.make.generated:
        if target == 'sphinx':
            generator_fn = 'sphinx_builders'
        else:
            generator_fn = target

        fn = os.path.sep.join([conf.paths.output, "makefile." + target])
        cloth = os.path.join(conf.paths.buildsystem, "makecloth", generator_fn + '.py')

        generated_makefiles.append(fn)

        if target != 'meta':
            m.include(conf.paths.output + '/makefile.' + target, ignore=True)

        m.target(target=fn, dependency=cloth, block='makefiles')
        m.job(' '.join(['python', cloth, fn]))
        m.newline()

    m.newline()

    m.target('.PHONY',  generated_makefiles)

    m.newline(3)
    m = giza_build.build_makefile(m, conf)

    return m
Exemplo n.º 15
0
def get_manual_path(conf=None):
    conf = lazy_conf(conf)

    if conf.system.branched is False:
        return conf.project.tag
    else:
        branch = get_branch()
        return get_path(conf, branch)
Exemplo n.º 16
0
def get_manual_path(conf=None):
    conf = lazy_conf(conf)

    if conf.system.branched is False:
        return conf.project.tag
    else:
        branch = get_branch()
        return get_path(conf, branch)
Exemplo n.º 17
0
def render_paths(conf=None, language=None):
    if is_processed('paths', conf):
        return conf
    else:
        conf = lazy_conf(conf)

        if language is None:
            public_path = 'public'
        else:
            public_path = os.path.join('public', language)

        conf.paths.public = os.path.join(conf.paths.output, public_path)
        conf.paths.branch_output = os.path.join(conf.paths.output, get_branch())
        conf.paths.branch_source = os.path.join(conf.paths.branch_output, 'source')
        conf.paths.branch_staging = os.path.join(conf.paths.public, get_branch())
        conf.paths.buildarchive = os.path.join(conf.paths.output, 'archive')

        conf.system.processed.paths = True
        return conf
Exemplo n.º 18
0
def render_paths(conf=None, language=None):
    if is_processed('paths', conf):
        return conf
    else:
        conf = lazy_conf(conf)

        if language is None:
            public_path = 'public'
        else:
            public_path = os.path.join('public', language)

        conf.paths.public = os.path.join(conf.paths.output, public_path)
        conf.paths.branch_output = os.path.join(conf.paths.output, get_branch())
        conf.paths.branch_source = os.path.join(conf.paths.branch_output, 'source')
        conf.paths.branch_staging = os.path.join(conf.paths.public, get_branch())
        conf.paths.buildarchive = os.path.join(conf.paths.output, 'archive')

        conf.system.processed.paths = True
        return conf
Exemplo n.º 19
0
def generate_meta(conf):
    m = MakefileCloth()

    m.section_break('branch/release meta', block='rel')
    if 'manual' in conf.git.branches and conf.project.name != 'primer':
        m.var('manual-branch', conf.git.branches.manual, block='rel')
        m.var('current-if-not-manual', conf.git.branches.manual, block='rel')
    m.var('current-branch', str(get_branch()), block='rel')
    m.var('last-commit', str(get_commit()), block='rel')

    m.section_break('file system paths', block='paths')
    m.var('output', conf.paths.output, block='paths')
    m.var('public-output', conf.paths.public, block='paths')
    m.var('branch-output', conf.paths.branch_output, block='paths')
    m.var('rst-include', conf.paths.includes, block='paths')
    m.var('branch-source', conf.paths.branch_source, block='paths')
    m.var('public-branch-output', conf.paths.branch_staging, block='paths')

    generated_makefiles = []

    if 'static' in conf.system.make:
        m.section_break('static makefile includes')

        for mfile in conf.system.make.static:
            if mfile.startswith('/'):
                m.include(mfile[1:], ignore=False)
            else:
                m.include(
                    os.path.join(
                        os.path.abspath(
                            os.path.join(__file__, '../../makefiles')), mfile))

    m.newline()

    m.section_break('generated makefiles')

    for target in conf.system.make.generated:
        fn = os.path.sep.join([conf.paths.output, "makefile." + target])
        cloth = os.path.join(conf.paths.buildsystem, "makecloth",
                             target + '.py')

        generated_makefiles.append(fn)

        if target != 'meta':
            m.raw(['-include ' + conf.paths.output + '/makefile.' + target])

        m.target(target=fn, dependency=cloth, block='makefiles')
        m.job(' '.join([conf.system.python, cloth, fn]))
        m.newline()

    m.newline()

    m.target('.PHONY', generated_makefiles)

    return m
Exemplo n.º 20
0
def render_git_info(conf):
    if is_processed('git_info', conf):
        return conf
    else:
        if 'branches' not in conf.git:
            conf.git.branches = AttributeDict()

        conf.git.branches.current = get_branch()
        conf.git.commit = get_commit()
        conf.system.processed.git_info = True

        return conf
Exemplo n.º 21
0
def render_git_info(conf):
    if is_processed('git_info', conf):
        return conf
    else:
        if 'branches' not in conf.git:
            conf.git.branches = AttributeDict()

        conf.git.branches.current = get_branch()
        conf.git.commit = get_commit()
        conf.system.processed.git_info = True

        return conf
Exemplo n.º 22
0
def generate_integration_targets(conf):
    m.target('_publish')
    base = 'fab'
    if site_conf.project.name == 'ecosystem':
        base += ' serial'

    m.job('{0} sphinx.target:{1}'.format(base, ','.join(conf['targets'])))

    m.target('_publish-debug')
    m.job('{0} log.set:debug sphinx.target:{1}'.format(
        base, ','.join(conf['targets'])))

    dependencies = ['_publish']
    dependencies_debug = ['_publish-debug']

    if 'doc_root' in conf:
        for dep in conf.doc_root:
            dependencies.append(os.path.join(paths.public, dep))
            dependencies_debug.append(os.path.join(paths.public, dep))

    dependencies.extend(proccess_branch_root(conf))
    dependencies_debug.extend(proccess_branch_root(conf))

    m.target('publish', dependencies)
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(
        get_branch(), paths.public))
    m.newline()

    m.target('publish-debug', dependencies_debug)
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(
        get_branch(), paths.public))
    m.newline()

    m.target('package')
    m.job('fab stage.package')
    m.target('package-debug')
    m.job('fab log.set:debug stage.package')

    m.target('.PHONY', ['_publish', 'publish', 'package'])
Exemplo n.º 23
0
def get_conf():
    project_root_dir, conf_file, conf, cached = discover_config_file()

    if cached is True:
        return conf

    conf = schema_migration_0(conf)

    conf_file = crawl_up_tree(conf_file, 2)
    conf.paths.projectroot = os.path.abspath(os.path.join(os.path.dirname(conf_file), '..'))
    conf.system.conf_file = conf_file

    if os.path.exists('/etc/arch-release'):
        conf.system.python = 'python2'
    else:
        conf.system.python = 'python'

    conf.system.processed = AttributeDict()
    conf.system.processed.paths = False
    conf.system.processed.edition = False
    conf.system.processed.project_paths = False
    conf.system.processed.project_conf = False
    conf.system.processed.versions = False

    conf = mangle_configuration(conf)
    conf = render_versions(conf)

    conf.git.branches.current = get_branch()
    conf.git.commit = get_commit()
    conf.project.basepath = get_manual_path(conf)

    conf = render_paths(conf)
    conf = mangle_paths(conf)

    conf.system.dependency_cache = os.path.join(conf.paths.projectroot,
                                                conf.paths.branch_output,
                                                'dependencies.json')


    conf_cache_dir = os.path.join(conf.paths.projectroot, conf.paths.branch_output)
    conf_cache = os.path.join(conf_cache_dir, 'conf-cache.json')

    if not os.path.exists(conf_cache_dir):
        os.makedirs(conf_cache_dir)

    with open(conf_cache, 'w') as f:
        json.dump(conf, f)

    return conf
Exemplo n.º 24
0
def generate_integration_targets(conf):
    m.target("_publish")
    base = "fab"
    if site_conf.project.name == "ecosystem":
        base += " serial"

    m.job("{0} sphinx.target:{1}".format(base, ",".join(conf["targets"])))

    m.target("_publish-debug")
    m.job("{0} log.set:debug sphinx.target:{1}".format(base, ",".join(conf["targets"])))

    dependencies = ["_publish"]
    dependencies_debug = ["_publish-debug"]

    if "doc_root" in conf:
        for dep in conf.doc_root:
            dependencies.append(os.path.join(paths.public, dep))
            dependencies_debug.append(os.path.join(paths.public, dep))

    dependencies.extend(proccess_branch_root(conf))
    dependencies_debug.extend(proccess_branch_root(conf))

    m.target("publish", dependencies)
    m.msg("[build]: deployed branch {0} successfully to {1}".format(get_branch(), paths.public))
    m.newline()

    m.target("publish-debug", dependencies_debug)
    m.msg("[build]: deployed branch {0} successfully to {1}".format(get_branch(), paths.public))
    m.newline()

    m.target("package")
    m.job("fab stage.package")
    m.target("package-debug")
    m.job("fab log.set:debug stage.package")

    m.target(".PHONY", ["_publish", "publish", "package"])
Exemplo n.º 25
0
def generate_integration_targets(conf):
    m.target('_publish')
    base = 'fab'
    if site_conf.project.name == 'ecosystem':
        base += ' serial'

    m.job('{0} sphinx.target:{1}'.format(base, ','.join(conf['targets'])))

    m.target('_publish-debug')
    m.job('{0} log.set:debug sphinx.target:{1}'.format(base, ','.join(conf['targets'])))

    dependencies = [ '_publish']
    dependencies_debug = [ '_publish-debug']

    if 'doc-root' in conf:
        for dep in conf['doc-root']:
            dependencies.append(os.path.join(paths['public'], dep))
            dependencies_debug.append(os.path.join(paths['public'], dep))

    dependencies.extend(proccess_branch_root(conf))
    dependencies_debug.extend(proccess_branch_root(conf))

    m.target('publish', dependencies)
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(get_branch(), paths['public']))
    m.newline()

    m.target('publish-debug', dependencies_debug)
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(get_branch(), paths['public']))
    m.newline()

    m.target('package')
    m.job('fab stage.package')
    m.target('package-debug')
    m.job('fab log.set:debug stage.package')

    m.target('.PHONY', ['_publish', 'publish', 'package'])
Exemplo n.º 26
0
def render_versions(conf=None):
    if is_processed('versions', conf):
        return conf
    else:
        conf = lazy_conf(conf)

        if 'branches' not in conf.git:
            conf.git.branches = AttributeDict()

        version_config_file = os.path.join(conf.paths.builddata,
                                           'published_branches.yaml')

        try:
            vconf_data = get_file_from_branch(version_config_file, 'master')
        except CommandError:
            if get_branch() == 'master':
                return conf

            remotes = command('git remote', capture=True).out.split('\n')
            if 'origin' in remotes:
                return conf

            if 'config-upstream' not in remotes:
                command('git remote add config-upstream git://github.com/{0}.git'.format(conf.git.remote.upstream))

            command('git fetch config-upstream')

            if 'master' not in command('git branch', capture=True).out.split('\n'):
                command('git branch master config-upstream/master')

            vconf_data = get_file_from_branch(version_config_file, 'master')
        except CommandError:
            return conf

        vconf = AttributeDict(yaml.load(vconf_data))

        conf.version.update(vconf.version)

        conf.git.branches.update(vconf.git.branches)

        conf.system.processed.versions = True

        return conf
Exemplo n.º 27
0
def render_versions(conf=None):
    if is_processed('versions', conf):
        return conf
    else:
        conf = lazy_conf(conf)

        if 'branches' not in conf.git:
            conf.git.branches = AttributeDict()

        version_config_file = os.path.join(conf.paths.builddata,
                                           'published_branches.yaml')

        try:
            vconf_data = get_file_from_branch(version_config_file, 'master')
        except CommandError:
            if get_branch() == 'master':
                return conf

            remotes = command('git remote', capture=True).out.split('\n')
            if 'origin' in remotes:
                return conf

            if 'config-upstream' not in remotes:
                command('git remote add config-upstream git://github.com/{0}.git'.format(conf.git.remote.upstream))

            command('git fetch config-upstream')

            if 'master' not in command('git branch', capture=True).out.split('\n'):
                command('git branch master config-upstream/master')

            vconf_data = get_file_from_branch(version_config_file, 'master')
        except CommandError:
            return conf

        vconf = AttributeDict(yaml.load(vconf_data))

        conf.version.update(vconf.version)

        conf.git.branches.update(vconf.git.branches)

        conf.system.processed.versions = True

        return conf
Exemplo n.º 28
0
def gennerate_translation_integration_targets(language, conf):
    dependencies = [ l + '-' + language for l in conf['targets'] ]

    for dep in conf['doc-root']:
        dependencies.append(os.path.join(paths['public'], dep))

    dependencies.extend(proccess_branch_root(conf))

    package_target = '-'.join(['package', language])
    publish_target = '-'.join(['publish', language])

    m.target(package_target)
    m.job('fab stage.package:' + language)

    m.target(publish_target, dependencies)
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(get_branch(), paths['public']))
    m.newline()

    m.target('.PHONY', [publish_target, package_target])
Exemplo n.º 29
0
def generate_integration_targets(conf):
    m.target('_publish')
    m.job('fab sphinx.target:{0}'.format(','.join(conf['targets'])))

    dependencies = [ '_publish']

    if 'doc-root' in conf:
        for dep in conf['doc-root']:
            dependencies.append(os.path.join(paths['public'], dep))

    dependencies.extend(proccess_branch_root(conf))

    m.target('publish', dependencies)
    m.msg('[build]: deployed branch {0} successfully to {1}'.format(get_branch(), paths['public']))
    m.newline()

    m.target('package')
    m.job('fab stage.package')

    m.target('.PHONY', ['_publish', 'publish', 'package'])
Exemplo n.º 30
0
def get_current_path(conf):
    branch = get_branch()
    if branch not in conf.git.branches.published:
        branch = conf.git.branches.published[0]

    return get_path(conf, branch)
Exemplo n.º 31
0
def get_manual_path(conf):
    if conf.system.branched is False:
        return conf.project.tag
    else:
        branch = get_branch()
        return get_path(conf, branch)
Exemplo n.º 32
0
def get_manual_path(conf):
    if conf.system.branched is False:
        return conf.project.tag
    else:
        branch = get_branch()
        return get_path(conf, branch)
Exemplo n.º 33
0
def get_current_path(conf):
    branch = get_branch()
    if branch not in conf.git.branches.published:
        branch = conf.git.branches.published[0]

    return get_path(conf, branch)