Ejemplo n.º 1
0
def init(dbname="shiftspace"):
    """
    Initialize the shiftspace database. Defaults to
    shiftspace for the database name.
    Parameters:
        dbname - the name of the database to use.
    """
    server = core.server()
    if not server.__contains__(dbname):
        print "Creating database %s." % dbname
        server.create(dbname)
    else:
        print "%s database already exists." % dbname
    db = server[dbname]
    loadDocs(db)
Ejemplo n.º 2
0
 def index(self):
     """
     Serves the status page for developers.
     """
     import models.core
     t = Template(filename="html/index.mako", lookup=lookup)
     try:
         server = core.server()
         server.version
     except Exception:
         return self.statusPage(status="err", details="couchdb")
     try:
         db = core.connect()
         db["_design/users"]
     except:
         return self.statusPage(status="err", details="initdb")
     return self.statusPage()
Ejemplo n.º 3
0
def init(dbname="shiftspace/master"):
    """
    Initialize the shiftspace database. Defaults to
    shiftspace for the database name.
    Parameters:
        dbname - the name of the database to use.
    """
    import models.core as core
    server = core.server()
    if not server.__contains__(dbname):
        print "Creating databases."
        server.create(dbname)
        server.create("shiftspace/public")
        server.create("shiftspace/shared")
        server.create("shiftspace/messages")
    else:
        print "%s database already exists." % dbname
    db = server[dbname]
    sync()
Ejemplo n.º 4
0
 def sandbox(self):
     """
     For developers. Serves the sandbox development enviroment. Automatically cocatenates 
     and preprocess all of CSS files and HTML files for the interface and
     as well as all of the JavaScript before serving the page.
     """
     import models.core
     t = Template(filename="html/index.mako", lookup=lookup)
     try:
         server = core.server()
         server.version
     except Exception:
         return self.statusPage(status="err", details="couchdb")
     corebuilder.run()
     compiler = sandalphon.SandalphonCompiler()
     compiler.compile(inputFile="client/ShiftSpace.html",
                      outDir="builds/compiledViews",
                      envFile="mydev")
     preprocessor = preprocess.SSPreProcessor(project="sandbox", env="mydev")
     preprocessor.preprocess(input="client/ShiftSpace.js",
                             output="builds/shiftspace.sandbox.js")
     return serve_file(os.path.join(webroot, 'sandbox/index.html'))