Skip to content

Commit

Permalink
added a bunch of new stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
lancejpollard committed Nov 14, 2011
1 parent 4471d70 commit c3b94d9
Show file tree
Hide file tree
Showing 72 changed files with 209 additions and 2,298 deletions.
11 changes: 11 additions & 0 deletions .npmignore
@@ -0,0 +1,11 @@
*.coffee
*.html
.DS_Store
.git*
Cakefile
wiki/
examples/
src/
spec/
favicon.ico
Watchfile
14 changes: 11 additions & 3 deletions Cakefile
Expand Up @@ -4,8 +4,9 @@ async = require './node_modules/async'
Shift = require './node_modules/shift'
engine = new Shift.CoffeeScript
{exec, spawn} = require 'child_process'
sys = require 'util'

Metro = require './lib/metro'
#Metro = require './lib/metro'
compressor = new Shift.UglifyJS

compileDirectory = (root, check, callback) ->
Expand Down Expand Up @@ -90,8 +91,15 @@ task 'clean', 'Remove built files in ./dist', ->

task 'spec', 'Run jasmine specs', ->
spec = spawn './node_modules/jasmine-node/bin/jasmine-node', ['--coffee', './spec']
spec.stdout.on 'data', (data) -> console.log data.toString().trim()

spec.stdout.on 'data', (data) ->
data = data.toString().replace(/^\s*|\s*$/g, '')
if data.match(/\u001b\[3\dm[\.F]\u001b\[0m/)
sys.print data
else
data = "\n#{data}" if data.match(/Finished/)
console.log data
spec.stderr.on 'data', (data) -> console.log data.toString().trim()

task 'coffee', 'Auto compile src/**/*.coffee files into lib/**/*.js', ->
coffee = spawn './node_modules/coffee-script/bin/coffee', ['-o', 'lib', '-w', 'src']
coffee.stdout.on 'data', (data) -> console.log data.toString().trim()
Expand Down
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -36,6 +36,12 @@
npm install metro
```

To install Metro with development dependencies, use:

``` bash
npm install metro --dev
```

## Structure

``` bash
Expand Down Expand Up @@ -299,6 +305,8 @@ Metro.Asset.configure

The default interpolator is mustache. You can swap that out with any template engine you want.

Should use https://github.com/olado/doT, which seems to be the fastest: http://jsperf.com/dom-vs-innerhtml-based-templating/253.

``` coffeescript
en:
hello: "world"
Expand Down Expand Up @@ -331,3 +339,6 @@ cake coffee
cake spec
cake minify
```


https://github.com/rstacruz/js2coffee
25 changes: 0 additions & 25 deletions lib/metro.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions lib/metro/application.js
@@ -1,4 +1,6 @@
(function() {
var connect;
connect = require('connect');
Metro.Application = (function() {
function Application() {
this.server || (this.server = require('connect')());
Expand All @@ -22,9 +24,27 @@
Metro.Controller.teardown();
return delete this._instance;
};
Application.prototype.stack = function() {
this.server.use(connect.favicon(Metro.publicPath + "/favicon.ico"));
this.server.use(Metro.Middleware.Static.middleware);
this.server.use(Metro.Middleware.Query.middleware);
this.server.use(Metro.Middleware.Assets.middleware);
this.server.use(connect.bodyParser());
this.server.use(Metro.Middleware.Dependencies.middleware);
this.server.use(Metro.Middleware.Router.middleware);
return this.server;
};
Application.prototype.listen = function() {
if (Metro.env !== "test") {
this.server.listen(Metro.port);
return console.log("Metro server listening on port " + Metro.port);
}
};
Application.run = function() {
Metro.Application.instance().stack();
return Metro.Application.instance().listen();
};
return Application;
})();
require('./application/server');
Metro.Application.include(Metro.Application.Server);
module.exports = Metro.Application;
}).call(this);
12 changes: 0 additions & 12 deletions lib/metro/application/client.js

This file was deleted.

8 changes: 0 additions & 8 deletions lib/metro/application/history.js

This file was deleted.

29 changes: 0 additions & 29 deletions lib/metro/application/server.js

This file was deleted.

81 changes: 0 additions & 81 deletions lib/metro/asset.js

This file was deleted.

0 comments on commit c3b94d9

Please sign in to comment.