brainstem-js 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/.gitignore +8 -0
  2. data/.pairs +21 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.tm_properties +1 -0
  6. data/.travis.yml +12 -0
  7. data/Assetfile +79 -0
  8. data/Gemfile +6 -0
  9. data/Gemfile.lock +50 -0
  10. data/LICENSE.txt +22 -0
  11. data/README.md +143 -0
  12. data/Rakefile +25 -0
  13. data/brainstemjs.gemspec +24 -0
  14. data/lib/brainstem/js/engine.rb +5 -0
  15. data/lib/brainstem/js/version.rb +5 -0
  16. data/lib/brainstem/js.rb +10 -0
  17. data/spec/brainstem-collection-spec.coffee +141 -0
  18. data/spec/brainstem-model-spec.coffee +283 -0
  19. data/spec/brainstem-sync-spec.coffee +22 -0
  20. data/spec/brainstem-utils-spec.coffee +12 -0
  21. data/spec/brianstem-expectation-spec.coffee +209 -0
  22. data/spec/helpers/builders.coffee +80 -0
  23. data/spec/helpers/jquery-matchers.js +137 -0
  24. data/spec/helpers/models/post.coffee +14 -0
  25. data/spec/helpers/models/project.coffee +13 -0
  26. data/spec/helpers/models/task.coffee +14 -0
  27. data/spec/helpers/models/time-entry.coffee +13 -0
  28. data/spec/helpers/models/user.coffee +8 -0
  29. data/spec/helpers/spec-helper.coffee +79 -0
  30. data/spec/storage-manager-spec.coffee +613 -0
  31. data/spec/support/.DS_Store +0 -0
  32. data/spec/support/console-runner.js +103 -0
  33. data/spec/support/headless.coffee +47 -0
  34. data/spec/support/headless.html +60 -0
  35. data/spec/support/runner.html +85 -0
  36. data/spec/vendor/backbone-factory.js +62 -0
  37. data/spec/vendor/backbone.js +1571 -0
  38. data/spec/vendor/inflection.js +448 -0
  39. data/spec/vendor/jquery-1.7.js +9300 -0
  40. data/spec/vendor/jquery.cookie.js +47 -0
  41. data/spec/vendor/minispade.js +67 -0
  42. data/spec/vendor/sinon-1.3.4.js +3561 -0
  43. data/spec/vendor/underscore.js +1221 -0
  44. data/vendor/assets/.DS_Store +0 -0
  45. data/vendor/assets/javascripts/.DS_Store +0 -0
  46. data/vendor/assets/javascripts/brainstem/brainstem-collection.coffee +53 -0
  47. data/vendor/assets/javascripts/brainstem/brainstem-expectation.coffee +65 -0
  48. data/vendor/assets/javascripts/brainstem/brainstem-inflections.js +449 -0
  49. data/vendor/assets/javascripts/brainstem/brainstem-model.coffee +141 -0
  50. data/vendor/assets/javascripts/brainstem/brainstem-sync.coffee +76 -0
  51. data/vendor/assets/javascripts/brainstem/index.js +1 -0
  52. data/vendor/assets/javascripts/brainstem/iso8601.js +41 -0
  53. data/vendor/assets/javascripts/brainstem/loading-mixin.coffee +13 -0
  54. data/vendor/assets/javascripts/brainstem/storage-manager.coffee +275 -0
  55. data/vendor/assets/javascripts/brainstem/utils.coffee +35 -0
  56. metadata +198 -0
@@ -0,0 +1,47 @@
1
+ /*!
2
+ * jQuery Cookie Plugin
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2011, Klaus Hartl
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.opensource.org/licenses/GPL-2.0
9
+ */
10
+ (function($) {
11
+ $.cookie = function(key, value, options) {
12
+
13
+ // key and at least value given, set cookie...
14
+ if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
15
+ options = $.extend({}, options);
16
+
17
+ if (value === null || value === undefined) {
18
+ options.expires = -1;
19
+ }
20
+
21
+ if (typeof options.expires === 'number') {
22
+ var days = options.expires, t = options.expires = new Date();
23
+ t.setDate(t.getDate() + days);
24
+ }
25
+
26
+ value = String(value);
27
+
28
+ return (document.cookie = [
29
+ encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
30
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
31
+ options.path ? '; path=' + options.path : '',
32
+ options.domain ? '; domain=' + options.domain : '',
33
+ options.secure ? '; secure' : ''
34
+ ].join(''));
35
+ }
36
+
37
+ // key and possibly options given, get cookie...
38
+ options = value || {};
39
+ var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
40
+
41
+ var pairs = document.cookie.split('; ');
42
+ for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
43
+ if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
44
+ }
45
+ return null;
46
+ };
47
+ })(jQuery);
@@ -0,0 +1,67 @@
1
+ /*jshint evil:true*/
2
+
3
+ if (typeof document !== "undefined") {
4
+ (function() {
5
+ minispade = {
6
+ root: null,
7
+ modules: {},
8
+ loaded: {},
9
+
10
+ globalEval: function(data) {
11
+ if ( data ) {
12
+ // We use execScript on Internet Explorer
13
+ // We use an anonymous function so that context is window
14
+ // rather than jQuery in Firefox
15
+ ( window.execScript || function( data ) {
16
+ window[ "eval" ].call( window, data );
17
+ } )( data );
18
+ }
19
+ },
20
+
21
+ requireModule: function(name) {
22
+ var loaded = minispade.loaded[name];
23
+ var mod = minispade.modules[name];
24
+
25
+ if (!loaded) {
26
+ if (mod) {
27
+ minispade.loaded[name] = true;
28
+
29
+ if (typeof mod === "string") {
30
+ this.globalEval(mod);
31
+ } else {
32
+ mod();
33
+ }
34
+ } else {
35
+ if (minispade.root && name.substr(0,minispade.root.length) !== minispade.root) {
36
+ return minispade.requireModule(minispade.root+name);
37
+ } else {
38
+ throw "The module '" + name + "' could not be found";
39
+ }
40
+ }
41
+ }
42
+
43
+ return loaded;
44
+ },
45
+
46
+ requireAll: function(regex) {
47
+ for (var module in this.modules) {
48
+ if (!this.modules.hasOwnProperty(module)) { continue; }
49
+ if (regex && !regex.test(module)) { continue; }
50
+ minispade.requireModule(module);
51
+ }
52
+ },
53
+
54
+ require: function(path) {
55
+ if (typeof path === 'string') {
56
+ minispade.requireModule(path);
57
+ } else {
58
+ minispade.requireAll(path);
59
+ }
60
+ },
61
+
62
+ register: function(name, callback) {
63
+ minispade.modules[name] = callback;
64
+ }
65
+ };
66
+ })();
67
+ }