Permalink
Browse files

docs

  • Loading branch information...
1 parent dca8fd5 commit 1e759dfcb21fa40dc76fa91dffd60c6f5a509a8b @lancejpollard lancejpollard committed Jan 11, 2012
Showing with 1,119 additions and 400 deletions.
  1. +1 −1 MIT-LICENSE.md
  2. +2 −0 benchmarks/mongodb.js
  3. +1 −1 lib/tower/application/configuration.js
  4. +0 −54 lib/tower/controller/rendering.js
  5. +2 −0 lib/tower/controller/responder.js
  6. +0 −11 lib/tower/controller/urls.js
  7. +0 −40 lib/tower/event/callbacks.js
  8. +0 −10 lib/tower/event/state.js
  9. +0 −28 lib/tower/event/stateMachine.js
  10. +0 −8 lib/tower/event/transition.js
  11. +0 −2 lib/tower/generator/generators/app/templates/app/views/layouts/application.js
  12. +0 −141 lib/tower/http/param.js
  13. +0 −38 lib/tower/model/callbacks.js
  14. +2 −0 lib/tower/model/hierarchical.js
  15. +10 −0 lib/tower/view/components.js
  16. +4 −0 spec/cases/generatorSpec.coffee
  17. +24 −0 spec/cases/http/paramsSpec.coffee
  18. +169 −0 spec/cases/http/routeDSLSpec.coffee
  19. +237 −0 spec/cases/http/routeSpec.coffee
  20. 0 lib/tower/generator/configuration.js → spec/cases/http/urlSpec.coffee
  21. +9 −0 spec/cases/middlewareSpec.coffee
  22. +28 −0 spec/cases/model/associations/belongsToSpec.coffee
  23. 0 spec/cases/model/associations/hasManySpec.coffee
  24. +23 −0 spec/cases/model/associations/hasManyThroughSpec.coffee
  25. +62 −0 spec/cases/model/associationsSpec.coffee
  26. +6 −0 spec/cases/model/criteriaSpec.coffee
  27. +23 −0 spec/cases/model/fieldsSpec.coffee
  28. +23 −0 spec/cases/model/hierarchicalSpec.coffee
  29. +18 −0 spec/cases/model/inheritanceSpec.coffee
  30. +17 −0 spec/cases/model/persistenceSpec.coffee
  31. +38 −0 spec/cases/model/scopesSpec.coffee
  32. +18 −0 spec/cases/model/serializationSpec.coffee
  33. +33 −0 spec/cases/model/validationsSpec.coffee
  34. +6 −0 spec/cases/modelSpec.coffee
  35. +74 −0 spec/cases/mongoDBSpec.coffee
  36. +103 −0 spec/cases/relationScopeSpec.coffee
  37. +4 −0 spec/cases/store/memorySpec.coffee
  38. +150 −0 spec/cases/store/mongodbSpec.coffee
  39. +11 −0 spec/cases/store/neo4jSpec.coffee
  40. +4 −0 spec/cases/store/redisSpec.coffee
  41. +5 −0 spec/cases/storeSpec.coffee
  42. +1 −1 src/tower/application/configuration.coffee
  43. +2 −1 src/tower/controller/responder.coffee
  44. +0 −31 src/tower/event/callbacks.coffee
  45. +0 −3 src/tower/event/state.coffee
  46. +0 −27 src/tower/event/stateMachine.coffee
  47. +0 −2 src/tower/event/transition.coffee
  48. +9 −1 src/tower/view/components.coffee
