ende 0.1.14 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +1 -1
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +5 -2
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +4 -3
- data/lib/assets/javascripts/value_objects/phone.js.coffee +8 -2
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +18 -21
- data/lib/ende/version.rb +1 -1
- data/lib/ende.rb +2 -2
- data/vendor/assets/javascripts/ende/build.js +485 -4879
- data/vendor/components/component-querystring/component.json +18 -0
- data/vendor/components/component-querystring/index.js +49 -0
- data/vendor/components/component-trim/component.json +13 -0
- data/vendor/components/component-trim/index.js +17 -0
- data/vendor/components/indefinido-indemma/.gitignore +14 -0
- data/vendor/components/indefinido-indemma/.ruby-gemset +1 -0
- data/vendor/components/indefinido-indemma/.ruby-version +1 -0
- data/vendor/components/indefinido-indemma/Gemfile +13 -0
- data/vendor/components/indefinido-indemma/Guardfile +39 -0
- data/vendor/components/indefinido-indemma/History.md +0 -0
- data/vendor/components/indefinido-indemma/Readme.md +443 -0
- data/vendor/components/indefinido-indemma/build/development.js +331 -0
- data/vendor/components/indefinido-indemma/build/release.js +21693 -0
- data/vendor/components/indefinido-indemma/build/test.js +331 -0
- data/vendor/components/indefinido-indemma/component.json +8 -9
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/component.json +18 -0
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/index.js +110 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/component.json +47 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/index.js +1 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/assertion.js +130 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/assert.js +1080 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/should.js +76 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/eql.js +129 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/index.js +108 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/inspect.js +320 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/test.js +26 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/type.js +45 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai.js +80 -0
- data/vendor/components/indefinido-indemma/components/component-bind/component.json +14 -0
- data/vendor/components/indefinido-indemma/components/component-bind/index.js +24 -0
- data/vendor/components/indefinido-indemma/components/component-jquery/component.json +14 -0
- data/vendor/components/indefinido-indemma/components/component-jquery/index.js +9601 -0
- data/vendor/components/indefinido-indemma/components/component-type/component.json +18 -0
- data/vendor/components/indefinido-indemma/components/component-type/index.js +32 -0
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/component.json +21 -0
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/index.js +1 -0
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/lib/advisable.js +60 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/component.json +25 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/components/cjohansen-sinon/sinon.js +4290 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/index.js +1 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/adapters/rivets.js +26 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/observable.js +323 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors-legacy.js +92 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors.js +173 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/array.indexOf.js +8 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/object.create.js +77 -0
- data/vendor/components/indefinido-indemma/components/kapit-observe-utils/component.json +13 -0
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/component.json +25 -0
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/dist/assimilate.js +87 -0
- data/vendor/components/indefinido-indemma/karma.conf.js +86 -0
- data/vendor/components/indefinido-indemma/lib/record/associable.js +6 -6
- data/vendor/components/indefinido-indemma/lib/record/errors.js +1 -0
- data/vendor/components/indefinido-indemma/lib/record/resource.js +14 -3
- data/vendor/components/indefinido-indemma/lib/record/rest.js +7 -4
- data/vendor/components/indefinido-indemma/lib/record/restfulable.js +45 -15
- data/vendor/components/indefinido-indemma/lib/record/scopable.js +13 -3
- data/vendor/components/indefinido-indemma/lib/record/validatable.js +20 -9
- data/vendor/components/indefinido-indemma/lib/record/validations/confirmation.js +1 -1
- data/vendor/components/indefinido-indemma/lib/record/validations/remote.js +6 -5
- data/vendor/components/indefinido-indemma/lib/record/validations/type.js +29 -0
- data/vendor/components/indefinido-indemma/lib/record.js +1 -11
- data/vendor/components/indefinido-indemma/spec/record/associable_spec.js +76 -0
- data/vendor/components/indefinido-indemma/spec/record/resource_spec.js +90 -0
- data/vendor/components/indefinido-indemma/spec/record/rest_spec.js +32 -0
- data/vendor/components/indefinido-indemma/spec/record/restfulable_spec.js +232 -0
- data/vendor/components/indefinido-indemma/spec/record/scopable_spec.js +201 -0
- data/vendor/components/indefinido-indemma/spec/record/translationable.js +28 -0
- data/vendor/components/indefinido-indemma/spec/record/validatable_spec.js +111 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js +43 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/confirmation_spec.js +36 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/cpf_spec.js +35 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/presence_spec.js +28 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/remote_spec.js +86 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/type_spec.js +48 -0
- data/vendor/components/indefinido-indemma/spec/record_spec.js +37 -0
- data/vendor/components/indefinido-indemma/spec/spec_helper.js +11 -0
- data/vendor/components/indefinido-indemma/spec/support/value_objects/phone.js +45 -0
- data/vendor/components/indefinido-indemma/src/lib/extensions/rivets.coffee +17 -0
- data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +173 -0
- data/vendor/components/indefinido-indemma/src/lib/record/errors.coffee +20 -0
- data/vendor/components/indefinido-indemma/src/lib/record/maid.coffee +16 -0
- data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +103 -0
- data/vendor/components/indefinido-indemma/src/lib/record/rest.coffee +28 -0
- data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +314 -0
- data/vendor/components/indefinido-indemma/src/lib/record/scopable.coffee +266 -0
- data/vendor/components/indefinido-indemma/src/lib/record/translationable.coffee +18 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +209 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/associated.coffee +32 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/confirmation.coffee +19 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/cpf.coffee +58 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/presence.coffee +19 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/remote.coffee +65 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/type.coffee +32 -0
- data/vendor/components/indefinido-indemma/src/lib/record.coffee +123 -0
- data/vendor/components/indefinido-indemma/src/spec/record/associable_spec.coffee +63 -0
- data/vendor/components/indefinido-indemma/src/spec/record/resource_spec.coffee +64 -0
- data/vendor/components/indefinido-indemma/src/spec/record/rest_spec.coffee +22 -0
- data/vendor/components/indefinido-indemma/src/spec/record/restfulable_spec.coffee +164 -0
- data/vendor/components/indefinido-indemma/src/spec/record/scopable_spec.coffee +181 -0
- data/vendor/components/indefinido-indemma/src/spec/record/translationable.coffee +19 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validatable_spec.coffee +100 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/associated_spec.coffee +35 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/confirmation_spec.coffee +25 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/cpf_spec.coffee +28 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/presence_spec.coffee +24 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/remote_spec.coffee +72 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/type_spec.coffee +33 -0
- data/vendor/components/indefinido-indemma/src/spec/record_spec.coffee +23 -0
- data/vendor/components/indefinido-indemma/src/spec/spec_helper.coffee +9 -0
- data/vendor/components/indefinido-indemma/src/spec/support/value_objects/phone.coffee +30 -0
- data/vendor/components/indefinido-indemma/vendor/owl/pluralize.js +190 -0
- data/vendor/components/indefinido-observable/lib/observable.js +3 -0
- metadata +119 -2
@@ -0,0 +1,77 @@
|
|
1
|
+
// ES5 15.2.3.5
|
2
|
+
// http://es5.github.com/#x15.2.3.5
|
3
|
+
if (!Object.create) {
|
4
|
+
|
5
|
+
// Contributed by Brandon Benvie, October, 2012
|
6
|
+
var createEmpty;
|
7
|
+
var supportsProto = Object.prototype.__proto__ === null;
|
8
|
+
if (supportsProto || typeof document == 'undefined') {
|
9
|
+
createEmpty = function () {
|
10
|
+
return { "__proto__": null };
|
11
|
+
};
|
12
|
+
} else {
|
13
|
+
// In old IE __proto__ can't be used to manually set `null`, nor does
|
14
|
+
// any other method exist to make an object that inherits from nothing,
|
15
|
+
// aside from Object.prototype itself. Instead, create a new global
|
16
|
+
// object and *steal* its Object.prototype and strip it bare. This is
|
17
|
+
// used as the prototype to create nullary objects.
|
18
|
+
createEmpty = function () {
|
19
|
+
var iframe = document.createElement('iframe');
|
20
|
+
var parent = document.body || document.documentElement;
|
21
|
+
iframe.style.display = 'none';
|
22
|
+
parent.appendChild(iframe);
|
23
|
+
iframe.src = 'javascript:';
|
24
|
+
var empty = iframe.contentWindow.Object.prototype;
|
25
|
+
parent.removeChild(iframe);
|
26
|
+
iframe = null;
|
27
|
+
delete empty.constructor;
|
28
|
+
delete empty.hasOwnProperty;
|
29
|
+
delete empty.propertyIsEnumerable;
|
30
|
+
delete empty.isPrototypeOf;
|
31
|
+
delete empty.toLocaleString;
|
32
|
+
delete empty.toString;
|
33
|
+
delete empty.valueOf;
|
34
|
+
empty.__proto__ = null;
|
35
|
+
|
36
|
+
function Empty() {}
|
37
|
+
Empty.prototype = empty;
|
38
|
+
// short-circuit future calls
|
39
|
+
createEmpty = function () {
|
40
|
+
return new Empty();
|
41
|
+
};
|
42
|
+
return new Empty();
|
43
|
+
};
|
44
|
+
}
|
45
|
+
|
46
|
+
Object.create = function create(prototype, properties) {
|
47
|
+
|
48
|
+
var object;
|
49
|
+
function Type() {} // An empty constructor.
|
50
|
+
|
51
|
+
if (prototype === null) {
|
52
|
+
object = createEmpty();
|
53
|
+
} else {
|
54
|
+
if (typeof prototype !== "object" && typeof prototype !== "function") {
|
55
|
+
// In the native implementation `parent` can be `null`
|
56
|
+
// OR *any* `instanceof Object` (Object|Function|Array|RegExp|etc)
|
57
|
+
// Use `typeof` tho, b/c in old IE, DOM elements are not `instanceof Object`
|
58
|
+
// like they are in modern browsers. Using `Object.create` on DOM elements
|
59
|
+
// is...err...probably inappropriate, but the native version allows for it.
|
60
|
+
throw new TypeError("Object prototype may only be an Object or null"); // same msg as Chrome
|
61
|
+
}
|
62
|
+
Type.prototype = prototype;
|
63
|
+
object = new Type();
|
64
|
+
// IE has no built-in implementation of `Object.getPrototypeOf`
|
65
|
+
// neither `__proto__`, but this manually setting `__proto__` will
|
66
|
+
// guarantee that `Object.getPrototypeOf` will work as expected with
|
67
|
+
// objects created using `Object.create`
|
68
|
+
object.__proto__ = prototype;
|
69
|
+
}
|
70
|
+
|
71
|
+
if (properties !== void 0) {
|
72
|
+
Object.defineProperties(object, properties);
|
73
|
+
}
|
74
|
+
|
75
|
+
return object;
|
76
|
+
};
|
77
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "observe-utils",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"main": "lib/observe-utils.js",
|
5
|
+
"devDependencies": {
|
6
|
+
"expect": "~0.2.0",
|
7
|
+
"sinon": "http://sinonjs.org/releases/sinon-1.6.0.js",
|
8
|
+
"observe-shim": "https://github.com/KapIT/observe-shim.git",
|
9
|
+
"mocha": "~1.8.1",
|
10
|
+
"es5-shim": "~2.0.8"
|
11
|
+
},
|
12
|
+
"repo": "https://raw.github.com/kapit/observe-utils"
|
13
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"name": "assimilate",
|
3
|
+
"version": "0.2.0",
|
4
|
+
"license": "MIT",
|
5
|
+
"repo": "pluma/assimilate",
|
6
|
+
"description": "Extends objects.",
|
7
|
+
"keywords": [
|
8
|
+
"extend",
|
9
|
+
"inherit",
|
10
|
+
"mixin"
|
11
|
+
],
|
12
|
+
"main": "./dist/assimilate.js",
|
13
|
+
"dependencies": {},
|
14
|
+
"development": {},
|
15
|
+
"scripts": [
|
16
|
+
"dist/assimilate.js"
|
17
|
+
],
|
18
|
+
"styles": [],
|
19
|
+
"ignore": [
|
20
|
+
"**/.*",
|
21
|
+
"build",
|
22
|
+
"components",
|
23
|
+
"node_modules"
|
24
|
+
]
|
25
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/*! assimilate 0.2.0 Copyright (c) 2013 Alan Plum. MIT licensed. */
|
2
|
+
var slice = Array.prototype.slice;
|
3
|
+
|
4
|
+
function assimilateWithStrategy(strategy, copyInherited, target) {
|
5
|
+
var sources = slice.call(arguments, 3),
|
6
|
+
i, source, key;
|
7
|
+
|
8
|
+
if (target === undefined || target === null) {
|
9
|
+
target = {};
|
10
|
+
}
|
11
|
+
|
12
|
+
for (i = 0; i < sources.length; i++) {
|
13
|
+
source = sources[i];
|
14
|
+
if (source === undefined || source === null) continue;
|
15
|
+
for (key in source) {
|
16
|
+
if (copyInherited || source.hasOwnProperty(key)) {
|
17
|
+
strategy(target, source, key, copyInherited);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
return target;
|
23
|
+
}
|
24
|
+
|
25
|
+
function assimilate() {
|
26
|
+
var args = slice.call(arguments, 0);
|
27
|
+
return assimilateWithStrategy.apply(
|
28
|
+
this, [assimilate.strategies.DEFAULT, false].concat(args)
|
29
|
+
);
|
30
|
+
}
|
31
|
+
|
32
|
+
assimilate.withStrategy = function(strategy, copyInherited) {
|
33
|
+
if (arguments.length === 1 && typeof strategy === 'boolean') {
|
34
|
+
copyInherited = strategy;
|
35
|
+
strategy = 'default';
|
36
|
+
}
|
37
|
+
if (typeof strategy === 'string') {
|
38
|
+
strategy = strategy.toUpperCase();
|
39
|
+
if (typeof assimilate.strategies[strategy] === 'function') {
|
40
|
+
strategy = assimilate.strategies[strategy];
|
41
|
+
}
|
42
|
+
}
|
43
|
+
if (typeof strategy !== 'function') {
|
44
|
+
throw new Error('Unknown strategy or not a function: ' + strategy);
|
45
|
+
}
|
46
|
+
return function() {
|
47
|
+
var args = slice.call(arguments, 0);
|
48
|
+
return assimilateWithStrategy.apply(
|
49
|
+
this, [strategy, !!copyInherited].concat(args)
|
50
|
+
);
|
51
|
+
};
|
52
|
+
};
|
53
|
+
|
54
|
+
assimilate.strategies = {
|
55
|
+
DEFAULT: function(target, source, key) {
|
56
|
+
target[key] = source[key];
|
57
|
+
},
|
58
|
+
DEEP: function(target, source, key, copyInherited) {
|
59
|
+
var newValue = source[key];
|
60
|
+
var oldValue = target[key];
|
61
|
+
if (
|
62
|
+
target.hasOwnProperty(key) &&
|
63
|
+
typeof newValue === 'object' &&
|
64
|
+
typeof oldValue === 'object'
|
65
|
+
) {
|
66
|
+
assimilateWithStrategy(
|
67
|
+
assimilate.strategies.DEEP, copyInherited, oldValue, newValue
|
68
|
+
);
|
69
|
+
} else {
|
70
|
+
target[key] = newValue;
|
71
|
+
}
|
72
|
+
},
|
73
|
+
STRICT: function(target, source, key) {
|
74
|
+
var value = source[key];
|
75
|
+
if (value !== undefined) {
|
76
|
+
target[key] = value;
|
77
|
+
}
|
78
|
+
},
|
79
|
+
FALLBACK: function(target, source, key) {
|
80
|
+
var oldValue = target[key];
|
81
|
+
if (oldValue === undefined) {
|
82
|
+
target[key] = source[key];
|
83
|
+
}
|
84
|
+
}
|
85
|
+
};
|
86
|
+
|
87
|
+
module.exports = assimilate;
|
@@ -0,0 +1,86 @@
|
|
1
|
+
// Karma configuration
|
2
|
+
// Generated on Mon May 27 2013 16:00:28 GMT-0300 (BRT)
|
3
|
+
|
4
|
+
|
5
|
+
// base path, that will be used to resolve files and exclude
|
6
|
+
basePath = '';
|
7
|
+
|
8
|
+
// list of files / patterns to load in the browser
|
9
|
+
files = [
|
10
|
+
|
11
|
+
// Test environment
|
12
|
+
MOCHA,
|
13
|
+
MOCHA_ADAPTER,
|
14
|
+
'vendor/sinon.js',
|
15
|
+
|
16
|
+
// Test dependencies
|
17
|
+
'build/test.js',
|
18
|
+
'spec/support/**/*.js',
|
19
|
+
|
20
|
+
// Test Source files
|
21
|
+
'spec/spec_helper.js',
|
22
|
+
'spec/**/*.js'
|
23
|
+
];
|
24
|
+
|
25
|
+
|
26
|
+
// list of files to exclude
|
27
|
+
exclude = [
|
28
|
+
'spec/coverage'
|
29
|
+
];
|
30
|
+
|
31
|
+
|
32
|
+
// test results reporter to use
|
33
|
+
// possible values: 'dots', 'progress', 'junit'
|
34
|
+
reporters = ['progress', 'coverage'];
|
35
|
+
|
36
|
+
|
37
|
+
// web server port
|
38
|
+
port = 9876;
|
39
|
+
|
40
|
+
|
41
|
+
// cli runner port
|
42
|
+
runnerPort = 9100;
|
43
|
+
|
44
|
+
|
45
|
+
// enable / disable colors in the output (reporters and logs)
|
46
|
+
colors = true;
|
47
|
+
|
48
|
+
|
49
|
+
// level of logging
|
50
|
+
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
|
51
|
+
logLevel = LOG_INFO;
|
52
|
+
|
53
|
+
|
54
|
+
// enable / disable watching file and executing tests whenever any file changes
|
55
|
+
autoWatch = true;
|
56
|
+
|
57
|
+
|
58
|
+
// Start these browsers, currently available:
|
59
|
+
// - Chrome
|
60
|
+
// - ChromeCanary
|
61
|
+
// - Firefox
|
62
|
+
// - Opera
|
63
|
+
// - Safari (only Mac)
|
64
|
+
// - PhantomJS
|
65
|
+
// - IE (only Windows)
|
66
|
+
browsers = ['Chrome'];
|
67
|
+
|
68
|
+
|
69
|
+
// If browser does not capture in given timeout [ms], kill it
|
70
|
+
captureTimeout = 600000;
|
71
|
+
|
72
|
+
|
73
|
+
// Continuous Integration mode
|
74
|
+
// if true, it capture browsers, run tests and exit
|
75
|
+
singleRun = false;
|
76
|
+
|
77
|
+
// Coverage preprocessors
|
78
|
+
preprocessors = {
|
79
|
+
'**/lib/*.js': 'coverage'
|
80
|
+
};
|
81
|
+
|
82
|
+
// Converage configuration
|
83
|
+
coverageReporter = {
|
84
|
+
type : 'html',
|
85
|
+
dir : 'spec/coverage'
|
86
|
+
}
|
@@ -50,13 +50,13 @@ plural = {
|
|
50
50
|
},
|
51
51
|
push: Array.prototype.push,
|
52
52
|
length: 0,
|
53
|
-
json: function() {
|
53
|
+
json: function(methods, omissions) {
|
54
54
|
var record, _i, _len, _results;
|
55
55
|
|
56
56
|
_results = [];
|
57
57
|
for (_i = 0, _len = this.length; _i < _len; _i++) {
|
58
58
|
record = this[_i];
|
59
|
-
_results.push(record.json());
|
59
|
+
_results.push(record.json(methods, omissions));
|
60
60
|
}
|
61
61
|
return _results;
|
62
62
|
}
|
@@ -109,21 +109,21 @@ associable = {
|
|
109
109
|
update_association: function(data) {
|
110
110
|
var associated, association, association_name, id, pluralized_association, _i, _j, _len, _len1, _ref;
|
111
111
|
|
112
|
-
id = this._id || data._id || data.id;
|
112
|
+
id = this._id || data && (data._id || data.id);
|
113
113
|
if (!id) {
|
114
114
|
return;
|
115
115
|
}
|
116
|
-
_ref = model[this.resource].has_many;
|
116
|
+
_ref = model[this.resource.toString()].has_many;
|
117
117
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
118
118
|
association_name = _ref[_i];
|
119
119
|
pluralized_association = model.pluralize(association_name);
|
120
120
|
association = this[pluralized_association];
|
121
121
|
if (!association.route) {
|
122
|
-
association.route = "/" + (model.pluralize(this.resource)) + "/" + id + "/" + (model.pluralize(association.resource));
|
122
|
+
association.route = "/" + (model.pluralize(this.resource.toString())) + "/" + id + "/" + (model.pluralize(association.resource));
|
123
123
|
for (_j = 0, _len1 = association.length; _j < _len1; _j++) {
|
124
124
|
associated = association[_j];
|
125
125
|
if (!associated.route && (associated.parent != null)) {
|
126
|
-
associated.route = "/" + (model.pluralize(this.resource)) + "/" + id + "/" + (model.pluralize(association.resource));
|
126
|
+
associated.route = "/" + (model.pluralize(this.resource.toString())) + "/" + id + "/" + (model.pluralize(association.resource));
|
127
127
|
}
|
128
128
|
}
|
129
129
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -2,6 +2,8 @@ var model, resource, resourceable, stampit;
|
|
2
2
|
|
3
3
|
stampit = require('../../vendor/stampit');
|
4
4
|
|
5
|
+
require('../../vendor/owl/pluralize');
|
6
|
+
|
5
7
|
resource = stampit({
|
6
8
|
toString: function() {
|
7
9
|
return this.name;
|
@@ -11,17 +13,25 @@ resource = stampit({
|
|
11
13
|
scope: null,
|
12
14
|
singular: false
|
13
15
|
}, function() {
|
16
|
+
var _base;
|
17
|
+
|
18
|
+
if (this.original_reference) {
|
19
|
+
stampit.mixIn(this.original_reference, this);
|
20
|
+
this.original_reference.toString = this.toString;
|
21
|
+
(_base = this.original_reference).param_name || (_base.param_name = this.name);
|
22
|
+
return this.original_reference;
|
23
|
+
}
|
14
24
|
this.param_name || (this.param_name = this.name);
|
15
25
|
return this;
|
16
26
|
});
|
17
27
|
|
18
28
|
resourceable = {
|
19
|
-
pluralize: function(word) {
|
29
|
+
pluralize: function(word, count, plural) {
|
20
30
|
if (!(word && word.length)) {
|
21
31
|
throw new TypeError("Invalid string passed to pluralize '" + word + "'");
|
22
32
|
}
|
23
33
|
if (word.indexOf('s') !== word.length - 1) {
|
24
|
-
return word
|
34
|
+
return owl.pluralize(word, count, plural);
|
25
35
|
} else {
|
26
36
|
return word;
|
27
37
|
}
|
@@ -30,7 +40,7 @@ resourceable = {
|
|
30
40
|
if (!(word && word.length)) {
|
31
41
|
throw new TypeError("Invalid string passed to singularize '" + word + "'");
|
32
42
|
}
|
33
|
-
if (word.
|
43
|
+
if (word.lastIndexOf('s') === word.length - 1) {
|
34
44
|
return word.substring(0, word.length - 1);
|
35
45
|
} else {
|
36
46
|
return word;
|
@@ -84,6 +94,7 @@ resourceable = {
|
|
84
94
|
};
|
85
95
|
}
|
86
96
|
if (typeof this.resource === 'object') {
|
97
|
+
this.resource.original_reference = this.resource;
|
87
98
|
resource_definition = this.resource;
|
88
99
|
}
|
89
100
|
resource_definition.parent = this.parent_resource;
|
@@ -7,10 +7,13 @@ module.exports = {
|
|
7
7
|
return request.call(this, 'get', (this._id ? "" + this.route + "/" + this._id : this.route), data);
|
8
8
|
},
|
9
9
|
put: function(data) {
|
10
|
-
return request.call(this, 'put', "" + this.route + "/" + this._id, data);
|
10
|
+
return request.call(this, 'put', (this._id ? "" + this.route + "/" + this._id : this.route), data);
|
11
11
|
},
|
12
12
|
post: function(data) {
|
13
13
|
return request.call(this, 'post', this.route, data);
|
14
|
+
},
|
15
|
+
"delete": function(data) {
|
16
|
+
return request.call(this, 'delete', this.route, data);
|
14
17
|
}
|
15
18
|
};
|
16
19
|
|
@@ -22,9 +25,9 @@ request = function(method, url, data) {
|
|
22
25
|
data = {};
|
23
26
|
data[param_name] = this.json();
|
24
27
|
}
|
25
|
-
if (data[param_name]) {
|
26
|
-
delete data[param_name]
|
27
|
-
delete data[param_name]
|
28
|
+
if (data && data[param_name]) {
|
29
|
+
delete data[param_name]['id'];
|
30
|
+
delete data[param_name]['_id'];
|
28
31
|
}
|
29
32
|
return $.ajax({
|
30
33
|
url: url,
|
@@ -29,7 +29,7 @@ util = {
|
|
29
29
|
restful = {
|
30
30
|
model: {
|
31
31
|
create: function() {
|
32
|
-
var attributes, callback, params, record, _i, _j, _len
|
32
|
+
var attributes, callback, params, record, savings, _i, _j, _len;
|
33
33
|
|
34
34
|
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), callback = arguments[_i++];
|
35
35
|
if (!arguments.length) {
|
@@ -37,18 +37,19 @@ restful = {
|
|
37
37
|
}
|
38
38
|
if (typeof callback !== 'function') {
|
39
39
|
params.push(callback);
|
40
|
+
callback = void 0;
|
40
41
|
}
|
41
42
|
if (!params.length) {
|
42
43
|
params.unshift({});
|
43
44
|
}
|
44
|
-
|
45
|
+
savings = [];
|
45
46
|
for (_j = 0, _len = params.length; _j < _len; _j++) {
|
46
47
|
attributes = params[_j];
|
47
48
|
record = this(attributes);
|
48
49
|
record.dirty = true;
|
49
|
-
|
50
|
+
savings.push(record.save(callback));
|
50
51
|
}
|
51
|
-
return
|
52
|
+
return $.when.apply($, savings);
|
52
53
|
},
|
53
54
|
all: function(conditions, callback) {
|
54
55
|
if (conditions == null) {
|
@@ -92,7 +93,8 @@ restful = {
|
|
92
93
|
promise = rest.get.call(this, data);
|
93
94
|
route = old_route;
|
94
95
|
return promise;
|
95
|
-
}
|
96
|
+
},
|
97
|
+
put: rest.put
|
96
98
|
},
|
97
99
|
record: {
|
98
100
|
reload: function() {
|
@@ -159,20 +161,43 @@ restful = {
|
|
159
161
|
}
|
160
162
|
return _results;
|
161
163
|
},
|
162
|
-
|
164
|
+
destroy: function(doned, failed, data) {
|
163
165
|
var promise;
|
164
166
|
|
165
|
-
if (!this.
|
166
|
-
|
167
|
+
if (!((this.id != null) || (this._id != null))) {
|
168
|
+
throw new Error('Can\'t delete record without id!');
|
167
169
|
}
|
168
|
-
promise = rest[
|
169
|
-
promise.done(this.
|
170
|
+
promise = rest["delete"].call(this, data);
|
171
|
+
promise.done(this.destroyed);
|
170
172
|
promise.fail(this.failed);
|
171
173
|
promise.done(doned);
|
172
174
|
promise.fail(failed);
|
173
|
-
this.lock = JSON.stringify(this.json());
|
174
175
|
return promise;
|
175
176
|
},
|
177
|
+
saving: false,
|
178
|
+
salvation: null,
|
179
|
+
save: function(doned, failed, data) {
|
180
|
+
var salvation;
|
181
|
+
|
182
|
+
if (this.saving) {
|
183
|
+
return this.salvation;
|
184
|
+
}
|
185
|
+
this.lock = JSON.stringify(this.json());
|
186
|
+
if (!this.dirty) {
|
187
|
+
salvation = $.Deferred().resolveWith(this, null);
|
188
|
+
}
|
189
|
+
salvation || (salvation = rest[this._id ? 'put' : 'post'].call(this, data));
|
190
|
+
this.salvation = salvation;
|
191
|
+
this.saving = true;
|
192
|
+
salvation.done(this.saved);
|
193
|
+
salvation.fail(this.failed);
|
194
|
+
salvation.always(function() {
|
195
|
+
return this.saving = false;
|
196
|
+
});
|
197
|
+
salvation.done(doned);
|
198
|
+
salvation.fail(failed);
|
199
|
+
return salvation;
|
200
|
+
},
|
176
201
|
saved: function(data) {
|
177
202
|
var callback, _i, _len, _ref, _results;
|
178
203
|
|
@@ -248,9 +273,12 @@ restful = {
|
|
248
273
|
serialized[this.resource] = this.json();
|
249
274
|
return JSON.stringify(serialized);
|
250
275
|
},
|
251
|
-
json: function() {
|
276
|
+
json: function(methods) {
|
252
277
|
var attribute, json, name, value, _i, _len, _ref;
|
253
278
|
|
279
|
+
if (methods == null) {
|
280
|
+
methods = {};
|
281
|
+
}
|
254
282
|
json = {};
|
255
283
|
for (name in this) {
|
256
284
|
value = this[name];
|
@@ -262,13 +290,13 @@ restful = {
|
|
262
290
|
}
|
263
291
|
if (type(value) === 'object') {
|
264
292
|
if (value.toJSON != null) {
|
265
|
-
json[name] = value.toJSON();
|
293
|
+
json[name] = value.toJSON(methods[name]);
|
266
294
|
} else {
|
267
295
|
_ref = this.nested_attributes;
|
268
296
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
269
297
|
attribute = _ref[_i];
|
270
298
|
if (attribute === name) {
|
271
|
-
json["" + name + "_attributes"] = value.json();
|
299
|
+
json["" + name + "_attributes"] = value.json(methods[name]);
|
272
300
|
}
|
273
301
|
}
|
274
302
|
}
|
@@ -284,11 +312,13 @@ restful = {
|
|
284
312
|
delete json.after_initialize;
|
285
313
|
delete json.parent_resource;
|
286
314
|
delete json.nested_attributes;
|
287
|
-
delete json.
|
315
|
+
delete json.saving;
|
316
|
+
delete json.salvation;
|
288
317
|
delete json.element;
|
289
318
|
delete json["default"];
|
290
319
|
delete json.lock;
|
291
320
|
delete json.validated;
|
321
|
+
delete json.validation;
|
292
322
|
return json;
|
293
323
|
}
|
294
324
|
}
|
@@ -43,12 +43,18 @@ scopable = {
|
|
43
43
|
fail: [],
|
44
44
|
declared: [],
|
45
45
|
fetch: function(data, done, fail) {
|
46
|
-
var
|
46
|
+
var deferred, scope;
|
47
47
|
|
48
48
|
scope = extend({}, this.scope.data);
|
49
|
-
|
49
|
+
if (scope.noned != null) {
|
50
|
+
deferred = $.Deferred();
|
51
|
+
deferred.resolveWith(this, [[]]);
|
52
|
+
} else {
|
53
|
+
deferred = rest.get.call(this, extend(scope, data));
|
54
|
+
}
|
55
|
+
deferred.done(this.scope.then.concat(done)).fail([this.scope.fail, fail]);
|
50
56
|
this.scope.clear();
|
51
|
-
return
|
57
|
+
return deferred;
|
52
58
|
},
|
53
59
|
clear: function() {
|
54
60
|
this.data = {};
|
@@ -84,6 +90,10 @@ scopable = {
|
|
84
90
|
}
|
85
91
|
},
|
86
92
|
model: {
|
93
|
+
none: function() {
|
94
|
+
this.scope.data.noned = true;
|
95
|
+
return this;
|
96
|
+
},
|
87
97
|
fetch: function(data, done, fail) {
|
88
98
|
return this.scope.fetch.call(this, data, done, fail);
|
89
99
|
},
|
@@ -22,16 +22,21 @@ messages = {
|
|
22
22
|
confirmation: function(attribute_name) {
|
23
23
|
var confirmation_attribute_name;
|
24
24
|
|
25
|
-
confirmation_attribute_name = this.human_attribute_name(
|
26
|
-
attribute_name = this.human_attribute_name(attribute_name);
|
27
|
-
return "O campo " + attribute_name + " não está
|
25
|
+
confirmation_attribute_name = this.human_attribute_name(attribute_name);
|
26
|
+
attribute_name = this.human_attribute_name(attribute_name.replace('_confirmation', ''));
|
27
|
+
return "O campo " + attribute_name + " não está de acordo com o campo " + confirmation_attribute_name + ".";
|
28
28
|
},
|
29
29
|
associated: function(attribute_name) {
|
30
30
|
attribute_name = this.human_attribute_name(attribute_name);
|
31
|
-
return "O registro associado " + attribute_name + " não é válido";
|
31
|
+
return "O registro associado " + attribute_name + " não é válido.";
|
32
32
|
},
|
33
33
|
server: function(attribute_name, options) {
|
34
|
-
|
34
|
+
attribute_name = this.human_attribute_name(attribute_name);
|
35
|
+
return "" + attribute_name + " " + options.server_message + ".";
|
36
|
+
},
|
37
|
+
type: function(attribute_name, options) {
|
38
|
+
attribute_name = this.human_attribute_name(attribute_name);
|
39
|
+
return "O campo " + attribute_name + " não está válido.";
|
35
40
|
}
|
36
41
|
};
|
37
42
|
|
@@ -64,8 +69,11 @@ errorsable = stampit({
|
|
64
69
|
splice: Array.prototype.splice
|
65
70
|
}, {
|
66
71
|
model: null,
|
67
|
-
messages:
|
72
|
+
messages: null,
|
68
73
|
length: 0
|
74
|
+
}, function() {
|
75
|
+
this.messages = {};
|
76
|
+
return this;
|
69
77
|
});
|
70
78
|
|
71
79
|
initializers = {
|
@@ -100,6 +108,7 @@ initializers = {
|
|
100
108
|
create_validators: function(definitions) {
|
101
109
|
var definition, name, validator, validator_options, _ref, _results;
|
102
110
|
|
111
|
+
this.validators = [];
|
103
112
|
_ref = manager.validators;
|
104
113
|
_results = [];
|
105
114
|
for (name in _ref) {
|
@@ -136,7 +145,7 @@ initializers = {
|
|
136
145
|
|
137
146
|
extensions = {
|
138
147
|
model: {
|
139
|
-
validators:
|
148
|
+
validators: null
|
140
149
|
},
|
141
150
|
record: {
|
142
151
|
validate_attribute: function(attribute, doned, failed) {
|
@@ -144,7 +153,7 @@ extensions = {
|
|
144
153
|
|
145
154
|
this.errors.messages[attribute] = null;
|
146
155
|
results = [this, attribute];
|
147
|
-
_ref = model[this.resource].validators;
|
156
|
+
_ref = model[this.resource.toString()].validators;
|
148
157
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
149
158
|
validator = _ref[_i];
|
150
159
|
if (validator.attribute_name === attribute) {
|
@@ -164,7 +173,7 @@ extensions = {
|
|
164
173
|
}
|
165
174
|
this.errors.clear();
|
166
175
|
results = [this];
|
167
|
-
_ref = model[this.resource].validators;
|
176
|
+
_ref = model[this.resource.toString()].validators;
|
168
177
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
169
178
|
validator = _ref[_i];
|
170
179
|
results.push(validator.validate_each(this, validator.attribute_name, this[validator.attribute_name]));
|
@@ -213,4 +222,6 @@ require('./validations/presence');
|
|
213
222
|
|
214
223
|
require('./validations/remote');
|
215
224
|
|
225
|
+
require('./validations/type');
|
226
|
+
|
216
227
|
require('./validations/cpf');
|
@@ -7,7 +7,7 @@ stampit = require('../../../vendor/stampit');
|
|
7
7
|
confirmationable = stampit({
|
8
8
|
validate_each: function(record, attribute, value) {
|
9
9
|
if (record[attribute] !== record["" + attribute + "_confirmation"]) {
|
10
|
-
return record.errors.add(attribute, 'confirmation', this.options);
|
10
|
+
return record.errors.add("" + attribute + "_confirmation", 'confirmation', this.options);
|
11
11
|
}
|
12
12
|
}
|
13
13
|
});
|