Ejemplo n.º 1
0
 def make(self, *make_args):
     return entry(Makefile, make_args)
Ejemplo n.º 2
0
    def pipe(cls, cmd, *_):
        if not cls.silent: print(cmd)
        pipe(cmd)

    @classmethod
    def generate(cls, path='./', match=None, *_):
        match = cls._gen_match(match)
        for file in os.listdir(path):
            file = os.path.join(path, file)
            if os.path.isdir(file):
                cls.generate(file, match)
            if os.path.isfile(file) and match.match(file):
                cls.pipe('go generate %s' % file)

    @staticmethod
    def _gen_match(match):
        if match is None:
            match = re.compile(r'^.*\.go$')
        if isinstance(match, str):
            match = re.compile(match)
        return match

    @classmethod
    @require_cls('up')
    def all(cls, *_):
        pass


if __name__ == '__main__':
    entry(Makefile, sys.argv[1:])
Ejemplo n.º 3
0
    @classmethod
    @require_cls('template0')
    def start0(cls, *_):
        pipe('docker-compose -f %s start' % (Makefile.compose_run_file0))

    @classmethod
    @require_cls('template0')
    def stop0(cls, *_):
        pipe('docker-compose -f %s stop' % (Makefile.compose_run_file0))

    @classmethod
    @require_cls('template0')
    def restart0(cls, *_):
        pipe('docker-compose -f %s restart' % (Makefile.compose_run_file0))

    @classmethod
    def clean(cls, *_):
        pipe('rm -rf -r %s/node*' % (Makefile.build_path))
        pipe('rm -rf -r %s/data*' % (Makefile.build_path))
        pipe('rm -rf -r %s/nsbstate.db' % (Makefile.build_path))
        pipe('rm -rf -r %s/trienode.db' % (Makefile.build_path))

    @classmethod
    @require_cls('build')
    def all(cls, *_):
        pass


if __name__ == '__main__':
    entry(Makefile)