dolt 0.16.0 → 0.17.0

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.
@@ -0,0 +1,71 @@
1
+ /*global gts, cull, dome*/
2
+ function uinitLogger(app, level) {
3
+ if (typeof level === "string") {
4
+ level = uinitLogger.levels.indexOf((level || "info").toLowerCase());
5
+ }
6
+
7
+ if (typeof level !== "number") {
8
+ level = uinitLogger.DEBUG;
9
+ }
10
+
11
+ if (level <= uinitLogger.INFO) {
12
+ app.on("init", function () {
13
+ console.log("===========================");
14
+ console.log("Attempting to load features");
15
+ console.log("===========================");
16
+ });
17
+ }
18
+
19
+ if (level <= uinitLogger.DEBUG) {
20
+ app.on("loading", function (feature) {
21
+ console.log("[Loading:", feature.name + "]");
22
+ });
23
+ }
24
+
25
+ if (level <= uinitLogger.INFO) {
26
+ app.on("pending", function (feature) {
27
+ var reason, waitingFor = cull.map(cull.prop("name"), cull.select(function (f) {
28
+ return !f.loaded;
29
+ }, feature.dependencies()));
30
+
31
+ if (waitingFor.length > 0) {
32
+ reason = "Waiting for ";
33
+ reason += waitingFor.length === 1 ? "dependency" : "dependencies";
34
+ reason += " [" + waitingFor.join(", ") + "]";
35
+ }
36
+
37
+ if (!reason && feature.elements) {
38
+ if (dome.byClass(feature.elements).length === 0) {
39
+ reason = "No matching elements for selector ." + feature.elements;
40
+ }
41
+ }
42
+
43
+ if (!reason && !feature.nullable) {
44
+ reason = "Feature produced null/undefined but is not nullable";
45
+ }
46
+
47
+ console.log("[Pending:", feature.name + "]", reason);
48
+ });
49
+ }
50
+
51
+ if (level <= uinitLogger.INFO) {
52
+ app.on("loaded", function (feature, result) {
53
+ console.log("[Load:", feature.name + "] =>", result);
54
+ });
55
+ }
56
+
57
+ if (level <= uinitLogger.ERROR) {
58
+ app.on("error", function (feature, err) {
59
+ console.log("Error while loading", feature.name);
60
+ console.log(" " + err.stack);
61
+ });
62
+ }
63
+ }
64
+
65
+ uinitLogger.levels = ["debug", "info", "warn", "error"];
66
+
67
+ cull.doall(function (level, i) {
68
+ uinitLogger[level.toUpperCase()] = i;
69
+ }, uinitLogger.levels);
70
+
71
+ uinitLogger(this.gts.app, uinitLogger.INFO);
@@ -1,6 +1,7 @@
1
+ /*global gts*/
1
2
  buster.testCase("Ref selector", {
2
3
  "returns div": function () {
3
- var element = gts.refSelector({});
4
+ var element = gts.refSelector.build({});
4
5
 
5
6
  assert.tagName(element, "div");
6
7
  assert.className(element, "dropdown");
@@ -8,7 +9,7 @@ buster.testCase("Ref selector", {
8
9
  },
9
10
 
10
11
  "includes link to current branch by ref": function () {
11
- var element = gts.refSelector({
12
+ var element = gts.refSelector.build({
12
13
  heads: [["master", "0123456"]]
13
14
  }, "0123456");
14
15
  var a = element.firstChild;
@@ -21,7 +22,7 @@ buster.testCase("Ref selector", {
21
22
  },
22
23
 
23
24
  "includes link to current branch by name": function () {
24
- var element = gts.refSelector({
25
+ var element = gts.refSelector.build({
25
26
  heads: [["master", "0123456"]]
26
27
  }, "master");
27
28
  var a = element.firstChild;
@@ -34,7 +35,7 @@ buster.testCase("Ref selector", {
34
35
  },
35
36
 
36
37
  "includes link to current tag": function () {
37
- var element = gts.refSelector({
38
+ var element = gts.refSelector.build({
38
39
  tags: [["v2.1.0", "1234567"]]
39
40
  }, "1234567");
40
41
 
@@ -42,7 +43,7 @@ buster.testCase("Ref selector", {
42
43
  },
43
44
 
44
45
  "includes link to current ref": function () {
45
- var element = gts.refSelector({
46
+ var element = gts.refSelector.build({
46
47
  tags: [["v2.1.0", "1234567"]]
47
48
  }, "aabbcc4");
48
49
 
@@ -50,21 +51,21 @@ buster.testCase("Ref selector", {
50
51
  },
51
52
 
52
53
  "includes list of refs": function () {
53
- var element = gts.refSelector({});
54
+ var element = gts.refSelector.build({});
54
55
 
55
56
  assert.tagName(element.childNodes[1], "ul");
56
57
  assert.className(element.childNodes[1], "dropdown-menu");
57
58
  },
58
59
 
59
60
  "includes ref input": function () {
60
- var list = gts.refSelector({}).childNodes[1];
61
+ var list = gts.refSelector.build({}).childNodes[1];
61
62
 
62
63
  assert.className(list.firstChild, "gts-dropdown-input");
63
64
  assert.match(list.firstChild.innerHTML, "Enter ref:");
64
65
  },
65
66
 
66
67
  "links all heads": function () {
67
- var element = gts.refSelector({
68
+ var element = gts.refSelector.build({
68
69
  heads: [["libgit2", "1234567"], ["master", "2345678"]],
69
70
  tags: [["v2.1.0", "34565789"], ["v2.1.1", "45657890"]]
70
71
  }, "2345678");
@@ -77,7 +78,7 @@ buster.testCase("Ref selector", {
77
78
  },
78
79
 
79
80
  "links all tags": function () {
80
- var element = gts.refSelector({
81
+ var element = gts.refSelector.build({
81
82
  heads: ["libgit2", "master"],
82
83
  tags: [["v2.1.0", "1234567"], ["v2.1.1", "2345678"]]
83
84
  }, "2345678");
@@ -90,7 +91,7 @@ buster.testCase("Ref selector", {
90
91
  },
91
92
 
92
93
  "sorts refs alpha-numerically": function () {
93
- var element = gts.refSelector({
94
+ var element = gts.refSelector.build({
94
95
  "heads": [["feature-B", "1234567"],
95
96
  ["master", "2345678"],
96
97
  ["feature-A", "3456789"]],
@@ -114,7 +115,7 @@ buster.testCase("Ref selector", {
114
115
  // Since switching from jQuery to Dome, this test no longer works,
115
116
  // as it's not possible(?) to fake the stopPropagation method.
116
117
  // Not sure how to solve
117
- var element = gts.refSelector({
118
+ var element = gts.refSelector.build({
118
119
  heads: [["libgit2", "1234567"], ["master", "2345678"]],
119
120
  tags: [["v2.1.0", "34565789"], ["v2.1.1", "45657890"]]
120
121
  }, "2345678");
@@ -127,7 +128,7 @@ buster.testCase("Ref selector", {
127
128
  },
128
129
 
129
130
  "uses URL template to generate links": function () {
130
- var element = gts.refSelector({
131
+ var element = gts.refSelector.build({
131
132
  heads: [["libgit2", "1234567"], ["master", "2345678"]],
132
133
  tags: [["v2.1.0", "34565789"], ["v2.1.1", "45657890"]]
133
134
  }, "2345678", "/dolt/#{ref}:");
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "buster": "~0.6",
18
- "buster-html-doc": "*"
18
+ "buster-html-doc": "*",
19
+ "uglify-js": "~1.3"
19
20
  }
20
21
  }
metadata CHANGED
@@ -1,40 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolt
3
3
  version: !ruby/object:Gem::Version
4
+ version: 0.17.0
4
5
  prerelease:
5
- version: 0.16.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Johansen
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-12 00:00:00.000000000 Z
12
+ date: 2013-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- type: :runtime
15
+ name: libdolt
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0.19'
21
+ version: '0.20'
22
+ type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - ~>
27
28
  - !ruby/object:Gem::Version
28
- version: '0.19'
29
- name: libdolt
29
+ version: '0.20'
30
30
  - !ruby/object:Gem::Dependency
31
- type: :runtime
31
+ name: thin
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
37
  version: '1.4'
38
+ type: :runtime
38
39
  prerelease: false
39
40
  version_requirements: !ruby/object:Gem::Requirement
40
41
  none: false
@@ -42,15 +43,15 @@ dependencies:
42
43
  - - ~>
43
44
  - !ruby/object:Gem::Version
44
45
  version: '1.4'
45
- name: thin
46
46
  - !ruby/object:Gem::Dependency
47
- type: :runtime
47
+ name: sinatra
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
53
  version: '1.0'
54
+ type: :runtime
54
55
  prerelease: false
55
56
  version_requirements: !ruby/object:Gem::Requirement
56
57
  none: false
@@ -58,15 +59,15 @@ dependencies:
58
59
  - - ~>
59
60
  - !ruby/object:Gem::Version
60
61
  version: '1.0'
61
- name: sinatra
62
62
  - !ruby/object:Gem::Dependency
63
- type: :runtime
63
+ name: tiltout
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.4'
70
+ type: :runtime
70
71
  prerelease: false
71
72
  version_requirements: !ruby/object:Gem::Requirement
72
73
  none: false
@@ -74,15 +75,15 @@ dependencies:
74
75
  - - ~>
75
76
  - !ruby/object:Gem::Version
76
77
  version: '1.4'
77
- name: tiltout
78
78
  - !ruby/object:Gem::Dependency
79
- type: :runtime
79
+ name: json
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
85
  version: '1.5'
86
+ type: :runtime
86
87
  prerelease: false
87
88
  version_requirements: !ruby/object:Gem::Requirement
88
89
  none: false
@@ -90,15 +91,15 @@ dependencies:
90
91
  - - ~>
91
92
  - !ruby/object:Gem::Version
92
93
  version: '1.5'
93
- name: json
94
94
  - !ruby/object:Gem::Dependency
95
- type: :runtime
95
+ name: main
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
101
  version: '5.2'
102
+ type: :runtime
102
103
  prerelease: false
103
104
  version_requirements: !ruby/object:Gem::Requirement
104
105
  none: false
@@ -106,15 +107,15 @@ dependencies:
106
107
  - - ~>
107
108
  - !ruby/object:Gem::Version
108
109
  version: '5.2'
109
- name: main
110
110
  - !ruby/object:Gem::Dependency
111
- type: :development
111
+ name: minitest
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '2.0'
118
+ type: :development
118
119
  prerelease: false
119
120
  version_requirements: !ruby/object:Gem::Requirement
120
121
  none: false
@@ -122,15 +123,15 @@ dependencies:
122
123
  - - ~>
123
124
  - !ruby/object:Gem::Version
124
125
  version: '2.0'
125
- name: minitest
126
126
  - !ruby/object:Gem::Dependency
127
- type: :development
127
+ name: rake
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0.9'
134
+ type: :development
134
135
  prerelease: false
135
136
  version_requirements: !ruby/object:Gem::Requirement
136
137
  none: false
@@ -138,15 +139,15 @@ dependencies:
138
139
  - - ~>
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0.9'
141
- name: rake
142
142
  - !ruby/object:Gem::Dependency
143
- type: :development
143
+ name: rack-test
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
147
147
  - - ~>
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0.6'
150
+ type: :development
150
151
  prerelease: false
151
152
  version_requirements: !ruby/object:Gem::Requirement
152
153
  none: false
@@ -154,7 +155,6 @@ dependencies:
154
155
  - - ~>
155
156
  - !ruby/object:Gem::Version
156
157
  version: '0.6'
157
- name: rack-test
158
158
  description: Dolt serves git trees and syntax highlighted blobs
159
159
  email:
160
160
  - christian@gitorious.org
@@ -184,23 +184,31 @@ files:
184
184
  - vendor/ui/build
185
185
  - vendor/ui/buster.js
186
186
  - vendor/ui/css/gitorious.css
187
- - vendor/ui/css/pygments.css
188
- - vendor/ui/dist/gts-ui-deps.js
187
+ - vendor/ui/css/syntax-highlight.css
188
+ - vendor/ui/dist/gitorious3.min.css
189
+ - vendor/ui/dist/gitorious3.min.js
189
190
  - vendor/ui/iconic/lock_stroke.svg
190
191
  - vendor/ui/images/f5f5f5-980x1.png
191
192
  - vendor/ui/images/gitorious.png
193
+ - vendor/ui/images/gitorious2013.png
192
194
  - vendor/ui/images/powered-by.png
193
195
  - vendor/ui/images/white-980x1.png
194
196
  - vendor/ui/js/src/app.js
195
197
  - vendor/ui/js/src/components/abbrev.js
198
+ - vendor/ui/js/src/components/blob.js
199
+ - vendor/ui/js/src/components/clone-url-selection.js
196
200
  - vendor/ui/js/src/components/commit-linker.js
201
+ - vendor/ui/js/src/components/dropdown.js
202
+ - vendor/ui/js/src/components/ganalytics.js
203
+ - vendor/ui/js/src/components/live-markdown-preview.js
197
204
  - vendor/ui/js/src/components/profile-menu.js
198
205
  - vendor/ui/js/src/components/ref-selector.js
199
206
  - vendor/ui/js/src/components/tree-history.js
200
207
  - vendor/ui/js/src/components/url.js
208
+ - vendor/ui/js/src/components/user-repo-view-state.js
201
209
  - vendor/ui/js/src/gitorious.js
210
+ - vendor/ui/js/src/logger.js
202
211
  - vendor/ui/js/test-libs/jquery-1.9.1.min.js
203
- - vendor/ui/js/test/app-test.js
204
212
  - vendor/ui/js/test/components/abbrev-test.js
205
213
  - vendor/ui/js/test/components/commit-linker-test.js
206
214
  - vendor/ui/js/test/components/profile-menu-test.js
@@ -240,3 +248,4 @@ signing_key:
240
248
  specification_version: 3
241
249
  summary: Dolt serves git trees and syntax highlighted blobs
242
250
  test_files: []
251
+ has_rdoc:
@@ -1 +0,0 @@
1
- var cull=function(a){function d(a){return!!a&&typeof a=="object"&&typeof a.length=="number"&&!a.tagName}function e(a){return c.call(a)==="[object Array]"?a:d(a)?b.call(a):typeof a=="undefined"||a===null?[]:b.call(arguments)}function f(a,b){var c,d;for(c=0,d=b.length;c<d;++c)a(b[c],c,b)}function g(a){return typeof a=="function"}function h(a,b,c){var d=0,e,f=c,g=b;arguments.length===2&&(f=b,g=f[0],d=1),typeof f=="string"&&(f=f.split(""));for(e=f.length;d<e;++d)g=a(g,f[d]);return g}function i(a,b){var c,d;for(c=0,d=b.length;c<d;++c)if(!a(b[c]))return!1;return!0}function j(a,b){var c,d;for(c=0,d=b.length;c<d;++c)if(a(b[c]))return!0;return!1}function k(a,b){var c,d,e,f;for(c=0,d=b.length;c<d;++c){a(b[c])?e=!0:f=!0;if(e&&f)return!0}return!1}function l(a){return a.trim&&a.trim()||a.replace(/^\s+|\s+$/,"")}function m(a){return a}function n(a){return typeof a!="undefined"&&a!==null}function o(a){return function(b){return a.call(this,b)}}function p(a){return function(b){return b[a]}}function q(a,b){return function(c){return c[a].apply(c,e(b))}}function r(a){return function(b){return a===b}}function t(a,b){var c=e(a);return function(){var a=c.length,d=arguments;while(a--)d=[c[a].apply(b||this,d)];return d[0]}}function u(){var a=arguments;return function(b){return b.apply(this,a)}}function v(a){var c=b.call(arguments,1);return function(){return a.apply(this,c.concat(b.call(arguments)))}}function w(a,c){var d=typeof c=="string"?a[c]:c,e=b.call(arguments,2);return function(){return d.apply(a,e.concat(b.call(arguments)))}}function x(a){var b=[],c,e;for(c=0,e=a.length;c<e;c++)b=b.concat(d(a[c])?x(a[c]):a[c]);return b}function y(a,b){var c,d;for(c=0,d=b.length;c<d;++c)if(a===b[c])return c;return-1}function z(a){var b=[],c,d;for(c=0,d=a.length;c<d;++c)y(a[c],b)<0&&b.push(a[c]);return b}function A(a,b){var c,d;for(c=0,d=b.length;c<d;++c)if(a(b[c]))return b[c]}function B(a,b){var c=[],d,e;for(d=0,e=b.length;d<e;++d)a(b[d])&&c.push(b[d]);return c}function C(a,b){return B(function(a){return y(a,b)<0},a)}function D(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push(b);return c}function E(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push(a[b]);return c}function G(a,b){var c=[],d,e;for(d=0,e=b.length;d<e;d++)c.push(a(b[d]));return c}function H(a){return function(){return!a.apply(this,arguments)}}function I(a,b){return B(H(a),b)}function J(a,b){return e(a).concat(e(b))}function K(a,b){var c=[],d,e;for(d=0,e=b.length;d<e;d+=a)c.push(b.slice(d,d+a));return c}function L(a,b){return F(G(a,F(b)))}function M(a,b){return h(J,G(a,b))}function N(a,b){var c=[],d,e;for(d=0,e=b.length;d<e;d+=1)c.push(b[d]),d<e-1&&c.push(a);return c}function O(a,c,d){var e=a[c];a[c]=function(){var a=e.apply(this,arguments),c=d.apply(this,[a].concat(b.call(arguments)));return typeof c!="undefined"?c:a}}function P(a,b,c){var d=a[b];a[b]=function(){return c.apply(this,arguments),d.apply(this,arguments)}}function Q(a,b,c){var d=v(c,a[b]);a[b]=function(){return d.apply(this,arguments)}}"use strict";var b=Array.prototype.slice,c=Object.prototype.toString,s="compose takes func|[funcs] and optional thisp object",F=v(B,n);return{trim:l,doall:f,reduce:h,all:i,some:j,onlySome:k,isFunction:g,isList:d,toList:e,identity:m,defined:n,unary:o,prop:p,func:q,eq:r,compose:t,callWith:u,partial:v,bind:w,keys:D,values:E,concat:J,flatten:x,uniq:z,first:A,select:B,negate:H,reject:I,seldef:F,map:G,mapdef:L,mapcat:M,partition:K,difference:C,interpose:N,indexOf:y,after:O,before:P,around:Q}}(this);typeof require=="function"&&typeof module!="undefined"&&(module.exports=cull)var dome=function(a){function b(c){if(a.isList(c))return a.flatten(a.map(b,c));var d=[],e=c.firstChild;while(e)e.nodeType===1&&d.push(e),e=e.nextSibling;return d}function c(a){return document.getElementById(a)}function d(b,d){d||(d=document);var e=function(b,e){if(/^#/.test(e))return b.concat(c(e.slice(1)));if(/^\./.test(e)){var f=e.slice(1);return a.concat(b,d.getElementsByClassName(f))}return a.concat(b,d.getElementsByTagName(e))};return a.uniq(a.reduce(e,[],a.toList(b)))}function e(a){a.parentNode.removeChild(a)}function f(a,b){var c=new RegExp("(^|\\s)"+a+"(\\s|$)");return c.test(b.className)}function g(b,c){if(a.isList(c))return a.doall(a.partial(g,b),c);if(f(b,c))return;c.className=a.trim(c.className+" "+b)}function h(b,c){if(a.isList(c))return a.doall(a.partial(h,b),c);if(!f(b,c))return;var d=new RegExp("(^|\\s)"+b+"(\\s|$)");c.className=a.trim(c.className.replace(d," "))}function i(a){var b=a.nodeType;if(b===1||b===9||b===11){if(typeof a.textContent=="string")return a.textContent;var c="";for(a=a.firstChild;a;a=a.nextSibling)c+=i(a);return c}return b===3||b===4?a.nodeValue:""}function j(b){var c=document.createDocumentFragment();return a.doall(a.bind(c,"appendChild"),a.toList(b)),c}function m(a,b){var c;a=a||{};for(c in a)a.hasOwnProperty(c)&&(b.setAttribute("data-"+c,a[c]),b["data-"+c]=a[c])}function n(a,b){return b.getAttribute("data-"+a)}function p(a,b){var c,d;a=a||{};for(c in a)a.hasOwnProperty(c)&&(d=o[c],d?d(b,a[c]):b[c]=a[c])}function q(b,c){b=a.toList(b);var d,e;for(d=0,e=b.length;d<e;++d)typeof b[d]=="string"?c.appendChild(document.createTextNode(b[d])):c.appendChild(b[d])}function r(a,b){b.innerHTML="",q(a,b)}var k,l=function(b){return b!==null&&typeof b!="undefined"&&(typeof b.nodeType!="undefined"||typeof b=="string"||a.isList(b))},o={style:function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c])},data:function(a,b){m(b,a)}};return k=function(a,b,c){if(!c&&l(b))return k(a,{},b);var d=document.createElement(a);return p(b,d),q(c||[],d),d},k.toString=function(){return"dome.el()"},a.doall(function(b){k[b]=a.partial(k,b)},["a","br","div","fieldset","form","h2","h3","h4","h5","img","input","label","li","p","span","strong","textarea","ul","span","select","option","ol","iframe","table","tr","td","pre","button","i"]),{propmap:o,el:k,setProp:p,append:q,setContent:r,children:b,id:c,get:d,remove:e,frag:j,text:i,data:{get:n,set:m},cn:{has:f,add:g,rm:h}}}(this.cull)!function(t,e,i){var o=["webkit","Moz","ms","O"],r={},n;function a(t,i){var o=e.createElement(t||"div"),r;for(r in i)o[r]=i[r];return o}function s(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var f=function(){var t=a("style",{type:"text/css"});s(e.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function l(t,e,i,o){var a=["opacity",e,~~(t*100),i,o].join("-"),s=.01+i/o*100,l=Math.max(1-(1-t)/e*(100-s),t),p=n.substring(0,n.indexOf("Animation")).toLowerCase(),u=p&&"-"+p+"-"||"";if(!r[a]){f.insertRule("@"+u+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+s+"%{opacity:"+t+"}"+(s+.01)+"%{opacity:1}"+(s+e)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",f.cssRules.length);r[a]=1}return a}function p(t,e){var r=t.style,n,a;if(r[e]!==i)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(a=0;a<o.length;a++){n=o[a]+e;if(r[n]!==i)return n}}function u(t,e){for(var i in e)t.style[p(t,i)||i]=e[i];return t}function c(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)if(t[r]===i)t[r]=o[r]}return t}function d(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}var h={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function m(t){if(!this.spin)return new m(t);this.opts=c(t||{},m.defaults,h)}m.defaults={};c(m.prototype,{spin:function(t){this.stop();var e=this,i=e.opts,o=e.el=u(a(0,{className:i.className}),{position:i.position,width:0,zIndex:i.zIndex}),r=i.radius+i.length+i.width,s,f;if(t){t.insertBefore(o,t.firstChild||null);f=d(t);s=d(o);u(o,{left:(i.left=="auto"?f.x-s.x+(t.offsetWidth>>1):parseInt(i.left,10)+r)+"px",top:(i.top=="auto"?f.y-s.y+(t.offsetHeight>>1):parseInt(i.top,10)+r)+"px"})}o.setAttribute("aria-role","progressbar");e.lines(o,e.opts);if(!n){var l=0,p=i.fps,c=p/i.speed,h=(1-i.opacity)/(c*i.trail/100),m=c/i.lines;(function y(){l++;for(var t=i.lines;t;t--){var r=Math.max(1-(l+t*m)%c*h,i.opacity);e.opacity(o,i.lines-t,r,i)}e.timeout=e.el&&setTimeout(y,~~(1e3/p))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=i}return this},lines:function(t,e){var i=0,o;function r(t,o){return u(a(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:o,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*i+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;i<e.lines;i++){o=u(a(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:n&&l(e.opacity,e.trail,i,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)s(o,u(r("#000","0 0 4px "+"#000"),{top:2+"px"}));s(t,s(o,r(e.color,"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});(function(){function t(t,e){return a("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}var e=u(a("group"),{behavior:"url(#default#VML)"});if(!p(e,"transform")&&e.adj){f.addRule(".spin-vml","behavior:url(#default#VML)");m.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function n(){return u(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",f=u(n(),{position:"absolute",top:a,left:a}),l;function p(e,r,a){s(f,s(u(n(),{rotation:360/i.lines*e+"deg",left:~~r}),s(u(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:i.color,opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(l=1;l<=i.lines;l++)p(l,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(l=1;l<=i.lines;l++)p(l);return s(e,f)};m.prototype.opacity=function(t,e,i,o){var r=t.firstChild;o=o.shadow&&o.lines||0;if(r&&e+o<r.childNodes.length){r=r.childNodes[e+o];r=r&&r.firstChild;r=r&&r.firstChild;if(r)r.opacity=i}}}else n=p(e,"animation")})();if(typeof define=="function"&&define.amd)define(function(){return m});else t.Spinner=m}(window,document);
@@ -1,386 +0,0 @@
1
- /*global gts, cull, dome, when*/
2
-
3
- buster.testCase("Application", {
4
- setUp: function () {
5
- this.root = dome.el.div();
6
- this.app = gts.app();
7
- this.something = dome.el.div({ className: "something" });
8
- this.root.appendChild(this.something);
9
- },
10
-
11
- "calls dependency-free feature": function () {
12
- var feature = this.spy();
13
- this.app.feature("Feature", feature);
14
-
15
- this.app.load();
16
-
17
- assert.called(feature);
18
- },
19
-
20
- "calls feature once for only matching element": function () {
21
- this.root.appendChild(this.something);
22
- var feature = this.spy();
23
- this.app.feature("Feature", feature, { elements: "something" });
24
-
25
- this.app.load(this.root);
26
-
27
- assert.equals(feature.callCount, 1);
28
- assert.calledWith(feature, this.something);
29
- },
30
-
31
- "env sets property on app": function () {
32
- this.app.env("something", 42);
33
-
34
- assert.equals(this.app.env.something, 42);
35
- },
36
-
37
- "runs feature with environment variable": function () {
38
- var feature = this.spy();
39
- this.app.feature("Feature", feature, { depends: ["answer"] });
40
- this.app.env("answer", 42);
41
-
42
- this.app.load();
43
-
44
- assert.calledWith(feature, 42);
45
- },
46
-
47
- "does not run feature with unsatiesfied environment": function () {
48
- var feature = this.spy();
49
- this.app.feature("Feature", feature, { depends: ["answer"] });
50
-
51
- this.app.load();
52
-
53
- refute.called(feature);
54
- },
55
-
56
- "runs feature with element and env var": function () {
57
- var feature = this.spy();
58
- this.app.feature("Feature", feature, {
59
- elements: "something",
60
- depends: ["answer"]
61
- });
62
- this.app.env("answer", 42);
63
-
64
- this.app.load(this.root);
65
-
66
- assert.calledWith(feature, this.something, 42);
67
- },
68
-
69
- "runs feature with element and multiple env vars": function () {
70
- var feature = this.spy();
71
- this.app.feature("Feature", feature, {
72
- elements: "something",
73
- depends: ["question", "answer"]
74
- });
75
- this.app.env("answer", 42);
76
- this.app.env("question", "life");
77
-
78
- this.app.load(this.root);
79
-
80
- assert.calledWith(feature, this.something, "life", 42);
81
- },
82
-
83
- "runs feature with for each element with env var": function () {
84
- this.root.appendChild(dome.el("div", { className: "something" }));
85
- var feature = this.spy();
86
- this.app.feature("Feature", feature, {
87
- elements: "something",
88
- depends: ["question", "answer"]
89
- });
90
- this.app.env("answer", 42);
91
- this.app.env("question", "life");
92
-
93
- this.app.load(this.root);
94
-
95
- assert.calledTwice(feature);
96
- assert.calledWith(feature, this.something, "life", 42);
97
- },
98
-
99
- "runs feature after run when env var is set": function () {
100
- var feature = this.spy();
101
- this.app.feature("Feature", feature, {
102
- elements: "something",
103
- depends: ["question"]
104
- });
105
- this.app.env("answer", 42);
106
- this.app.load(this.root);
107
- this.app.env("question", "life");
108
-
109
- assert.called(feature);
110
- },
111
-
112
- "setting env var does not load feature when not running": function () {
113
- var feature = this.spy();
114
- this.app.feature("Feature", feature, {
115
- depends: ["question", "answer"]
116
- });
117
- this.app.env("answer", 42);
118
- this.app.env("question", "life");
119
-
120
- refute.called(feature);
121
- },
122
-
123
- "lazy feature is not called proactively": function () {
124
- var feature = this.spy();
125
- this.app.feature("Feature", feature, { lazy: true });
126
-
127
- this.app.load();
128
-
129
- refute.called(feature);
130
- },
131
-
132
- "feature is called when depending on executed feature": function () {
133
- var feature = this.spy();
134
- this.app.feature("A", function () {});
135
- this.app.feature("B", feature, { depends: ["A"] });
136
-
137
- this.app.load();
138
-
139
- assert.calledOnce(feature);
140
- },
141
-
142
- "feature is called when dependency is resolved": function () {
143
- var feature = this.spy();
144
- this.app.feature("A", feature, { depends: ["B"] });
145
- this.app.feature("B", function () {});
146
-
147
- this.app.load();
148
-
149
- assert.calledOnce(feature);
150
- },
151
-
152
- "features are only called once": function () {
153
- var featureA = this.spy();
154
- var featureB = this.spy();
155
- this.app.feature("A", featureA, { depends: ["B"] });
156
- this.app.feature("B", featureB);
157
-
158
- this.app.load();
159
-
160
- assert.calledOnce(featureA);
161
- assert.calledOnce(featureB);
162
- },
163
-
164
- "feature is called when dependency is resolved after run": function () {
165
- var feature = this.spy();
166
- this.app.feature("A", feature, { depends: ["B"] });
167
-
168
- this.app.load();
169
- this.app.feature("B", function () {});
170
-
171
- assert.calledOnce(feature);
172
- },
173
-
174
- "feature is called with return-value of dependency": function () {
175
- var feature = this.spy();
176
- this.app.feature("A", feature, { depends: ["B"] });
177
-
178
- this.app.load();
179
- this.app.feature("B", this.stub().returns(42));
180
-
181
- assert.calledWith(feature, 42);
182
- },
183
-
184
- "feature is not called until dependency's returned promise resolves": function () {
185
- var feature = this.spy();
186
- var deferred = when.defer();
187
- this.app.feature("A", feature, { depends: ["B"] });
188
- this.app.feature("B", this.stub().returns(deferred.promise));
189
-
190
- this.app.load();
191
-
192
- refute.called(feature);
193
- deferred.resolve(42);
194
- assert.calledOnceWith(feature, 42);
195
- },
196
-
197
- "resolves nested dependencies": function () {
198
- var feature = this.spy();
199
- var deferredB = when.defer();
200
- var deferredC = when.defer();
201
- this.app.feature("A", feature, { depends: ["B"] });
202
- this.app.feature("B", this.stub().returns(deferredB.promise), {
203
- depends: ["C"]
204
- });
205
- this.app.feature("C", this.stub().returns(deferredC.promise));
206
-
207
- this.app.load();
208
- deferredB.resolve(42);
209
- deferredC.resolve(13);
210
-
211
- assert.calledOnceWith(feature, 42);
212
- },
213
-
214
- "calls lazy feature when depended on": function () {
215
- var feature = this.spy();
216
- this.app.feature("A", feature, { lazy: true });
217
- this.app.feature("B", function () {}, { depends: ["A"] });
218
-
219
- this.app.load();
220
-
221
- assert.calledOnce(feature);
222
- },
223
-
224
- "throws exception when adding duplicate feature": function () {
225
- var app = this.app;
226
- app.feature("A", function () {});
227
-
228
- assert.exception(function () { app.feature("A", function () {}); });
229
- },
230
-
231
- "throws exception when adding feature duplicating env var": function () {
232
- var app = this.app;
233
- app.env("A", 42);
234
-
235
- assert.exception(function () { app.feature("A", function () {}); });
236
- },
237
-
238
- "throws exception when adding duplicate env var": function () {
239
- var app = this.app;
240
- app.feature("A", function () {});
241
-
242
- assert.exception(function () { app.env("A", 42); });
243
- },
244
-
245
- "data registers lazy feature": function () {
246
- var data = this.spy();
247
- var feature = this.spy();
248
- this.app.data("somedata", data);
249
-
250
- this.app.load();
251
- refute.called(data);
252
-
253
- this.app.feature("A", feature, { depends: ["somedata"] });
254
- assert.calledOnce(data);
255
- assert.calledOnce(feature);
256
- },
257
-
258
- "data can have dependencies as well": function () {
259
- var data = this.spy();
260
- var feature = this.spy();
261
- this.app.data("somedata", data, { depends: ["input"] });
262
-
263
- this.app.load();
264
- refute.called(data);
265
-
266
- this.app.feature("A", feature, { depends: ["somedata"] });
267
- refute.called(data);
268
-
269
- this.app.env("input", 42);
270
- assert.calledOnceWith(data, 42);
271
- assert.calledOnce(feature);
272
- },
273
-
274
- "calling run multiple times reruns features": function () {
275
- var feature = this.spy();
276
- this.app.feature("A", feature);
277
-
278
- this.app.load();
279
- this.app.load();
280
-
281
- assert.calledTwice(feature);
282
- },
283
-
284
- "calling run multiple times does not erase env vars": function () {
285
- var feature = this.spy();
286
- this.app.env("B", 42);
287
- this.app.feature("A", feature, { depends: ["B"] });
288
-
289
- this.app.load();
290
- this.app.load();
291
-
292
- assert.calledTwice(feature);
293
- assert.calledWith(feature, 42);
294
- },
295
-
296
- "calling run multiple times with different contexts": function () {
297
- var feature = this.spy();
298
- this.app.feature("A", feature, { elements: "something" });
299
-
300
- this.app.load(this.root);
301
- this.app.load(document.createElement("div"));
302
-
303
- assert.calledOnce(feature);
304
- },
305
-
306
- "running feature multiple times in different contexts": function () {
307
- var feature = this.spy();
308
- var root1 = dome.el.div([dome.el.div({ className: "sumptn" })]);
309
- var root2 = dome.el.div([dome.el.div({ className: "sumptn" })]);
310
- this.app.feature("A", feature, { elements: "sumptn" });
311
-
312
- this.app.load(root1);
313
- this.app.load(root2);
314
-
315
- assert.calledTwice(feature);
316
- assert.calledWith(feature, root1.firstChild);
317
- assert.calledWith(feature, root2.firstChild);
318
- },
319
-
320
- "calls data two times": function () {
321
- var data = this.spy();
322
- this.app.data("data", data);
323
- this.app.feature("A", this.spy(), { depends: ["data"] });
324
-
325
- this.app.load();
326
- this.app.load();
327
-
328
- assert.calledTwice(data);
329
- },
330
-
331
- "retries features not running": function () {
332
- var root = dome.el.div();
333
- var feature = this.spy();
334
- this.app.feature("A", feature, { elements: "el" });
335
-
336
- this.app.load(root);
337
- root.appendChild(dome.el.div({ className: "el" }));
338
- this.app.tryPending();
339
-
340
- assert.calledOnce(feature);
341
- },
342
-
343
- "retrying does not call running features again": function () {
344
- var feature = this.spy();
345
- this.app.feature("A", feature);
346
-
347
- this.app.load();
348
- this.app.tryPending();
349
-
350
- assert.calledOnce(feature);
351
- },
352
-
353
- "events": {
354
- setUp: function () {
355
- this.loading = this.spy();
356
- this.loaded = this.spy();
357
- this.pending = this.spy();
358
- this.app.on("loading", this.loading);
359
- this.app.on("loaded", this.loaded);
360
- this.app.on("pending", this.pending);
361
- },
362
-
363
- "emits 'loading' when calling feature": function () {
364
- var feature = this.spy();
365
- this.app.feature("A", feature);
366
-
367
- this.app.load();
368
-
369
- assert.calledOnce(this.loading);
370
- assert.match(this.loading.args[0][0], { name: "A" });
371
- assert.equals(this.loading.args[0][0].dependencies(), []);
372
- },
373
-
374
- "emits 'loading' when calling feature with resolved dependencies": function () {
375
- var feature = this.spy();
376
- this.app.feature("A", feature, { depends: ["B"] });
377
- this.app.feature("B", this.spy());
378
-
379
- this.app.load();
380
-
381
- assert.calledTwice(this.loading);
382
- assert.match(this.loading.args[1][0], { name: "A" });
383
- assert.match(this.loading.args[1][0].dependencies(), [{ name: "B" }]);
384
- }
385
- }
386
- });