def render_versions(conf=None): if is_processed('versions', conf): return conf else: conf = lazy_conf(conf) version_config_file = os.path.join(conf.paths.builddata, 'published_branches.yaml') if conf.git.branches.current == 'master' and not os.path.exists( version_config_file): return conf try: vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: setup_config_remote('master', conf) 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
def render_versions(conf=None): if is_processed('versions', conf): return conf else: conf = lazy_conf(conf) version_config_file = os.path.join(conf.paths.builddata, 'published_branches.yaml') if conf.git.branches.current == 'master'and not os.path.exists(version_config_file): return conf try: vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: setup_config_remote('master', conf) 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
def render_deploy_info(conf): if is_processed('deploy', conf): return conf else: deploy_conf_file = os.path.join(conf.paths.global_config, 'deploy.yaml') if os.path.exists(deploy_conf_file): conf.deploy = BuildConfiguration(deploy_conf_file) conf.system.processed.deploy = True return conf
def render_assets(conf): if is_processed('assets', conf): return conf elif 'assets' not in conf: return conf else: if not isinstance(conf.assets, list): conf.assets = [ conf.assets ] conf.system.processed.assets = True return conf
def render_assets(conf): if is_processed('assets', conf): return conf elif 'assets' not in conf: return conf else: if not isinstance(conf.assets, list): conf.assets = [conf.assets] conf.system.processed.assets = True return conf
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
def render_cache(conf): if is_processed('cached', conf): return conf else: 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) conf.system.processed.cached = True return conf
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
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