コード例 #1
0
ファイル: plugins.py プロジェクト: jsdir/stretch
    def run_migration(self, plugin, deploy):
        path = plugin.get_path()

        # Use releases for template context
        contexts = [contexts.create_deploy_context(deploy)]

        # Render database.json
        context = self.options.get('context')
        if context:
            contexts.append(context)

        rendered_file = self.render_template(('database.json', ), path,
                                             contexts)

        # Install dependencies and database drivers
        os.chdir(path)
        self.env.call_npm(['install'])

        if plugin == self:
            call(['db-migrate', '-e', 'stretch', 'up'])
        else:
            migrations = os.listdir(os.path.join(self.get_path(),
                                                 'migrations'))
            migration_file = reduce(migrations, self.get_later_migration)
            call(['db-migrate', '-e', 'stretch', 'down', migration_file])

        # Clean up
        os.remove(rendered_file)
コード例 #2
0
ファイル: plugins.py プロジェクト: jsdir/stretch
    def run_migration(self, plugin, deploy):
        path = plugin.get_path()

        # Use releases for template context
        contexts = [contexts.create_deploy_context(deploy)]

        # Render database.json
        context = self.options.get('context')
        if context:
            contexts.append(context)

        rendered_file = self.render_template(('database.json',), path,
                                             contexts)

        # Install dependencies and database drivers
        os.chdir(path)
        self.env.call_npm(['install'])

        if plugin == self:
            call(['db-migrate', '-e', 'stretch', 'up'])
        else:
            migrations = os.listdir(os.path.join(self.get_path(),
                                                 'migrations'))
            migration_file = reduce(migrations, self.get_later_migration)
            call(['db-migrate', '-e', 'stretch', 'down', migration_file])

        # Clean up
        os.remove(rendered_file)
コード例 #3
0
ファイル: plugins.py プロジェクト: jsdir/stretch
    def build(self, deploy):
        super(GruntPlugin, self).build()
        self.setup()

        path = self.get_path()

        # Render Gruntfile
        contexts = [contexts.create_deploy_context(deploy)]
        context = self.options.get('context')
        if context:
            contexts.append(context)

        rendered_file = self.render_template(
            ('Gruntfile.js', 'Gruntfile.coffee'), path, contexts)

        # Run grunt build task
        os.chdir(path)
        self.env.call_npm(['install'])
        call(['grunt', 'build'])

        # Clean up
        os.remove(rendered_file)
コード例 #4
0
ファイル: plugins.py プロジェクト: jsdir/stretch
    def build(self, deploy):
        super(GruntPlugin, self).build()
        self.setup()

        path = self.get_path()

        # Render Gruntfile
        contexts = [contexts.create_deploy_context(deploy)]
        context = self.options.get('context')
        if context:
            contexts.append(context)

        rendered_file = self.render_template(
            ('Gruntfile.js', 'Gruntfile.coffee'), path, contexts)

        # Run grunt build task
        os.chdir(path)
        self.env.call_npm(['install'])
        call(['grunt', 'build'])

        # Clean up
        os.remove(rendered_file)