예제 #1
0
 def test_usual(self):
     """Test with all usual config options set"""
     cfg = self.baseConfig
     cfg["EMAIL"] = "info@localhost"
     cfg["LANGUAGE"] = "en"
     cfg["DISQUS_NAME"] = "__test__"
     bootstrap(os.path.join(self.tmpdir, "usual"), cfg)
     self.assertTrue(
         os.path.isfile(os.path.join(self.tmpdir, "usual/_config.py")),
         "config file not added")
예제 #2
0
 def setUp(self):
     self.tmpdir = tempfile.mkdtemp()
     self.cwd = os.getcwd()
     os.chdir(self.tmpdir)
     bootstrap(
         self.tmpdir, {
             "URL": "localhost",
             "TITLE": "Example",
             "DEFAULTS": {
                 "AUTHOR": "John Doe",
             }
         })
예제 #3
0
 def test_in_docroot(self):
     """Bootstrap with URL path set to '/'"""
     bootstrap(
         os.path.join(self.tmpdir, "in_docroot"), {
             "URL": "localhost",
             "TITLE": "Example",
             "DEFAULTS": {
                 "AUTHOR": "John Doe",
             }
         })
     self.assertTrue(
         os.path.isfile(os.path.join(self.tmpdir, "in_docroot/robots.txt")),
         "robots.txt not added")
     self.assertTrue(
         os.path.isfile(os.path.join(self.tmpdir, "in_docroot/humans.txt")),
         "humans.txt not added")
예제 #4
0
def init(*args):
    """usage: website init NAME
Create a new website project.

Options:
    NAME        name of the project folder"""
    config = dict([
            ["URL", raw_input("Base URL (e.g., http://example.com/blog): ")],
            ["TITLE", raw_input("Title of the website: ")],
            ["DEFAULTS", {
                "AUTHOR": raw_input("Your name: ")
            }],
            ["EMAIL", raw_input("Your email address (optional): ")],
            ["LANGUAGE", raw_input("Website language (optional, two-letter language code): ")],
            ["DISQUS_NAME", raw_input("Your Disqus username (optional): ")],
    ])
    if len(args) == 0:
        target = "."
    else:
        target = args[0]
    if os.path.isdir(target):
        if os.listdir(target) != []:
            logger.critical("The directory %s is not empty" % target)
            raise ValueError
    return bootstrap(target, config)
예제 #5
0
 def test_minimal(self):
     """Bootstrap with a minimal config"""
     bootstrap(os.path.join(self.tmpdir, "minimal"), self.baseConfig)
     self.assertTrue(
         os.path.isfile(os.path.join(self.tmpdir, "minimal/_config.py")),
         "config file not added")
예제 #6
0
 def test_noconf(self):
     """Bootstrap with empty config"""
     bootstrap(os.path.join(self.tmpdir, "noconf"), None)
     self.assertTrue(
         os.path.isfile(os.path.join(self.tmpdir, "noconf/_config.py")),
         "config file not added")
예제 #7
0
 def test_existing_empty_target(self):
     """Bootstrap in an existing empty target"""
     os.mkdir(os.path.join(self.tmpdir, "empty_target"))
     bootstrap(os.path.join(self.tmpdir, "empty_target"), {})