Ringobot log - RingoJS IRC channel: #ringojs on irc.freenode.net
2010-06-01:
[8:00] <hannesw> earl is your packages branch ready for consumption?[8:41] <rist> hi
[8:41] <rist> I'm trying to setup some urls for my app and I'm having problems mixing url definitons (some contain regexen, some don't)
[8:43] <rist> I set the urls up like this: ["/manage/([a-zA-Z]+)/edit", "manageActions", "edit"],
[8:43] <rist> ["/manage/", "manageActions", "index"]
[8:43] <rist> the edit url (e.g. http://localhost:8080/manage/abcd/edit/) works - the index url (http://localhost:8080/manage/) doesnt
[8:44] <rist> manageActions.js looks like this:
[8:44] <rist> exports.index = function (req) {
[8:44] <rist> return skinResponse('skins/list.html', {redirects: Redirect.all().sort(String.Sorter('shortUrl'))});
[8:44] <rist> };
[8:44] <rist> exports.edit = function (req, redirectId) {
[8:44] <rist> return skinResponse('skins/list.html', {redirects: Redirect.all().sort(String.Sorter('shortUrl'))});
[8:44] <rist> };
[9:00] <rist> while debugging it would be helpful to get more log statements from the webapp module - but setting the rootlooger and log4j.category.ringo.webapp to DEBUG didn't help - anything else?
[9:04] <hannesw> rist you should get more log statements with log4j.category.ringo.webapp = DEBUG
[9:04] <hannesw> maybe the problem is you need to restart for changes in logging to take effect
[9:04] <hannesw> this is new, because the log4j config watching caused a thread leak, unfortunately
[9:05] <hannesw> let me know if that doesn't work
[9:07] <rist> i did restart
[9:08] <rist> currently im especially interested to get more logstatements from webapp.js/resolveInConfig()
[9:09] <rist> oh - i changed the wrong log4j prop file
[9:10] <rist> I changed some "central" (?) log4j file which did in fact seem to change some behavior but not all
[9:10] <rist> now I have more than enough log statements
[9:12] <rist> ah - and found the culprit for my url resolution problem - again a "/" - this works: ["/manage", "manageActions", "index"]
[9:16] <hannesw> what was wrong? do you think it's a bug in webapp?
[9:16] <hannesw> and yes, overlayed configs may be confusing...
[9:17] <gmosx> hi
[9:21] <rist> I had these tow url mappings: ["/manage/([a-zA-Z]+)/edit", "manageActions", "edit"], and ["/manage/", "manageActions", "index"]
[9:21] <rist> the 2nd didn't work (but it was due to the second "/" in "/manage/")
[9:25] <robi42> hi rist, you could skip the explicit "index" action def. as in ["/manage", "manageActions"]
[9:26] <rist> oh - wasn't sure if I can mix url definitions with 2 and 3 arguments and wanted to be sure and added the "index"
[9:27] <robi42> (root url paths resolve to "index" by default)
[9:27] <rist> just trying to build a small app and I still miss helma's url/orm magic stuff
[9:28] <robi42> the object-o-magic hierarchy mapping?
[9:28] <rist> yes
[9:28] <robi42> one needs to get use to the ringo way, i guess
[9:28] <robi42> used*
[9:29] <rist> yes - let's see how it works out - it's just a small app so it's not that much of a problem
[9:29] <robi42> ok
[9:52] <hannesw> hm, i'm not sure why webapp removes leading/trailing slashes
[9:54] <hannesw> it also does some magic, like implicitly replacing leading / with ^ in the pattern (thus binding regexp to beginning of path)
[9:55] <hannesw> i think we should try to get rid of this
[9:56] <hannesw> the less hidden magic the better
[9:56] <robi42> +1
[9:56] <gmosx> hannesw: can I have a single file webapp?
[9:56] <hannesw> yes, sure
[9:56] <gmosx> like this:
[9:56] <gmosx> exports.app = function (request) {
[9:56] <gmosx> return {status: 200, headers: {}, body: ["OK"]}
[9:56] <gmosx> }
[9:56] <gmosx> if (require.main == module) {
[9:56] <gmosx> require("ringo/webapp").main();
[9:56] <gmosx> }
[9:56] <gmosx> should I pass some kind of parameter to main() ?
[9:57] <gmosx> should I give a special name to the file?
[9:57] <hannesw> you don't have to
[9:57] <hannesw> http://github.com/ringo/ringojs/tree/master/apps/jsgi/
[9:57] <hannesw> default module name for webapp is "config"
[9:57] <gmosx> should I have two files and pass module.directory?
[9:58] <gmosx> ah if I name my file config.js there is no need to pass module.directory?
[9:58] <hannesw> depends. module directory is for adding the webapp directory to module search path
[9:58] <hannesw> not sure if/when it's required
[9:59] <gmosx> it seems to work without module.directory
[9:59] <hannesw> passing it explicitly makes the webapp callable from anywhere, else current directory is assumed i think
[9:59] <gmosx> I am wondering what happens with static files...
[9:59] <gmosx> can I set the static file directory?
[10:00] <hannesw> yes:
[10:00] <gmosx> ie use 'root' instead of 'static' as a static directory?
[10:00] <hannesw> exports.static = ["/static", "./path"];
[10:00] <hannesw> exports.static = ["/static", "./root"];
[10:00] <hannesw> should work
[10:00] <gmosx> ok will try this, thanks...
[10:06] <gmosx> hannesw: one thing about ringo-admin
[10:07] <gmosx> lets say I install a package
[10:07] <gmosx> ringo-admin install gmosx/nitro
[10:07] <gmosx> if I run the command again I get an error (package installed)
[10:07] <hannesw> yes
[10:07] <gmosx> I would like to update the package (ie fetch the latest version)
[10:07] <hannesw> i think there's a -f/--force switch for that
[10:07] <gmosx> ah
[10:13] <ringostarr> c6a4687 Hannes Walln?fer: Remove implicit manipulation on path and url patterns in request dispatching.
[10:14] <gmosx> hannesw: another great improvement would be if 'ringo-admin install' automatically installed package dependencies (from the original package's package.json)
[10:14] <hannesw> yes, that's an important one
[10:14] <hannesw> problem is we need some kind of catalog for that
[10:14] <gmosx> will lower the barrier of entry...
[10:15] <gmosx> we can use the catalog from narhwal...
[10:15] <gmosx> a simple json file
[10:15] <gmosx> and perhaps publish the catalog to
[10:15] <hannesw> that's possible
[10:15] <gmosx> www.ringojs.org/catalog.json
[10:15] <gmosx> or something...
[10:16] <hannesw> maybe look what the recent packages discussion brought
[10:17] <hannesw> didn't follow it, but i think it provides some dependency resolution
[10:17] <robi42> on commonjs ml, that is?
[10:17] <hannesw> note: just pushed a change that may break url mappings in web apps:
[10:18] <hannesw> http://github.com/ringo/ringojs/commit/c6a4687c3424952efaddea1ccdde2b20c2fa157e
[10:18] <hannesw> now path patterns and request path are taken as they are
[10:18] <hannesw> should make it simpler to use
[10:18] <hannesw> robi42 yes
[10:19] <hannesw> there's also a new proposal by krisk
[10:23] <gmosx> hannesw: the webapp Request object lacks a referrer filed
[10:23] <gmosx> field
[10:23] <gmosx> but I guess it is not needed with jsgi 0.3
[10:24] <gmosx> request.headers.referer is og
[10:24] <gmosx> ok
[10:28] <gmosx> hannesw: should I do something special to enable sessions?
[10:28] <gmosx> when running from the command line?
[11:42] <rist> hi - just to be sure - mongo-db package mentioned at http://ringojs.org/wiki/packages/ is just a mongodb-driver wrapper and not an implementation of a ringojs store?
[11:42] <hannesw> rist: no, not a ringojs store
[11:42] <hannesw> neither is cassandra
[11:42] <hannesw> but berkeley is
[11:42] <hannesw> afk
[11:43] <rist> ok
[12:30] <guest> hello.
[12:31] <guest> Can ringo load packages from app directory?
[12:32] <oberhamsi> hi guest currently not
[12:33] <guest> whould you please add this feature?
[12:34] <robi42> guest: atm you can simply symlink app-specific packages into ringo home packages dir (as a workaround)
[12:36] <robi42> and we're considering adding that feature, yes
[12:36] <guest> yes, i see.
[12:38] <guest> another problem, some app needs only some packages but all packages in ringo home packages dir.
[12:39] <oberhamsi> guest, that is not ideal but does it break for you? package conflicts?
[12:39] <robi42> guest: btw, there's also been some connected talk on ringojs' ml recently, see: http://groups.google.com/group/ringojs/browse_thread/thread/fc9d3a38207c4b7
[12:42] <guest> no yet. but i want to deploy my app on a VPS.
[12:42] <guest> robi42, the thread in not exist.
[12:43] <robi42> oops: http://groups.google.com/group/ringojs/browse_thread/thread/fc9d3a38207c4b7f
[12:44] <guest> yes, i got it. thank you.
[12:46] <robi42> you're welcome
[12:48] <guest> another problem. when i stop the web app, deamon.stop hasn't been called.
[12:49] <oberhamsi> guest, how do you stop the web app? if you stop it with deamon.stop() it certainly gets called :)
[12:50] <guest> Perhaps we should add java.lang.Runtime.runtime.addShutdownHook into webapp.js.
[12:50] <guest> Ctrl-c or kill
[12:52] <robi42> guest, ad previous question: one can also explicitly specify module search path in `bin/ringo` as in `ringo -D ringo.modulepath=path/to/modules`
[12:53] <guest> for packages too?
[12:54] <oberhamsi> if the packages is really just a js module (no jars) then yes
[12:54] <robi42> well, at least this way one could tell ringo where to load additional modules from
[12:55] <robi42> but we certainly rather want a solution to the problem in the first place :)
[12:55] <guest> so good. robi42
[12:56] <guest> I like ringojs so much. :)
[12:56] <robi42> glad you like it
[12:57] <guest> and, how to mount static file on "/"?
[12:58] <guest> such as /robots.txt
[13:03] <robi42> guest, you could add an action which returns an according static response
[13:06] <guest> yes, I do it as your word. but a clear solution will be perfect.
[13:15] <robi42> guest, here's an example for that: http://ringojs.pastebin.com/WrbX8uED
[13:17] <guest> I got it.
[13:21] <guest> Time to leave. thank you so much.
[13:21] <guest> bye.
[13:31] <earl> hannesw: packages should be ready, yes
[13:32] <earl> i got rid of an unnecessary incompatibility with tusk i introduced earlier
[13:33] <earl> nevertheless, seems tusk doesn't work too well with current ringo
