def run(self): """ Method to facilitate the generate command and tie in classes such as extend which allow further manipulation of the object. """ compress_config = fetch_yaml_file(self.compress_file) include_files = self.load_imports(compress_config) extended_file = ExtendYaml(include_files, compress_config).parse() write_yaml_file(self.base_dir + "docker-compose.gen.yml", extended_file) Logger.info("docker-compose.gen.yml file generated")
def load_imports(self, config_yaml): """ Load yaml files that are listed in the import section of the provided compress file. Keyword arguments: config_yaml -- yaml structure of .compress.yml file """ include_files = dict() for include in config_yaml['include']: Logger.info("Including %s", include) yaml_file = fetch_yaml_file(self.base_dir + include) altered_yaml = self.alter_pathing(yaml_file, include) # TODO: Will need to be smarter about merging in the # future so we don't lose properties when merging # parent yaml blocks with child yaml blocks. for key, value in altered_yaml.items(): include_files[key] = value return include_files
def main(): """ Script entrypoint as defined in setup.py """ Logger.configure() CompressCommand()