Пример #1
0
    def test_packaging_bit_raises_exception_when_output_directory_exists(self, filesystem):
        filesystem.directory_exists.return_value = True
        packager = BitPackager()
        project = ProjectDescriptor('cest')
        project.build.packages.append(PackageDescription('fakeit'))

        self.assertRaises(PackagingFailure, packager.pack, project, 'dist')
Пример #2
0
 def __init__(self,
              cpm_hub_connector,
              bit_packager=BitPackager(),
              template_packager=TemplatePackager()):
     self.template_packager = template_packager
     self.bit_packager = bit_packager
     self.cpm_hub_connector = cpm_hub_connector
Пример #3
0
    def test_packaging_creates_output_directory(self, filesystem):
        filesystem.directory_exists.return_value = False
        packager = BitPackager()
        project = Project('cest')
        project.build.add_package(Package('api'))
        project.build.add_package(Package('domain'))

        packager.pack(project, 'dist')

        filesystem.create_directory.assert_called_once_with('dist')
        filesystem.copy_file.assert_called_once_with('project.yaml', 'dist/project.yaml')
        filesystem.copy_directory.assert_has_calls([
            mock.call('api', 'dist/api'),
            mock.call('domain', 'dist/domain'),
        ])
        filesystem.zip.assert_called_once_with('dist', 'cest')
        filesystem.remove_directory.assert_called_once_with('dist')
Пример #4
0
    def test_packaging_creates_output_directory(self, filesystem):
        filesystem.directory_exists.return_value = False
        packager = BitPackager()
        project = ProjectDescriptor('cest')
        project.targets['default'] = TargetDescription('default')
        project.build.packages.append(PackageDescription('api'))
        project.targets['default'].build.packages.append(PackageDescription('domain'))

        packager.pack(project, 'dist')

        filesystem.create_directory.assert_called_once_with('dist')
        filesystem.copy_file.assert_called_once_with('project.yaml', 'dist/project.yaml')
        filesystem.copy_directory.assert_has_calls([
            mock.call('api', 'dist/api'),
            mock.call('domain', 'dist/domain'),
        ])
        filesystem.zip.assert_called_once_with('dist', 'cest')
        filesystem.remove_directory.assert_called_once_with('dist')
Пример #5
0
def execute(argv):
    publish_parser = argparse.ArgumentParser(prog='cpm publish',
                                             description='cpm Package Manager',
                                             add_help=False)
    publish_parser.add_argument('-s',
                                '--repository-url',
                                required=True,
                                action='store',
                                default='https://repo.cpmbits.com:8000')
    publish_parser.add_argument('-d',
                                '--dry-run',
                                required=False,
                                action='store_true',
                                default=False)
    args = publish_parser.parse_args(argv)

    packager = BitPackager()
    cpm_hub_connector = CpmHubConnectorV1(repository_url=args.repository_url,
                                          dry_run=args.dry_run)
    service = PublishService(packager, cpm_hub_connector)

    result = publish_project(service)

    return result
Пример #6
0
    def test_packaging_bit_raises_exception_when_no_packages_are_declared(self):
        packager = BitPackager()
        project = ProjectDescriptor('cest')

        self.assertRaises(PackagingFailure, packager.pack, project, 'dist')