backbone-cocktail-rails 0.5.10
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 +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +23 -0
- data/VERSION +1 -0
- data/backbone-cocktail-rails.gemspec +15 -0
- data/lib/backbone-cocktail-rails.rb +8 -0
- data/vendor/assets/javascripts/backbone.cocktail.js +102 -0
- data/vendor/assets/javascripts/backbone.cocktail.min.js +4 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 46d586f16c62d8425b6759318cdad0d159f8fd5d
|
4
|
+
data.tar.gz: 6c5b8da4eea19da719bd13343bf734f4700537e0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9bd8b7d2193b4e414a0f7b0a2a0402b62b67508045e4e1d1d33695a6255971e2c0948a844ff2f90d033a086a518ff5192db35c37ddbf6f7078042ba1040878fb
|
7
|
+
data.tar.gz: e4a23517e4ab85d7b5baf07619473d33a616038b57f71c3b30cb857c7b558a4ee4b01a32973eed55e82c938100d2ffb5343314bafa5583c4c2bc6c96cfdeee0a
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
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
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.DS_Store
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Alexander Schwartzberg
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
backbone-cocktail-rails
|
2
|
+
=======================
|
3
|
+
|
4
|
+
Rails (3.1 and up) asset wrapper for the latest version of [backbone.cocktail](https://github.com/onsi/cocktail) (0.5.10).
|
5
|
+
|
6
|
+
# Installation
|
7
|
+
#### Step 1: Add it to your gemfile:
|
8
|
+
|
9
|
+
gem 'backbone-cocktail-rails'
|
10
|
+
|
11
|
+
#### Step 2: Include assets:
|
12
|
+
|
13
|
+
```javascript
|
14
|
+
// In application.js
|
15
|
+
//= require backbone.cocktail
|
16
|
+
```
|
17
|
+
or
|
18
|
+
```javascript
|
19
|
+
// In application.js
|
20
|
+
//= require backbone.cocktail.min
|
21
|
+
```
|
22
|
+
|
23
|
+
#####Special thanks to [onsi](https://github.com/onsi) for his work on [backbone.cocktail](https://github.com/onsi/cocktail).
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.10
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
VERSION = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "backbone-cocktail-rails"
|
6
|
+
spec.version = VERSION
|
7
|
+
spec.authors = ["Alexander Schwartzberg"]
|
8
|
+
spec.email = ["aeksco@gmail.com"]
|
9
|
+
spec.summary = "Rails asset wrapper for backbone.cocktail"
|
10
|
+
spec.homepage = "https://github.com/aeksco/backbone-cocktail-rails"
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files`.split("\n")
|
14
|
+
spec.require_paths = ["lib"]
|
15
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
// (c) 2012 Onsi Fakhouri
|
2
|
+
// Cocktail.js may be freely distributed under the MIT license.
|
3
|
+
// http://github.com/onsi/cocktail
|
4
|
+
(function(factory) {
|
5
|
+
if (typeof require === 'function' && typeof module !== 'undefined' && module.exports) {
|
6
|
+
module.exports = factory(require('underscore'));
|
7
|
+
} else if (typeof define === 'function') {
|
8
|
+
define(['underscore'], factory);
|
9
|
+
} else {
|
10
|
+
this.Cocktail = factory(_);
|
11
|
+
}
|
12
|
+
}(function (_) {
|
13
|
+
|
14
|
+
var Cocktail = {};
|
15
|
+
|
16
|
+
Cocktail.mixins = {};
|
17
|
+
|
18
|
+
Cocktail.mixin = function mixin(klass) {
|
19
|
+
var mixins = _.chain(arguments).toArray().rest().flatten().value();
|
20
|
+
// Allows mixing into the constructor's prototype or the dynamic instance
|
21
|
+
var obj = klass.prototype || klass;
|
22
|
+
|
23
|
+
var collisions = {};
|
24
|
+
|
25
|
+
_.each(mixins, function(mixin) {
|
26
|
+
if (_.isString(mixin)) {
|
27
|
+
mixin = Cocktail.mixins[mixin];
|
28
|
+
}
|
29
|
+
_.each(mixin, function(value, key) {
|
30
|
+
if (_.isFunction(value)) {
|
31
|
+
// If the mixer already has that exact function reference
|
32
|
+
// Note: this would occur on an accidental mixin of the same base
|
33
|
+
if (obj[key] === value) return;
|
34
|
+
|
35
|
+
if (obj[key]) {
|
36
|
+
// Avoid accessing built-in properties like constructor (#39)
|
37
|
+
collisions[key] = collisions.hasOwnProperty(key) ? collisions[key] : [obj[key]];
|
38
|
+
collisions[key].push(value);
|
39
|
+
}
|
40
|
+
obj[key] = value;
|
41
|
+
} else if (_.isArray(value)) {
|
42
|
+
obj[key] = _.union(value, obj[key] || []);
|
43
|
+
} else if (_.isObject(value)) {
|
44
|
+
obj[key] = _.extend({}, value, obj[key] || {});
|
45
|
+
} else if (!(key in obj)) {
|
46
|
+
obj[key] = value;
|
47
|
+
}
|
48
|
+
});
|
49
|
+
});
|
50
|
+
|
51
|
+
_.each(collisions, function(propertyValues, propertyName) {
|
52
|
+
obj[propertyName] = function() {
|
53
|
+
var that = this,
|
54
|
+
args = arguments,
|
55
|
+
returnValue;
|
56
|
+
|
57
|
+
_.each(propertyValues, function(value) {
|
58
|
+
var returnedValue = _.isFunction(value) ? value.apply(that, args) : value;
|
59
|
+
returnValue = (typeof returnedValue === 'undefined' ? returnValue : returnedValue);
|
60
|
+
});
|
61
|
+
|
62
|
+
return returnValue;
|
63
|
+
};
|
64
|
+
});
|
65
|
+
|
66
|
+
return klass;
|
67
|
+
};
|
68
|
+
|
69
|
+
var originalExtend;
|
70
|
+
|
71
|
+
Cocktail.patch = function patch(Backbone) {
|
72
|
+
originalExtend = Backbone.Model.extend;
|
73
|
+
|
74
|
+
var extend = function(protoProps, classProps) {
|
75
|
+
var klass = originalExtend.call(this, protoProps, classProps);
|
76
|
+
|
77
|
+
var mixins = klass.prototype.mixins;
|
78
|
+
if (mixins && klass.prototype.hasOwnProperty('mixins')) {
|
79
|
+
Cocktail.mixin(klass, mixins);
|
80
|
+
}
|
81
|
+
|
82
|
+
return klass;
|
83
|
+
};
|
84
|
+
|
85
|
+
_.each([Backbone.Model, Backbone.Collection, Backbone.Router, Backbone.View], function(klass) {
|
86
|
+
klass.mixin = function mixin() {
|
87
|
+
Cocktail.mixin(this, _.toArray(arguments));
|
88
|
+
};
|
89
|
+
|
90
|
+
klass.extend = extend;
|
91
|
+
});
|
92
|
+
};
|
93
|
+
|
94
|
+
Cocktail.unpatch = function unpatch(Backbone) {
|
95
|
+
_.each([Backbone.Model, Backbone.Collection, Backbone.Router, Backbone.View], function(klass) {
|
96
|
+
klass.mixin = undefined;
|
97
|
+
klass.extend = originalExtend;
|
98
|
+
});
|
99
|
+
};
|
100
|
+
|
101
|
+
return Cocktail;
|
102
|
+
}));
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/* Onsi Fakhouri <onsijoe@gmail.com>
|
2
|
+
* backbone.cocktail v0.5.10
|
3
|
+
* https://github.com/onsi/cocktail/ */
|
4
|
+
!function(a){"function"==typeof require&&"undefined"!=typeof module&&module.exports?module.exports=a(require("underscore")):"function"==typeof define?define(["underscore"],a):this.Cocktail=a(_)}(function(a){var b={};b.mixins={},b.mixin=function(c){var d=a.chain(arguments).toArray().rest().flatten().value(),e=c.prototype||c,f={};return a.each(d,function(c){a.isString(c)&&(c=b.mixins[c]),a.each(c,function(b,c){if(a.isFunction(b)){if(e[c]===b)return;e[c]&&(f[c]=f.hasOwnProperty(c)?f[c]:[e[c]],f[c].push(b)),e[c]=b}else a.isArray(b)?e[c]=a.union(b,e[c]||[]):a.isObject(b)?e[c]=a.extend({},b,e[c]||{}):c in e||(e[c]=b)})}),a.each(f,function(b,c){e[c]=function(){var c,d=this,e=arguments;return a.each(b,function(b){var f=a.isFunction(b)?b.apply(d,e):b;c="undefined"==typeof f?c:f}),c}}),c};var c;return b.patch=function(d){c=d.Model.extend;var e=function(a,d){var e=c.call(this,a,d),f=e.prototype.mixins;return f&&e.prototype.hasOwnProperty("mixins")&&b.mixin(e,f),e};a.each([d.Model,d.Collection,d.Router,d.View],function(c){c.mixin=function(){b.mixin(this,a.toArray(arguments))},c.extend=e})},b.unpatch=function(b){a.each([b.Model,b.Collection,b.Router,b.View],function(a){a.mixin=void 0,a.extend=c})},b});
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: backbone-cocktail-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.10
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Schwartzberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- aeksco@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- LICENSE
|
23
|
+
- README.md
|
24
|
+
- VERSION
|
25
|
+
- backbone-cocktail-rails.gemspec
|
26
|
+
- lib/backbone-cocktail-rails.rb
|
27
|
+
- vendor/assets/javascripts/backbone.cocktail.js
|
28
|
+
- vendor/assets/javascripts/backbone.cocktail.min.js
|
29
|
+
homepage: https://github.com/aeksco/backbone-cocktail-rails
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.2.2
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Rails asset wrapper for backbone.cocktail
|
53
|
+
test_files: []
|