示例#1
0
 def install(self, bit_download):
     bit_directory = f'bits/{bit_download.bit_name}'
     if filesystem.directory_exists(bit_directory):
         filesystem.remove_directory(bit_directory)
     filesystem.create_directory(bit_directory)
     filesystem.unzips(base64.b64decode(bit_download.payload),
                       bit_directory)
示例#2
0
 def build_tests(self, project, files_or_dirs):
     if not filesystem.directory_exists(constants.BUILD_DIRECTORY):
         filesystem.create_directory(constants.BUILD_DIRECTORY)
     if not files_or_dirs:
         self.__build_tests(project, ['tests'])
     else:
         tests_to_run = self.tests_from_args(project, files_or_dirs)
         self.__build_tests(project, [test.name for test in tests_to_run])
示例#3
0
 def add_test(self, file_name, fails=False):
     if not filesystem.directory_exists('tests'):
         filesystem.create_directory('tests')
     expect = 'false' if fails else 'true'
     filesystem.create_file(
         f'tests/{file_name}', '#include <cest/cest.h>\n'
         'using namespace cest;\n'
         'describe("Test Case", []() {\n'
         '    it("passes", []() {\n'
         f'        expect(true).toBe({expect});\n'
         '    });\n'
         '});\n')
示例#4
0
    def pack(self, project_descriptor, build_directory):
        if filesystem.directory_exists(build_directory):
            raise FailedToPackageTemplate(cause='build directory exists')

        filesystem.create_directory(build_directory)
        filesystem.copy_file(PROJECT_DESCRIPTOR_FILE,
                             f'{build_directory}/project.yaml')
        self.__copy_packages(build_directory, project_descriptor)
        self.__copy_mains(build_directory, project_descriptor)
        self.__copy_dockerfiles(build_directory, project_descriptor)
        filesystem.zip(build_directory, f'{project_descriptor.name}')
        filesystem.remove_directory(build_directory)

        return f'{project_descriptor.name}.zip'
示例#5
0
    def pack(self, project_descriptor, build_directory):
        if not project_descriptor.build_packages():
            raise PackagingFailure(cause='project contains no packages')

        if filesystem.directory_exists(build_directory):
            raise PackagingFailure(cause='build directory exists')

        filesystem.create_directory(build_directory)
        filesystem.copy_file(PROJECT_DESCRIPTOR_FILE,
                             f'{build_directory}/project.yaml')
        for package in project_descriptor.build_packages():
            filesystem.copy_directory(package.path,
                                      f'{build_directory}/{package.path}')
        filesystem.zip(build_directory, f'{project_descriptor.name}')
        filesystem.remove_directory(build_directory)

        return f'{project_descriptor.name}.zip'
示例#6
0
 def clean(self, project):
     if filesystem.directory_exists(constants.BUILD_DIRECTORY):
         filesystem.remove_directory(constants.BUILD_DIRECTORY)
     _ignore_exception(lambda: filesystem.delete_file(constants.CMAKELISTS))
示例#7
0
 def build(self, project):
     if not filesystem.directory_exists(constants.BUILD_DIRECTORY):
         filesystem.create_directory(constants.BUILD_DIRECTORY)
     self.__build(project, [project.name], post_build=self.__post_build(project))
示例#8
0
 def install(self, template_download, directory):
     if filesystem.directory_exists(directory):
         raise UnableToInstallTemplate
     filesystem.create_directory(directory)
     filesystem.unzips(base64.b64decode(template_download.payload), directory)
示例#9
0
 def clean(self, project):
     if filesystem.directory_exists(constants.BUILD_DIRECTORY):
         self.__run_command(constants.NINJA_COMMAND, 'clean')
         filesystem.remove_directory(constants.BUILD_DIRECTORY)
     _ignore_exception(lambda: filesystem.delete_file(constants.CMAKELISTS))
示例#10
0
 def build(self, project, target_name):
     if not filesystem.directory_exists(constants.BUILD_DIRECTORY):
         filesystem.create_directory(constants.BUILD_DIRECTORY)
     self.__build(project, target_name, [project.name])