Beispiel #1
0
class Drupan(object):
    """drupan engine - everything happens here"""
    def setup(self, path, nodeploy, serve):
        """setup engine"""
        self.site = Site()
        self.site.path = path
        self.no_deployment = nodeploy
        self.serve = serve

    def run(self):
        """run drupan"""
        self.site.setup()
        plugins = Plugin(self.site)

        for plugin in plugins.plugins:
            plugin.run()

        if self.serve is True:
            server = Server(self.site)
            server.serve()

    def initialize(self, path):
        """init new site"""
        bootstrap(path)
        sys.exit(0)
Beispiel #2
0
    def setUp(self):
        self.e1 = Entity({})
        self.e1.meta["title"] = "foo"
        self.e1.meta["layout"] = "post"

        self.e2 = Entity({})
        self.e2.meta["title"] = "bar"
        self.e2.meta["layout"] = "post"
        self.e2.tag = "asdf"

        self.site = Site()
        self.site.entities.append(self.e1)
        self.site.entities.append(self.e2)
    def setUp(self):
        self.config = Config()
        self.config.options = {"markdown": {"extras": "."}}

        self.site = Site()

        self.entity = Entity(self.config)
        self.entity.raw = "foobar"
Beispiel #4
0
class TestSite(unittest.TestCase):
    def setUp(self):
        self.e1 = Entity({})
        self.e1.meta["title"] = "foo"
        self.e1.meta["layout"] = "post"

        self.e2 = Entity({})
        self.e2.meta["title"] = "bar"
        self.e2.meta["layout"] = "post"
        self.e2.tag = "asdf"

        self.site = Site()
        self.site.entities.append(self.e1)
        self.site.entities.append(self.e2)

    def test_get_title(self):
        """should return e1"""
        entity = self.site.get("title", "foo")
        self.assertEqual(entity, self.e1)

    def test_get_layout(self):
        """should return two entities"""
        results = self.site.get("layout", "post")
        self.assertEqual(len(results), 2)

    def test_get_none(self):
        """should return None"""
        result = self.site.get("foo", "bar")
        self.assertEqual(result, None)

    def test_search_meta(self):
        """should return True"""
        result = search(self.e1, "title", "foo")
        self.assertTrue(result)

    def test_search_attribute(self):
        """should return True"""
        result = search(self.e2, "tag", "asdf")
        self.assertTrue(result)

    def test_search_noresult(self):
        """should return False"""
        result = search(self.e1, "foo", "baz")
        self.assertFalse(result)
    def setUp(self):
        self.config = Config()
        self.config.reader = "filesystem"
        self.config.options = {
            "reader": {
                "directory": "foo",
                "extension": "md"
            }
        }

        self.site = Site()
    def setUp(self):
        self.config = Config()
        self.config.reader = "filesystem"
        self.config.options = {
            "reader": {
                "content": "foo",
                "extension": "md",
                "template": "bar",
            }
        }

        self.site = Site()
Beispiel #7
0
    def setUp(self):
        self.config = Config()
        self.config.options = {
            "blank": {
                "generate": {
                    "foo": "bar",
                    "baz": "wusa"
                }
            }
        }

        self.site = Site()
Beispiel #8
0
    def setUp(self):
        config = Config()
        config.options = {
            "jinja": {
                "template": "foo",
            }
        }

        self.entity = Entity(config)

        site = Site()
        site.entities.append(self.entity)

        self.render = Render(site, config)
Beispiel #9
0
 def setUp(self):
     self.site = Site()
     self.config = Config()
     cfg = {
         "options": {
             "s3cf": {
                 "bucket": "asdf",
                 "md5path": "asdf",
                 "redirects": "asdf",
                 "site_url": "asdf",
                 "skip_upload": "asdf",
                 "aws_access_key": "asdf",
                 "aws_secret_key": "asdf",
                 "cloudfront_id": "asdf",
             },
         }
     }
     self.config.from_dict(cfg)
 def setUp(self):
     self.site = Site()
     self.config = Config()
     cfg = {
         "options": {
             "s3sub": {
                 "bucket": "asdf",
                 "profile": "asdf",
                 "md5path": "asdf",
                 "redirects": "asdf",
                 "site_url": "asdf",
                 "skip_upload": "asdf"
             },
             "writer": {
                 "directory": "asdf"
             }
         }
     }
     self.config.from_dict(cfg)
Beispiel #11
0
 def setUp(self):
     self.config = Config()
     self.site = Site()
     self.plugin = Plugin(self.site, self.config)
Beispiel #12
0
 def setup(self, path, nodeploy, serve):
     """setup engine"""
     self.site = Site()
     self.site.path = path
     self.no_deployment = nodeploy
     self.serve = serve