Files @ 6af3e67cc576
Branch filter:

Location: kallithea/rhodecode/lib/dbmigrate/migrate/versioning/script/base.py

Bradley M. Kuhn
Add Twitter's Bootstrap 3.0.0 CSS and Javascript files, under Apache License 2.0

These files are exactly as they appear the upstream release 3.0.0 of
Bootstrap, which Twitter released under the Apache License 2.0. To extract
these files, I did the following:

I downloaded the following file:
https://github.com/twbs/bootstrap/archive/v3.0.0.zip

with sha256sum of:
$ sha256sum v3.0.0.zip
2d54f345f4abc6bf65ea648c323e9bae577e6febf755650e62555f2d7a222e17 v3.0.0.zip

And extracted from it these two files:
bootstrap-3.0.0/dist/css/bootstrap.css
bootstrap-3.0.0/dist/js/bootstrap.js
which are licensed under the Apache License 2.0.

and placed them into:
rhodecode/public/css/bootstrap.css
rhodecode/public/js/bootstrap.js
respectively.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging

from rhodecode.lib.dbmigrate.migrate import exceptions
from rhodecode.lib.dbmigrate.migrate.versioning.config import operations
from rhodecode.lib.dbmigrate.migrate.versioning import pathed


log = logging.getLogger(__name__)

class BaseScript(pathed.Pathed):
    """Base class for other types of scripts.
    All scripts have the following properties:

    source (script.source())
      The source code of the script
    version (script.version())
      The version number of the script
    operations (script.operations())
      The operations defined by the script: upgrade(), downgrade() or both.
      Returns a tuple of operations.
      Can also check for an operation with ex. script.operation(Script.ops.up)
    """ # TODO: sphinxfy this and implement it correctly

    def __init__(self, path):
        log.debug('Loading script %s...' % path)
        self.verify(path)
        super(BaseScript, self).__init__(path)
        log.debug('Script %s loaded successfully' % path)

    @classmethod
    def verify(cls, path):
        """Ensure this is a valid script
        This version simply ensures the script file's existence

        :raises: :exc:`InvalidScriptError <migrate.exceptions.InvalidScriptError>`
        """
        try:
            cls.require_found(path)
        except:
            raise exceptions.InvalidScriptError(path)

    def source(self):
        """:returns: source code of the script.
        :rtype: string
        """
        fd = open(self.path)
        ret = fd.read()
        fd.close()
        return ret

    def run(self, engine):
        """Core of each BaseScript subclass.
        This method executes the script.
        """
        raise NotImplementedError()