def inject(self):
     for file in recursive_path_iterate(self.path, "*"):
         with open(file) as file_pointer:
             content = file_pointer.read()
         template = DottedTemplate(content)
         with open(file, "w") as file_pointer:
             file_pointer.write(template.substitute(self.config))
Exemple #2
0
    def synchronize(source, dest, pattern="*"):
        LOGGER.debug("synchronizing '%s' to '%s'" % (source, dest))
        for abs_source_path in recursive_path_iterate(source, pattern):
            rel_path_to_sync = os.path.relpath(abs_source_path, source)

            abs_dest_path = os.path.join(dest, rel_path_to_sync)

            if Synchronizer._is_sync_needed(abs_source_path, abs_dest_path):
                os.makedirs(os.path.dirname(abs_dest_path), exist_ok=True)
                shutil.copy(abs_source_path, abs_dest_path)