flight-for-rails 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +0 -0
- data/LICENSE +19 -0
- data/README.md +80 -0
- data/flight-for-rails.gemspec +22 -0
- data/lib/flight-for-rails/engine.rb +4 -0
- data/lib/flight-for-rails/version.rb +3 -0
- data/lib/flight-for-rails.rb +2 -0
- data/vendor/assets/javascripts/es5-shim/es5-sham.js +7 -0
- data/vendor/assets/javascripts/es5-shim/es5-shim.js +17 -0
- data/vendor/assets/javascripts/flight/standalone.js +8 -0
- data/vendor/assets/javascripts/flight-for-rails.js +3 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjRlOTU4ZDljOTQxYWYwM2M0Yzc1YWY4YzhlMWU1OGZkYWU0OGMyMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTFhZDA2YmU4YWQ3ZTAwNGZiZWM3M2FkZTg2ODYyMjQ5OTY1MmJmNw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTMwNGQ5Mjk1ZWZlZjhmYzk0NjUyMmQ0N2Y0YTBmMzZkYzk2OGEwYzNkMmI5
|
10
|
+
OGM5MWI4ZWU1NDdmZjRlYzBlZGNkMjY3MjYxOWJiZTRlNDc5OTgwMTdjODU4
|
11
|
+
Y2JlMDE5ZjBhMzk5YzQ4YmZiMDgyMjI5YjRlNjFkZWI3YmI4NTk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmViMGQxZWExMWY1NzRiNGJlYzNkMzc5NjZlNGQ0OTAwYzNjYWRhYzQ1NGE2
|
14
|
+
ZGQ5NzVjYTQ0NDExODA3NmI3YzNkMjI5MGFmYjc4NThlMzQ3NDQ0YmEzMTZk
|
15
|
+
NWU2OTEyOTIyNDI5MTI2OTYzYmE5NGI5ODJlMWEwYzZhNjVhZDg=
|
data/.gitignore
ADDED
File without changes
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2013 Sergey Rezvanov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
FlightForRails
|
2
|
+
==============
|
3
|
+
|
4
|
+
FlightForRails is a plugin for Rails assets pipeline, which integrates your applicaiton with Twitter Flight javascript framework. Flight is a lightweight, component-based javascript framework that maps behavior to DOM nodes. Twitter uses it for their web applications. Why do not you try it? :)
|
5
|
+
|
6
|
+
For more information see [official Flight page](http://twitter.github.com/flight).
|
7
|
+
|
8
|
+
## Browser Support
|
9
|
+
|
10
|
+
Flight has been tested on all major browsers: Chrome, Firefox, Safari, Opera and IE7 and upwards.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
This gem vendors Flight files and dependecies for Rails assets pipeline.
|
15
|
+
|
16
|
+
First add the following lines to your application `Gemfile`:
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
gem install 'flight-for-rails', '~> 1.0.6'
|
20
|
+
```
|
21
|
+
|
22
|
+
Then run `bundle install` to update your's gems bundle.
|
23
|
+
|
24
|
+
Now you need to edit your manifest file (usualy `app/assets/javascripts/application.js`) and add the following lines:
|
25
|
+
|
26
|
+
``` javascript
|
27
|
+
//= require jquery
|
28
|
+
//= require flight-for-rails
|
29
|
+
```
|
30
|
+
|
31
|
+
Done!
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
0. Define a component
|
36
|
+
0. Attach a component instance to a DOM node
|
37
|
+
|
38
|
+
Simple example:
|
39
|
+
|
40
|
+
``` coffeescript
|
41
|
+
# app/assets/javascript/components/my-component.js.coffee
|
42
|
+
$ ->
|
43
|
+
MyComponent = flight.component
|
44
|
+
@after 'initialize', ->
|
45
|
+
@on 'click', @triggerMyEvent
|
46
|
+
|
47
|
+
@triggerMyEvent = ->
|
48
|
+
@trigger document, 'myEvent', text: 'My event'
|
49
|
+
|
50
|
+
MyComponent.attachTo '#my-component'
|
51
|
+
```
|
52
|
+
|
53
|
+
``` coffeescript
|
54
|
+
# app/assets/javascript/components/my-component-2.js.coffee
|
55
|
+
$ ->
|
56
|
+
MyComponent2 = flight.component
|
57
|
+
@after 'initialize', ->
|
58
|
+
@on 'myEvent', @handleMyEvent
|
59
|
+
|
60
|
+
@handleMyEvent = (event, data) ->
|
61
|
+
console.log "#{data.text} event is triggered!"
|
62
|
+
|
63
|
+
MyComponent2.attachTo '#my-component2'
|
64
|
+
```
|
65
|
+
|
66
|
+
And don't forget add the following line to your manifest file (usualy app/assets/javascript/application.js):
|
67
|
+
|
68
|
+
```javascript
|
69
|
+
//= require_directory ./components
|
70
|
+
```
|
71
|
+
|
72
|
+
Pretty awesome! Enjoy!
|
73
|
+
|
74
|
+
## Authors
|
75
|
+
|
76
|
+
+ [Sergey Rezvanov](http://github.com/rezwyi)
|
77
|
+
|
78
|
+
## Copyright
|
79
|
+
|
80
|
+
See LICENSE file.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../lib/flight-for-rails/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'flight-for-rails'
|
5
|
+
s.summary = 'Flight javascript framework for Rails 3.1 and greater assets pipeline'
|
6
|
+
s.description = s.summary
|
7
|
+
|
8
|
+
s.version = FlightForRails::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
|
11
|
+
s.authors = ['Sergey Rezvanov']
|
12
|
+
s.email = ['sergey@rezvanov.info']
|
13
|
+
s.homepage = 'https://github.com/rezwyi/flight-for-rails'
|
14
|
+
|
15
|
+
s.licenses = ['MIT']
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
s.add_dependency 'rails', '>= 3.1.0'
|
21
|
+
s.add_dependency 'jquery-rails'
|
22
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
(function(f){"function"==typeof define?define(f):"function"==typeof YUI?YUI.add("es5-sham",f):f()})(function(){function f(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(c){}}var b=Function.prototype.call,g=Object.prototype,h=b.bind(g.hasOwnProperty),p,q,k,l,i;if(i=h(g,"__defineGetter__"))p=b.bind(g.__defineGetter__),q=b.bind(g.__defineSetter__),k=b.bind(g.__lookupGetter__),l=b.bind(g.__lookupSetter__);Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__||
|
2
|
+
(a.constructor?a.constructor.prototype:g)});Object.getOwnPropertyDescriptor||(Object.getOwnPropertyDescriptor=function(a,c){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+a);if(h(a,c)){var d={enumerable:true,configurable:true};if(i){var b=a.__proto__;a.__proto__=g;var e=k(a,c),f=l(a,c);a.__proto__=b;if(e||f){if(e)d.get=e;if(f)d.set=f;return d}}d.value=a[c];return d}});Object.getOwnPropertyNames||(Object.getOwnPropertyNames=
|
3
|
+
function(a){return Object.keys(a)});if(!Object.create){var m;if(null===Object.prototype.__proto__||"undefined"==typeof document)m=function(){return{__proto__:null}};else{var r=function(){},b=document.createElement("iframe"),j=document.body||document.documentElement;b.style.display="none";j.appendChild(b);b.src="javascript:";var e=b.contentWindow.Object.prototype;j.removeChild(b);b=null;delete e.constructor;delete e.hasOwnProperty;delete e.propertyIsEnumerable;delete e.isPrototypeOf;delete e.toLocaleString;
|
4
|
+
delete e.toString;delete e.valueOf;e.__proto__=null;r.prototype=e;m=function(){return new r}}Object.create=function(a,c){function d(){}var b;if(a===null)b=m();else{if(typeof a!=="object"&&typeof a!=="function")throw new TypeError("Object prototype may only be an Object or null");d.prototype=a;b=new d;b.__proto__=a}c!==void 0&&Object.defineProperties(b,c);return b}}if(Object.defineProperty&&(b=f({}),j="undefined"==typeof document||f(document.createElement("div")),!b||!j))var n=Object.defineProperty,
|
5
|
+
o=Object.defineProperties;if(!Object.defineProperty||n)Object.defineProperty=function(a,c,d){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.defineProperty called on non-object: "+a);if(typeof d!="object"&&typeof d!="function"||d===null)throw new TypeError("Property description must be an object: "+d);if(n)try{return n.call(Object,a,c,d)}catch(b){}if(h(d,"value"))if(i&&(k(a,c)||l(a,c))){var e=a.__proto__;a.__proto__=g;delete a[c];a[c]=d.value;a.__proto__=e}else a[c]=
|
6
|
+
d.value;else{if(!i)throw new TypeError("getters & setters can not be defined on this javascript engine");h(d,"get")&&p(a,c,d.get);h(d,"set")&&q(a,c,d.set)}return a};if(!Object.defineProperties||o)Object.defineProperties=function(a,c){if(o)try{return o.call(Object,a,c)}catch(d){}for(var b in c)h(c,b)&&b!="__proto__"&&Object.defineProperty(a,b,c[b]);return a};Object.seal||(Object.seal=function(a){return a});Object.freeze||(Object.freeze=function(a){return a});try{Object.freeze(function(){})}catch(t){var s=
|
7
|
+
Object.freeze;Object.freeze=function(a){return typeof a=="function"?a:s(a)}}Object.preventExtensions||(Object.preventExtensions=function(a){return a});Object.isSealed||(Object.isSealed=function(){return false});Object.isFrozen||(Object.isFrozen=function(){return false});Object.isExtensible||(Object.isExtensible=function(a){if(Object(a)!==a)throw new TypeError;for(var c="";h(a,c);)c=c+"?";a[c]=true;var b=h(a,c);delete a[c];return b})});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
(function(o){"function"==typeof define?define(o):"function"==typeof YUI?YUI.add("es5",o):o()})(function(){function o(){}function v(a){a=+a;a!==a?a=0:0!==a&&(a!==1/0&&a!==-(1/0))&&(a=(0<a||-1)*Math.floor(Math.abs(a)));return a}function s(a){var b=typeof a;return null===a||"undefined"===b||"boolean"===b||"number"===b||"string"===b}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError("Function.prototype.bind called on incompatible "+b);
|
2
|
+
var d=q.call(arguments,1),c=function(){if(this instanceof c){var e=b.apply(this,d.concat(q.call(arguments)));return Object(e)===e?e:this}return b.apply(a,d.concat(q.call(arguments)))};b.prototype&&(o.prototype=b.prototype,c.prototype=new o,o.prototype=null);return c});var k=Function.prototype.call,p=Object.prototype,q=Array.prototype.slice,h=k.bind(p.toString),t=k.bind(p.hasOwnProperty);t(p,"__defineGetter__")&&(k.bind(p.__defineGetter__),k.bind(p.__defineSetter__),k.bind(p.__lookupGetter__),k.bind(p.__lookupSetter__));
|
3
|
+
if(2!=[1,2].splice(0).length){var y=Array.prototype.splice;Array.prototype.splice=function(a,b){return arguments.length?y.apply(this,[a===void 0?0:a,b===void 0?this.length-a:b].concat(q.call(arguments,2))):[]}}if(1!=[].unshift(0)){var z=Array.prototype.unshift;Array.prototype.unshift=function(){z.apply(this,arguments);return this.length}}Array.isArray||(Array.isArray=function(a){return h(a)=="[object Array]"});var k=Object("a"),l="a"!=k[0]||!(0 in k);Array.prototype.forEach||(Array.prototype.forEach=
|
4
|
+
function(a,b){var d=n(this),c=l&&h(this)=="[object String]"?this.split(""):d,e=-1,f=c.length>>>0;if(h(a)!="[object Function]")throw new TypeError;for(;++e<f;)e in c&&a.call(b,c[e],e,d)});Array.prototype.map||(Array.prototype.map=function(a,b){var d=n(this),c=l&&h(this)=="[object String]"?this.split(""):d,e=c.length>>>0,f=Array(e);if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");for(var g=0;g<e;g++)g in c&&(f[g]=a.call(b,c[g],g,d));return f});Array.prototype.filter||(Array.prototype.filter=
|
5
|
+
function(a,b){var d=n(this),c=l&&h(this)=="[object String]"?this.split(""):d,e=c.length>>>0,f=[],g;if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");for(var i=0;i<e;i++)if(i in c){g=c[i];a.call(b,g,i,d)&&f.push(g)}return f});Array.prototype.every||(Array.prototype.every=function(a,b){var d=n(this),c=l&&h(this)=="[object String]"?this.split(""):d,e=c.length>>>0;if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&!a.call(b,c[f],
|
6
|
+
f,d))return false;return true});Array.prototype.some||(Array.prototype.some=function(a,b){var d=n(this),c=l&&h(this)=="[object String]"?this.split(""):d,e=c.length>>>0;if(h(a)!="[object Function]")throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&a.call(b,c[f],f,d))return true;return false});Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=n(this),d=l&&h(this)=="[object String]"?this.split(""):b,c=d.length>>>0;if(h(a)!="[object Function]")throw new TypeError(a+
|
7
|
+
" is not a function");if(!c&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var e=0,f;if(arguments.length>=2)f=arguments[1];else{do{if(e in d){f=d[e++];break}if(++e>=c)throw new TypeError("reduce of empty array with no initial value");}while(1)}for(;e<c;e++)e in d&&(f=a.call(void 0,f,d[e],e,b));return f});Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=n(this),d=l&&h(this)=="[object String]"?this.split(""):b,c=d.length>>>0;if(h(a)!=
|
8
|
+
"[object Function]")throw new TypeError(a+" is not a function");if(!c&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var e,c=c-1;if(arguments.length>=2)e=arguments[1];else{do{if(c in d){e=d[c--];break}if(--c<0)throw new TypeError("reduceRight of empty array with no initial value");}while(1)}do c in this&&(e=a.call(void 0,e,d[c],c,b));while(c--);return e});if(!Array.prototype.indexOf||-1!=[0,1].indexOf(1,2))Array.prototype.indexOf=function(a){var b=l&&
|
9
|
+
h(this)=="[object String]"?this.split(""):n(this),d=b.length>>>0;if(!d)return-1;var c=0;arguments.length>1&&(c=v(arguments[1]));for(c=c>=0?c:Math.max(0,d+c);c<d;c++)if(c in b&&b[c]===a)return c;return-1};if(!Array.prototype.lastIndexOf||-1!=[0,1].lastIndexOf(0,-3))Array.prototype.lastIndexOf=function(a){var b=l&&h(this)=="[object String]"?this.split(""):n(this),d=b.length>>>0;if(!d)return-1;var c=d-1;arguments.length>1&&(c=Math.min(c,v(arguments[1])));for(c=c>=0?c:d-Math.abs(c);c>=0;c--)if(c in b&&
|
10
|
+
a===b[c])return c;return-1};if(!Object.keys){var w=!0,x="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),A=x.length,r;for(r in{toString:null})w=!1;Object.keys=function(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.keys called on a non-object");var b=[],d;for(d in a)t(a,d)&&b.push(d);if(w)for(d=0;d<A;d++){var c=x[d];t(a,c)&&b.push(c)}return b}}if(!Date.prototype.toISOString||-1===(new Date(-621987552E5)).toISOString().indexOf("-000001"))Date.prototype.toISOString=
|
11
|
+
function(){var a,b,d,c;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");c=this.getUTCFullYear();a=this.getUTCMonth();c=c+Math.floor(a/12);a=[(a%12+12)%12+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];c=(c<0?"-":c>9999?"+":"")+("00000"+Math.abs(c)).slice(0<=c&&c<=9999?-4:-6);for(b=a.length;b--;){d=a[b];d<10&&(a[b]="0"+d)}return c+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+
|
12
|
+
"Z"};r=!1;try{r=Date.prototype.toJSON&&null===(new Date(NaN)).toJSON()&&-1!==(new Date(-621987552E5)).toJSON().indexOf("-000001")&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(H){}r||(Date.prototype.toJSON=function(){var a=Object(this),b;a:if(s(a))b=a;else{b=a.valueOf;if(typeof b==="function"){b=b.call(a);if(s(b))break a}b=a.toString;if(typeof b==="function"){b=b.call(a);if(s(b))break a}throw new TypeError;}if(typeof b==="number"&&!isFinite(b))return null;b=a.toISOString;
|
13
|
+
if(typeof b!="function")throw new TypeError("toISOString property is not callable");return b.call(a)});var g=Date,m=function(a,b,d,c,e,f,h){var i=arguments.length;if(this instanceof g){i=i==1&&String(a)===a?new g(m.parse(a)):i>=7?new g(a,b,d,c,e,f,h):i>=6?new g(a,b,d,c,e,f):i>=5?new g(a,b,d,c,e):i>=4?new g(a,b,d,c):i>=3?new g(a,b,d):i>=2?new g(a,b):i>=1?new g(a):new g;i.constructor=m;return i}return g.apply(this,arguments)},u=function(a,b){var d=b>1?1:0;return B[b]+Math.floor((a-1969+d)/4)-Math.floor((a-
|
14
|
+
1901+d)/100)+Math.floor((a-1601+d)/400)+365*(a-1970)},C=RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),B=[0,31,59,90,120,151,181,212,243,273,304,334,365],j;for(j in g)m[j]=g[j];m.now=g.now;m.UTC=g.UTC;m.prototype=g.prototype;m.prototype.constructor=m;m.parse=function(a){var b=C.exec(a);if(b){var d=Number(b[1]),c=Number(b[2]||1)-1,e=Number(b[3]||1)-1,f=Number(b[4]||0),h=Number(b[5]||0),i=Number(b[6]||
|
15
|
+
0),j=Number(b[7]||0),m=!b[4]||b[8]?0:Number(new g(1970,0)),k=b[9]==="-"?1:-1,l=Number(b[10]||0),b=Number(b[11]||0);if(f<(h>0||i>0||j>0?24:25)&&h<60&&i<60&&j<1E3&&c>-1&&c<12&&l<24&&b<60&&e>-1&&e<u(d,c+1)-u(d,c)){d=((u(d,c)+e)*24+f+l*k)*60;d=((d+h+b*k)*60+i)*1E3+j+m;if(-864E13<=d&&d<=864E13)return d}return NaN}return g.parse.apply(this,arguments)};Date=m;Date.now||(Date.now=function(){return(new Date).getTime()});if("0".split(void 0,0).length){var D=String.prototype.split;String.prototype.split=function(a,
|
16
|
+
b){return a===void 0&&b===0?[]:D.apply(this,arguments)}}if("".substr&&"b"!=="0b".substr(-1)){var E=String.prototype.substr;String.prototype.substr=function(a,b){return E.call(this,a<0?(a=this.length+a)<0?0:a:a,b)}}j="\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||j.trim()){j="["+j+"]";var F=RegExp("^"+j+j+"*"),G=RegExp(j+j+"*$");String.prototype.trim=function(){if(this===void 0||this===
|
17
|
+
null)throw new TypeError("can't convert "+this+" to object");return String(this).replace(F,"").replace(G,"")}}var n=function(a){if(a==null)throw new TypeError("can't convert "+a+" to object");return Object(a)}});
|
@@ -0,0 +1,8 @@
|
|
1
|
+
(function(context){var factories={},loaded={};var isArray=Array.isArray||function(obj){return obj.constructor==Array};var map=Array.map||function(arr,fn,scope){for(var i=0,len=arr.length,result=[];i<len;i++){result.push(fn.call(scope,arr[i]))}return result};function define(){var args=Array.prototype.slice.call(arguments),dependencies=[],id,factory;if(typeof args[0]=="string"){id=args.shift()}if(isArray(args[0])){dependencies=args.shift()}factory=args.shift();factories[id]=[dependencies,factory]}function require(id){function resolve(dep){var relativeParts=id.split("/"),depParts=dep.split("/"),relative=false;relativeParts.pop();while(depParts[0]==".."&&relativeParts.length){relativeParts.pop();depParts.shift();relative=true}if(depParts[0]=="."){depParts.shift();relative=true}if(relative){depParts=relativeParts.concat(depParts)}return depParts.join("/")}var unresolved,factory,dependencies;if(typeof loaded[id]=="undefined"){unresolved=factories[id];if(unresolved){dependencies=unresolved[0];factory=unresolved[1];loaded[id]=factory.apply(undefined,map(dependencies,function(id){return require(resolve(id))}))}}return loaded[id]};define("lib/utils",[],function(){var a=[],b=100,c={isDomObj:function(a){return!!a.nodeType||a===window},toArray:function(b,c){return a.slice.call(b,c)},merge:function(){var a=arguments.length,b=0,c=new Array(a+1);for(;b<a;b++)c[b+1]=arguments[b];return a===0?{}:(c[0]={},c[c.length-1]===!0&&(c.pop(),c.unshift(!0)),$.extend.apply(undefined,c))},push:function(a,b,c){return a&&Object.keys(b||{}).forEach(function(d){if(a[d]&&c)throw Error("utils.push attempted to overwrite '"+d+"' while running in protected mode");typeof a[d]=="object"&&typeof b[d]=="object"?this.push(a[d],b[d]):a[d]=b[d]},this),a},isEnumerable:function(a,b){return Object.keys(a).indexOf(b)>-1},compose:function(){var a=arguments;return function(){var b=arguments;for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},uniqueArray:function(a){var b={},c=[];for(var d=0,e=a.length;d<e;++d){if(b.hasOwnProperty(a[d]))continue;c.push(a[d]),b[a[d]]=1}return c},debounce:function(a,c,d){typeof c!="number"&&(c=b);var e,f;return function(){var b=this,g=arguments,h=function(){e=null,d||(f=a.apply(b,g))},i=d&&!e;return clearTimeout(e),e=setTimeout(h,c),i&&(f=a.apply(b,g)),f}},throttle:function(a,c){typeof c!="number"&&(c=b);var d,e,f,g,h,i,j=this.debounce(function(){h=g=!1},c);return function(){d=this,e=arguments;var b=function(){f=null,h&&(i=a.apply(d,e)),j()};return f||(f=setTimeout(b,c)),g?h=!0:(g=!0,i=a.apply(d,e)),j(),i}},countThen:function(a,b){return function(){if(!--a)return b.apply(this,arguments)}},delegate:function(a){return function(b,c){var d=$(b.target),e;Object.keys(a).forEach(function(f){if((e=d.closest(f)).length)return c=c||{},c.el=e[0],a[f].apply(this,[b,c])},this)}}};return c})
|
2
|
+
define("lib/registry",["./utils"],function(a){function b(a,b){var c,d,e,f=b.length;return typeof b[f-1]=="function"&&(f-=1,e=b[f]),typeof b[f-1]=="object"&&(f-=1),f==2?(c=b[0],d=b[1]):(c=a.node,d=b[0]),{element:c,type:d,callback:e}}function c(a,b){return a.element==b.element&&a.type==b.type&&(b.callback==null||a.callback==b.callback)}function d(){function d(b){this.component=b,this.attachedTo=[],this.instances={},this.addInstance=function(a){var b=new e(a);return this.instances[a.identity]=b,this.attachedTo.push(a.node),b},this.removeInstance=function(b){delete this.instances[b.identity];var c=this.attachedTo.indexOf(b.node);c>-1&&this.attachedTo.splice(c,1),this.instances.length||a.removeComponentInfo(this)},this.isAttachedTo=function(a){return this.attachedTo.indexOf(a)>-1}}function e(b){this.instance=b,this.events=[],this.addBind=function(b){this.events.push(b),a.events.push(b)},this.removeBind=function(a){for(var b=0,d;d=this.events[b];b++)c(d,a)&&this.events.splice(b,1)}}var a=this;(this.reset=function(){this.components=[],this.allInstances={},this.events=[]}).call(this),this.addInstance=function(a){var b=this.findComponentInfo(a);b||(b=new d(a.constructor),this.components.push(b));var c=b.addInstance(a);return this.allInstances[a.identity]=c,b},this.removeInstance=function(a){var b,c=this.findInstanceInfo(a),d=this.findComponentInfo(a);d&&d.removeInstance(a),delete this.allInstances[a.identity]},this.removeComponentInfo=function(a){var b=this.components.indexOf(a);b>-1&&this.components.splice(b,1)},this.findComponentInfo=function(a){var b=a.attachTo?a:a.constructor;for(var c=0,d;d=this.components[c];c++)if(d.component===b)return d;return null},this.findInstanceInfo=function(a){return this.allInstances[a.identity]||null},this.findInstanceInfoByNode=function(a){var b=[];return Object.keys(this.allInstances).forEach(function(c){var d=this.allInstances[c];d.instance.node===a&&b.push(d)},this),b},this.on=function(c){var d=a.findInstanceInfo(this),e,f=arguments.length,g=1,h=new Array(f-1);for(;g<f;g++)h[g-1]=arguments[g];if(d){e=c.apply(null,h),e&&(h[h.length-1]=e);var i=b(this,h);d.addBind(i)}},this.off=function(c,d,e){var f=b(this,arguments),g=a.findInstanceInfo(this);g&&g.removeBind(f)},this.teardown=function(){a.removeInstance(this)},this.withRegistration=function(){this.before("initialize",function(){a.addInstance(this)}),this.around("on",a.on),this.after("off",a.off),this.after("teardown",{obj:a,fnName:"teardown"})}}return new d})
|
3
|
+
define("tools/debug/debug",["../../lib/registry","../../lib/utils"],function(a,b){function d(a,b,c){var c=c||{},e=c.obj||window,g=c.path||(e==window?"window":""),h=Object.keys(e);h.forEach(function(c){(f[a]||a)(b,e,c)&&console.log([g,".",c].join(""),"->",["(",typeof e[c],")"].join(""),e[c]),Object.prototype.toString.call(e[c])=="[object Object]"&&e[c]!=e&&g.split(".").indexOf(c)==-1&&d(a,b,{obj:e[c],path:[g,c].join(".")})})}function e(a,b,c,e){!b||typeof c==b?d(a,c,e):console.error([c,"must be",b].join(" "))}function g(a,b){e("name","string",a,b)}function h(a,b){e("nameContains","string",a,b)}function i(a,b){e("type","function",a,b)}function j(a,b){e("value",null,a,b)}function k(a,b){e("valueCoerced",null,a,b)}function l(a,b){d(a,null,b)}function n(){var a=[].slice.call(arguments,0);c.eventNames.length||(c.eventNames="all"),c.actions=a.length?a:"all"}function o(){var a=[].slice.call(arguments,0);c.actions.length||(c.actions="all"),c.eventNames=a.length?a:"all"}function p(){c.actions=[],c.eventNames=[]}function q(){c.actions="all",c.eventNames="all"}var c,f={name:function(a,b,c){return a==c},nameContains:function(a,b,c){return c.indexOf(a)>-1},type:function(a,b,c){return b[c]instanceof a},value:function(a,b,c){return b[c]===a},valueCoerced:function(a,b,c){return b[c]==a}},m=[];return c={actions:m,eventNames:m},{enable:function(a){this.enabled=!!a,a&&window.console&&(console.info("Booting in DEBUG mode"),console.info("You can configure event logging with DEBUG.events.logAll()/logNone()/logByName()/logByAction()")),window.DEBUG=this},find:{byName:g,byNameContains:h,byType:i,byValue:j,byValueCoerced:k,custom:l},events:{logFilter:c,logByAction:n,logByName:o,logAll:q,logNone:p}}})
|
4
|
+
define("lib/compose",["./utils","../tools/debug/debug"],function(a,b){function f(a,b){if(!c)return;var e=Object.create(null);Object.keys(a).forEach(function(c){if(d.indexOf(c)<0){var f=Object.getOwnPropertyDescriptor(a,c);f.writable=b,e[c]=f}}),Object.defineProperties(a,e)}function g(a,b,d){var e;if(!c||!a.hasOwnProperty(b)){d.call(a);return}e=Object.getOwnPropertyDescriptor(a,b).writable,Object.defineProperty(a,b,{writable:!0}),d.call(a),Object.defineProperty(a,b,{writable:e})}function h(a,b){a.mixedIn=a.hasOwnProperty("mixedIn")?a.mixedIn:[],b.forEach(function(b){a.mixedIn.indexOf(b)==-1&&(f(a,!1),b.call(a),a.mixedIn.push(b))}),f(a,!0)}var c=b.enabled&&!a.isEnumerable(Object,"getOwnPropertyDescriptor"),d=["mixedIn"];if(c)try{Object.getOwnPropertyDescriptor(Object,"keys")}catch(e){c=!1}return{mixin:h,unlockProperty:g}})
|
5
|
+
define("lib/advice",["./utils","./compose"],function(a,b){var c={around:function(a,b){return function(){var d=0,e=arguments.length,f=new Array(e+1);f[0]=a.bind(this);for(;d<e;d++)f[d+1]=arguments[d];return b.apply(this,f)}},before:function(a,b){var c=typeof b=="function"?b:b.obj[b.fnName];return function(){return c.apply(this,arguments),a.apply(this,arguments)}},after:function(a,b){var c=typeof b=="function"?b:b.obj[b.fnName];return function(){var d=(a.unbound||a).apply(this,arguments);return c.apply(this,arguments),d}},withAdvice:function(){["before","after","around"].forEach(function(a){this[a]=function(d,e){b.unlockProperty(this,d,function(){return typeof this[d]=="function"?this[d]=c[a](this[d],e):this[d]=e})}},this)}};return c})
|
6
|
+
define("lib/component",["./advice","./utils","./compose","./registry"],function(a,b,c,d){function g(a){a.events.slice().forEach(function(a){var b=[a.type];a.element&&b.unshift(a.element),typeof a.callback=="function"&&b.push(a.callback),this.off.apply(this,b)},a.instance)}function h(){g(d.findInstanceInfo(this))}function i(){var a=d.findComponentInfo(this);a&&Object.keys(a.instances).forEach(function(b){var c=a.instances[b];c.instance.teardown()})}function j(a,b){try{window.postMessage(b,"*")}catch(c){throw console.log("unserializable data for event",a,":",b),new Error(["The event",a,"on component",this.toString(),"was triggered with non-serializable data"].join(" "))}}function k(){this.trigger=function(){var a,b,c,d,e,f=arguments.length-1,g=arguments[f];return typeof g!="string"&&(!g||!g.defaultBehavior)&&(f--,c=g),f==1?(a=$(arguments[0]),d=arguments[1]):(a=this.$node,d=arguments[0]),d.defaultBehavior&&(e=d.defaultBehavior,d=$.Event(d.type)),b=d.type||d,window.DEBUG&&window.DEBUG.enabled&&window.postMessage&&j.call(this,b,c),typeof this.attr.eventData=="object"&&(c=$.extend(!0,{},this.attr.eventData,c)),a.trigger(d||b,c),e&&!d.isDefaultPrevented()&&(this[e]||e).call(this),a},this.on=function(){var a,c,d,e,f=arguments.length-1,g=arguments[f];typeof g=="object"?e=b.delegate(this.resolveDelegateRules(g)):e=g,f==2?(a=$(arguments[0]),c=arguments[1]):(a=this.$node,c=arguments[0]);if(typeof e!="function"&&typeof e!="object")throw new Error("Unable to bind to '"+c+"' because the given callback is not a function or an object");return d=e.bind(this),d.target=e,e.guid&&(d.guid=e.guid),a.on(c,d),e.guid=d.guid,d},this.off=function(){var a,b,c,d=arguments.length-1;return typeof arguments[d]=="function"&&(c=arguments[d],d-=1),d==1?(a=$(arguments[0]),b=arguments[1]):(a=this.$node,b=arguments[0]),a.off(b,c)},this.resolveDelegateRules=function(a){var b={};return Object.keys(a).forEach(function(c){if(!c in this.attr)throw new Error('Component "'+this.toString()+'" wants to listen on "'+c+'" but no such attribute was defined.');b[this.attr[c]]=a[c]},this),b},this.defaultAttrs=function(a){b.push(this.defaults,a,!0)||(this.defaults=a)},this.select=function(a){return this.$node.find(this.attr[a])},this.initialize=$.noop,this.teardown=h}function l(a){var c=arguments.length,e=new Array(c-1);for(var f=1;f<c;f++)e[f-1]=arguments[f];if(!a)throw new Error("Component needs to be attachTo'd a jQuery object, native node or selector string");var g=b.merge.apply(b,e);$(a).each(function(a,b){var c=b.jQuery?b[0]:b,e=d.findComponentInfo(this);if(e&&e.isAttachedTo(c))return;new this(b,g)}.bind(this))}function m(){function j(a,b){b=b||{},this.identity=f++;if(!a)throw new Error("Component needs a node");a.jquery?(this.node=a[0],this.$node=a):(this.node=a,this.$node=$(a)),this.toString=j.toString,window.DEBUG&&window.DEBUG.enabled&&(this.describe=this.toString());var c=Object.create(b);for(var d in this.defaults)b.hasOwnProperty(d)||(c[d]=this.defaults[d]);this.attr=c,Object.keys(this.defaults||{}).forEach(function(a){if(this.defaults[a]===null&&this.attr[a]===null)throw new Error('Required attribute "'+a+'" not specified in attachTo for component "'+this.toString()+'".')},this),this.initialize.call(this,b)}var b=arguments.length,g=new Array(b);for(var h=0;h<b;h++)g[h]=arguments[h];return j.toString=function(){var a=g.map(function(a){if(a.name==null){var b=a.toString().match(e);return b&&b[1]?b[1]:""}return a.name!="withBaseComponent"?a.name:""}).filter(Boolean).join(", ");return a},window.DEBUG&&window.DEBUG.enabled&&(j.describe=j.toString()),j.attachTo=l,j.teardownAll=i,g.unshift(k,a.withAdvice,d.withRegistration),c.mixin(j.prototype,g),j}var e=/function (.*?)\s?\(/,f=0;return m.teardownAll=function(){d.components.slice().forEach(function(a){a.component.teardownAll()}),d.reset()},m})
|
7
|
+
define("lib/logger",["./compose","./utils"],function(a,b){function d(a){var b=a.tagName?a.tagName.toLowerCase():a.toString(),c=a.className?"."+a.className:"",d=b+c;return a.tagName?["'","'"].join(d):d}function e(a,b,e){var f,g,h,i,j,k,l,m;typeof e[e.length-1]=="function"&&(h=e.pop(),h=h.unbound||h),typeof e[e.length-1]=="object"&&e.pop(),e.length==2?(g=e[0],f=e[1]):(g=b.$node[0],f=e[0]),window.DEBUG&&window.DEBUG.enabled&&(j=DEBUG.events.logFilter,l=j.actions=="all"||j.actions.indexOf(a)>-1,k=function(a){return a.test?a:new RegExp("^"+a.replace(/\*/g,".*")+"$")},m=j.eventNames=="all"||j.eventNames.some(function(a){return k(a).test(f)}),l&&m&&console.info(c[a],a,"["+f+"]",d(g),b.constructor.toString(),h&&(i=h.name||h.displayName)&&"-> "+i))}function f(){this.before("trigger",function(){e("trigger",this,b.toArray(arguments))}),this.before("on",function(){e("on",this,b.toArray(arguments))}),this.before("off",function(a){e("off",this,b.toArray(arguments))})}var c={on:"<-",trigger:"->",off:"x "};return f})
|
8
|
+
define("lib/index",["./advice","./component","./compose","./logger","./registry","./utils"],function(a,b,c,d,e,f){return{advice:a,component:b,compose:c,logger:d,registry:e,utils:f}});context.flight=require("lib/index")})(this);
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flight-for-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergey Rezvanov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jquery-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Flight javascript framework for Rails 3.1 and greater assets pipeline
|
42
|
+
email:
|
43
|
+
- sergey@rezvanov.info
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- flight-for-rails.gemspec
|
52
|
+
- lib/flight-for-rails.rb
|
53
|
+
- lib/flight-for-rails/engine.rb
|
54
|
+
- lib/flight-for-rails/version.rb
|
55
|
+
- vendor/assets/javascripts/es5-shim/es5-sham.js
|
56
|
+
- vendor/assets/javascripts/es5-shim/es5-shim.js
|
57
|
+
- vendor/assets/javascripts/flight-for-rails.js
|
58
|
+
- vendor/assets/javascripts/flight/standalone.js
|
59
|
+
homepage: https://github.com/rezwyi/flight-for-rails
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Flight javascript framework for Rails 3.1 and greater assets pipeline
|
83
|
+
test_files: []
|