def do_things_in_starter_project_and_main(self, function): pushdir(self.details.starter_project_dir) function() popdir() pushdir(self.details.main_project_dir) function() popdir()
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 commit_starter_project(self): pushdir(self.details.starter_project_dir) run([ "git", "commit", "-m", F"'Update to Approvals {self.details.new_version}'" ]) popdir()
def test_conan_and_create_pr(self): # TODO Fix this directory name pushdir(self.details.conan_data_dir) # We cannot test the new Conan recipe until the new release has been # published on github new_version_without_v = version.get_version_without_v( self.details.new_version) run(['conan', 'create', '.', F'{new_version_without_v}@']) # TODO Commit the changes - with message f'Add approvaltests.cpp {new_version_without_v}' # TODO Push the changes - NB on the feature branch for the release popdir() check_step( "that you have created a Pull Request for conan-center-index?")
def update_version_number_header(self): pushdir(self.details.approval_tests_dir) version_header = os.path.join("ApprovalTestsVersion.h") text = \ F"""#ifndef APPROVALTESTS_CPP_APPROVALTESTSVERSION_H #define APPROVALTESTS_CPP_APPROVALTESTSVERSION_H #define APPROVALTESTS_VERSION_MAJOR {self.details.new_version_object['major']} #define APPROVALTESTS_VERSION_MINOR {self.details.new_version_object['minor']} #define APPROVALTESTS_VERSION_PATCH {self.details.new_version_object['patch']} #define APPROVALTESTS_VERSION_STR "{version.get_version_without_v(self.details.new_version)}" #define APPROVALTESTS_VERSION \\ (APPROVALTESTS_VERSION_MAJOR * 10000 + APPROVALTESTS_VERSION_MINOR * 100 + \\ APPROVALTESTS_VERSION_PATCH) #endif //APPROVALTESTS_CPP_APPROVALTESTSVERSION_H """ write_file(version_header, text) popdir()
def test_conan_and_create_pr(self): pushdir(os.path.join(self.details.conan_approvaltests_dir, 'all')) # We cannot test the new Conan recipe until the new release has been # published on github new_version_without_v = version.get_version_without_v( self.details.new_version) run(['conan', 'create', '.', F'{new_version_without_v}@']) check_step( F"Commit the changes - with message 'Add approvaltests.cpp {new_version_without_v}'" ) check_step( 'Push the changes - NB on the feature branch for the release') popdir() print( F"Create a pull request, including this in the description: **approvaltests.cpp/{new_version_without_v}**" ) check_step( "that you have created a Pull Request for conan-center-index?")
def regenerate_markdown(self): pushdir("..") run(["./run_markdown_templates.sh"]) popdir()
def update_readme_and_docs(self): pushdir("..") replace_text_in_file("mdsource/README.source.md", self.details.old_version, self.details.new_version) popdir()
def check_starter_project_builds(self): pushdir(F"{self.details.starter_project_dir}/cmake-build-debug") run(["cmake", "--build", "."]) popdir()
def push_main_project(self): pushdir(self.details.main_project_dir) run(["git", "push", "origin", "master"]) popdir()
def commit_main_project(self): pushdir(self.details.main_project_dir) run(["git", "commit", "-m", F"'{self.details.new_version} release'"]) popdir()