Ejemplo n.º 1
0
    def __init__(self, project_name='project_name'):
        kwargs = self.get_kwargs()
        self.site = DjangoStack(project_name, **kwargs)

        for checkout in self.get_checkouts():
            self.site.add_checkout(
                checkout['repository'], checkout['destination'], **checkout['kwargs']
            )

        self.site.add_pre_build_hook(self.pre_build)
        self.site.add_post_build_hook(self.post_build)

        for package in self.get_packages():
            self.site.add_additional_package(package)

        for python_dependency in self.get_python_dependencies():
            self.site.add_additional_python_dependency(python_dependency)

        self.site.expose_to_current_module()
        self.site.setup_stack()
Ejemplo n.º 2
0
class Deploy(object):
    def __init__(self, project_name='project_name'):
        kwargs = self.get_kwargs()
        self.site = DjangoStack(project_name, **kwargs)

        for checkout in self.get_checkouts():
            self.site.add_checkout(
                checkout['repository'], checkout['destination'], **checkout['kwargs']
            )

        self.site.add_pre_build_hook(self.pre_build)
        self.site.add_post_build_hook(self.post_build)

        for package in self.get_packages():
            self.site.add_additional_package(package)

        for python_dependency in self.get_python_dependencies():
            self.site.add_additional_python_dependency(python_dependency)

        self.site.expose_to_current_module()
        self.site.setup_stack()

    def get_kwargs(self):
        # Return a keyword argument dictionary to pass into the DjangoStack instance.
        raise NotImplementedError('get_kwargs must be implemented')

    def get_checkouts(self):
        # Return a list of dictionaries, each of which contain source_repository,
        # destination and kwargs.
        return []

    def get_packages(self):
        # Return a list of valid system packages to be installed via apt-get.
        return []

    def get_python_dependencies(self):
        # Return a list of valid python dependencies to be installed by pip.
        return []

    def pre_build(self):
        # Whatever needs to be done before DjangoStack deploys.
        return None

    def post_build(self):
        # Whatever needs to be done after DjangoStack deploys.
        return None