View
@@ -1,4 +1,4 @@
-Copyright &copy; 2012 [Lance Pollard](http://lancepollard.com) <lancejpollard@gmail.com>
+Copyright &copy; 2011 - 2012 [Lance Pollard](http://lancepollard.com) <lancejpollard@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -0,0 +1,2 @@
+
+
@@ -2,7 +2,7 @@
Tower.Support.Object.extend(Tower, {
env: "development",
port: 1597,
- version: "0.3.6",
+ version: "0.3.0",
client: typeof window !== "undefined",
root: "/",
publicPath: "/",
@@ -1,54 +0,0 @@
-
-Tower.Controller.Rendering = {
- render: function() {
- var args, callback, options, self, view, _base;
- args = Tower.Support.Array.args(arguments);
- if (args.length >= 2 && typeof args[args.length - 1] === "function") {
- callback = args.pop();
- } else {
- callback = null;
- }
- if (args.length > 1 && typeof args[args.length - 1] === "object") {
- options = args.pop();
- }
- if (typeof args[0] === "object") {
- options = args[0];
- } else {
- options || (options = {});
- options.template = args[0];
- }
- if (options.template) {
- if (typeof options.template === "string" && !!!options.template.match(/\//)) {
- options.template = "" + this.collectionName + "/" + options.template;
- }
- } else if (options.action) {
- options.template = "" + this.collectionName + "/" + options.action;
- }
- view = new Tower.View(this);
- (_base = this.headers)["Content-Type"] || (_base["Content-Type"] = this.contentType);
- self = this;
- return view.render.call(view, options, function(error, body) {
- if (error) {
- self.body = error.stack;
- } else {
- self.body = body;
- }
- if (callback) callback(error, body);
- if (self.callback) return self.callback();
- });
- },
- renderToBody: function(options) {
- this._processOptions(options);
- return this._renderTemplate(options);
- },
- renderToString: function() {
- var options;
- options = this._normalizeRender.apply(this, arguments);
- return this.renderToBody(options);
- },
- _renderTemplate: function(options) {
- return this.template.render(viewContext, options);
- }
-};
-
-module.exports = Tower.Controller.Rendering;
@@ -6,3 +6,5 @@ Tower.Controller.Responder = (function() {
return Responder;
})();
+
+module.exports = Tower.Controller.Responder;
@@ -1,11 +0,0 @@
-
-Tower.Controller.Urls = {
- ClassMethods: {
- helper: function(object) {
- this._helpers || (this._helpers = []);
- return this._helpers.push(object);
- }
- }
-};
-
-module.exports = Tower.Controller.Urls;
@@ -1,40 +0,0 @@
-
-Tower.Event.Callbacks = {
- extended: function() {
- return this.callbacks = {};
- },
- ClassMethods: {
- before: function(name, callback) {
- return this.defineCallback("before", name, callback);
- },
- after: function(name, callback) {},
- defineCallback: function(phase, name, callback) {
- var callbacks, _base;
- callbacks = (_base = this.callbacks)[phase] || (_base[phase] = []);
- callbacks.push(callback);
- return this;
- }
- },
- InstanceMethods: {
- runCallbacks: function(name) {
- var callback, callbacks, _i, _len;
- callbacks = this.constructor.callbacks[name];
- for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
- callback = callbacks[_i];
- if (typeof callback === "string") callback = this[callback];
- if (!callback.call(this)) return false;
- }
- return true;
- },
- withCallbacks: function(block) {
- var self, success;
- self = this;
- success = self.runCallbacks("before");
- success = block.call(self);
- success = self.runCallbacks("after");
- return success;
- }
- }
-};
-
-module.exports = Tower.Event.Callbacks;
View
@@ -1,10 +0,0 @@
-
-Tower.State = (function() {
-
- function State() {}
-
- return State;
-
-})();
-
-module.exports = Tower.State;
@@ -1,28 +0,0 @@
-
-Tower.Event.StateMachine = (function() {
-
- function StateMachine(name, options, block) {
- if (typeof options === "function") {
- block = options;
- options = {};
- }
- block.call(this);
- this.events = [];
- this.states = [];
- }
-
- StateMachine.prototype.transition = function(from, to) {};
-
- StateMachine.prototype.state = function(name) {
- return this.states.push(name);
- };
-
- StateMachine.prototype.event = function(name, block) {
- return this.events.push(name);
- };
-
- return StateMachine;
-
-})();
-
-module.exports = Tower.Event.StateMachine;
@@ -1,8 +0,0 @@
-
-Tower.State.Transition = (function() {
-
- function Transition() {}
-
- return Transition;
-
-})();
View
@@ -1,141 +0,0 @@
-var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
-
-Tower.HTTP.Param = (function() {
-
- Param.perPage = 20;
-
- Param.sortDirection = "ASC";
-
- Param.sortKey = "sort";
-
- Param.limitKey = "limit";
-
- Param.pageKey = "page";
-
- Param.separator = "_";
-
- Param.operators = {
- gte: ":value..t",
- gt: ":value...t",
- lte: "t..:value",
- lte: "t...:value",
- rangeInclusive: ":i..:f",
- rangeExclusive: ":i...:f",
- "in": [",", "+OR+"],
- nin: "-",
- all: "[:value]",
- nil: "[-]",
- notNil: "[+]",
- asc: ["+", ""],
- desc: "-",
- geo: ":lat,:lng,:radius"
- };
-
- Param.create = function(key, options) {
- options.type || (options.type = "String");
- return new Tower.HTTP.Param[options.type](key, options);
- };
-
- function Param(key, options) {
- if (options == null) options = {};
- this.controller = options.controller;
- this.key = key;
- this.attribute = options.as || this.key;
- this.modelName = options.modelName;
- if (typeof modelName !== "undefined" && modelName !== null) {
- this.namespace = Tower.Support.String.pluralize(this.modelName);
- }
- this.exact = options.exact || false;
- this["default"] = options["default"];
- }
-
- Param.prototype.parse = function(value) {
- return value;
- };
-
- Param.prototype.render = function(value) {
- return value;
- };
-
- Param.prototype.toCriteria = function(value) {
- var result;
- return result = this.parse(value);
- };
-
- Param.prototype.parseValue = function(value, operators) {
- return {
- namespace: this.namespace,
- key: this.key,
- operators: operators,
- value: value,
- attribute: this.attribute
- };
- };
-
- Param.prototype._clean = function(string) {
- return string.replace(/^-/, "").replace(/^\+-/, "").replace(/^'|'$/, "").replace("+", " ").replace(/^\^/, "").replace(/\$$/, "").replace(/^\s+|\s+$/, "");
- };
-
- return Param;
-
-})();
-
-Tower.HTTP.Param.String = (function() {
-
- __extends(String, Tower.HTTP.Param);
-
- function String() {
- String.__super__.constructor.apply(this, arguments);
- }
-
- String.prototype.parse = function(value) {
- var arrays, i, node, values, _len;
- var _this = this;
- arrays = value.split(/(?:[\s|\+]OR[\s|\+]|\||,)/);
- for (i = 0, _len = arrays.length; i < _len; i++) {
- node = arrays[i];
- values = [];
- node.replace(/([\+\-\^]?[\w@_\s\d\.\$]+|-?\'[\w@-_\s\d\+\.\$]+\')/g, function(_, token) {
- var exact, negation, operators;
- negation = false;
- exact = false;
- token = token.replace(/^(\+?-+)/, function(_, $1) {
- negation = $1 && $1.length > 0;
- return "";
- });
- token = token.replace(/^\'(.+)\'$/, function(_, $1) {
- exact = $1 && $1.length > 0;
- return $1;
- });
- if (negation) {
- operators = [exact ? "!=" : "!~"];
- } else {
- operators = [exact ? "=" : "=~"];
- }
- if (!!token.match(/^\+?\-?\^/)) operators.push("^");
- if (!!token.match(/\$$/)) operators.push("$");
- values.push(_this.parseValue(_this._clean(token), operators));
- return _;
- });
- arrays[i] = values;
- }
- return arrays;
- };
-
- String.prototype.toCriteria = function(value) {
- var node, nodes, result, _i, _len, _name;
- nodes = String.__super__.toCriteria.call(this, value)[0];
- result = {};
- for (_i = 0, _len = nodes.length; _i < _len; _i++) {
- node = nodes[_i];
- result[_name = node.attribute] || (result[_name] = {});
- result[node.attribute][node.operators[0]] = node.value;
- }
- return result;
- };
-
- return String;
-
-})();
-
-module.exports = Tower.HTTP.Param;
@@ -1,38 +0,0 @@
-
-Tower.Model.Callbacks = {
- ClassMethods: {
- before: function(action, run, options) {
- return this.appendCallback(action, "before", run, options);
- },
- after: function() {},
- callback: function() {
- return this.appendCallback.apply(this, arguments);
- },
- removeCallback: function(action, phase, run) {
- return this;
- },
- appendCallback: function(action, phase, run, options) {
- var callbacks, _base;
- if (options == null) options = {};
- callbacks = this.callbacks();
- callbacks[action] || (callbacks[action] = {});
- (_base = callbacks[action])[phase] || (_base[phase] = []);
- callbacks[action][phase].push([run, options]);
- return this;
- },
- prependCallback: function(action, phase, run, options) {
- var callbacks, _base;
- if (options == null) options = {};
- callbacks = this.callbacks();
- callbacks[action] || (callbacks[action] = {});
- (_base = callbacks[action])[phase] || (_base[phase] = []);
- callbacks[action][phase].push([run, options]);
- return this;
- },
- callbacks: function() {
- return this._callbacks || (this._callbacks = {});
- }
- }
-};
-
-module.exports = Tower.Model.Callbacks;
@@ -0,0 +1,2 @@
+
+
@@ -1,4 +1,14 @@
+render(function() {
+ global.h1 = function() {};
+ global.tag = function() {};
+ global.form = function() {};
+ return formFor(function() {
+ var _ref;
+ return (_ref = Tower.View.Components.Form).render.apply(_ref, arguments);
+ });
+});
+
Tower.View.Components = {
formFor: function() {
var _ref;
@@ -0,0 +1,4 @@
+require '../config'
+
+describe 'Tower.Generator', ->
+
Oops, something went wrong.

0 comments on commit 1e759df

Please sign in to comment.