Giter Site home page Giter Site logo

derbyjs / derby Goto Github PK

View Code? Open in Web Editor NEW
4.7K 4.7K 261.0 2.46 MB

MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers

Home Page: http://derbyjs.com

JavaScript 52.31% HTML 0.06% TypeScript 47.63%

derby's People

Contributors

0chroma avatar bnoguchi avatar craigbeck avatar cray0000 avatar distracteddev avatar enjalot avatar ericyhwang avatar ericz avatar heapwolf avatar iakumai avatar icaliman avatar ishbu avatar jonsadka avatar josephg avatar kolegm avatar lackac avatar lefnire avatar michael-brade avatar mrthomasteller avatar nateps avatar ofridagansamanage avatar ovvn avatar patrickjs avatar pypmannetjies avatar re1ro avatar rkstedman avatar slaks avatar xcoderzach avatar zag2art avatar zmillman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

derby's Issues

Unable to detach racer-db-mongodb

After I integrated mongodb in example app with following code, I am unable to detach mongo.

derby.use(require('racer-db-mongo'));
store = app.createStore({
  listen: server
, db: {
      type: "Mongo"
    , uri: 'mongodb://localhost/database'
  }
})

When I comment out this code I get following errors in console after I hit any url. Note that the info - socket.io started has disappeared from console.

$ node server.js
Starting cluster with 1 workers in undefined mode
`kill -s SIGUSR2 8092` to force cluster reload
Go to: http://localhost:3000/
TypeError: Cannot call method 'createModel' of null
    at d:\nodeyness\derby-app\node_modules\derby\lib\derby.js:77:20
    at Object.handle (d:\nodeyness\derby-app\node_modules\derby\lib\router.server.js:41:21)
    at next (d:\nodeyness\derby-app\node_modules\express\node_modules\connect\lib\proto.js:190:15)
    at Object.handle (d:\nodeyness\derby-app\node_modules\express\node_modules\connect\lib\middleware\compress.js:143:5)
    at next (d:\nodeyness\derby-app\node_modules\express\node_modules\connect\lib\proto.js:190:15)
    at Object.favicon [as handle] (d:\nodeyness\derby-app\node_modules\express\node_modules\connect\lib\middleware\favicon.js:83:7)
    at next (d:\nodeyness\derby-app\node_modules\express\node_modules\connect\lib\proto.js:190:15)
    at Object.expressInit [as handle] (d:\nodeyness\derby-app\node_modules\express\lib\middleware.js:34:5)
    at next (d:\nodeyness\derby-app\node_modules\express\node_modules\connect\lib\proto.js:190:15)
    at Object.query [as handle] (d:\nodeyness\derby-app\node_modules\express\node_modules\connect\lib\middleware\query.js:44:5)

Deleting an item doesn't update an associated refList

I have a refList set up like this:

model.refList '_groupList', 'groups', '_groupIds'

Deleting an item from groups with

model.del("groups.#{group._id}")

doesn't set the item in _groupList to undefined, and doesn't update the client; it has to be removed manually with

model.at('_refList.[index]').remove

Nested live bindings don't work

