def update_starter_project(self): STARTER_PATH_OLD_SINGLE_HEADER = F"{self.details.starter_project_dir}/lib/{self.details.old_single_header}" STARTER_PATH_NEW_SINGLE_HEADER = F"{self.details.starter_project_dir}/lib/{self.details.new_single_header}" # Make sure starter project folder is clean pushdir(self.details.starter_project_dir) # Delete untracked files: # - does not delete ignored files # - does not delete untracked files in new, untracked directories run(["git", "clean", "-f"]) run(["git", "reset", "--hard"]) popdir() shutil.copyfile(self.details.release_new_single_header, STARTER_PATH_NEW_SINGLE_HEADER) # Delete the last release: if os.path.exists(STARTER_PATH_OLD_SINGLE_HEADER): os.remove(STARTER_PATH_OLD_SINGLE_HEADER) # Update the version in the "redirect" header: replace_text_in_file( F"{self.details.starter_project_dir}/lib/ApprovalTests.hpp", self.details.old_version, self.details.new_version) # Update the version number in the Visual Studio project: replace_text_in_file( F"{self.details.starter_project_dir}/visual-studio-2017/StarterProject.vcxproj", self.details.old_single_header, self.details.new_single_header)
def prepare_release_notes(self): replace_text_in_file(self.details.xxx_release_notes_path, 'v.x.y.z', self.details.new_version) shutil.move(self.details.xxx_release_notes_path, self.details.new_release_notes_path) # Make sure the above move has finished, before we create the new xxx file: time.sleep(1) shutil.copyfile(self.details.template_release_notes_path, self.details.xxx_release_notes_path)
def update_features_page(self): features_file = '../doc/mdsource/Features.source.md' content = read_file(features_file) missing_features = F""" ## v.x.y.z ## {self.details.old_version} """ if missing_features in content: check_step( "the Features page is empty: are you sure you want this?") else: update_version = F""" ## v.x.y.z ## {self.details.new_version} """ replace_text_in_file(features_file, '\n## v.x.y.z\n', update_version)
def update_readme_and_docs(self): pushdir("..") replace_text_in_file("mdsource/README.source.md", self.details.old_version, self.details.new_version) popdir()