Пример #1
0
def console_watch(args, project_dir, output_dir):
    ret_code = 0
    logger.info("running watch")
    d = Directory(project_dir, '.git')
    if d.exists():
        try:
            git_path = subprocess.check_output(['which', 'git']).strip()
            output = subprocess.check_output(
                [git_path, "pull", "origin", "master"],
                stderr=subprocess.STDOUT,
                cwd=str(project_dir)
            )
            if (output.find("Updating") >= 0) or not output_dir.exists():
                # there are new changes, let's recompile the project
                s = Site(project_dir, output_dir)
                s.output()

            elif output.find("Already up-to-date"):
                # nothing has changed, so don't recompile
                pass
            else:
                raise RuntimeError(output)

        except subprocess.CalledProcessError as e:
            raise

    else:
        ret_code = 1

    logger.info("watch done")
    return ret_code
Пример #2
0
    def test_in_private(self):
        d = Directory(testdata.create_dir("/foo/_bar/che"))
        self.assertTrue(d.in_private())
        self.assertFalse(d.is_private())

        d = Directory(testdata.create_dir("/foo/_bar"))
        self.assertTrue(d.in_private())
        self.assertTrue(d.is_private())