示例#1
0
                        try:
                            os.makedirs(vendordir)
                        except:
                            pass
                    t = os.path.join(prefix, t)
                    break
            
        copy_helper(appdir, t)
    fid = os.path.join(appdir, '_id')
    if not os.path.isfile(fid):
        f = open(fid, 'wb')
        f.write('_design/%s' % os.path.split(appdir)[1])
        f.close()
    
    if create:
        doc = localdoc.instance(ui, path, create=True)
        app_name = os.path.split(path)[-1]
        rcfile = os.path.join(path, '.couchapprc')
        ui.write_json(rcfile, {"env": {"default": {"name": app_name}}})

    #ui.extensions.notify("post-generate", path)
    
def generate_function(ui, path, kind, name, template=None):
    functions_path = ['functions']
    if template:
        functions_path = []
        _relpath = os.path.join(*template.split('/'))
        template_dir = find_template_dir(_relpath)
    else:
        template_dir = find_template_dir()
    if template_dir:
示例#2
0
文件: app.py 项目: rhunter/couchapp
def document(ui, path='', create=False, docid=None):
    doc = localdoc.instance(ui, path, create=create, docid=docid)
    return doc