Ejemplo n.º 1
0
    def new_project(self):
        template_path = get_template_path('project')
        project_path = os.path.realpath(self.args['<name>'])

        copy_project(
            template_path,
            project_path,
            self.args['--blank']
        )

        logger.info("New project created : {}".format(project_path))
Ejemplo n.º 2
0
    def test_copy_empty_dir(self):
        project = get_template_path("project")
        with tmp_folder() as tmpdir:
            copy_project(project, os.path.join(tmpdir, "foo"), True)
            root = [f for f in os.listdir(
                os.path.join(tmpdir, "foo"))
            ]
            post = [f for f in os.listdir(
                os.path.join(tmpdir, "foo", "posts"))
            ]
            page = [f for f in os.listdir(
                os.path.join(tmpdir, "foo", "pages"))
            ]

            self.assertEqual(len(root), 5)
            self.assertEqual(len(post), 0)
            self.assertEqual(len(page), 0)
Ejemplo n.º 3
0
 def test_existing_dir(self):
     with tmp_folder() as tmpdir:
         with self.assertRaises(DirectoryExistsException):
             copy_project(tmpdir, tmpdir, False)