示例#1
0
 def sync(self):
     _sources = self.app.db['sources']
     for label in self.app.db['sources']:
         print("Syncing %s Templates . . . " % label.capitalize())
         src = SourceManager(self.app)
         src.sync(label)
         print('')
示例#2
0
    def create(self):
        if not len(self.app.pargs.extra) >= 1:
            raise boss_exc.BossArgumentError("Destination path required.")

        if not self.app.pargs.template:
            raise boss_exc.BossArgumentError("Template label required.")

        sources = self.app.db.get('sources')

        try:
            tmpl_parts = self.app.pargs.template.split(':')
            source = tmpl_parts[0]
            template = tmpl_parts[1]
        except IndexError as e:
            source = 'boss'
            template = self.app.pargs.template

        src = SourceManager(self.app)
        src.create_from_template(source, template, self.app.pargs.extra[0])
示例#3
0
    def templates(self):
        print('')
        sources = self.app.db['sources']
        for label,data in sources.items():
            print("Source: %s" % label)
            print('-' * 78)
            if data['is_local'] is True:
                local_path = sources[label]
                remote_path = None
            else:
                local_path = "%s/templates/%s" % (
                            self.app.config.get('boss', 'data_dir'), label,
                            )
                remote_path = sources[label]

            src = SourceManager(self.app)
            for tmpl in src.get_templates(label):
                print(tmpl)

            print('')