def stage_file(self, orig_path, relative_staging_path, mutator=None): target_path = self._make_path(self.staging_path, relative_staging_path) if mutator is None: files.copy_file(orig_path, target_path) else: with open(orig_path, 'r') as file: old_contents = file.read() new_contents = mutator.apply(old_contents) with open(target_path, 'w') as file: file.write(new_contents) return target_path
def compile_file(self, orig_path, relative_compile_path): target_path = self._make_path(self.compile_path, relative_compile_path) files.copy_file(orig_path, target_path)
def backup_file(self, orig_path, relative_backup_path): target_path = self._make_path(self.backup_path, relative_backup_path) files.copy_file(orig_path, target_path)
def copy_staged_file(self, orig_path, relative_staging_path): src_path = self._make_path(self.staging_path, orig_path) target_path = self._make_path(self.staging_path, relative_staging_path) files.copy_file(src_path, target_path) return target_path