From user-return-5969-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Aug 12 21:28:30 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 6827 invoked from network); 12 Aug 2009 21:28:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Aug 2009 21:28:30 -0000 Received: (qmail 42600 invoked by uid 500); 12 Aug 2009 21:28:36 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 42509 invoked by uid 500); 12 Aug 2009 21:28:36 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 42499 invoked by uid 99); 12 Aug 2009 21:28:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2009 21:28:36 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of norman.barker@gmail.com designates 209.85.211.175 as permitted sender) Received: from [209.85.211.175] (HELO mail-yw0-f175.google.com) (209.85.211.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2009 21:28:23 +0000 Received: by ywh5 with SMTP id 5so470420ywh.13 for ; Wed, 12 Aug 2009 14:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=7WD4KVESgtpNVAC/I8YV1bddGvVWgTy4UR1mgcTnoE0=; b=YG8B4JdKK5VSELH5nL2CSP8lbyGPeYehhZ/oaRAjr1OBThrgXyuj375pLzsWx3D30i g8v2Z30OasmvjUC+9gchFSsRhZUf99iZKSDSg6dHix4ftt5sLwbT0ur+Z8gfvvRiH4g+ R2k8hQuJzBehj4r5APg9apmdTLVBkuICeXfSY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=iYx8nIXq51+xY1/4BerPDn3slBtSHxp9KvNygTVBTgiGSrxI+1s/AqSHfVM46XC8xN zSpxCihk3cTVxgnHHzubvwAToG5lde0tpT+cBSJEzYdNnKiGdb4E7PvT+VoHkCXhFdHP Fh2CFhu76Hjjwpscg1ZntNr9QsfD1Mfzikqp4= MIME-Version: 1.0 Received: by 10.150.104.15 with SMTP id b15mr617335ybc.100.1250112482818; Wed, 12 Aug 2009 14:28:02 -0700 (PDT) In-Reply-To: <2B7642EB-5892-4B60-91AB-ABADB8BE57E4@apache.org> References: <2B7642EB-5892-4B60-91AB-ABADB8BE57E4@apache.org> Date: Wed, 12 Aug 2009 15:28:02 -0600 Message-ID: Subject: Re: spidermonkey load function From: Norman Barker To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org ok, I see that it is stated in the FAQ that this is not in your plan, so a pre-processor it is. Just in case anyone else wants to add generic methods to main.js without polluting their views and needs to import a fairly substantial javascript library to do this you can do this in dos as follows copy x.js + y.js + couch_main.js main.js /Y xcopy main.js %COUCH_HOME%\share\server /Y /Q /R as you can see I am running windows, I have some bug fixes to give back on the c compilation with MSVC is JIRA the best way? thanks, Norman On Wed, Aug 12, 2009 at 3:06 PM, Jan Lehnardt wrote: > > On 12 Aug 2009, at 22:50, Norman Barker wrote: > >> ok, (sorry should have been clearer) >> >> I am just looking to add generic functions to main.js - and the >> methods will be added to the sandbox to be available in a view, I also >> do not wish to load arbitrary functions in a view. =A0I am not looking >> to add many, but main.js is getting big and it would be more >> manageable if we could use load (at the moment I am using a >> pre-processor to create main.js). >> >> Load will be available in main.js, it will not be available in the >> views - the sandbox takes care of that. >> >> I doubt I will be the only one who wants to add generic functions to a >> server since _show has been implemented and generic functionality from >> external libraries would be useful in this application. >> >> It is easier to maintain if generic functions can be added main.js not >> in views as such there either needs to be a pre-process in couchdb to >> create the main.js (so a windows batch file or shell script) or the >> load() function needs to be enabled or main.js is going to grow and >> grow. >> >> Jan, unless I am mistaken CouchApp does not change main.js? > > No but it injects code into your view, show and list functions which is > exactly > what you want. If you change your function library code, views need to > invalidated, if you don't include the code in the functions, CouchDB has = no > way of knowing. > > http://wiki.apache.org/couchdb/Frequently_asked_questions#view_share_code > > Cheers > Jan > -- > > >> >> Norman >> >> On Wed, Aug 12, 2009 at 2:07 PM, Jan Lehnardt wrote: >>> >>> On 12 Aug 2009, at 21:08, Norman Barker wrote: >>> >>>> Hi, >>>> >>>> I have been looking at the SpiderMonkey shell and the custom couchdb >>>> javascript driver and see that the couchdb driver does not allow the >>>> load(filename) function which is allowed in the shell, is this >>>> intentional? >>> >>> We don't want users to load extra files in their view code :) >>> >>> >>>> I am looking to add functions to main.js without having to paste them >>>> into one file and load() would have been a way around this. =A0The >>>> alternative is to implement a pre-processor to create one file before >>>> deployment which I will use for now. >>> >>> CouchApp* is that preprocessor: >>> >>> http://github.com/couchapp/couchapp/tree/master >>> >>> Cheers >>> Jan >>> -- >>> >>> >> > >