From user-return-5970-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Aug 12 21:33:57 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 11021 invoked from network); 12 Aug 2009 21:33:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Aug 2009 21:33:57 -0000 Received: (qmail 53567 invoked by uid 500); 12 Aug 2009 21:34:02 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 53489 invoked by uid 500); 12 Aug 2009 21:34:02 -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 53479 invoked by uid 99); 12 Aug 2009 21:34:02 -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:34:02 +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 paul.joseph.davis@gmail.com designates 209.85.132.248 as permitted sender) Received: from [209.85.132.248] (HELO an-out-0708.google.com) (209.85.132.248) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2009 21:33:50 +0000 Received: by an-out-0708.google.com with SMTP id b2so131390ana.5 for ; Wed, 12 Aug 2009 14:33:29 -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=R+LH2UuR0YssyOGuI+uckVpraVs9s80QQOk6a7cwJ7U=; b=xBKrLwTGZwXDUbaseKntsvpCNO5NaZBidFKikn5C7RFQhIuEetRvscN4WrPgWBIiBB r1bnXgxcXXw5EHujYp3buLAWb5pq5EDsDgdQ6AXT/vautuUeY/JG3qV8zSdEdEtXqVw8 nUJPLrWgYqxNrXW2IABgl9oYVCGrKs4LHI8mo= 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=rSuZyHWhqI2u7+I+OIUyiEtJp/lC7i0bAmGQ2iFjadOAzO4iFZbH9nrFf7+OfselKt DLCaqIh3sWCdQ+jBLNQqd87fwWf6g6kUsuL53SDu8wLjYEQEU2Ivu62dlz1wNmB5Ju7e BCXEYQK+sSS+UHRsgqr8QqjMrRBy9G6DfBFyk= MIME-Version: 1.0 Received: by 10.101.53.11 with SMTP id f11mr443693ank.158.1250112809227; Wed, 12 Aug 2009 14:33:29 -0700 (PDT) In-Reply-To: References: <2B7642EB-5892-4B60-91AB-ABADB8BE57E4@apache.org> Date: Wed, 12 Aug 2009 17:33:29 -0400 Message-ID: Subject: Re: spidermonkey load function From: Paul Davis 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 On Wed, Aug 12, 2009 at 5:28 PM, Norman Barker wro= te: > 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? > Yeah, JIRA is the place to submit patches. Paul > 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_cod= e >> >> 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 >>>> -- >>>> >>>> >>> >> >> >