((#_room.people :person))
  <tr class=person>
       <th ><input type='text' value='((.name))'></input></th>
    ((#.answers :answer))
        <td><input type='radio' name="((:person.name))" checked="((.value))"></td>
    ((/))
    <td><button x-bind=click:deletePerson>Delete</button></td>
  </tr>
((/))

When a new answer is added to the array, I get the following error:

 Uncaught Error: Can't find alias for person

It seems like the live events don't capture the outer scope (ie. :person) at the time of their creation.

use jade?

can i use jade templates with this framework?

Derby won't run on Windows?

I'm not sure what's going on, I'm able to install it, run it and listen to the server, and then once I open http://localhost:3000/ on a web browser, I get a white blank screen, with no HTML on the source code.

I tried running several console.log() around the server and app scripts, and noticed that model.subscribe "rooms.#{roomName}, (err, room) ->" won't trigger the callback.

This does work on Linux though.

{{{unescape}}} Inside <Title:>

HTML entity unescaping with {{{Cr&egrave;me Br&ucirc;l&eacute;e}}} worked as advertised for me in the <Body:>, though seems to be ignored in the <Title:>.

Error: ERR unknown command 'eval' in chat example

Howdy!

I've been following derby for a little bit, and saw your presentation at KRTconf. (Great presentation!) I really like the direction you're going.

I'm pretty fresh to node (been doing Ruby and Rails the past few years, and Backbone the past ~6 months) and am trying to run through the derby examples.

When I run the chat example, and type into the username box in the browser, I get the following:

[master][~/dev/derby/examples/chat] node server.js 
   info  - socket.io started
Express server started in development mode
Go to: http://localhost:3002/
   debug - client authorized
   info  - handshake authorized 2025404070337778023
   debug - setting request GET /socket.io/1/websocket/2025404070337778023
   debug - set heartbeat interval for client 2025404070337778023
   debug - client authorized for 
   debug - websocket writing 1::
   debug - websocket writing 5:::{"name":"txnNum","args":[0]}
   debug - websocket writing 5:::{"name":"txnErr","args":[{"stack":"Error: ERR unknown command 'eval'\n    at RedisReplyParser.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:78:27)\n    at RedisReplyParser.emit (events.js:64:17)\n    at RedisReplyParser.send_error (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:265:14)\n    at RedisReplyParser.execute (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:124:22)\n    at RedisClient.on_data (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:358:27)\n    at Socket.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:93:14)\n    at Socket.emit (events.js:64:17)\n    at Socket._onReadable (net.js:672:14)\n    at IOWatcher.onReadable [as callback] (net.js:177:10)","message":"ERR unknown command 'eval'"},"3.29"]}
   debug - websocket writing 5:::{"name":"txnErr","args":[{"stack":"Error: ERR unknown command 'eval'\n    at RedisReplyParser.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:78:27)\n    at RedisReplyParser.emit (events.js:64:17)\n    at RedisReplyParser.send_error (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:265:14)\n    at RedisReplyParser.execute (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:124:22)\n    at RedisClient.on_data (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:358:27)\n    at Socket.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:93:14)\n    at Socket.emit (events.js:64:17)\n    at Socket._onReadable (net.js:672:14)\n    at IOWatcher.onReadable [as callback] (net.js:177:10)","message":"ERR unknown command 'eval'"},"3.30"]}
   debug - websocket writing 5:::{"name":"txnErr","args":[{"stack":"Error: ERR unknown command 'eval'\n    at RedisReplyParser.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:78:27)\n    at RedisReplyParser.emit (events.js:64:17)\n    at RedisReplyParser.send_error (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:265:14)\n    at RedisReplyParser.execute (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:124:22)\n    at RedisClient.on_data (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:358:27)\n    at Socket.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:93:14)\n    at Socket.emit (events.js:64:17)\n    at Socket._onReadable (net.js:672:14)\n    at IOWatcher.onReadable [as callback] (net.js:177:10)","message":"ERR unknown command 'eval'"},"3.31"]}
   debug - websocket writing 5:::{"name":"txnErr","args":[{"stack":"Error: ERR unknown command 'eval'\n    at RedisReplyParser.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:78:27)\n    at RedisReplyParser.emit (events.js:64:17)\n    at RedisReplyParser.send_error (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:265:14)\n    at RedisReplyParser.execute (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:124:22)\n    at RedisClient.on_data (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:358:27)\n    at Socket.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:93:14)\n    at Socket.emit (events.js:64:17)\n    at Socket._onReadable (net.js:672:14)\n    at IOWatcher.onReadable [as callback] (net.js:177:10)","message":"ERR unknown command 'eval'"},"3.32"]}
   debug - websocket writing 5:::{"name":"txnErr","args":[{"stack":"Error: ERR unknown command 'eval'\n    at RedisReplyParser.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:78:27)\n    at RedisReplyParser.emit (events.js:64:17)\n    at RedisReplyParser.send_error (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:265:14)\n    at RedisReplyParser.execute (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/lib/parser/javascript.js:124:22)\n    at RedisClient.on_data (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:358:27)\n    at Socket.<anonymous> (/Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/redis/index.js:93:14)\n    at Socket.emit (events.js:64:17)\n    at Socket._onReadable (net.js:672:14)\n    at IOWatcher.onReadable [as callback] (net.js:177:10)","message":"ERR unknown command 'eval'"},"3.33"]}

My node and npm information:

[master][~/dev/derby/examples/chat] npm --version
1.0.105
[master][~/dev/derby/examples/chat] node --version
v0.4.12
[master][~/dev/derby/examples/chat] npm ls
npm WARN [email protected] package.json: bugs['web'] should probably be bugs['url']
npm WARN seq >=0.1.7 Unmet dependency in /Users/jasonmorrison/dev/derby/examples/chat/node_modules/derby/node_modules/racer/node_modules/browserify/node_modules/detective/node_modules/findit
[email protected] /Users/jasonmorrison/dev/derby/examples/chat
├── [email protected] 
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ └── [email protected] 
├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├─┬ [email protected] 
│ │ │ ├── [email protected] 
│ │ │ ├─┬ [email protected] 
│ │ │ │ ├─┬ [email protected] 
│ │ │ │ │ ├── [email protected] 
│ │ │ │ │ └── [email protected] 
│ │ │ │ └─┬ [email protected]  extraneous
│ │ │ │   └── UNMET DEPENDENCY seq >=0.1.7
│ │ │ ├── [email protected] 
│ │ │ ├─┬ [email protected] 
│ │ │ │ └── [email protected] 
│ │ │ └── [email protected] 
│ │ ├── [email protected] 
│ │ ├── [email protected] 
│ │ ├─┬ [email protected] 
│ │ │ ├─┬ [email protected] 
│ │ │ │ └── [email protected] 
│ │ │ ├── [email protected] 
│ │ │ ├── [email protected]  extraneous
│ │ │ ├─┬ [email protected] 
│ │ │ │ └── [email protected] 
│ │ │ └── [email protected]  extraneous
│ │ ├─┬ [email protected] 
│ │ │ └── [email protected] 
│ │ └─┬ [email protected] 
│ │   ├── [email protected] 
│ │   ├── [email protected] 
│ │   └── [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ └── [email protected] 
└─┬ [email protected] 
  ├── [email protected] 
  ├── [email protected] 
  ├── [email protected] 
  └── [email protected] 

In the browser, I get an exception:


ready(function(model) {
    var displayTime, i, message, messagePath, months, time, _len, _ref2;
    months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
    displayTime = function(time) {
      var hours, minutes, period;
      time = new Date(time);
      hours = time.getHours();
      period = hours < 12 ? ' am, ' : ' pm, ';
      hours = (hours % 12) || 12;
      minutes = time.getMinutes();
      if (minutes < 10) minutes = '0' + minutes;
      return hours + ':' + minutes + period + months[time.getMonth()] + ' ' + time.getDate() + ', ' + time.getFullYear();
    };
    _ref2 = model.get('_room.messages');
    for (i = 0, _len = _ref2.length; i < _len; i++) {
      //
      // On the line above: gen/L99FClvcujfbSS1m7aECAQ.js:3156 Uncaught TypeError: Cannot read property 'length' of undefined
      //
      message = _ref2[i];
      messagePath = "_room.messages." + i;
      if (time = model.get(messagePath + '.time')) {
        model.set(messagePath + '._displayTime', displayTime(time));
      }
    }

npm install is broken due to stylus update

Steps to Reproduce

npm install -g derby

node version v0.6.15

error output

air-3:derby twilson63$ npm install
npm http GET https://registry.npmjs.org/stylus
npm http 304 https://registry.npmjs.org/stylus
npm ERR! cb() never called!
npm ERR!  
npm not ok

observation

Appears to be related to SemVer package.json config and recent update to stylus to version 0.25.0

what I did to fix in my fork in package.json

  "dependencies": {
    "racer": "0.3.0",
    "express": "~2.x.x",
    "qs": "~0.4.x",
    "stylus": "~0.15.x",
    "nib": "~0.3.x",
    "commander": "~0.4.x",
    "mkdirp": "~0.0.x",
    "up": "~0.1.x"
  },
  "engines": {
    "node": "0.6 || 0.7"
  },

If you would like a pull request, I will be happy to submit.

Looking forward to getting started with derbyjs

Example Live Updates in iOS

The timer in the default generated example app stays at 0.0 seconds and never advances. The page increment only updates after a manual refresh of the page. The <h1> changes live, but the input box does not. The page increment in the browser title does advance live.

There are no errors in the debug console.

examples fail to compile

I cloned the repo and ran npm install in all the right places, but when I run make compile-examples I get the following errors:

./node_modules/coffee-script/bin/coffee -bcw ./examples//.coffee

/Users/bknorr/Dev/derby/node_modules/coffee-script/lib/coffee-script/command.js:201
return fs.watch(source, function(event) {
^
TypeError: Object # has no method 'watch'
at /Users/bknorr/Dev/derby/node_modules/coffee-script/lib/coffee-script/command.js:201:17
make: *** [compile-examples] Error 1

Sink Example on Windows

I 'm trying to run sink example, but I get the following error:

TEMPLATE ERROR
Error: Can't find file D:\nodejs\node_modules\derby-examples\sink\views\app\shared
    at D:\nodejs\node_modules\derby\lib\files.js:245:29
    at D:\nodejs\node_modules\derby\lib\files.js:229:7
    at Object.oncomplete (path.js:412:19)

I'm using derby v3.0.5, NodeJS 6.0.17 (32 bit).

thanks...

Not Reconnecting

Derby promises to be great, but....

A real life issue is that the server might restart (because of bugs ?), and than that all clients connected are left in the dark...
I know that socket.io has some reconnecting capabilities (I used it in the past).

It would be wonderful if a server could be stopped, en than started again, and that all connected clients would reconnect. Don't you agree?

Regards...

WebSocket Error

After the initial rendering of a page, eventually this error pops up in my Chrome console:

Error during WebSocket handshake: 'Connection' header value is not 'Upgrade'

Rendering tables with live bindings strips the tags

<Body:>
  <table>
    <thead>
      <tr>
        <th>Name</th>
      </tr>
    </thead>
    <tbody>
      ((users > user))
    </tbody>
  </table>

<user:>
  <tr><td>((.name))</td></tr>
page.render({
  users: [ { name: 'foo' }, {name: 'bar' }]
});

Will output something like:

<table>
  <thead>
    <tr>
      <th>Name</th>
    </tr>
  </thead>
  <tbody id="$1">
    foobar
  </tbody>
</table>

Running derby fails

Installation of Derby and Redis was fine. However on running it gives the following error:

anand@anand-laptop:/node$ cd ~
anand@anand-laptop:
$ derby new first-project

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '../lib/bin/derby'
at Function._resolveFilename (module.js:317:11)
at Function._load (module.js:262:25)
at require (module.js:346:19)
at Object. (/usr/local/lib/node_modules/derby/bin/derby:3:1)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at Array. (module.js:421:10)
at EventEmitter._tickCallback (node.js:126:26)

Kindly advise.

JSON API Example

I'm having a difficult time figuring out how to leverage the shared server/client model for using a JSON object returned by a third party API. Could this be a use case for the next example?

Security issue. Exposing all model to client

Problem

1

Let's look at chat example

2

If I set breakpoint on line 45 in browser (I mean equal line in compiled js)

42        ## CONTROLLER FUNCTIONS ##
43
44        ready (model) ->
45          months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
46          displayTime = (time) ->

3

I can do window.model = model in console

And continue script execution

4

In console

for (i in model.get('users'))
  model.set('users.'+i+'.name', 'lolz')

5

Name of every user is lolz

P.S.

Even in production environment, when js is uglified. I can do code reformat in chrome and put a breakpoint on function that has closure for model variable. And make that function happen. Like

c.postMessage = function() {
  return a.push("_room.messages", {userId: a.get("_session.userId"),comment: a.get("_newComment"),time: +(new Date)}), a.set("_newComment", "")
}

Where a is the model

I catch that breakpoint when I post a new message

Expose hooks in src/files.coffee

It would be great if there were callback hooks available to allow the additional of filters into the rendering pipeline - for example I'm thinking of bootstrap-stylus which requires me to hook into the stylus() pipeline and add .use(bootstrap()).

Random error at startup (Max call stack size)

Sometimes, on the first connection the server throws this when the first client connects. If I restart it it works fine.

RangeError: Maximum call stack size exceeded

I'm using the default app modified for persistence by following the method described in the v0.3 announcement, with node 0.6.15 under Ubuntu 11.04 on x86.

Edit: Node n00b here. I'll reopen the issue with a proper stack trace if it occurs again. Sorry for the noise.

Coffee Make Task Failure

On initial creation of project, following the default instructions for a CoffeeScript project

$ cd ~
$ derby new --coffee first-project
$ cd first-project
$ make

The make command causes an error related to the CoffeeScript watcher:

{PATH}/first-project/node_modules/coffee-script/lib/coffee-script/command.js:201
      return fs.watch(source, function(event) {
                ^
TypeError: Object #<Object> has no method 'watch'
    at {PATH}/first-project/node_modules/coffee-script/lib/coffee-script/command.js:201:17
make: *** [compile] Error 1

On Platform: OSX Lion
Node: 0.4.7

Is this something changed in the CoffeeScript module perhaps, or in the guts of derby.


Thanks guys - this looks like bloody exciting stuff. I really want to get into this approach you've been designing here.

Hello World example responds 404 on socket.io

A request for http://localhost:3000/socket.io/1/?clientId=040b397f-5462-468a-987b-da0ba4dd13c0&t=1335403163810 is 404-ing.
I setup a basic derbyjs Hello World with a file lib/server/index.js containing:

var app = require('../app');
//some other requires...
var expressApp = express()
    .use(express.static(__dirname + '/../../public'))
    .use(app.router());

var server = http.createServer(expressApp).listen(process.env.PORT || 3000);

app.createStore({ listen: expressApp });

and a lib/app/index.js containing:

var app = require('derby').createApp(module);
app.get('/', function(page, model, params) {
    page.render();
});

These are basically copied from the Hello World example on derbyjs.com at this moment. I also tried to start a clean project with just ./hello.js, ./server.js, derby and [email protected], and I get the same 404 errors on socket.io requests.

In this second attempt, however, multiple socket.io requests are made and all 404, after which the app crashes with:

fs.js:422
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT, no such file or directory '/tmp/.com.google.Chrome.cxnuBW/SingletonCookie'
at Object.statSync (fs.js:422:18)
at /tmp/node_modules/derby/lib/files.js:394:12
at Array.forEach (native)
at /tmp/node_modules/derby/lib/files.js:392:39
at /tmp/node_modules/derby/lib/files.js:395:14
at Array.forEach (native)
at /tmp/node_modules/derby/lib/files.js:392:39
at Object.watch (/tmp/node_modules/derby/lib/files.js:213:12)
at /tmp/node_modules/derby/lib/refresh.server.js:53:9
at Socket. (/tmp/node_modules/derby/lib/refresh.server.js:45:14)

Not sure what's going on, but I'll keep looking

Nested #each not working as expected

Test code:

{expect, calls} = require 'racer/test/util'
{DetachedModel: Model, ResMock} = require 'derby/test/mocks'
View = require 'derby/src/View.server'

describe 'View', ->

  it 'supports nested #each', ->

    view = new View
    view._init new Model

    template = """
    {{#each outer as :out}}
      {{#each inner as :in}}[{{:out.name}} {{:in.name}} {{equal(:out.color, :in.color)}}] {{/}}
    {{/}}
    """

    view.make 'test', template
    compiled = view.get 'test',
      outer: [{name: 'stuff', color: 'blue'}, {name: 'more', color: 'pink'}]
      inner: [{name: '0', color: 'pink'}, {name: '1', color: 'blue'}]
    expect(compiled).to.equal '[stuff 0 false] [stuff 1 true] [more 0 true] [more 1 false] '

Fails with:

View

  1. supports nested #each

✖ 1 of 1 tests failed:

  1. View supports nested #each:
    Error: expected '[stuff 0 false] [stuff 0 false] [more 1 false] [more 1 false] ' to equal '[stuff 0 false] [stuff 1 true] [more 0 true] [more 1 false]'

It seems the inner loop's index is overwritten by the outer loop.

Live bindings don't work for non-objects

For example, I had something like this:

data: [true, false, true]

In the template...

((#data :value))
   <input type='checkbox' value='((:value))' />
 ((/))

This didnt work, the live change events wouldn't fire. However if I changed the data array to be objects with one property, I was able to get it to work.

Changes Not Updating in Development Mode

In development mode, without restarting Derby, changes made to any .js or .html file do not display in the browser. Changes to .styl files seem to work as expected.

I have in my .bash_profile: export NODE_ENV=development and Starting cluster with 1 workers in development mode in my console after starting Derby.

I am using the latest Derby: 0.1.10 on port 8080 and browsing with latest production Chrome.

Compile CoffeeScript on the fly? (no make-based watcher)

It would be nice if CoffeeScript could be loaded transparently, and mixed with JS files in the same source tree.

It would make your loader logic a bit more complex, but it would be nicer for your users.

Not that the current approach is heavy, but it would be one less thing to think about.

Hitting url from firefox breaks the app

Windows 7, FF V 12
As pointed out in #42 FF is gzip incompatible. Hitting url from firefox breaks the app such that it doesn't respond to requests anymore, from any browser. How to prevent gzipped content. Simply commenting out this line .use(gzippo.staticGzip(publicPath, {maxAge: ONE_YEAR})) breaks the app again. It stops serving /gen/javscript file.

initial example doesnt run on Windows 7 x64 chrome

with these dependencies:

[email protected]

i ran these commands

derby new blah
cd blah
node server.js

browsed to http://localhost:3000 and noticed this error in chrome js console twice:

Cannot find module './index.js'

i can only imagine its related to this line 3294

require('./index.js').view._makeAll( //...

because all my definitions have full windows escaped paths:

require.define("c:\\blah\\lib\\app\\index.js", Function( //...

so with a suggestion from @nateps i used a updated a browserify file:

curl https://raw.github.com/cjblomqvist/node-browserify/4b75a099ce9c8703323693095b3d073610cdd1e7/lib/wrap.js > node_modules/derby/node_modules/racer/node_modules/browserify/lib/wrap.js

then ran the app

node server.js

and browsed to http://localhost:3000

i now get this error:

Error: Cannot find module 'express/lib/router/route'

i observe that all my require.define() calls are pretty little relative paths like so:

require.define("/index.js", Function( //...

except for 2 of them:

require.define("c:/blah/node_modules/derby/node_modules/racer/lib/path.js", Function( //...
require.define("c:/blah/node_modules/express/lib/router/route.js", Function( //...

which maybe helps explain the error a bit ?

@bnoguchi suggested i document my problem here
ill try to track down the issue and report back if i find anything

this is all with chrome/safari/IE. things go downhill with FF (that looks like a gzip incompatibility )

Needs multi-page examples

It would be great to have an example of how to structure an app with multiple controllers, multiple views, etc... Particularly in regards to the way to structure the source files.

websocket error running derbyjs an socket.io on different ports

installed derbyjs and ran ~derby new testproject

changed these two files to listen on different ports

server.js

require('derby').run(__dirname + '/lib/server', 8127)

lib/server/index.js

// STORE SETUP //

//store = app.createStore({listen: server})
store = app.createStore({listen: 8126})

port 8127 is apache proxy redirect to derbyjs
port 8126 is opened for direct websocket connections

console output:
debug - client authorized
info - handshake authorized 14079569741541546961
debug - setting request GET /socket.io/1/websocket/14079569741541546961?clientId=392276ac-7b08-4663-a4c9-a009c00d5067
debug - set heartbeat interval for client 14079569741541546961
debug - client authorized for
debug - websocket writing 1::
debug - websocket writing 5:1+::{"name":"resyncWithStore"}
debug - sending data ack packet
debug - websocket writing 6:::1+[false]
debug - websocket writing 5:::{"name":"fatalErr","args":["clientStartId != startId (h19p3mlp != undefined)"]}
debug - websocket writing 5:::{"name":"snapshotUpdate:replace","args":[{"data":[["rooms.48epn799",null,0]]},1]}
debug - got disconnection packet
info - transport end by forced client disconnection
debug - websocket writing 0::
info - transport end (booted)

firefox reloads the page every second, even if i start it with / or with a sample room /48epn799

Default app remains subscribed to old rooms. model.unsubscribe() doesn't fix

I created the base app using "derby new first-project". Now, imagine I have two browsers:

In browser#1 I go to http://localhost:3000/ and then click the "somewhere random" link. In browser#2 I go to http://localhost:3000/

Why can I see Derby sending data about the "home" page to browser#1 when it is no longer viewing the home page? Each time I refresh browser#2, I can see long poll xhr requests being fulfilled in browser#1 through Firebug, even though they're now viewing different rooms...

If I start browser#1 in a different room, rather than going via the home page, this problem does not occur.

I guessed that by adding a model.unsubscribe() to the very beginning of the "get '/:roomName?'" router would fix the problem, but it doesn't.

Typing mistake (which causes error) in bundled example app

In the example app that comes bundled when you create a new project, in lib/server/index.js you have the following:

  // .use(express.cookieParser('secret_sauce'))
  // .use(express.session({
  //   cookie: {maxAge: ONE_YEAR}
  // })
  // .use(app.session())

It should be (there's a ending parenthesis missing on row 5 which I've added):

  // .use(express.cookieParser('secret_sauce'))
  // .use(express.session({
  //   cookie: {maxAge: ONE_YEAR}
  // }))
  // .use(app.session())

Couldn't find where this exists in the code base and I figured it's probably a lot easier for you guys to fix it.

error during 'make': TypeError: Object #<Object> has no method 'watch'

DerbyJS is a fascinating project and it may finally enable me to start using web stack.

I've been hunting forever for a web stack that's compact, expressive, efficient and complete, and Derby is the most promising effort I've seen in this area. It seems to be a very well-thought-out stack with excellent choices for each stack component, and lots of sensible convention over configuration.

One problem I've been hitting so far:
When I type 'make' in a new project, the feature where coffeescript watches changes to the filesystem is generating an error.

When I type 'make', it says:

TypeError: Object #<Object> has no method 'watch'
    at /home/scott/sandbox/derby/first-project/node_modules/coffee-script/lib/coffee-script/command.js:201:17
make: *** [compile] Error 1

Full transcript below (after installing derby using 'sudo npm install derby -g' and in another window installing redis-2.2.111-scripting and launching srv/redis-server on port 6379):

scott@hal:~/sandbox$ mkdir derby
scott@hal:~/sandbox$ cd derby
scott@hal:~/sandbox/derby$ derby new --coffee first-project

  Creating CoffeeScript project in first-project with the application app

  created: first-project
  created: first-project/Makefile
  created: first-project/server.js
  created: first-project/package.json
  created: first-project/.gitignore
  created: first-project/README.md
  created: first-project/public/img
  created: first-project/views/app
  created: first-project/styles/app
  created: first-project/src/app
  created: first-project/src/server
  created: first-project/views/app/index.html
  created: first-project/views/404.html
  created: first-project/styles/app/index.styl
  created: first-project/styles/404.styl
  created: first-project/styles/reset.styl
  created: first-project/styles/base.styl
  created: first-project/src/app/index.coffee
  created: first-project/src/server/index.coffee

  Installing dependencies. This may take a little while...

  [email protected] ./node_modules/coffee-script
  [email protected] ./node_modules/express
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  [email protected] ./node_modules/connect-gzip
  +-- [email protected]
  +-- [email protected]
  [email protected] ./node_modules/derby
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected] ([email protected] [email protected])
  +-- [email protected]


  Project created!

  Try it out:
    $ cd first-project
    $ make

  Then in a new terminal:
    $ cd /home/scott/sandbox/derby/first-project
    $ node server.js

  More info at: http://derbyjs.com/


~/sandbox/derby/first-project$ make
./node_modules/coffee-script/bin/coffee -bw -o ./lib -c ./src

/home/scott/sandbox/derby/first-project/node_modules/coffee-script/lib/coffee-script/command.js:201
      return fs.watch(source, function(event) {
                ^
TypeError: Object #<Object> has no method 'watch'
    at /home/scott/sandbox/derby/first-project/node_modules/coffee-script/lib/coffee-script/command.js:201:17
make: *** [compile] Error 1

If it's any help, here is the output from npm ls:

scott@hal:~/sandbox/derby/first-project$ npm ls
npm WARN [email protected] package.json: bugs['web'] should probably be bugs['url']
npm WARN seq >=0.1.7 Unmet dependency in /home/scott/sandbox/derby/first-project/node_modules/derby/node_modules/racer/node_modules/browserify/node_modules/detective/node_modules/findit
[email protected] /home/scott/sandbox/derby/first-project
+-- [email protected]
+-- [email protected]
¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ +-- [email protected]
+-- [email protected]
¦ +-- [email protected]
¦ +-- [email protected]
¦ +-- [email protected]
¦ +-- [email protected]
¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ +-- [email protected]  extraneous
¦ ¦ ¦ ¦   +-- UNMET DEPENDENCY seq >=0.1.7
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]  extraneous
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]  extraneous
¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ ¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ ¦   +-- [email protected]
¦ ¦   +-- [email protected]
¦ ¦   +-- [email protected]
¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ ¦ +-- [email protected]
¦ +-- [email protected]
+-- [email protected]
  +-- [email protected]
  ¦ +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]

DerbyJS is an exciting project and it could really take off.

Thanks for any ideas!

  • Scott

Conditional comments are removed too

All comments, leading whitespace, and new lines are removed from a template before parsing. Which is perfect, aside from one thing: conditional comments are removed too.

This behavior mangles web developers that would like to let old versions of IE support new HTML5 elements, but not newer browers — with say, the following snippet:

<!--[if lt IE 9]>
  <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.