Beispiel #1
0
def main() -> None:
    builder = Builder()

    install_common_dependencies(builder)

    home_dir = os.path.expanduser("~")
    install_zsh(builder, home_dir)
    create_symlinks(builder, "./", home_dir)

    install_vim(builder)
    install_tmux(builder)

    builder.build()
Beispiel #2
0
    def test_all_build_units_complete(self) -> None:
        builder = Builder(io_out=DEVNULL)
        spy_actions = []

        for _ in range(3):
            spy_action = SpyBuildAction()
            spy_actions.append(spy_action)
            builder.add_unit(
                BuildUnit(
                    AlwaysRunBuildPredicate(),
                    spy_action,
                ), )

        builder.build()

        for spy_action in spy_actions:
            spy_action.assert_called()
Beispiel #3
0
    def test_create_symlinks(self) -> None:
        os.mkdir("fiz")
        Path("fiz/bar.symlink").touch()
        os.mkdir("fiz/fah")
        Path("fiz/fah/bir.symlink").touch()

        dest_dir = "test_home"
        os.mkdir(dest_dir)

        builder = Builder(io_out=DEVNULL)
        create_symlinks(builder, "fiz", dest_dir)
        builder.build()

        for root, dirs, files in os.walk(dest_dir):
            self.assertIn(".bar", files)
            self.assertIn(".bir", files)

        shutil.rmtree("fiz")
        shutil.rmtree(dest_dir)
Beispiel #4
0
    def test_all_errors_are_thrown_at_end(self) -> None:
        builder = Builder(io_out=DEVNULL)

        num_errors = 3
        for _ in range(num_errors):
            builder.add_unit(SaboteurBuildUnit())

        spy_action = SpyBuildAction()
        builder.add_unit(BuildUnit(
            AlwaysRunBuildPredicate(),
            spy_action,
        ), )

        try:
            builder.build()
        except Exception as e:
            self.assertEqual(len(e.args[0]), num_errors)

        spy_action.assert_called()