serenade_rails 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in serenade_rails.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Serenade.js for Ruby on Rails
2
+
3
+ [Serenade.js] is a JavaScript client side MVC framework. This gem makes it
4
+ easy to use Serenade.js with the Ruby on Rails Asset Pipeline in Rails
5
+ 3.1 and later.
6
+
7
+ Add it to the assets group in your Gemfile:
8
+
9
+ ``` ruby
10
+ group :assets do
11
+ gem 'serenade_rails'
12
+ end
13
+ ```
14
+
15
+ You can now require Serenade in your `application.js` file, or wherever
16
+ you prefer:
17
+
18
+ ``` javascript
19
+ //= require serenade
20
+ ```
21
+
22
+ Serenade should now be loaded and ready. See the [Serenade README][readme] for
23
+ examples.
24
+
25
+ ## Views
26
+
27
+ You can also easily use views from the asset pipeline. Just use the extension
28
+ `.serenade` on your views, for example, place something like this in
29
+ `app/assets/javascripts/test.serenade`:
30
+
31
+ ```
32
+ h1 "Hello world"
33
+ ```
34
+
35
+ Now you can render this view:
36
+
37
+ ``` javascript
38
+ document.appendChild(Serenade.render('test'));
39
+ ```
40
+
41
+ Couldn't be simpler!
42
+
43
+ If the path to your view starts with `views`, that initial part is stripped
44
+ off, so you could have placed the above view in
45
+ `app/assets/javascripts/views/test.serenade` without changing the code.
46
+
47
+ ## License
48
+
49
+ (The MIT License)
50
+
51
+ Copyright (c) 2012 Jonas Nicklas
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining
54
+ a copy of this software and associated documentation files (the
55
+ 'Software'), to deal in the Software without restriction, including
56
+ without limitation the rights to use, copy, modify, merge, publish,
57
+ distribute, sublicense, and/or sell copies of the Software, and to
58
+ permit persons to whom the Software is furnished to do so, subject to
59
+ the following conditions:
60
+
61
+ The above copyright notice and this permission notice shall be
62
+ included in all copies or substantial portions of the Software.
63
+
64
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
65
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
66
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
67
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
68
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
69
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
70
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
71
+
72
+ [readme]: https://github.com/elabs/serenade.js/blob/master/README.md
73
+ [serenade.js]: https://github.com/elabs/serenade.js
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Serenade.js JavaScript Framework v0.1.0
3
+ * http://github.com/elabs/serenade.js
4
+ *
5
+ * Copyright 2011, Jonas Nicklas, Elabs AB
6
+ * Released under the MIT License
7
+ */
8
+ (function(a){var b=function(){function a(b){return a[b]}return a["./events"]=new function(){var a=this;((function(){var b=Array.prototype.slice;a.Events={bind:function(a,b){var c,d,e,f,g;d=a.split(" "),c=this.hasOwnProperty("_callbacks")&&this._callbacks||(this._callbacks={});for(f=0,g=d.length;f<g;f++)e=d[f],c[e]||(c[e]=[]),c[e].push(b);return this},one:function(a,b){return this.bind(a,function(){return this.unbind(a,arguments.callee),b.apply(this,arguments)})},trigger:function(){var a,c,d,e,f,g,h;a=1<=arguments.length?b.call(arguments,0):[],d=a.shift(),typeof recordEvents!="undefined"&&recordEvents!==null&&(this._triggeredEvents||(this._triggeredEvents={}),this._triggeredEvents[d]=a),e=this.hasOwnProperty("_callbacks")&&((h=this._callbacks)!=null?h[d]:void 0);if(!e)return!1;for(f=0,g=e.length;f<g;f++)c=e[f],c.apply(this,a);return!0},unbind:function(a,b){var c,d,e,f,g;if(!a)return this._callbacks={},this;e=(g=this._callbacks)!=null?g[a]:void 0;if(!e)return this;if(!b)return delete this._callbacks[a],this;for(d=0,f=e.length;d<f;d++){c=e[d];if(c!==b)continue;e=e.slice(),e.splice(d,1),this._callbacks[a]=e;break}return this}}})).call(this)},a["./helpers"]=new function(){var a=this;((function(){var b;b={extend:function(a,b){var c,d,e;e=[];for(c in b)d=b[c],Object.prototype.hasOwnProperty.call(b,c)?e.push(a[c]=d):e.push(void 0);return e},get:function(a,b,c){return c==null&&(c=!0),c&&(a!=null?a.get:void 0)?a.get(b):c?a!=null?a[b]:void 0:b},format:function(a,c,d){return d==null&&(d=!0),d&&a.format?a.format(c):b.get(a,c,d)},forEach:function(a,b){var c,d,e,f;if(typeof a.forEach=="function")return a.forEach(b);f=[];for(d=0,e=a.length;d<e;d++)c=a[d],f.push(b(c));return f},map:function(a,b){var c,d,e,f;if(typeof a.map=="function")return a.map(b);f=[];for(d=0,e=a.length;d<e;d++)c=a[d],f.push(b(c));return f},isArray:function(a){return Object.prototype.toString.call(a)==="[object Array]"},pairToObject:function(a,b){var c;return c={},c[a]=b,c},serializeObject:function(a){return a&&typeof a.serialize=="function"?a.serialize():b.isArray(a)?b.map(a,function(a){return b.serializeObject(a)}):a},indexOf:function(a,b){var c,d,e;if(a.indexOf)return a.indexOf(b);for(c=0,e=a.length;c<e;c++){d=a[c];if(d===b)return c}return-1},deleteItem:function(a,c){return a.splice(b.indexOf(c),1)},getFunctionName:function(a){var b,c,d;return b=a.modelName,b||(b=a.name),b||(b=(c=a.toString().match(/\[object (.+?)\]/))!=null?c[1]:void 0),b||(b=(d=a.toString().match(/function (.+?)\(\)/))!=null?d[1]:void 0),b},preventDefault:function(a){return a.preventDefault?a.preventDefault():a.returnValue=!1}},b.extend(a,b)})).call(this)},a["./cache"]=new function(){var b=this;((function(){var c,d,e,f;f=a("./helpers"),e=f.serializeObject,d=f.getFunctionName,c={_storage:typeof window!="undefined"&&window!==null?window.localStorage:void 0,_identityMap:{},get:function(a,b){var c,e;c=d(a);if(c&&b)return((e=this._identityMap[c])!=null?e[b]:void 0)||this.retrieve(a,b)},set:function(a,b,c){var e,f;e=d(a);if(e&&b)return(f=this._identityMap)[e]||(f[e]={}),this._identityMap[e][b]=c},store:function(a,b,c){var f;f=d(a);if(f&&b&&typeof JSON!="undefined"&&JSON!==null)return this._storage.setItem(""+f+"_"+b,JSON.stringify(e(c)))},retrieve:function(a,b){var c,e;e=d(a);if(e&&b&&a.localStorage&&typeof JSON!="undefined"&&JSON!==null){c=this._storage.getItem(""+e+"_"+b);if(c)return new a(JSON.parse(c),!0)}}},b.Cache=c})).call(this)},a["./collection"]=new function(){var b=this;((function(){var c,d,e,f,g,h,i;c=a("./events").Events,i=a("./helpers"),e=i.extend,f=i.forEach,h=i.serializeObject,d=i.deleteItem,g=i.indexOf,b.Collection=function(){function a(a){var b=this;this.list=a,this.length=this.list.length,this.bind("change",function(){return b.length=b.list.length})}return e(a.prototype,c),a.prototype.get=function(a){return this.list[a]},a.prototype.set=function(a,b){return this._notIn(this.list[a]),this.list[a]=b,this._in(b),this.trigger("change:"+a,b),this.trigger("set",a,b),this.trigger("change",this.list)},a.prototype.push=function(a){return this.list.push(a),this._in(a),this.trigger("add",a),this.trigger("change",this.list)},a.prototype.update=function(a){var b,c,d,e,f,g;g=this.list;for(c=0,e=g.length;c<e;c++)b=g[c],this._notIn(b);this.list=a;for(d=0,f=a.length;d<f;d++)b=a[d],this._in(b);return this.trigger("update",a),this.trigger("change",this.list)},a.prototype.forEach=function(a){return f(this.list,a)},a.prototype.map=function(a){var b,c,d,e,f;e=this.list,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],f.push(a(b));return f},a.prototype.indexOf=function(a){return g(this.list,a)},a.prototype.deleteAt=function(a){return this._notIn(this.list[a]),this.list.splice(a,1),this.trigger("delete",a),this.trigger("change",this.list)},a.prototype["delete"]=function(a){return this.deleteAt(this.indexOf(a))},a.prototype.serialize=function(){return h(this.list)},a.prototype.select=function(a){var b,c,d,e,f;e=this.list,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],a(b)&&f.push(b);return f},a.prototype._in=function(a){var b;if(typeof a=="object")return a._inCollections||(a._inCollections=[]),(b=a._inCollections)!=null?b.push(this):void 0},a.prototype._notIn=function(a){if(a!=null?a._inCollections:void 0)return d(a._inCollections,this)},a}()})).call(this)},a["./association_collection"]=new function(){var b=this;((function(){var c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=a("./collection").Collection,c=function(a){function b(a,c){var d;this.ctor=a,this.list=c,b.__super__.constructor.call(this,function(){var a,b,e;e=[];for(a=0,b=c.length;a<b;a++)d=c[a],e.push(this._convert(d));return e}.call(this))}return f(b,a),b.prototype.set=function(a,c){return b.__super__.set.call(this,a,this._convert(c))},b.prototype.push=function(a){return b.__super__.push.call(this,this._convert(a))},b.prototype.update=function(a){var c;return b.__super__.update.call(this,function(){var b,d,e;e=[];for(b=0,d=a.length;b<d;b++)c=a[b],e.push(this._convert(c));return e}.call(this))},b.prototype._convert=function(a){var b;return b=this.ctor(),a.constructor===b?a:new b(a)},b}(d),b.AssociationCollection=c})).call(this)},a["./associations"]=new function(){var b=this;((function(){var c,d,e,f,g,h,i;c=a("./association_collection").AssociationCollection,e=a("./collection").Collection,i=a("./helpers"),f=i.extend,h=i.map,g=i.get,d=function(){function a(){}return a.belongsTo=function(a,b){var c;return b==null&&(b={}),c=b.as||function(){return Object},f(b,{set:function(b){return this.attributes[a]=new(c())(b)}}),this.property(a,b),this.property(a+"Id",{get:function(){return g(this.get(a),"id")},set:function(b){return this.attributes[a]=c().find(b)},dependsOn:a})},a.hasMany=function(a,b){var d;return b==null&&(b={}),d=b.as||function(){return Object},f(b,{get:function(){var b=this;return this.attributes[a]||(this.attributes[a]=new c(d,[]),this.attributes[a].bind("change",function(){return b._triggerChangesTo([a])})),this.attributes[a]},set:function(b){return this.get(a).update(b)}}),this.property(a,b),this.property(a+"Ids",{get:function(){return new e(this.get(a).map(function(a){return g(a,"id")}))},set:function(b){var e;return e=h(b,function(a){return d().find(a)}),this.attributes[a]=new c(d,e)},dependsOn:a})},a}(),b.Associations=d})).call(this)},a["./serenade"]=new function(){var b=this;((function(){var c,d,e;c=a("./cache").Cache,e=a("./helpers").extend,d={VERSION:"0.1.0",_views:{},_controllers:{},_formats:{},document:typeof window!="undefined"&&window!==null?window.document:void 0,view:function(b,c){var d;return d=a("./view").View,c?this._views[b]=new d(c):new d(b)},render:function(a,b,c){return b||(b={}),c||(c=this.controllerFor(a,b)),c||(c={}),this._views[a].render(b,c)},controller:function(a,b){return this._controllers[a]=b},controllerFor:function(a,b){if(this._controllers[a])return new this._controllers[a](b)},registerFormat:function(a,b){return this._formats[a]=b},clearIdentityMap:function(){return c._identityMap={}},clearLocalStorage:function(){return c._storage.clear()},clearCache:function(){return d.clearIdentityMap(),d.clearLocalStorage()},unregisterAll:function(){return d._views={},d._controllers={},d._formats={}},bindEvent:function(a,b,c){return typeof a.addEventListener=="function"?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},useJQuery:function(){return this.bindEvent=function(a,b,c){return jQuery(a).bind(b,c)}},extend:e,Events:a("./events").Events,Collection:a("./collection").Collection,Helpers:{}},b.Serenade=d,b.compile=function(){var b,c,e;return b=a("jsdom").jsdom(null,null,{}),c=a("fs"),e=b.createWindow(),d.document=b,function(a){var e,f,g,h;return g=a.model,h=a.filename.split("/").reverse()[0].replace(/\.serenade$/,""),d.view(h,c.readFileSync(a.filename).toString()),e=d.render(h,g,{}),b.body.appendChild(e),f=b.body.innerHTML,a.doctype!==!1&&(f="<!DOCTYPE html>\n"+f),f}}})).call(this)},a["./lexer"]=new function(){var a=this;((function(){var b,c,d,e,f,g;b=/^[a-zA-Z][a-zA-Z0-9\-]*/,c=/^[\[\]=\:\-!#\.@]/,f=/^"((?:\\.|[^"])*)"/,e=/^(?:\n[^\n\S]*)+/,g=/^[^\n\S]+/,d=function(){function a(){}return a.prototype.tokenize=function(a,b){var c,d;b==null&&(b={}),this.code=a,this.line=b.line||0,this.indent=0,this.indents=[],this.ends=[],this.tokens=[],c=0;while(this.chunk=a.slice(c))c+=this.identifierToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.literalToken();while(d=this.ends.pop())d==="OUTDENT"?this.token("OUTDENT"):this.error("missing "+d);return this.tokens},a.prototype.whitespaceToken=function(){var a;return(a=g.exec(this.chunk))?(this.token("WHITESPACE",a[0].length),a[0].length):0},a.prototype.token=function(a,b){return this.tokens.push([a,b,this.line])},a.prototype.identifierToken=function(){var a;return(a=b.exec(this.chunk))?(this.token("IDENTIFIER",a[0]),a[0].length):0},a.prototype.stringToken=function(){var a;return(a=f.exec(this.chunk))?(this.token("STRING_LITERAL",a[1]),a[0].length):0},a.prototype.lineToken=function(){var a,b,c,d,f;if(!(c=e.exec(this.chunk)))return 0;b=c[0],this.line+=this.count(b,"\n"),d=this.last(this.tokens,1),f=b.length-1-b.lastIndexOf("\n"),a=f-this.indent;if(f===this.indent)this.newlineToken();else if(f>this.indent)this.token("INDENT"),this.indents.push(a),this.ends.push("OUTDENT");else{while(a<0)this.last(this.ends)!=="OUTDENT"&&this.error("Should be an OUTDENT, yo"),this.ends.pop(),a+=this.indents.pop(),this.token("OUTDENT");this.token("TERMINATOR","\n")}return this.indent=f,b.length},a.prototype.literalToken=function(){var a;return(a=c.exec(this.chunk))?(this.token(a[0]),1):this.error("WUT??? is '"+this.chunk.charAt(0)+"'")},a.prototype.newlineToken=function(){if(this.tag()!=="TERMINATOR")return this.token("TERMINATOR","\n")},a.prototype.tag=function(a,b){var c;return(c=this.last(this.tokens,a))&&(b?c[0]=b:c[0])},a.prototype.value=function(a,b){var c;return(c=this.last(this.tokens,a))&&(b?c[1]=b:c[1])},a.prototype.error=function(a){throw SyntaxError(""+a+" on line "+(this.line+1))},a.prototype.count=function(a,b){var c,d;c=d=0;if(!b.length)return 1/0;while(d=1+a.indexOf(b,d))c++;return c},a.prototype.last=function(a,b){return a[a.length-(b||0)-1]},a}(),a.Lexer=d})).call(this)},a["./nodes"]=new function(){var b=this;((function(){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=function(a,b){return function(){return a.apply(b,arguments)}};l=a("./serenade").Serenade,t=a("./helpers"),q=t.format,r=t.get,p=t.forEach,s=t.preventDefault,j=function(){function a(a,b,c,d){var e,f,g,h,i,j,l,m,n;this.ast=a,this.document=b,this.model=c,this.controller=d,this.element=this.document.createElement(this.ast.name),this.ast.shortId&&this.element.setAttribute("id",this.ast.shortId),((l=this.ast.shortClasses)!=null?l.length:void 0)&&this.element.setAttribute("class",this.ast.shortClasses.join(" ")),m=this.ast.properties;for(g=0,i=m.length;g<i;g++)f=m[g],k.property(f,this,this.document,this.model,this.controller);n=this.ast.children;for(h=0,j=n.length;h<j;h++)e=n[h],k.compile(e,this.document,this.model,this.controller).append(this.element)}return a.prototype.append=function(a){return a.appendChild(this.element)},a.prototype.insertAfter=function(a){return a.parentNode.insertBefore(this.element,a.nextSibling)},a.prototype.remove=function(){return this.element.parentNode.removeChild(this.element)},a.prototype.lastElement=function(){return this.element},a}(),m=function(){function a(a,b,c,d,e){var f,g=this;this.ast=a,this.node=b,this.document=c,this.model=d,this.controller=e,this.element=this.node.element,this.update(),this.ast.bound&&typeof (f=this.model).bind=="function"&&f.bind("change:"+this.ast.value,function(a){return g.update()})}return a.prototype.update=function(){return this.element.style[this.ast.name]=this.get()},a.prototype.get=function(){return q(this.model,this.ast.value,this.ast.bound)},a}(),f=function(){function a(a,b,c,d,e){var f,g;this.ast=a,this.node=b,this.document=c,this.model=d,this.controller=e,this.element=this.node.element,g=this,f=function(a){return g.ast.preventDefault&&s(a),g.controller[g.ast.value](a)},l.bindEvent(this.element,this.ast.name,f)}return a}(),c=function(){function a(a,b,c,d,e){var f,g=this;this.ast=a,this.node=b,this.document=c,this.model=d,this.controller=e,this.element=this.node.element,this.update(),this.ast.bound&&typeof (f=this.model).bind=="function"&&f.bind("change:"+this.ast.value,function(a){return g.update()})}return a.prototype.update=function(){var a,b;return b=this.get(),this.ast.name==="value"?this.element.value=b||"":this.node.ast.name==="input"&&this.ast.name==="checked"?this.element.checked=!!b:this.ast.name==="class"?(a=this.node.ast.shortClasses,b!==void 0&&(a=a.concat(b)),a.length?this.element.setAttribute(this.ast.name,a.join(" ")):this.element.removeAttribute(this.ast.name)):b===void 0?this.element.removeAttribute(this.ast.name):this.element.setAttribute(this.ast.name,b)},a.prototype.get=function(){return q(this.model,this.ast.value,this.ast.bound)},a}(),n=function(){function a(a,b,c,d){var e=this;this.ast=a,this.document=b,this.model=c,this.controller=d,this.textNode=b.createTextNode(this.get()),this.ast.bound&&typeof c.bind=="function"&&c.bind("change:"+this.ast.value,function(){return e.textNode.nodeValue=e.get()})}return a.prototype.append=function(a){return a.appendChild(this.textNode)},a.prototype.insertAfter=function(a){return a.parentNode.insertBefore(this.textNode,a.nextSibling)},a.prototype.remove=function(){return this.textNode.parentNode.removeChild(this.textNode)},a.prototype.lastElement=function(){return this.textNode},a.prototype.get=function(){return q(this.model,this.ast.value,this.ast.bound)||""},a}(),o=function(){function a(a,b,c,d){this.ast=a,this.document=b,this.model=c,this.parentController=d,this.controller=l.controllerFor(this.ast.arguments[0],this.model),this.controller&&(this.controller.parent=this.parentController),this.view=l.render(this.ast.arguments[0],this.model,this.controller||this.parentController,this.document)}return a.prototype.append=function(a){return a.appendChild(this.view)},a.prototype.insertAfter=function(a){return a.parentNode.insertBefore(this.view,a.nextSibling)},a.prototype.remove=function(){return this.view.parentNode.removeChild(this.view)},a.prototype.lastElement=function(){return this.view},a}(),h=function(){function a(a,b,c,d){var e;this.ast=a,this.document=b,this.model=c,this.controller=d,this.build=u(this.build,this),this.anchor=b.createTextNode(""),typeof (e=this.model).bind=="function"&&e.bind("change:"+this.ast.arguments[0],this.build)}return a.prototype.build=function(){var a,b,c,d,e,f;if(r(this.model,this.ast.arguments[0])){this.nodes||(this.nodes=function(){var b,c,d,e;d=this.ast.children,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(k.compile(a,this.document,this.model,this.controller));return e}.call(this)),e=this.nodes,f=[];for(b=0,d=e.length;b<d;b++)c=e[b],f.push(c.insertAfter(this.nodes[b-1]||this.anchor));return f}return this.removeNodes()},a.prototype.append=function(a){return a.appendChild(this.anchor),this.build()},a.prototype.insertAfter=function(a){return a.parentNode.insertBefore(this.anchor,a.nextSibling),this.build()},a.prototype.remove=function(){return this.removeNodes(),this.anchor.parentNode.removeChild(this.anchor)},a.prototype.removeNodes=function(){var a,b,c,d;if(this.nodes){d=this.nodes;for(b=0,c=d.length;b<c;b++)a=d[b],a.remove()}return this.nodes=void 0},a.prototype.lastElement=function(){return this.nodes[this.nodes.length-1].lastElement()},a}(),i=function(){function a(a,b,c,d){var e;this.ast=a,this.document=b,this.model=c,this.controller=d,this.build=u(this.build,this),this.anchor=b.createTextNode(""),typeof (e=this.model).bind=="function"&&e.bind("change:"+this.ast.arguments[0],this.build)}return a.prototype.build=function(){var a,b,c,d,e,f,g;this.removeNodes(),d=r(this.model,this.ast.arguments[0]),this.nodes=function(){var b,c,e,f;e=this.ast.children,f=[];for(b=0,c=e.length;b<c;b++)a=e[b],f.push(k.compile(a,this.document,d,this.controller));return f}.call(this),f=this.nodes,g=[];for(b=0,e=f.length;b<e;b++)c=f[b],g.push(c.insertAfter(this.nodes[b-1]||this.anchor));return g},a.prototype.append=function(a){return a.appendChild(this.anchor),this.build()},a.prototype.insertAfter=function(a){return a.parentNode.insertBefore(this.anchor,a.nextSibling),this.build()},a.prototype.remove=function(){return this.removeNodes(),this.anchor.parentNode.removeChild(this.anchor)},a.prototype.removeNodes=function(){var a,b,c,d;if(this.nodes){d=this.nodes;for(b=0,c=d.length;b<c;b++)a=d[b],a.remove()}return this.nodes=void 0},a.prototype.lastElement=function(){return this.nodes[this.nodes.length-1].lastElement()},a}(),d=function(){function a(a,b,c,d){var e=this;this.ast=a,this.document=b,this.model=c,this.controller=d,this.anchor=b.createTextNode(""),this.collection=this.get(),this.collection.bind&&(this.collection.bind("update",function(){return e.rebuild()}),this.collection.bind("set",function(){return e.rebuild()}),this.collection.bind("add",function(a){return e.appendItem(a)}),this.collection.bind("delete",function(a){return e["delete"](a)}))}return a.prototype.rebuild=function(){var a,b,c,d;d=this.items;for(b=0,c=d.length;b<c;b++)a=d[b],a.remove();return this.build()},a.prototype.build=function(){var a=this;return this.items=[],p(this.collection,function(b){return a.appendItem(b)})},a.prototype.appendItem=function(a){var b;return b=new e(this.ast.children,this.document,a,this.controller),b.insertAfter(this.lastElement()),this.items.push(b)},a.prototype["delete"]=function(a){return this.items[a].remove(),this.items.splice(a,1)},a.prototype.lastItem=function(){return this.items[this.items.length-1]},a.prototype.lastElement=function(){var a;return a=this.lastItem(),a?a.lastElement():this.anchor},a.prototype.remove=function(){var a,b,c,d,e;this.anchor.parentNode.removeChild(this.anchor),d=this.items,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.remove());return e},a.prototype.append=function(a){return a.appendChild(this.anchor),this.build()},a.prototype.insertAfter=function(a){return a.parentNode.insertBefore(this.anchor,a.nextSibling),this.build()},a.prototype.get=function(){return r(this.model,this.ast.arguments[0])},a}(),g=function(){function a(a,b,c,d){this.ast=a,this.document=b,this.model=c,this.controller=d,this.render=u(this.render,this),this.helperFunction=l.Helpers[this.ast.command]||function(){throw SyntaxError("no helper "+this.ast.command+" defined")}.call(this),this.context={document:this.document,render:this.render,model:this.model,controller:this.controller},this.element=this.helperFunction.apply(this.context,this.ast.arguments)}return a.prototype.render=function(a,b,c){var d,e,f,g,h,i;b==null&&(b=this.model),c==null&&(c=this.controller),h=this.ast.children,i=[];for(f=0,g=h.length;f<g;f++)d=h[f],e=k.compile(d,this.document,b,c),i.push(e.append(a));return i},a.prototype.lastElement=function(){var a;return a=this.lastItem(),a?a.lastElement():this.anchor},a.prototype.remove=function(){var a,b,c,d,e;this.element.parentNode.removeChild(this.element),d=this.items,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.remove());return e},a.prototype.append=function(a){return a.appendChild(this.element)},a.prototype.insertAfter=function(a){return a.parentNode.insertBefore(this.element,a.nextSibling)},a}(),e=function(){function a(a,b,c,d){var e;this.children=a,this.document=b,this.model=c,this.controller=d,this.nodes=function(){var a,b,c,d;c=this.children,d=[];for(a=0,b=c.length;a<b;a++)e=c[a],d.push(k.compile(e,this.document,this.model,this.controller));return d}.call(this)}return a.prototype.insertAfter=function(a){var b,c,d,e,f,g;b=a,f=this.nodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],c.insertAfter(b),g.push(b=c.lastElement());return g},a.prototype.lastElement=function(){return this.nodes[this.nodes.length-1].lastElement()},a.prototype.remove=function(){var a,b,c,d,e;d=this.nodes,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.remove());return e},a}(),k={compile:function(a,b,c,e){switch(a.type){case"element":return new j(a,b,c,e);case"text":return new n(a,b,c,e);case"instruction":switch(a.command){case"view":return new o(a,b,c,e);case"collection":return new d(a,b,c,e);case"if":return new h(a,b,c,e);case"in":return new i(a,b,c,e);default:return new g(a,b,c,e)}break;default:throw SyntaxError("unknown type '"+a.type+"'")}},property:function(a,b,d,e,g){switch(a.scope){case"attribute":return new c(a,b,d,e,g);case"style":return new m(a,b,d,e,g);case"event":return new f(a,b,d,e,g);default:throw SyntaxError(""+a.scope+" is not a valid scope")}}},b.Nodes=k})).call(this)},a["./parser"]=new function(){var b=this,c=function(){undefined;var a={trace:function(){},yy:{},symbols_:{error:2,Root:3,Element:4,TERMINATOR:5,ElementIdentifier:6,IDENTIFIER:7,"#":8,".":9,"[":10,"]":11,PropertyList:12,WHITESPACE:13,Text:14,INDENT:15,ChildList:16,OUTDENT:17,TextList:18,Bound:19,STRING_LITERAL:20,Child:21,Instruction:22,Property:23,"=":24,"!":25,":":26,"-":27,"@":28,$accept:0,$end:1},terminals_:{2:"error",5:"TERMINATOR",7:"IDENTIFIER",8:"#",9:".",10:"[",11:"]",13:"WHITESPACE",15:"INDENT",17:"OUTDENT",20:"STRING_LITERAL",24:"=",25:"!",26:":",27:"-",28:"@"},productions_:[0,[3,0],[3,1],[3,2],[6,1],[6,3],[6,2],[6,2],[6,3],[4,1],[4,3],[4,4],[4,3],[4,4],[18,1],[18,3],[14,1],[14,1],[16,1],[16,3],[21,1],[21,1],[21,1],[12,1],[12,3],[23,3],[23,3],[23,4],[23,4],[23,3],[23,3],[22,3],[22,3],[22,4],[19,2]],performAction:function(b,c,d,e,f,g,h){var i=g.length-1;switch(f){case 1:this.$=null;break;case 2:return this.$;case 3:return this.$;case 4:this.$={name:g[i],shortClasses:[]};break;case 5:this.$={name:g[i-2],shortId:g[i],shortClasses:[]};break;case 6:this.$={name:"div",shortId:g[i],shortClasses:[]};break;case 7:this.$={name:"div",shortClasses:[g[i]]};break;case 8:this.$=function(){return g[i-2].shortClasses.push(g[i]),g[i-2]}();break;case 9:this.$={name:g[i].name,shortId:g[i].shortId,shortClasses:g[i].shortClasses,properties:[],children:[],type:"element"};break;case 10:this.$=g[i-2];break;case 11:this.$=function(){return g[i-3].properties=g[i-1],g[i-3]}();break;case 12:this.$=function(){return g[i-2].children=g[i-2].children.concat(g[i]),g[i-2]}();break;case 13:this.$=function(){return g[i-3].children=g[i-3].children.concat(g[i-1]),g[i-3]}();break;case 14:this.$=[g[i]];break;case 15:this.$=g[i-2].concat(g[i]);break;case 16:this.$={type:"text",value:g[i],bound:!0};break;case 17:this.$={type:"text",value:g[i],bound:!1};break;case 18:this.$=[].concat(g[i]);break;case 19:this.$=g[i-2].concat(g[i]);break;case 20:this.$=g[i];break;case 21:this.$=g[i];break;case 22:this.$=g[i];break;case 23:this.$=[g[i]];break;case 24:this.$=g[i-2].concat(g[i]);break;case 25:this.$={name:g[i-2],value:g[i],bound:!0,scope:"attribute"};break;case 26:this.$={name:g[i-2],value:g[i],bound:!0,scope:"attribute"};break;case 27:this.$={name:g[i-3],value:g[i-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 28:this.$={name:g[i-3],value:g[i-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 29:this.$={name:g[i-2],value:g[i],bound:!1,scope:"attribute"};break;case 30:this.$=function(){return g[i].scope=g[i-2],g[i]}();break;case 31:this.$={command:g[i],arguments:[],children:[],type:"instruction"};break;case 32:this.$=function(){return g[i-2].arguments.push(g[i].value),g[i-2]}();break;case 33:this.$=function(){return g[i-3].children=g[i-1],g[i-3]}();break;case 34:this.$=g[i]}},table:[{1:[2,1],3:1,4:2,6:3,7:[1,4],8:[1,5],9:[1,6]},{1:[3]},{1:[2,2],5:[1,7],10:[1,8],13:[1,9],15:[1,10]},{1:[2,9],5:[2,9],9:[1,11],10:[2,9],13:[2,9],15:[2,9],17:[2,9]},{1:[2,4],5:[2,4],8:[1,12],9:[2,4],10:[2,4],13:[2,4],15:[2,4],17:[2,4]},{7:[1,13]},{7:[1,14]},{1:[2,3]},{7:[1,18],11:[1,15],12:16,23:17},{14:19,19:20,20:[1,21],28:[1,22]},{4:25,6:3,7:[1,4],8:[1,5],9:[1,6],14:29,16:23,18:27,19:20,20:[1,21],21:24,22:26,27:[1,28],28:[1,22]},{7:[1,30]},{7:[1,31]},{1:[2,6],5:[2,6],9:[2,6],10:[2,6],13:[2,6],15:[2,6],17:[2,6]},{1:[2,7],5:[2,7],9:[2,7],10:[2,7],13:[2,7],15:[2,7],17:[2,7]},{1:[2,10],5:[2,10],10:[2,10],13:[2,10],15:[2,10],17:[2,10]},{11:[1,32],13:[1,33]},{11:[2,23],13:[2,23]},{24:[1,34],26:[1,35]},{1:[2,12],5:[2,12],10:[2,12],13:[2,12],15:[2,12],17:[2,12]},{1:[2,16],5:[2,16],10:[2,16],13:[2,16],15:[2,16],17:[2,16]},{1:[2,17],5:[2,17],10:[2,17],13:[2,17],15:[2,17],17:[2,17]},{7:[1,36]},{5:[1,38],17:[1,37]},{5:[2,18],17:[2,18]},{5:[2,20],10:[1,8],13:[1,9],15:[1,10],17:[2,20]},{5:[2,21],13:[1,39],15:[1,40],17:[2,21]},{5:[2,22],13:[1,41],17:[2,22]},{13:[1,42]},{5:[2,14],13:[2,14],17:[2,14]},{1:[2,8],5:[2,8],9:[2,8],10:[2,8],13:[2,8],15:[2,8],17:[2,8]},{1:[2,5],5:[2,5],9:[2,5],10:[2,5],13:[2,5],15:[2,5],17:[2,5]},{1:[2,11],5:[2,11],10:[2,11],13:[2,11],15:[2,11],17:[2,11]},{7:[1,18],23:43},{7:[1,44],19:45,20:[1,46],28:[1,22]},{7:[1,18],23:47},{1:[2,34],5:[2,34],10:[2,34],11:[2,34],13:[2,34],15:[2,34],17:[2,34],25:[2,34]},{1:[2,13],5:[2,13],10:[2,13],13:[2,13],15:[2,13],17:[2,13]},{4:25,6:3,7:[1,4],8:[1,5],9:[1,6],14:29,18:27,19:20,20:[1,21],21:48,22:26,27:[1,28],28:[1,22]},{14:49,19:20,20:[1,21],28:[1,22]},{4:25,6:3,7:[1,4],8:[1,5],9:[1,6],14:29,16:50,18:27,19:20,20:[1,21],21:24,22:26,27:[1,28],28:[1,22]},{14:51,19:20,20:[1,21],28:[1,22]},{7:[1,52]},{11:[2,24],13:[2,24]},{11:[2,25],13:[2,25],25:[1,53]},{11:[2,26],13:[2,26],25:[1,54]},{11:[2,29],13:[2,29]},{11:[2,30],13:[2,30]},{5:[2,19],17:[2,19]},{5:[2,32],13:[2,32],15:[2,32],17:[2,32]},{5:[1,38],17:[1,55]},{5:[2,15],13:[2,15],17:[2,15]},{5:[2,31],13:[2,31],15:[2,31],17:[2,31]},{11:[2,27],13:[2,27]},{11:[2,28],13:[2,28]},{5:[2,33],13:[2,33],15:[2,33],17:[2,33]}],defaultActions:{7:[2,3]},parseError:function(b,c){throw new Error(b)},parse:function(b){function o(a){d.length=d.length-2*a,e.length=e.length-a,f.length=f.length-a}function p(){var a;return a=c.lexer.lex()||1,typeof a!="number"&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0,l=2,m=1;this.lexer.setInput(b),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var n=this.lexer.yylloc;f.push(n),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var q,r,s,t,u,v,w={},x,y,z,A;for(;;){s=d[d.length-1],this.defaultActions[s]?t=this.defaultActions[s]:(q==null&&(q=p()),t=g[s]&&g[s][q]);if(typeof t=="undefined"||!t.length||!t[0]){if(!k){A=[];for(x in g[s])this.terminals_[x]&&x>2&&A.push("'"+this.terminals_[x]+"'");var B="";this.lexer.showPosition?B="Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+this.terminals_[q]+"'":B="Parse error on line "+(i+1)+": Unexpected "+(q==1?"end of input":"'"+(this.terminals_[q]||q)+"'"),this.parseError(B,{text:this.lexer.match,token:this.terminals_[q]||q,line:this.lexer.yylineno,loc:n,expected:A})}if(k==3){if(q==m)throw new Error(B||"Parsing halted.");j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,q=p()}for(;;){if(l.toString()in g[s])break;if(s==0)throw new Error(B||"Parsing halted.");o(1),s=d[d.length-1]}r=q,q=l,s=d[d.length-1],t=g[s]&&g[s][l],k=3}if(t[0]instanceof Array&&t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+s+", token: "+q);switch(t[0]){case 1:d.push(q),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(t[1]),q=null,r?(q=r,r=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:y=this.productions_[t[1]][1],w.$=e[e.length-y],w._$={first_line:f[f.length-(y||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(y||1)].first_column,last_column:f[f.length-1].last_column},v=this.performAction.call(w,h,j,i,this.yy,t[1],e,f);if(typeof v!="undefined")return v;y&&(d=d.slice(0,-1*y*2),e=e.slice(0,-1*y),f=f.slice(0,-1*y)),d.push(this.productions_[t[1]][0]),e.push(w.$),f.push(w._$),z=g[d[d.length-2]][d[d.length-1]],d.push(z);break;case 3:return!0}}return!0}};return a}();typeof a!="undefined"&&typeof b!="undefined"&&(b.parser=c,b.parse=function(){return c.parse.apply(c,arguments)},b.main=function(d){if(!d[1])throw new Error("Usage: "+d[0]+" FILE");if(typeof process!="undefined")var e=a("fs").readFileSync(a("path").join(process.cwd(),d[1]),"utf8");else var f=a("file").path(a("file").cwd()),e=f.join(d[1]).read({charset:"utf-8"});return b.parser.parse(e)},typeof module!="undefined"&&a.main===module&&b.main(typeof process!="undefined"?process.argv.slice(1):a("system").args))},a["./properties"]=new function(){var b=this;((function(){var b,c,d,e,f,g,h,i,j,k,l,m=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};d=a("./serenade").Serenade,b=a("./collection").Collection,c=a("./events").Events,l=a("./helpers"),i=l.pairToObject,k=l.serializeObject,g=l.extend,h=l.map,j="_prop_",f=/^_prop_/,e=Object.defineProperties,d.Properties={property:function(a,b){b==null&&(b={}),this[j+a]=b,this[j+a].name=a,e&&Object.defineProperty(this,a,{get:function(){return d.Properties.get.call(this,a)},set:function(b){return d.Properties.set.call(this,a,b)}});if(typeof b.serialize=="string")return this.property(b.serialize,{get:function(){return this.get(a)},set:function(b){return this.set(a,b)}})},collection:function(a,c){return this.property(a,{get:function(){var c=this;return this.attributes[a]||(this.attributes[a]=new b([]),this.attributes[a].bind("change",function(){return c._triggerChangesTo([a])}),this.attributes[a]._deferTo=i(a,this)),this.attributes[a]},set:function(b){return this.get(a).update(b)}})},set:function(a,b){var c,d,e;typeof a=="string"&&(a=i(a,b)),d=[];for(c in a)b=a[c],this._undefer(c),d.push(c),this.attributes||(this.attributes={}),((e=this[j+c])!=null?e.set:void 0)?this[j+c].set.call(this,b):this.attributes[c]=b,this._defer(c);return this._triggerChangesTo(d)},get:function(a){var b;return this.attributes||(this.attributes={}),((b=this[j+a])!=null?b.get:void 0)?this[j+a].get.call(this):this.attributes[a]},format:function(a){var b,c;return b=(c=this[j+a])!=null?c.format:void 0,typeof b=="string"?d._formats[b].call(this,this.get(a)):typeof b=="function"?b.call(this,this.get(a)):this.get(a)},serialize:function(){var a,b,c,d,e,g;d={};for(b in this)c=this[b],b.match(f)&&(typeof c.serialize=="string"?d[c.serialize]=k(this.get(c.name)):typeof c.serialize=="function"?(g=c.serialize.call(this),a=g[0],e=g[1],d[a]=k(e)):c.serialize&&(d[c.name]=k(this.get(c.name))));return d},_defer:function(a){var b,c;b=this.get(a);if(typeof b=="object")return b._deferTo||(b._deferTo={}),(c=b._deferTo)!=null?c[a]=this:void 0},_undefer:function(a){var b;b=this.get(a);if(b!=null?b._deferTo:void 0)return delete b._deferTo[a]},_triggerChangesTo:function(a){var b,c,d,i,j,k,l,n,o,p,q,r,s,t,u,v,w,x,y,z=this;o=function(a){return[].concat(a)},d=function(b){var c,e,g,h;h=[];for(c in z)e=z[c],c.match(f)&&e.dependsOn&&(m.call(o(e.dependsOn),b)>=0&&(g=e.name,m.call(a,g)<0)?(a.push(e.name),h.push(d(e.name))):h.push(void 0));return h};for(r=0,u=a.length;r<u;r++)p=a[r],d(p);c={};for(s=0,v=a.length;s<v;s++)n=a[s],q=this.get(n),this.trigger("change:"+n,q),c[n]=q,e||(this[n]=this.get(n));this.trigger("change",c),b=this._deferTo||[];if(this._inCollections){x=this._inCollections;for(t=0,w=x.length;t<w;t++)i=x[t],g(b,i._deferTo)}y=[];for(j in b){k=b[j];if(!b.hasOwnProperty(j))continue;l=h(a,function(a){return""+j+"."+a}),y.push(k._triggerChangesTo(l))}return y}},g(d.Properties,c)})).call(this)},a["./model"]=new function(){var b=this;((function(){var b,c,d,e,f=Object.prototype.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=a("./serenade").Serenade,c=a("./cache").Cache,b=a("./associations").Associations,e=a("./helpers").extend,d.Model=function(){function a(a,b){var d,e=this;b==null&&(b=!1);if(!b)if(a!=null?a.id:void 0){d=c.get(this.constructor,a.id);if(d)return d.set(a),d;c.set(this.constructor,a.id,this)}this.constructor.localStorage==="save"?this.bind("saved",function(){return c.store(e.constructor,e.get("id"),e)}):this.constructor.localStorage&&this.bind("change",function(){return c.store(e.constructor,e.get("id"),e)}),this.set(a)}return e(a.prototype,d.Properties),e(a.prototype,b),a.property=function(){var a;return(a=this.prototype).property.apply(a,arguments)},a.collection=function(){var a;return(a=this.prototype).collection.apply(a,arguments)},a.belongsTo=function(){var a;return(a=this.prototype).belongsTo.apply(a,arguments)},a.hasMany=function(){var a;return(a=this.prototype).hasMany.apply(a,arguments)},a.find=function(a){return c.get(this,a)||new this({id:a})},a.property("id",{serialize:!0}),a.extend=function(a,b){var c;return c=function(c){function d(){d.__super__.constructor.apply(this,arguments),b&&b.apply(this,arguments)}return g(d,c),d.modelName=a,d}(this)},a.prototype.save=function(){return this.trigger("saved")},a}()})).call(this)},a["./view"]=new function(){var b=this;((function(){var c,d,e,f,g;g=a("./parser").parser,c=a("./lexer").Lexer,d=a("./nodes").Nodes,e=a("./serenade").Serenade,g.lexer={lex:function(){var a,b;return b=this.tokens[this.pos++]||[""],a=b[0],this.yytext=b[1],this.yylineno=b[2],a},setInput:function(a){return this.tokens=a,this.pos=0},upcomingInput:function(){return""}},f=function(){function a(a){this.view=a}return a.prototype.parse=function(){return typeof this.view=="string"?g.parse((new c).tokenize(this.view)):this.view},a.prototype.render=function(a,b){var c;return a==null&&(a={}),b==null&&(b={}),c=d.compile(this.parse(),e.document,a,b),b.model=a,b.view=c.element},a}(),b.View=f})).call(this)},a["./serenade"].Serenade}();typeof define=="function"&&define.amd?define(function(){return b}):a.Serenade=b})(this)
@@ -0,0 +1,4 @@
1
+ module SerenadeRails
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,21 @@
1
+ require 'sprockets'
2
+ require 'sprockets/engines'
3
+ require 'tilt'
4
+
5
+ module SerenadeRails
6
+ class Processor < Tilt::Template
7
+ def self.default_mime_type
8
+ 'application/javascript'
9
+ end
10
+
11
+ def prepare
12
+ end
13
+
14
+ def evaluate(scope, locals, &block)
15
+ name = scope.logical_path.gsub(/^views\//, "")
16
+ SerenadeRails::Template.new(name, data.dup).render
17
+ end
18
+ end
19
+ end
20
+
21
+ Sprockets.register_engine '.serenade', SerenadeRails::Processor
@@ -0,0 +1,25 @@
1
+ require 'execjs'
2
+ require 'active_support/json'
3
+
4
+ module SerenadeRails
5
+ SERENADE_PATH = File.expand_path('../assets/javascripts/serenade.js', File.dirname(__FILE__))
6
+
7
+ class Template
8
+ attr_reader :name, :content
9
+
10
+ def initialize(name, content)
11
+ @name = name
12
+ @content = content
13
+ end
14
+
15
+ def parse
16
+ context = ExecJS.compile(File.read(SERENADE_PATH))
17
+ code = "Serenade.view(#{content.to_json}).parse()"
18
+ context.eval(code)
19
+ end
20
+
21
+ def render
22
+ "Serenade.view(#{name.to_json}, #{parse.to_json});"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module SerenadeRails
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'serenade_rails/version'
2
+ require 'serenade_rails/processor'
3
+ require 'serenade_rails/engine'
4
+ require 'serenade_rails/template'
5
+
6
+ module SerenadeRails
7
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/serenade_rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Jonas Nicklas"]
6
+ gem.email = ["jonas.nicklas@gmail.com"]
7
+ gem.description = %q{Use Serenade.js within the Rails asset pipeline}
8
+ gem.summary = %q{Serenade.js for Rails}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "serenade_rails"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = SerenadeRails::VERSION
17
+
18
+ gem.add_dependency "rails", "~> 3.1"
19
+ gem.add_dependency "execjs", ">= 0.3.0"
20
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: serenade_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jonas Nicklas
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &2152347540 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2152347540
25
+ - !ruby/object:Gem::Dependency
26
+ name: execjs
27
+ requirement: &2152345420 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.3.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2152345420
36
+ description: Use Serenade.js within the Rails asset pipeline
37
+ email:
38
+ - jonas.nicklas@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - README.md
46
+ - Rakefile
47
+ - lib/assets/javascripts/serenade.js
48
+ - lib/serenade_rails.rb
49
+ - lib/serenade_rails/engine.rb
50
+ - lib/serenade_rails/processor.rb
51
+ - lib/serenade_rails/template.rb
52
+ - lib/serenade_rails/version.rb
53
+ - serenade_rails.gemspec
54
+ homepage: ''
55
+ licenses: []
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 1.8.10
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: Serenade.js for Rails
78
+ test_files: []
79
+ has_rdoc: