Exemplo n.º 1
0
    def test_dependencies_downloaded(self):
        # Arrange
        self.fs.CreateFile('nut_shell/shell.yml', contents="""
shell:
    name: nut_shell
    author: Chuck Norris
    email: [email protected]
    description: Save the world
    version: 1.0.0
    """)

        os.chdir('nut_shell')

        dependencies_packager = Mock()
        command_executor = DistCommandExecutor(dependencies_packager)

        # Act
        command_executor.dist()

        # Assert
        self.assertTrue(dependencies_packager.save_offline_dependencies.called)
        args = dependencies_packager.save_offline_dependencies.call_args[0]
        self.assertEqual(args[0].split(os.path.sep)[-1], 'requirements.txt')
        self.assertEqual(args[0].split(os.path.sep)[-2], 'src')
        self.assertEqual(args[1].split(os.path.sep)[-1], 'offline_requirements')
        self.assertEqual(args[1].split(os.path.sep)[-2], 'dist')
Exemplo n.º 2
0
    def test_dependencies_downloaded_only_pypi(self):
        # Arrange
        self.fs.CreateFile('nut_shell/shell.yml',
                           contents="""
shell:
    name: nut_shell
    author: Chuck Norris
    email: [email protected]
    description: Save the world
    version: 1.0.0
    """)

        os.chdir('nut_shell')

        dependencies_packager = Mock()
        command_executor = DistCommandExecutor(dependencies_packager)

        # Act
        command_executor.dist(enable_cs_repo=False)
def main(args):

    #
    # CLI
    #
    parser = ArgumentParser(description='create new TG release',
                            formatter_class=RawDescriptionHelpFormatter)
    parser.add_argument("-r", "--release", help="New release version")
    parser.add_argument("-m", "--message", help="New commit message")
    parsed_args = parser.parse_args(args)

    #
    # Write new version
    #
    with open("shell.yml", 'r') as f:
        shell = yaml.safe_load(f)
    shell['shell']['version'] = parsed_args.release
    with open("shell.yml", 'w') as f:
        yaml.safe_dump(shell, f, default_flow_style=False)

    with open("version.txt", 'w') as f:
        f.write(parsed_args.release)

    drivermetadata = ET.parse('src/drivermetadata.xml')
    driver = drivermetadata.getroot()
    driver.attrib['Version'] = parsed_args.release
    drivermetadata.write('src/drivermetadata.xml')

    #
    # Shellfoundry
    #
    PackCommandExecutor().pack()
    DistCommandExecutor().dist()
    InstallCommandExecutor().install()

    #
    # git
    #
    if parsed_args.message:
        repo = Repo('.')
        repo.git.add('.')
        repo.git.commit('-m version {}'.format(parsed_args.message))
        repo.git.push()
Exemplo n.º 4
0
def dist():
    """
    Creates a deployable Shell which can be distributed to a production environment
    """
    PackCommandExecutor().pack()
    DistCommandExecutor().dist()