Example #1
0
    def run(self, runtime):
        root = self['path']
        if root.exists():
            runtime.report('migrations directory exists for %r; aborting' % schema)
            return

        root.makedirs_p()
        (root / 'versions').mkdir()

        script = get_package_data('spire.schema:templates/script.py.mako.tmpl')
        (root / 'script.py.mako').write_bytes(script)

        env = get_package_data('spire.schema:templates/env.py.tmpl')
        (root / 'env.py').write_bytes(env % {
            'schema': self.schema,
        })

        runtime.report('created migrations directory for %r' % self.schema)
Example #2
0
    def run(self, runtime):
        root = self['path']
        schema = self['schema']
        if root.exists():
            runtime.report('migrations directory exists for %r; aborting' %
                           schema)
            return

        root.makedirs_p()
        (root / 'versions').mkdir()

        script = get_package_data('spire.schema:templates/script.py.mako.tmpl')
        (root / 'script.py.mako').write_bytes(script)

        env = get_package_data('spire.schema:templates/env.py.tmpl')
        (root / 'env.py').write_bytes(env % {
            'schema': self.schema,
        })

        runtime.report('created migrations directory for %r' % self.schema)
Example #3
0
    def __init__(self, sources):
        self.context = {}
        for source in sources or []:
            content = get_package_data(source)
            self.context.update(json.loads(content))

        if 'meshconf' not in self.context:
            mesh_bundles = {}
            for k, v in Assembly.current().configuration.iteritems():
                if k.startswith('mesh-proxy'):
                    mesh_bundles[k[11:]] = v['path']
            self.context['meshconf'] = MESHCONF_SCRIPT % json.dumps(mesh_bundles)